decocms 4.253.2 → 4.253.3

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 (222) hide show
  1. package/dist/client/assets/{AlertCircle-BYvQDEJ0.js → AlertCircle-CtXDDPuh.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DMcwZhe6.js → AreaChart-yi4TgkYE.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-B-9nUwLX.js → ArrowLeft-DtOVN8vp.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-B1UtGT45.js → ArrowUp-I330YJW3.js} +1 -1
  5. package/dist/client/assets/{Check-Cu-Awg_S.js → Check-CDgez8no.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-C4O_1HW1.js → CheckCircle-yFYdDBYT.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-D1GCQiij.js → ChevronDown-CKlR5rwM.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-NcrFTq4Q.js → ChevronRight-BJ3yvnPz.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-DhZiWWo6.js → ChevronSelectorVertical-DrytqWO7.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-CrheBWdX.js → ChevronUp-Bk64bZHd.js} +1 -1
  11. package/dist/client/assets/{Copy01-DwPzyMCP.js → Copy01-DUFwBGHZ.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-CqBwox93.js → CreditCard01-4vl-vsk4.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-Dnc_qefX.js → DotsVertical-BVAKyUxS.js} +1 -1
  14. package/dist/client/assets/{Download01-yzTeB8lR.js → Download01-DBszkg_x.js} +1 -1
  15. package/dist/client/assets/{Eye-rZWcM_sl.js → Eye-CzwEImrg.js} +1 -1
  16. package/dist/client/assets/{FilterLines-BMCdm4O2.js → FilterLines-ByiTdPGm.js} +1 -1
  17. package/dist/client/assets/{Globe01-CojEB28p.js → Globe01-BT9zQGYP.js} +1 -1
  18. package/dist/client/assets/{Globe04-DohkS1yI.js → Globe04-CUaWBaQZ.js} +1 -1
  19. package/dist/client/assets/{HardDrive-WahlW5wX.js → HardDrive-OvDfsdks.js} +1 -1
  20. package/dist/client/assets/{Key01-Bx4K_S3Q.js → Key01-C80140fI.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-CtNOOeZL.js → LinkExternal01-Crdm3X-P.js} +1 -1
  22. package/dist/client/assets/{LockUnlocked01-D_Q5BYhU.js → LockUnlocked01-BaCHfPNz.js} +1 -1
  23. package/dist/client/assets/{LogOut01-BZABwyef.js → LogOut01-W-wJ3HBs.js} +1 -1
  24. package/dist/client/assets/{Monitor01-7UTn7zVa.js → Monitor01-Ch5Y4tuq.js} +1 -1
  25. package/dist/client/assets/{Palette-BoChqeld.js → Palette-BcDfqcDI.js} +1 -1
  26. package/dist/client/assets/{Play-DNBU5rzE.js → Play-DH1W9sUg.js} +1 -1
  27. package/dist/client/assets/{Plus-8T2afHEs.js → Plus-DOqutG8C.js} +1 -1
  28. package/dist/client/assets/{SearchLg-6rfLixx5.js → SearchLg-3rGuCUoM.js} +1 -1
  29. package/dist/client/assets/{SearchMd-0vzqE1Pd.js → SearchMd-eExvU_Cs.js} +1 -1
  30. package/dist/client/assets/{Settings02-KfyhGAo3.js → Settings02-CmGQOcPT.js} +1 -1
  31. package/dist/client/assets/{Share07-BTlsc7Ng.js → Share07-5YpBA79_.js} +1 -1
  32. package/dist/client/assets/{Shield01-CPg5EmjN.js → Shield01-BnZKrg7I.js} +1 -1
  33. package/dist/client/assets/{Stars01-CV6o6WbI.js → Stars01-RuIE5Zdu.js} +1 -1
  34. package/dist/client/assets/{Stars02-Do7POkWd.js → Stars02-BQJTArZQ.js} +1 -1
  35. package/dist/client/assets/{Sun-knqgcKen.js → Sun-DNrI0Umm.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-dwH3CFZl.js → SwitchHorizontal01--iR18qCk.js} +1 -1
  37. package/dist/client/assets/{Tool01-CawhE5Vv.js → Tool01-DCPbUowt.js} +1 -1
  38. package/dist/client/assets/{Tool02-DUb3PZH0.js → Tool02-Bu2KnVcQ.js} +1 -1
  39. package/dist/client/assets/{Trash01-CZV6hVoi.js → Trash01-D17XOrLH.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-Cp69MjT_.js → TrendUp01-P2ZZoWEf.js} +1 -1
  41. package/dist/client/assets/{Upload01-AWrvzckN.js → Upload01-DzeGUE4j.js} +1 -1
  42. package/dist/client/assets/{User01-DLfObf45.js → User01-9xZCV673.js} +1 -1
  43. package/dist/client/assets/{UserSquare-BjlZKgC9.js → UserSquare-CVtGfIDn.js} +1 -1
  44. package/dist/client/assets/{Users01-CQ3eFXvg.js → Users01-mNF9ASXd.js} +1 -1
  45. package/dist/client/assets/{Users03-DgZSfmdp.js → Users03-BgkkJa8X.js} +1 -1
  46. package/dist/client/assets/{XCircle-BpPG80mN.js → XCircle-DCQf8XEr.js} +1 -1
  47. package/dist/client/assets/{XClose-DW7idjn0.js → XClose-D3a9ZSmL.js} +1 -1
  48. package/dist/client/assets/{YAxis-Da2rtvB9.js → YAxis-wwPBklqZ.js} +1 -1
  49. package/dist/client/assets/{Zap-Dzj3-lys.js → Zap-DV9Keoy4.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-Bs2nDJX-.js → ZapSquare-Cs9IlPcM.js} +1 -1
  51. package/dist/client/assets/{access-gate-DZ_-IWJN.js → access-gate-gBCcXiQ5.js} +1 -1
  52. package/dist/client/assets/{agent-icon-xLXU6rvd.js → agent-icon-Bs96UMN4.js} +1 -1
  53. package/dist/client/assets/{agents-list-CE_lUbRY.js → agents-list-KlcE8Guv.js} +1 -1
  54. package/dist/client/assets/{ai-providers-B5hVpeDw.js → ai-providers-2TQlnA-T.js} +1 -1
  55. package/dist/client/assets/{alert-CnmxLYRw.js → alert-BfgQbql2.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-CvsZ6guw.js → alert-dialog-CYISmsp0.js} +1 -1
  57. package/dist/client/assets/{api-keys-D72J-m-j.js → api-keys-CobV6DXd.js} +1 -1
  58. package/dist/client/assets/{app-editor-CClK5ocS.js → app-editor-C4t39sNr.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-DHLFLTCH.js → auth-catchall-BcNlgPxi.js} +1 -1
  60. package/dist/client/assets/{auth-1R6gk2tO.js → auth-dGsBCMlC.js} +1 -1
  61. package/dist/client/assets/{auth-entry-CUwr4ac9.js → auth-entry-CqcvIPvV.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-Cx8b5rv5.js → auth-split-layout-BLakgVeC.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-CZZKLfUR.js → authenticate-and-persist-oauth-BPXOHlXS.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-DuyceG26.js → automation-list-row-C3v52KPe.js} +1 -1
  65. package/dist/client/assets/{automation-runs-DP3JWssQ.js → automation-runs-C2HUGQOX.js} +1 -1
  66. package/dist/client/assets/{automations-DbKB4JrO.js → automations-bSKH6oaP.js} +1 -1
  67. package/dist/client/assets/{avatar-DPXyNBP8.js → avatar-BenMWCiJ.js} +1 -1
  68. package/dist/client/assets/{badge-CGCuo_-5.js → badge-CliF6PXU.js} +1 -1
  69. package/dist/client/assets/{block-document-CMd9Eo96.js → block-document-ecGEHpLp.js} +1 -1
  70. package/dist/client/assets/{buckets-DljZRfHK.js → buckets-CsGE0mZQ.js} +1 -1
  71. package/dist/client/assets/{bulk-category-panel-BLk77HCA.js → bulk-category-panel-CPeSnbUk.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-DnpJPSNM.js → capability-load-error-Br0E5BK9.js} +1 -1
  73. package/dist/client/assets/{cards-C60HDM5G.js → cards-CwRuFB_T.js} +1 -1
  74. package/dist/client/assets/{category-editor-DCes96yT.js → category-editor-jfBtBcjQ.js} +1 -1
  75. package/dist/client/assets/{chart-BDZIA7_t.js → chart-B6MFUsFo.js} +1 -1
  76. package/dist/client/assets/{chat-context-C9nTU_s6.js → chat-context-Dfd1-1Lo.js} +1 -1
  77. package/dist/client/assets/{checkbox-CYVQb6u5.js → checkbox-EYTcqsBG.js} +1 -1
  78. package/dist/client/assets/{choose-editor-CHdyY5E4.js → choose-editor-Cip_BFLn.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-a3s0cdGF.js → cli-auth-success-CH0wRwLP.js} +1 -1
  80. package/dist/client/assets/{collection-detail-COMW8222.js → collection-detail-H7RiBES3.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-DjAF7BCj.js → collection-display-button-DA23yX4e.js} +1 -1
  82. package/dist/client/assets/{collection-search-CSSjKy7f.js → collection-search-DJzt3Gor.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-DOG_oIXa.js → collection-table-wrapper-Dlv17U_6.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-DGI2IEmV.js → collection-tabs-DtP7TjJI.js} +1 -1
  85. package/dist/client/assets/{command-DUeMCHIE.js → command-CKH2r5eb.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-DB8uJRe2.js → commerce-onboarding-bCIN1-83.js} +1 -1
  87. package/dist/client/assets/{connect-xjult6u-.js → connect-BUGoLkAq.js} +1 -1
  88. package/dist/client/assets/{connection-O58eU8Dr.js → connection-DQgnmnzq.js} +1 -1
  89. package/dist/client/assets/{connection-card-Drtf7vdR.js → connection-card-ACuj5E9S.js} +1 -1
  90. package/dist/client/assets/{connection-detail-O-fmNmpE.js → connection-detail-BULrhdZi.js} +1 -1
  91. package/dist/client/assets/{connection-form-helpers-rO7EwngE.js → connection-form-helpers-Cfz51jR_.js} +1 -1
  92. package/dist/client/assets/{connections-kiyFdETe.js → connections-DsXrDSxT.js} +1 -1
  93. package/dist/client/assets/{decopilot-sse-pool-BNBoVXdw.js → decopilot-sse-pool-BeJzOsVO.js} +1 -1
  94. package/dist/client/assets/{dialog-06THKDmm.js → dialog-DuSBFSga.js} +1 -1
  95. package/dist/client/assets/{domain-settings-DxS7w6w-.js → domain-settings-DRz19-Jt.js} +1 -1
  96. package/dist/client/assets/{drawer-DfM0a7aK.js → drawer-CHruCnRr.js} +1 -1
  97. package/dist/client/assets/{dropdown-menu-w7n_JiUQ.js → dropdown-menu-C8nav0fy.js} +1 -1
  98. package/dist/client/assets/{empty-state-DytlgCAm.js → empty-state-mkhi1rfX.js} +1 -1
  99. package/dist/client/assets/{extract-connection-data-42ShpRyJ.js → extract-connection-data-BNJ-imMD.js} +1 -1
  100. package/dist/client/assets/{file-explorer-D_PGAi5e.js → file-explorer-DLJoQEI1.js} +1 -1
  101. package/dist/client/assets/{file-type-icon-DIpohPJ6.js → file-type-icon-ZBtP7G5F.js} +1 -1
  102. package/dist/client/assets/{form-D7T5_Dgj.js → form-Bz1Blvsa.js} +1 -1
  103. package/dist/client/assets/{general-DmFqcLLE.js → general-CPBxviis.js} +1 -1
  104. package/dist/client/assets/{github-repo-picker-BebzrN3W.js → github-repo-picker-B8bIONwq.js} +1 -1
  105. package/dist/client/assets/{hooks-BxLy1Zzz.js → hooks-rJKJK9uM.js} +1 -1
  106. package/dist/client/assets/{index-9OoxX1NR.js → index-BVEPrL3c.js} +1 -1
  107. package/dist/client/assets/{index-DDTrmVhz.js → index-BY-CqMte.js} +1 -1
  108. package/dist/client/assets/{index-DF3uNrPp.js → index-CG1pYzpa.js} +1 -1
  109. package/dist/client/assets/{index-CvNeVHfy.js → index-CUt_QACY.js} +1 -1
  110. package/dist/client/assets/{index-BdUjMMS5.js → index-CW_yn53K.js} +1 -1
  111. package/dist/client/assets/{index-B1P_V3qG.js → index-CxtBxDI6.js} +1 -1
  112. package/dist/client/assets/{index-BB4_ygWi.js → index-DUWnGqTz.js} +1 -1
  113. package/dist/client/assets/{index-BYzmGpA0.js → index-Dfj5Ug_S.js} +1 -1
  114. package/dist/client/assets/{index-C2wbMIfs.js → index-ndY-oSUU.js} +5 -5
  115. package/dist/client/assets/{index-CMALBC-v.js → index-pn6its_f.js} +3 -3
  116. package/dist/client/assets/{index-redirect-Cpg_Q5et.js → index-redirect-SGbZ48ZW.js} +1 -1
  117. package/dist/client/assets/{infra-billing-DyTByfZt.js → infra-billing-CNfnM4ka.js} +1 -1
  118. package/dist/client/assets/{input-CjP4wQRD.js → input-Ci4t0s2s.js} +1 -1
  119. package/dist/client/assets/{integration-icon-_VDJvzJ-.js → integration-icon-CImpG20B.js} +1 -1
  120. package/dist/client/assets/{invite-member-dialog-8QQ-DA_M.js → invite-member-dialog-DxoBMqRW.js} +1 -1
  121. package/dist/client/assets/{label-BNnDeYWX.js → label-DzYHqeOW.js} +1 -1
  122. package/dist/client/assets/{layout-DGxeKl7-.js → layout-Cpwo9qMT.js} +1 -1
  123. package/dist/client/assets/{login-BmUk90CP.js → login-CMwy8bWM.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-R6LWeGel.js → mcp-oauth-BLKHxK_9.js} +1 -1
  125. package/dist/client/assets/{members-Rje746QY.js → members-D1aLpNnn.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-CHdpsAKe.js → monaco-editor-DAY5kz0b.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-nWQLcD7N.js → monitoring-stats-row-DCElRuK8.js} +1 -1
  128. package/dist/client/assets/{multi-select-DvVxCCA2.js → multi-select-Y2ogFLe9.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-BrZMJ9Z_.js → oauth-callback-BHS88oZ9.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-ai-provider-6lB5ioTQ.js → oauth-callback-ai-provider-DMlMd00n.js} +1 -1
  131. package/dist/client/assets/{onboarding-CFZ_YqBk.js → onboarding-Dasul-y-.js} +1 -1
  132. package/dist/client/assets/{org-layout-CFJ3s3aO.js → org-layout-Cw-8oJq9.js} +1 -1
  133. package/dist/client/assets/{organization-choice-4gTGCdVZ.js → organization-choice-8SsJz-Kn.js} +1 -1
  134. package/dist/client/assets/{orgs-BlhaM_QR.js → orgs-BjhvjtBn.js} +1 -1
  135. package/dist/client/assets/{page-seo-form-8CrhZnSd.js → page-seo-form-LlbkmsrH.js} +1 -1
  136. package/dist/client/assets/{popover-BZEJPBaN.js → popover-k9Q2U8MP.js} +1 -1
  137. package/dist/client/assets/{post-editor-DXF_bdFs.js → post-editor-CdIOS9Pq.js} +1 -1
  138. package/dist/client/assets/{primitives-DefLuCWp.js → primitives-BLv1hHA7.js} +1 -1
  139. package/dist/client/assets/{profile-ixoNCK51.js → profile-CZcbiHZH.js} +1 -1
  140. package/dist/client/assets/{project-app-view-BmDjcK09.js → project-app-view-C3T5V3cO.js} +1 -1
  141. package/dist/client/assets/record-editor-DwWObGXS.js +1 -0
  142. package/dist/client/assets/{redirect-editor-DOZ_6ItM.js → redirect-editor-Cbkccd6C.js} +1 -1
  143. package/dist/client/assets/registry-BINw5C1A.js +2 -0
  144. package/dist/client/assets/{registry-layout-CZnAV2GE.js → registry-layout-ir9IA911.js} +1 -1
  145. package/dist/client/assets/{reports-BskvcwLH.js → reports-eHZgj0t3.js} +1 -1
  146. package/dist/client/assets/{require-capability-Byjk0WDJ.js → require-capability-Cw87zgq2.js} +1 -1
  147. package/dist/client/assets/{required-auth-layout-BuUCLduS.js → required-auth-layout-DWSFcPaB.js} +1 -1
  148. package/dist/client/assets/{reset-password-Hn69qiVu.js → reset-password-_ZheVpnD.js} +1 -1
  149. package/dist/client/assets/{roles-DPU4GH76.js → roles-G8zZMQV2.js} +1 -1
  150. package/dist/client/assets/{search-input-F06b4Ka7.js → search-input-Duqb8J7K.js} +1 -1
  151. package/dist/client/assets/{secrets-DtooYsRz.js → secrets-Cox7mlSS.js} +1 -1
  152. package/dist/client/assets/{sections-editor-DHi-y1Qr.js → sections-editor-BKACmRBp.js} +1 -1
  153. package/dist/client/assets/{select-fEJ2CWnh.js → select-CZBrxnZP.js} +1 -1
  154. package/dist/client/assets/{select-model-CSZcccgl.js → select-model-Bx_B88dX.js} +1 -1
  155. package/dist/client/assets/{self-tool-result-BoRiwr9O.js → self-tool-result-TKX8PVRX.js} +1 -1
  156. package/dist/client/assets/{seo-editor-C0yrgVaA.js → seo-editor-NeW6LrgW.js} +1 -1
  157. package/dist/client/assets/{settings-layout-CkCx5djT.js → settings-layout-CuEgRfLl.js} +1 -1
  158. package/dist/client/assets/{shell-controls-CvuXlA7S.js → shell-controls-BnGACb2W.js} +1 -1
  159. package/dist/client/assets/{shell-layout-D2WGSk9d.js → shell-layout-DiQgbo88.js} +1 -1
  160. package/dist/client/assets/{spinner-DRW7bcot.js → spinner-Dc2wGodB.js} +1 -1
  161. package/dist/client/assets/{sso-C9S6ArZ5.js → sso-L91u7aIt.js} +1 -1
  162. package/dist/client/assets/{store-DUIqjsmW.js → store-Dw0jnViH.js} +1 -1
  163. package/dist/client/assets/store-registry-xH_8cb-l.js +2 -0
  164. package/dist/client/assets/{switch-9lR-M49q.js → switch-cFSs7XoW.js} +1 -1
  165. package/dist/client/assets/{synced-repos-DCY70HWU.js → synced-repos-C0wLX6aH.js} +1 -1
  166. package/dist/client/assets/{tab-id-DOlOt_oN.js → tab-id-C6YUqvRq.js} +1 -1
  167. package/dist/client/assets/{table-55wy8ES_.js → table-BDqmn3dR.js} +1 -1
  168. package/dist/client/assets/{tabs-B_f6B2ih.js → tabs-DXuBW9wa.js} +1 -1
  169. package/dist/client/assets/{task-key-DC0DmXL_.js → task-key-C5WsmOV8.js} +1 -1
  170. package/dist/client/assets/{tasks-C1jd4mF0.js → tasks-GWYtJ4Df.js} +1 -1
  171. package/dist/client/assets/{textarea-CioreWQ5.js → textarea-dPhCEXKr.js} +1 -1
  172. package/dist/client/assets/{toggle-group-CKR4opVv.js → toggle-group-DMRSkixl.js} +1 -1
  173. package/dist/client/assets/{toolbar-DxhudO7Y.js → toolbar-DatHEDdN.js} +1 -1
  174. package/dist/client/assets/{track-5IMkFYjp.js → track-CziUhU91.js} +1 -1
  175. package/dist/client/assets/{types-LSAqkaao.js → types-DNCJwL4t.js} +1 -1
  176. package/dist/client/assets/{use-ai-providers-C1myPe1T.js → use-ai-providers-BZ3Rr2E-.js} +1 -1
  177. package/dist/client/assets/{use-api-keys-BLhCxSau.js → use-api-keys-r3Wthsr0.js} +1 -1
  178. package/dist/client/assets/{use-automations-CB10hjhp.js → use-automations-CXawOzXl.js} +1 -1
  179. package/dist/client/assets/{use-autosave-BxOegg1k.js → use-autosave-D0cOZ97s.js} +1 -1
  180. package/dist/client/assets/{use-clock-tick-jMDHnmqb.js → use-clock-tick-DHR8fR-3.js} +1 -1
  181. package/dist/client/assets/{use-commerce-diagnostic-CzYB3N6a.js → use-commerce-diagnostic-Eb4IUPoq.js} +1 -1
  182. package/dist/client/assets/{use-connection-DT2B_DYi.js → use-connection-BXWPlJBx.js} +1 -1
  183. package/dist/client/assets/{use-copy-D3XerJdc.js → use-copy-DN7yEEj_.js} +1 -1
  184. package/dist/client/assets/{use-create-virtual-mcp-DKZ39HDE.js → use-create-virtual-mcp-L6nBl4-w.js} +1 -1
  185. package/dist/client/assets/{use-debounced-autosave-DTkDy42k.js → use-debounced-autosave-BW5BR0e-.js} +1 -1
  186. package/dist/client/assets/{use-debounced-value-DbRRK9TT.js → use-debounced-value-wubVjvto.js} +1 -1
  187. package/dist/client/assets/{use-decopilot-events-G33cy0ys.js → use-decopilot-events-85uKVxiJ.js} +1 -1
  188. package/dist/client/assets/{use-delete-connection-B7i8EHY-.js → use-delete-connection-_KV84ITu.js} +1 -1
  189. package/dist/client/assets/{use-deployment-admin-EilNlemK.js → use-deployment-admin-CzweoLQP.js} +1 -1
  190. package/dist/client/assets/{use-file-configs-BPtRUpqF.js → use-file-configs-B0lETjBj.js} +1 -1
  191. package/dist/client/assets/{use-infinite-scroll-QWIMbpAi.js → use-infinite-scroll-CFU5iMXa.js} +1 -1
  192. package/dist/client/assets/{use-join-requests-d9x5nN9k.js → use-join-requests-BPkJuyIJ.js} +1 -1
  193. package/dist/client/assets/{use-mcp-client-CluZ1kcE.js → use-mcp-client-C7DoCN8S.js} +1 -1
  194. package/dist/client/assets/{use-mcp-tools-Bn-w9dls.js → use-mcp-tools-krQNfneB.js} +1 -1
  195. package/dist/client/assets/{use-members-Bsc6dQLG.js → use-members-BKlO0dvu.js} +1 -1
  196. package/dist/client/assets/{use-navigate-to-agent-NiTIdPbN.js → use-navigate-to-agent-mhMqplTl.js} +1 -1
  197. package/dist/client/assets/{use-org-auth-client-Cu0_xvCB.js → use-org-auth-client-BnzVw0OX.js} +1 -1
  198. package/dist/client/assets/{use-org-repo-syncs-DNte33T4.js → use-org-repo-syncs-DOv8ph3D.js} +1 -1
  199. package/dist/client/assets/{use-org-sso-Bf2lWMgv.js → use-org-sso-Llil0EAX.js} +1 -1
  200. package/dist/client/assets/{use-organization-roles-BtYEcikp.js → use-organization-roles-DR38nLFO.js} +1 -1
  201. package/dist/client/assets/{use-organization-settings-h-vNu5dF.js → use-organization-settings-D0Kz-YEB.js} +1 -1
  202. package/dist/client/assets/{use-registry-connections-CpTGVE3o.js → use-registry-connections-DL69X8pZ.js} +1 -1
  203. package/dist/client/assets/{use-secrets-Djj5tnEX.js → use-secrets-ddoBQmdq.js} +1 -1
  204. package/dist/client/assets/{use-section-preview-base-DwW1Ebe1.js → use-section-preview-base-DGGZVHGT.js} +1 -1
  205. package/dist/client/assets/{use-status-sounds-Bfvpj4xw.js → use-status-sounds-BcGbFKp2.js} +1 -1
  206. package/dist/client/assets/{use-tags-Bcb85fVL.js → use-tags-C_oi6adA.js} +1 -1
  207. package/dist/client/assets/{use-view-mode-CHryhyWZ.js → use-view-mode-CQ7C45Rq.js} +1 -1
  208. package/dist/client/assets/{use-virtual-mcp-DMt0VXr_.js → use-virtual-mcp-DgRlnk4E.js} +1 -1
  209. package/dist/client/assets/useInfiniteQuery-BNDjieF7.js +1 -0
  210. package/dist/client/assets/useSuspenseInfiniteQuery-CPbq2GSv.js +1 -0
  211. package/dist/client/assets/{users-BK6ODa0L.js → users-3XZqH4os.js} +1 -1
  212. package/dist/client/assets/{variant-calendar-D8gSD-Zc.js → variant-calendar-3TFN0yrj.js} +1 -1
  213. package/dist/client/assets/{view-mode-toggle-k-CL6fP4.js → view-mode-toggle-BxPtdsgT.js} +1 -1
  214. package/dist/client/index.html +1 -1
  215. package/dist/server/cli.js +1 -1
  216. package/dist/server/server.js +1 -1
  217. package/package.json +1 -1
  218. package/dist/client/assets/record-editor-SauBdytI.js +0 -1
  219. package/dist/client/assets/registry-DNELIUVJ.js +0 -2
  220. package/dist/client/assets/store-registry-CCLV9EGA.js +0 -2
  221. package/dist/client/assets/useInfiniteQuery-gLOjDPyq.js +0 -1
  222. package/dist/client/assets/useSuspenseInfiniteQuery-EB_E_bJc.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-DHi-y1Qr.js","assets/index-CMALBC-v.js","assets/index-DZ9B9lIh.css","assets/ChevronDown-D1GCQiij.js","assets/agent-icon-xLXU6rvd.js","assets/AlertCircle-BYvQDEJ0.js","assets/Tool01-CawhE5Vv.js","assets/ArrowUp-B1UtGT45.js","assets/ArrowLeft-B-9nUwLX.js","assets/Tool02-DUb3PZH0.js","assets/XCircle-BpPG80mN.js","assets/TrendUp01-Cp69MjT_.js","assets/ZapSquare-Bs2nDJX-.js","assets/Users03-DgZSfmdp.js","assets/CheckCircle-C4O_1HW1.js","assets/Check-Cu-Awg_S.js","assets/ChevronRight-NcrFTq4Q.js","assets/ChevronSelectorVertical-DhZiWWo6.js","assets/ChevronUp-CrheBWdX.js","assets/DotsVertical-Dnc_qefX.js","assets/Stars02-Do7POkWd.js","assets/UserSquare-BjlZKgC9.js","assets/Copy01-DwPzyMCP.js","assets/CreditCard01-CqBwox93.js","assets/Download01-yzTeB8lR.js","assets/Settings02-KfyhGAo3.js","assets/Eye-rZWcM_sl.js","assets/FilterLines-BMCdm4O2.js","assets/Share07-BTlsc7Ng.js","assets/Globe01-CojEB28p.js","assets/Globe04-DohkS1yI.js","assets/SwitchHorizontal01-dwH3CFZl.js","assets/HardDrive-WahlW5wX.js","assets/Key01-Bx4K_S3Q.js","assets/LinkExternal01-CtNOOeZL.js","assets/LockUnlocked01-D_Q5BYhU.js","assets/LogOut01-BZABwyef.js","assets/Monitor01-7UTn7zVa.js","assets/Sun-knqgcKen.js","assets/Palette-BoChqeld.js","assets/Play-DNBU5rzE.js","assets/Plus-8T2afHEs.js","assets/SearchLg-6rfLixx5.js","assets/SearchMd-0vzqE1Pd.js","assets/Shield01-CPg5EmjN.js","assets/Stars01-CV6o6WbI.js","assets/Trash01-CZV6hVoi.js","assets/Upload01-AWrvzckN.js","assets/User01-DLfObf45.js","assets/Users01-CQ3eFXvg.js","assets/XClose-DW7idjn0.js","assets/Zap-Dzj3-lys.js","assets/automation-runs-DP3JWssQ.js","assets/select-fEJ2CWnh.js","assets/useInfiniteQuery-gLOjDPyq.js","assets/use-infinite-scroll-QWIMbpAi.js","assets/use-connection-DT2B_DYi.js","assets/use-mcp-client-CluZ1kcE.js","assets/constants-_08zpzmT.js","assets/auth-1R6gk2tO.js","assets/use-virtual-mcp-DMt0VXr_.js","assets/table-55wy8ES_.js","assets/empty-state-DytlgCAm.js","assets/use-members-Bsc6dQLG.js","assets/use-org-auth-client-Cu0_xvCB.js","assets/use-clock-tick-jMDHnmqb.js","assets/use-automations-CB10hjhp.js","assets/useSuspenseInfiniteQuery-EB_E_bJc.js","assets/avatar-DPXyNBP8.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-D3XerJdc.js","assets/dialog-06THKDmm.js","assets/tab-id-DOlOt_oN.js","assets/hooks-BxLy1Zzz.js","assets/decopilot-sse-pool-BNBoVXdw.js","assets/backoff-CrEUbyZT.js","assets/delay-CnY5UFtP.js","assets/chat-context-C9nTU_s6.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-ai-providers-C1myPe1T.js","assets/use-decopilot-events-G33cy0ys.js","assets/use-organization-settings-h-vNu5dF.js","assets/monaco-editor-CHdpsAKe.js","assets/spinner-DRW7bcot.js","assets/types-LSAqkaao.js","assets/shell-layout-D2WGSk9d.js","assets/required-auth-layout-BuUCLduS.js","assets/use-org-sso-Bf2lWMgv.js","assets/integration-icon-_VDJvzJ-.js","assets/use-navigate-to-agent-NiTIdPbN.js","assets/reusable-new-chat-CouMjkYR.js","assets/chart-BDZIA7_t.js","assets/index-DDTrmVhz.js","assets/form-D7T5_Dgj.js","assets/label-BNnDeYWX.js","assets/input-CjP4wQRD.js","assets/file-type-icon-DIpohPJ6.js","assets/dropdown-menu-w7n_JiUQ.js","assets/page-seo-form-8CrhZnSd.js","assets/switch-9lR-M49q.js","assets/use-section-preview-base-DwW1Ebe1.js","assets/drawer-DfM0a7aK.js","assets/collection-search-CSSjKy7f.js","assets/deco-site-production-url-BjY4ZYd-.js","assets/tabs-B_f6B2ih.js","assets/toggle-group-CKR4opVv.js","assets/use-commerce-diagnostic-CzYB3N6a.js","assets/popover-BZEJPBaN.js","assets/self-tool-result-BoRiwr9O.js","assets/alert-dialog-CvsZ6guw.js","assets/extract-connection-data-42ShpRyJ.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-DbRRK9TT.js","assets/authenticate-and-persist-oauth-CZZKLfUR.js","assets/mcp-oauth-R6LWeGel.js","assets/track-5IMkFYjp.js","assets/toolbar-DxhudO7Y.js","assets/github-repo-picker-BebzrN3W.js","assets/use-mcp-tools-Bn-w9dls.js","assets/agent-capabilities-C4tLW0Za.js","assets/connection-card-Drtf7vdR.js","assets/use-registry-connections-CpTGVE3o.js","assets/retry-CErkP7V6.js","assets/connection-slug-eyAPH6o3.js","assets/textarea-CioreWQ5.js","assets/connection-form-helpers-rO7EwngE.js","assets/collection-tabs-DGI2IEmV.js","assets/badge-CGCuo_-5.js","assets/command-DUeMCHIE.js","assets/index-B1P_V3qG.js","assets/select-model-CSZcccgl.js","assets/checkbox-CYVQb6u5.js","assets/ai-providers-logos-DD3qZ33J.js","assets/cards-C60HDM5G.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-Bfvpj4xw.js","assets/use-file-configs-BPtRUpqF.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-DTkDy42k.js","assets/search-input-F06b4Ka7.js","assets/index-BYzmGpA0.js","assets/use-secrets-Djj5tnEX.js","assets/AreaChart-DMcwZhe6.js","assets/task-key-DC0DmXL_.js","assets/use-tags-Bcb85fVL.js","assets/get-initials-D-f_fDFw.js","assets/automation-list-row-DuyceG26.js","assets/use-org-repo-syncs-DNte33T4.js","assets/file-explorer-D_PGAi5e.js","assets/app-editor-CClK5ocS.js","assets/post-editor-DXF_bdFs.js","assets/multi-select-DvVxCCA2.js","assets/block-document-CMd9Eo96.js","assets/primitives-DefLuCWp.js","assets/use-autosave-BxOegg1k.js","assets/record-editor-SauBdytI.js","assets/category-editor-DCes96yT.js","assets/bulk-category-panel-BLk77HCA.js","assets/seo-editor-C0yrgVaA.js","assets/variant-calendar-D8gSD-Zc.js","assets/view-mode-toggle-k-CL6fP4.js","assets/redirect-editor-DOZ_6ItM.js","assets/project-app-view-BmDjcK09.js"])))=>i.map(i=>d[i]);
2
- import{p as Ls,r as E,ah as lk,ai as ak,c as F,H as We,n as ie,j as r,E as Js,b as re,t as pe,aa as Tr,a5 as So,a8 as Ue,a9 as He,ab as Ke,aj as _s,ak as _i,al as ck,am as nn,an as Om,I as Bm,B as he,ao as zm,ap as jb,aq as dk,ar as uk,x as Ei,as as Es,at as Ho,au as zg,d as Ot,av as zs,e as Xs,q as st,aw as hk,D as ko,ax as fk,ay as Cb,az as mk,aA as Ui,aB as Yf,aC as En,aD as pk,aE as Qf,aF as gk,aG as xk,aH as bk,aI as vk,z as Lh,K as it,aJ as yk,aK as _k,aL as Lk,aM as wk,aN as Nb,aO as ld,o as Vt,k as ut,a as ci,C as Wd,aP as wd,u as lr,f as wh,R as Vb,aQ as Fm,aR as Sk,aS as kk,L as jk,a3 as Tb,aT as T0,aU as Ko,Y as xt,aV as Ab,aW as Eb,aX as Rn,P as yi,aY as St,s as Pb,aZ as Ck,a_ as Nk,a$ as Vk,b0 as Tk,b1 as Ak,b2 as Rb,b3 as Db,b4 as Ib,b5 as Mb,b6 as $b,b7 as Ob,b8 as Bb,b9 as zb,ba as Fb,bb as Ub,bc as In,bd as Hb,be as Ek,bf as Pk,bg as Kb,bh as Rk,bi as Dk,bj as Ik,bk as Mk,bl as xa,bm as $k,bn as Ok,bo as Bk,bp as zk,M as Fk,ag as Uk}from"./index-CMALBC-v.js";import{i as Sh,n as Hk}from"./ArrowUp-B1UtGT45.js";import{u as jo,a as di,b as Co,c as en,d as Wb,s as Kk,e as Wk,f as qk,g as Gk,h as Yk,i as Qk,j as Jk,k as Um,A as Xk,l as Zk,m as ej,p as qb,V as tj,E as kh,S as Gb,n as Aa,t as sj,o as nj,q as jh,r as ls,v as Ea,H as Sd,w as kd,x as ra,y as Yb,z as Qb,B as ij}from"./chat-context-C9nTU_s6.js";import{c as Ch,s as ec,g as Ji,P as jd,d as Hm,t as Zo,a as rj,M as oj,i as lj,b as Ar,e as Nh,f as aj,D as cj,h as dj,j as uj,k as Pa,l as hj,m as fj,u as Km,E as mj,n as qd,o as pj,F as gj,p as Wm,q as qm,r as Jb,S as xj,v as bj,w as vj,x as yj,y as Fg,z as _j,A as Xb,O as Lj,B as No,C as Ki,G as wj,T as Zb,H as Jf,I as qc,J as Sj,K as kj,L as ev,N as jj,Q as ar,R as Cj,U as Nj,V as tv,W as pr,X as Vj,Y as jc,Z as Tj,_ as sv,$ as nv,a0 as Gm,a1 as iv,a2 as Aj,a3 as Ej,a4 as Pj,a5 as Vo,a6 as Ym,a7 as rv,a8 as ov,a9 as lv,aa as Rj,ab as Dj,ac as av,ad as Ij,ae as Mj,af as $j,ag as Oj,ah as Bj,ai as zj}from"./automation-runs-DP3JWssQ.js";import{S as Cd}from"./spinner-DRW7bcot.js";import{a as ms,b as $t,d as Pt,e as Rt,h as Dn,c as Gn,i as cv}from"./dialog-06THKDmm.js";import{c as Fj,b as Vh,a as Th,D as Ah,d as dv,e as Uj,f as Hj}from"./drawer-DfM0a7aK.js";import{C as Kj}from"./collection-search-CSSjKy7f.js";import{u as Qt,a as Wj,m as qj}from"./use-mcp-client-CluZ1kcE.js";import{a as tc,i as A0,S as sc,b as Gj,W as uv,c as Yj,C as Ug,g as E0,d as hv,e as Hg,f as Qj,Q as Jj,h as Xj,j as Zj,k as eC}from"./constants-_08zpzmT.js";import{u as fv,g as Gd,l as s1,C as tC,a as sC,b as nC}from"./chart-BDZIA7_t.js";import{t as Jt}from"./ChevronDown-D1GCQiij.js";import{t as iC,z as rC,s as mv,a as Yd,b as Qm,u as oC,c as pv}from"./hooks-BxLy1Zzz.js";import{K as lC,i as gv,u as nc,a as xv,m as aC}from"./shell-layout-D2WGSk9d.js";import{u as Qd,a as Fs,b as Jm,c as cC}from"./use-virtual-mcp-DMt0VXr_.js";import{w as bv,A as dC,r as ba,b as uC,p as vv,f as g0,c as yv,d as _v,e as Lv,g as hC,F as fC,h as mC,j as pC,k as gC,l as xC,m as bC,O as vC,n as yC,o as _C}from"./tab-id-DOlOt_oN.js";import{r as Xm,p as LC,s as wC}from"./deco-site-production-url-BjY4ZYd-.js";import{i as pl,b as Zm,a as SC}from"./XCircle-BpPG80mN.js";import{h as wv,j as ep,k as gl,l as Sv,m as tp,n as kv,A as yo,o as jv,p as Ra,s as Er,q as Cv,r as To,u as kC,v as jC,c as Nv,w as Kg,x as ic,y as Nu,z as CC,B as Li,C as oi,D as NC,E as Vv,f as VC,F as Eh,G as xl,H as TC,I as sp,J as Tv,K as Av,L as n1,M as Xf,N as Wg,e as Ph,O as AC,P as EC,Q as PC,R as RC,S as DC,T as np,U as Ev,V as Yn,W as ip,X as rp,d as Jd,Y as Xd,Z as Pv,_ as Rv,$ as Dv,a0 as IC,a1 as op,a2 as MC,a3 as qg,a4 as $C,a5 as OC,t as Iv,a6 as Rh,a7 as Zd,a8 as BC,a9 as jr,aa as mo,i as Dh,ab as zC,ac as FC,ad as UC,ae as HC,af as KC,ag as WC,ah as Cr,ai as Gg,aj as Mv,ak as qC,al as GC,am as YC,an as Da,ao as lp,ap as QC,aq as Yg,ar as JC,as as XC,at as ZC,au as $v,av as eN,aw as tN,ax as sN,ay as nN,az as iN,aA as rN,aB as oN,aC as lN,aD as aN,aE as Ov,aF as ap,aG as cN,aH as dN,aI as uN,aJ as hN}from"./agent-icon-xLXU6rvd.js";import{i as Et}from"./Check-Cu-Awg_S.js";import{a as wi,i as fN,b as cp,c as dp}from"./Tool01-CawhE5Vv.js";import{i as Qn}from"./Upload01-AWrvzckN.js";import{i as pn}from"./AlertCircle-BYvQDEJ0.js";import{a as on}from"./Copy01-DwPzyMCP.js";import{F as i1,a as up,b as hp,c as fp,d as Bv}from"./form-D7T5_Dgj.js";import{d as At,S as js,a as Cs,b as Ps,c as Ns}from"./select-fEJ2CWnh.js";import{t as Ih,i as zv,a as mN}from"./UserSquare-BjlZKgC9.js";import{i as Mh}from"./ArrowLeft-B-9nUwLX.js";import{T as Yo,a as rc,b as Xi,c as eu}from"./tabs-B_f6B2ih.js";import{t as r1}from"./Tool02-DUb3PZH0.js";import{T as mp,a as Nd}from"./toggle-group-CKR4opVv.js";import{I as pt}from"./input-CjP4wQRD.js";import{u as pp,b as gp,g as pN,h as gN,i as xN,C as xp,a as bN,c as vN,T as yN,f as _N,A as LN,N as wN}from"./use-commerce-diagnostic-CzYB3N6a.js";import{u as Fv,M as SN,a as kN,m as $h,i as jN,g as Uv,b as CN,N as NN,c as VN}from"./select-model-CSZcccgl.js";import{s as Si}from"./XClose-DW7idjn0.js";import{a as ts,b as ss,P as ns,c as TN}from"./popover-BZEJPBaN.js";import{t as Nr}from"./Stars01-CV6o6WbI.js";import{c as AN,a as Oh,b as bp,d as Hv,e as Kv,u as Qg}from"./use-organization-settings-h-vNu5dF.js";import{u as Bh,a as EN}from"./use-ai-providers-C1myPe1T.js";import{b as vp,g as tu,c as Wv,a as Qs,r as qv,f as PN,d as RN}from"./agent-capabilities-C4tLW0Za.js";import{f as DN,a as IN,u as Vd,b as oc,c as Gv,d as MN,e as yp,g as el,h as Yv,i as _p,j as $N,k as Lp,l as wp,m as ON,p as BN,n as zN,o as FN,q as UN,r as HN,F as su,t as Qv,s as KN,v as Jv,S as WN,B as qN,w as Xv,x as GN,R as YN}from"./cards-C60HDM5G.js";import{c as qt,D as Gt,b as Yt,a as et,d as Wi,e as qi,f as Gi,g as Td,h as Zi,i as er,j as Cc}from"./dropdown-menu-w7n_JiUQ.js";import{s as Dt}from"./Plus-8T2afHEs.js";import{p as QN,q as JN}from"./question-004-sINsf4GQ.js";import{A as Os}from"./avatar-DPXyNBP8.js";import{u as Zv,a as zh}from"./use-members-Bsc6dQLG.js";import{i as gn}from"./ChevronRight-NcrFTq4Q.js";import{u as Fh}from"./use-is-desktop-app-BNujXJc_.js";import{i as ui}from"./CheckCircle-C4O_1HW1.js";import{I as Pi}from"./integration-icon-_VDJvzJ-.js";import{e as nu}from"./backoff-CrEUbyZT.js";import{u as XN}from"./use-status-sounds-Bfvpj4xw.js";import{E as _o}from"./empty-state-DytlgCAm.js";import{T as uo,a as ZN}from"./toolbar-DxhudO7Y.js";import{b as ey,n as Sp}from"./ZapSquare-Bs2nDJX-.js";import{i as Pr,a as eV}from"./Share07-BTlsc7Ng.js";import{i as Mn}from"./Globe01-CojEB28p.js";import{i as ty}from"./Monitor01-7UTn7zVa.js";import{u as ki,a as kp,b as jp}from"./use-connection-DT2B_DYi.js";import{u as sy,a as Cp,b as ny}from"./use-mcp-tools-Bn-w9dls.js";import{g as Uh,M as tV}from"./types-LSAqkaao.js";import{F as nr}from"./file-type-icon-DIpohPJ6.js";import{d as Np,c as Vp,s as Hh,b as sV}from"./TrendUp01-Cp69MjT_.js";import{u as Tp,a as iy}from"./use-file-configs-BPtRUpqF.js";import{n as Ia}from"./Download01-yzTeB8lR.js";import{n as mn}from"./LinkExternal01-CtNOOeZL.js";import{l as ry,w as Jg,M as iu,F as nV}from"./monaco-editor-CHdpsAKe.js";import{i as Kh}from"./Key01-Bx4K_S3Q.js";import{p as iV,f as rV}from"./pt-BR-CLy76QW2.js";import{g as oV,e as lV}from"./extract-connection-data-42ShpRyJ.js";import{a as aV,i as Xg}from"./mcp-oauth-R6LWeGel.js";import{A as Ma,a as $a,b as Oa,c as Ba,d as za,e as Fa,f as Ua,g as Ha}from"./alert-dialog-CvsZ6guw.js";import{L as Mt}from"./label-BNnDeYWX.js";import{S as Rr}from"./switch-9lR-M49q.js";import{T as Dr}from"./textarea-CioreWQ5.js";import{i as tl}from"./Play-DNBU5rzE.js";import{s as Zs}from"./Trash01-CZV6hVoi.js";import{u as P0}from"./use-debounced-autosave-DTkDy42k.js";import{i as Ad}from"./SearchMd-0vzqE1Pd.js";import{C as lc}from"./checkbox-CYVQb6u5.js";import{S as Wh}from"./search-input-F06b4Ka7.js";import{C as oy}from"./collection-tabs-DGI2IEmV.js";import{T as ly,u as ay,I as cV,R as dV,a as uV}from"./index-BYzmGpA0.js";import{n as hV}from"./LockUnlocked01-D_Q5BYhU.js";import{g as fV,s as cy}from"./connection-slug-eyAPH6o3.js";import{a as mV,i as pV}from"./Settings02-KfyhGAo3.js";import{d as ac}from"./delay-CnY5UFtP.js";import{G as kn,a as Ap,u as gV}from"./github-repo-picker-BebzrN3W.js";import{s as R0}from"./User01-DLfObf45.js";import{t as Ep}from"./Users01-CQ3eFXvg.js";import{u as dy,a as uy}from"./use-secrets-Djj5tnEX.js";import{i as hy,a as Pp}from"./DotsVertical-Dnc_qefX.js";import{a as cc}from"./format-time-BnbuEtat.js";import{f as fy,g as xV,l as my,a as bV}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as vV}from"./authenticate-and-persist-oauth-CZZKLfUR.js";import{X as yV,A as _V,a as LV}from"./AreaChart-DMcwZhe6.js";import{t as wV,u as py,a as gy,p as SV}from"./task-key-DC0DmXL_.js";import{s as dc}from"./Eye-rZWcM_sl.js";import{D as kV,R as jV,i as Ed,a as CV,S as os,b as xy,n as NV}from"./decopilot-sse-pool-BNBoVXdw.js";import{u as Zf}from"./use-copy-D3XerJdc.js";import{i as Rp,c as by}from"./SwitchHorizontal01-dwH3CFZl.js";import{u as Dp,a as VV,b as TV}from"./use-tags-Bcb85fVL.js";import{g as Wn}from"./get-initials-D-f_fDFw.js";import{C as hi,a as Jn,b as Ut,c as fs,d as fi,e as Ri,f as AV,g as Zg}from"./command-DUeMCHIE.js";import{i as qh}from"./ChevronSelectorVertical-DhZiWWo6.js";import{i as Ip}from"./FilterLines-BMCdm4O2.js";import{i as Gh}from"./SearchLg-6rfLixx5.js";import{u as o1,a as EV,c as PV,p as RV,b as DV}from"./self-tool-result-BoRiwr9O.js";import{a as l1}from"./Palette-BoChqeld.js";import{u as Yh}from"./use-debounced-value-DbRRK9TT.js";import{u as vy}from"./useInfiniteQuery-gLOjDPyq.js";import{i as Ir}from"./Zap-Dzj3-lys.js";import{B as IV}from"./badge-CGCuo_-5.js";import{u as ru,a as MV,b as $V,c as OV,d as BV}from"./use-automations-CB10hjhp.js";import{s as ad}from"./Stars02-Do7POkWd.js";import{A as zV}from"./automation-list-row-DuyceG26.js";import{u as FV,a as UV}from"./use-org-repo-syncs-DNte33T4.js";import{n as yy}from"./ChevronUp-CrheBWdX.js";function Qh(t,e){const s=Ls(e);return HV({filters:{...t,status:"pending"}},s).length}function e3(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function HV(t={},e){const s=Ls(e).getMutationCache(),n=E.useRef(t),i=E.useRef(null);return i.current===null&&(i.current=e3(s,t)),E.useEffect(()=>{n.current=t}),E.useSyncExternalStore(E.useCallback(o=>s.subscribe(()=>{const l=lk(i.current,e3(s,n.current));i.current!==l&&(i.current=l,ak.schedule(o))}),[s]),()=>i.current,()=>i.current)}const t3=3,_y="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",KV="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Ly(t){const e=F.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:o,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=Ji(c._meta);d=c.title??Hm(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(a==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const w=o||i,j=i&&"bg-accent/40",N=(o||i)&&"cursor-not-allowed opacity-50";let A;e[7]!==j||e[8]!==N?(A=ie(KV,"hover:bg-accent/60 text-foreground",j,N),e[7]=j,e[8]=N,e[9]=A):A=e[9];let C;e[10]!==h?(C=r.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=C):C=e[11];let T;e[12]!==i?(T=i&&r.jsx(Cd,{size:"xs"}),e[12]=i,e[13]=T):T=e[13];let V;e[14]!==C||e[15]!==T?(V=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,T]}),e[14]=C,e[15]=T,e[16]=V):V=e[16];let R;e[17]!==u?(R=u&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=R):R=e[18];let P;return e[19]!==V||e[20]!==R||e[21]!==S||e[22]!==w||e[23]!==A?(P=r.jsxs("button",{type:"button",onClick:S,disabled:w,className:A,children:[V,R]}),e[19]=V,e[20]=R,e[21]=S,e[22]=w,e[23]=A,e[24]=P):P=e[24],P}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=o||i,p=i&&"bg-muted/50",g=(o||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(_y,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=r.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(Cd,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let y;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(y=r.jsx(Ue,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=y):y=e[40];const L=u??h;let _;e[41]!==L?(_=r.jsx(He,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=_):_=e[42];let k;return e[43]!==y||e[44]!==_?(k=r.jsxs(Ke,{delayDuration:400,children:[y,_]}),e[43]=y,e[44]=_,e[45]=k):k=e[45],k}function WV(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=re(),[c,d]=E.useState(""),h=!!l;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(C=>{const T=c.toLowerCase();return C.prompt.name.toLowerCase().includes(T)||(C.prompt.title??"").toLowerCase().includes(T)||(C.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,m=So();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==l?.name||e[10]!==i||e[11]!==o){let C;e[13]!==h||e[14]!==l?.name||e[15]!==i||e[16]!==o?(C=T=>r.jsx(Ly,{item:T,variant:"card",onSelect:V=>{i(!1),o(V)},isLoading:l?.name===T.prompt.name,isDisabled:h&&l?.name!==T.prompt.name},T.prompt.name),e[13]=h,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=h,e[9]=l?.name,e[10]=i,e[11]=o,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=C=>{C.key==="Escape"&&d("")},e[23]=y):y=e[23];let L;e[24]!==c||e[25]!==v?(L=r.jsx(Kj,{value:c,onChange:d,placeholder:v,onKeyDown:y}),e[24]=c,e[25]=v,e[26]=L):L=e[26];const _=L;if(m){let C;e[27]!==a?(C=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=C):C=e[28];let T;e[29]!==C?(T=r.jsx(Fj,{className:"sr-only",children:r.jsx(Vh,{children:C})}),e[29]=C,e[30]=T):T=e[30];let V;e[31]!==a?(V=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=V):V=e[32];let R;e[33]!==V?(R=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:V})}),e[33]=V,e[34]=R):R=e[34];let P;e[35]!==b||e[36]!==_||e[37]!==R||e[38]!==T?(P=r.jsxs(Th,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,R,_,b]}),e[35]=b,e[36]=_,e[37]=R,e[38]=T,e[39]=P):P=e[39];let M;return e[40]!==i||e[41]!==n||e[42]!==P?(M=r.jsx(Tr,{delayDuration:400,children:r.jsx(Ah,{open:n,onOpenChange:i,children:P})}),e[40]=i,e[41]=n,e[42]=P,e[43]=M):M=e[43],M}let k;e[44]!==a?(k=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=k):k=e[45];let S;e[46]!==k?(S=r.jsx(ms,{className:"sr-only",children:r.jsx($t,{children:k})}),e[46]=k,e[47]=S):S=e[47];let w;e[48]!==a?(w=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=w):w=e[49];let j;e[50]!==w?(j=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:w})}),e[50]=w,e[51]=j):j=e[51];let N;e[52]!==b||e[53]!==_||e[54]!==j||e[55]!==S?(N=r.jsxs(Pt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,_,b]}),e[52]=b,e[53]=_,e[54]=j,e[55]=S,e[56]=N):N=e[56];let A;return e[57]!==i||e[58]!==n||e[59]!==N?(A=r.jsx(Tr,{delayDuration:400,children:r.jsx(Rt,{open:n,onOpenChange:i,children:N})}),e[57]=i,e[58]=n,e[59]=N,e[60]=A):A=e[60],A}function qV(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=re(),[a,c]=E.useState(!1);if(s.length===0)return null;let d,h,u,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,t3),v=s.slice(t3),y=!!i;let L;e[10]!==y||e[11]!==i?.name||e[12]!==n?(L=k=>r.jsx(Ly,{item:k,onSelect:n,isLoading:i?.name===k.prompt.name,isDisabled:y&&i?.name!==k.prompt.name},k.prompt.name),e[10]=y,e[11]=i?.name,e[12]=n,e[13]=L):L=e[13];const _=b.map(L);d=Tr,m=400,e[14]!==o?(h=ie("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=h):h=e[15],u=_,f=v.length>0&&r.jsx("button",{type:"button",disabled:y,onClick:()=>c(!0),className:ie(_y,"hover:bg-muted/70 hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=o,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]=m}else d=e[5],h=e[6],u=e[7],f=e[8],m=e[9];let p;e[16]!==h||e[17]!==u||e[18]!==f?(p=r.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=r.jsx(WV,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=r.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function GV(){return null}function YV(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 QV(t){const e=F.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=di(),{org:o}=We();let l;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(l={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.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}=fv(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(JV),e[8]=u,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=E.useReducer(YV,p),[b,v]=E.useState(null);let y;e[11]!==a||e[12]!==i||e[13]!==n?(y=async(V,R)=>{if(!a){pe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const P=await Gd(a,V.name,R);x({type:"RESET"});const M={type:"doc",content:[{type:"paragraph",content:[Ch({id:V.name,name:ec(V.name,Ji(V._meta)),metadata:P.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await i(M)}catch(P){console.error("[ice-breakers] Failed to fetch prompt:",P),pe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=y):y=e[14];const L=y;let _;e[15]!==L?(_=async V=>{if(V.arguments&&V.arguments.length>0){x({type:"SELECT_PROMPT",prompt:V}),v(V);return}x({type:"START_LOADING",prompt:V}),await L(V)},e[15]=L,e[16]=_):_=e[16];const k=_;let S;e[17]!==b||e[18]!==L?(S=async V=>{b&&(x({type:"START_LOADING",prompt:b,arguments:V}),v(null),await L(b,V))},e[17]=b,e[18]=L,e[19]=S):S=e[19];const w=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let N;e[20]!==k||e[21]!==m||e[22]!==j?(N=r.jsx(qV,{items:m,onSelect:k,loadingPrompt:j}),e[20]=k,e[21]=m,e[22]=j,e[23]=N):N=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{v(null),x({type:"RESET"})},e[24]=A):A=e[24];let C;e[25]!==b||e[26]!==w?(C=r.jsx(jd,{prompt:b,setPrompt:A,onSubmit:w}),e[25]=b,e[26]=w,e[27]=C):C=e[27];let T;return e[28]!==N||e[29]!==C?(T=r.jsxs(r.Fragment,{children:[N,C]}),e[28]=N,e[29]=C,e[30]=T):T=e[30],T}function JV(t){return{prompt:t}}function XV(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=jo(),{org:i}=We();let o;e[0]!==i.id?(o=tc(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=o.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=r.jsx(GV,{}),e[4]=h):h=e[4];let u;e[5]!==a?(u=r.jsx(QV,{connectionId:a}),e[5]=a,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=r.jsx(Js,{fallback:null,children:r.jsx(E.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const e9="cubic-bezier(0.645, 0.045, 0.355, 1)",ZV=44,eT={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"},tT={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},sT={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Lo(t){const e=F.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,m=re(),[p,g]=E.useState(d),[x,b]=E.useState(!1);let v;e[0]!==u?(v=()=>{b(!0),u?.()},e[0]=u,e[1]=v):v=e[1];const y=v;if(x)return null;const L=tT[f],_=eT[f];let k;e[2]!==L||e[3]!==_?(k=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,_),e[2]=L,e[3]=_,e[4]=k):k=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(nT),e[5]=S):S=e[5];const w=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let N;e[6]!==w||e[7]!==j?(N=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",w,j),e[6]=w,e[7]=j,e[8]=N):N=e[8];const A=sT[f];let C;e[9]!==A?(C=ie("shrink-0",A),e[9]=A,e[10]=C):C=e[10];let T;e[11]!==s||e[12]!==C?(T=r.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=T):T=e[13];let V;e[14]!==n?(V=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=V):V=e[15];let R;e[16]!==i?(R=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=R):R=e[17];const P=p?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==P?(M=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(Jt,{size:16,style:{transform:P,transition:`transform 180ms ${e9}`}})}),e[18]=P,e[19]=M):M=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let z,I;e[24]!==y?(z=Z=>{Z.stopPropagation(),y()},I=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),y())},e[24]=y,e[25]=z,e[26]=I):(z=e[25],I=e[26]);let O;e[27]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(_s,{size:16}),e[27]=O):O=e[27];let B;e[28]!==D||e[29]!==$||e[30]!==z||e[31]!==I?(B=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:$,onClick:z,onKeyDown:I,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:O}),e[28]=D,e[29]=$,e[30]=z,e[31]=I,e[32]=B):B=e[32];let U;e[33]!==p||e[34]!==T||e[35]!==V||e[36]!==R||e[37]!==M||e[38]!==B||e[39]!==N?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:N,children:[T,V,R,M,B]}),e[33]=p,e[34]=T,e[35]=V,e[36]=R,e[37]=M,e[38]=B,e[39]=N,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let K;e[41]!==H?(K={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${e9}`},e[41]=H,e[42]=K):K=e[42];let W;e[43]===Symbol.for("react.memo_cache_sentinel")?(W={overflow:"hidden",minHeight:0},e[43]=W):W=e[43];const Y=p?1:0;let Q;e[44]!==Y?(Q={opacity:Y,transition:`opacity 120ms ${e9}`,maxHeight:"60vh"},e[44]=Y,e[45]=Q):Q=e[45];let te;e[46]!==o?(te=o?r.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:o})}):r.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=o,e[47]=te):te=e[47];let ee;e[48]!==c||e[49]!==o?(ee=c?r.jsx("div",{className:ie("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=ee):ee=e[50];let oe;e[51]!==te||e[52]!==ee?(oe=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[te,ee]}),e[51]=te,e[52]=ee,e[53]=oe):oe=e[53];let se;e[54]!==l||e[55]!==a?(se=l||a?r.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:l}),r.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=se):se=e[56];let G;e[57]!==Q||e[58]!==oe||e[59]!==se?(G=r.jsx("div",{style:W,children:r.jsxs("div",{className:"flex flex-col",style:Q,children:[oe,se]})}),e[57]=Q,e[58]=oe,e[59]=se,e[60]=G):G=e[60];let X;e[61]!==K||e[62]!==G?(X=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:G}),e[61]=K,e[62]=G,e[63]=X):X=e[63];let q;return e[64]!==U||e[65]!==X||e[66]!==k||e[67]!==f?(q=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:k,children:[U,X]}),e[64]=U,e[65]=X,e[66]=k,e[67]=f,e[68]=q):q=e[68],q}function nT(t){return!t}const iT=_i({content:nn().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Om(["pending","in_progress","completed"]),activeForm:nn().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),wy=_i({todos:ck(iT)}),rT="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.";iC({description:rT,inputSchema:rC(wy),execute:async({todos:t})=>({ok:!0,count:t.length})});const oT="tool-todo_write",lT=new Set(["input-available","output-available"]);function aT(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 o=n[i];if(o.type!==oT||typeof o.state!="string"||!lT.has(o.state))continue;const l=wy.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function Sy(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:Zo(rj(n)),input:s.input})}return e}function ky(t){return t.at(-1)}function jy(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 cT(t){return t?t.message.startsWith("[CREDITS]"):!1}const dT="[SUBSCRIPTION_REQUIRED]";function Cy(t){return t?.message.startsWith(dT)?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 uT={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function hT(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&cT(s))return{...uT,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,h=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,u=jy(a),f=Sy(c),m=aT(e),p=i?null:Cy(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=u.length>0,y=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:y,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:m}}function Ny(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=di(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==o||t[2]!==e||t[3]!==l||t[4]!==a?(c=hT({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:o}),t[0]=i,t[1]=o,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function fT(){const t=Ny();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 Vy(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 mT="__home__";function Mp(t,e){return Bm.chatDraft(t,e)}function pT(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 Ty(t,e,s,n,i){const o=Mp(e,s);if(Vy(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(xT(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function s3(t,e,s){const n=Mp(e,s),i=t.getItem(n),o=pT(i);return i!==null&&o===null&&t.removeItem(n),o}function gT(t,e,s){t.removeItem(Mp(e,s))}function xT(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function bT(t){return t==="cms"||t==="sandbox"?t:null}function vT(t,e){const s=Xm(t),n=!!s&&t?.fastPreview===!0;return{runtime:bT(e?.runtime)==="sandbox"?"sandbox":n?"cms":"sandbox",fastPreviewCapability:n,previewServerUrl:s}}function ji(t,e){const{runtime:s,previewServerUrl:n}=vT(t,e);return{previewServerUrl:n,active:s==="cms"}}function yT(t,e){const s=ji(t).active,n=ji(t,e).active;return s&&!n}function ou(){return Co()?.activeTask?.metadata}function _T(t){const e=F.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=re();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ie("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]!==l?(h=l("chat.pagination.previousLabel"),e[2]=l,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Mh,{size:14}),e[4]=u):u=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==h?(f=r.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":h,children:u}),e[5]=i,e[6]=a,e[7]=d,e[8]=h,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=r.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let v;e[16]!==b?(v=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let y;e[18]!==l?(y=l("chat.pagination.nextLabel"),e[18]=l,e[19]=y):y=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(pl,{size:14}),e[20]=L):L=e[20];let _;e[21]!==o||e[22]!==x||e[23]!==v||e[24]!==y?(_=r.jsx("button",{type:"button",onClick:o,disabled:x,className:v,"aria-label":y,children:L}),e[21]=o,e[22]=x,e[23]=v,e[24]=y,e[25]=_):_=e[25];let k;return e[26]!==_||e[27]!==f||e[28]!==g?(k=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,_]}),e[26]=_,e[27]=f,e[28]=g,e[29]=k):k=e[29],k}function Ay(t){const e=F.c(8),{currentIndex:s,total:n,onPrev:i,onNext:o,extraLeft:l}=t;let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a=r.jsx(_T,{current:s,total:n,onPrev:i,onNext:o}),e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=r.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function LT(t){const e=F.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,submitLabel:l,nextLabel:a}=t,h=n?l===void 0?"Submit":l:a===void 0?"Next":a,u=n?s:!i,f=u?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==u||e[1]!==o?(m=()=>{u||o()},e[0]=u,e[1]=o,e[2]=m):m=e[2];const p=u&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==u||e[6]!==h||e[7]!==m||e[8]!==g?(x=r.jsx(he,{type:"button",size:"sm","aria-disabled":u,onClick:m,className:g,children:h}),e[5]=u,e[6]=h,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let v;e[10]!==b?(v=r.jsx(Ue,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(He,{children:f}),e[12]=f,e[13]=y):y=e[13];let L;return e[14]!==v||e[15]!==y?(L=r.jsxs(Ke,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=L):L=e[16],L}function Ey(t,e,s){return t.findIndex(n=>e(n)===s)}function n3(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function i3(t,e,s,n,i){if(t.length===0)return null;const o=Ey(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(o+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function wT(t){return!t.isStreaming&&t.allAnswered}function Py(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,h]=E.useState(c),[u,f]=E.useState(!1),m=zm({resolver:jb(n),defaultValues:i}),p=m.watch(),g=Ey(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=n3(e,s,p,l),y=wT({isStreaming:o,allAnswered:v}),L=()=>{if(g>0){const A=e[g-1];A&&h(s(A))}},_=()=>{if(g>=0&&g<e.length-1){const A=e[g+1];A&&h(s(A))}},k=()=>{const A=m.getValues(),C=i3(e,s,A,l,d);C&&h(C)},S=()=>{m.handleSubmit(A=>{const C=A;for(const T of e)a(T,C[s(T)])})()},w=E.useRef(S);w.current=S;const j=()=>{y&&(f(!1),w.current())},N=()=>{const A=m.getValues();if(n3(e,s,A,l)){if(o){f(!0);return}f(!1),w.current()}else{const C=i3(e,s,A,l,d);C&&h(C)}};return E.useEffect(()=>{if(u&&!o){if(!v){f(!1);return}f(!1),w.current()}},[u,o,v]),{form:m,activeKey:d,setActiveKey:h,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:y,goPrev:L,goNext:_,advanceToNextUnanswered:k,submit:j,submitOrAdvance:N}}const Ry="chat.approval.defaultDenyReason";function Dy(t){const e=F.c(36),{onYolo:s}=t,n=re(),[i,o]=Ei();let l,a,c,d,h,u,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const L=Ho.find(S=>S.value===i.toolApprovalLevel)??Ho[0];let _;e[13]!==s||e[14]!==i||e[15]!==o?(_=S=>{const w=S,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:w}),w==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=_):_=e[16];const k=_;c=js,m=i.toolApprovalLevel,p=k,a=Cs,h="xs",u="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=ST,l=Ps,d=n(L.shortKey),e[0]=s,e[1]=i,e[2]=o,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=h,e[9]=u,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],h=e[8],u=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=r.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==h||e[22]!==u||e[23]!==f||e[24]!==g?(x=r.jsx(a,{size:h,className:u,onClick:f,children:g}),e[20]=a,e[21]=h,e[22]=u,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=Ho.map(L=>r.jsx(At,{value:L.value,children:n(L.labelKey)},L.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=r.jsx(Ns,{children:b}),e[28]=b,e[29]=v):v=e[29];let y;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(y=r.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=y):y=e[35],y}function ST(t){return t.stopPropagation()}function Iy(t){const e=F.c(8),{input:s}=t,n=re();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=r.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let o;return e[6]!==i?(o=r.jsx("div",{className:"px-4",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[6]=i,e[7]=o):o=e[7],o}function kT(t){const e=F.c(38),{approval:s,onRespond:n}=t,i=re(),[o]=Ei(),l=o.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(Ry),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const h=d;let u;e[9]!==s.approvalId||e[10]!==n?(u=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=u):u=e[11];const f=u;let m;e[12]!==f?(m=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(Dy,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=r.jsx(he,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let v;e[21]!==h||e[22]!==b?(v=r.jsx(he,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:h,children:b}),e[21]=h,e[22]=b,e[23]=v):v=e[23];let y;e[24]!==x||e[25]!==v?(y=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=y):y=e[26];const L=y;let _;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(Ih,{size:14}),e[27]=_):_=e[27];let k;e[28]!==i?(k=i("chat.approval.needsApproval"),e[28]=i,e[29]=k):k=e[29];let S;e[30]!==s.input?(S=r.jsx(Iy,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let w;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==k||e[36]!==S?(w=r.jsx(Lo,{icon:_,label:k,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=k,e[36]=S,e[37]=w):w=e[37],w}const jT=dk(nn(),_i({approved:uk().optional(),levelOverride:Om(["auto","readonly"]).optional()}));function CT(t){const e=F.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=re(),[l]=Ei(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(TT)),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==a||e[3]!==i||e[4]!==o?(h=(C,T)=>{const V=T;typeof V?.approved=="boolean"&&i(C.approvalId,V.approved,V.approved===!1?o(Ry):void 0,V.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=h):h=e[5];let u;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==h?(u={parts:s,partKey:VT,schema:jT,defaultValues:d,isStreaming:n,hasAnswer:NT,onSubmit:h},e[6]=s,e[7]=d,e[8]=n,e[9]=h,e[10]=u):u=e[10];const f=Py(u);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:C}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(Ih,{size:14}),e[16]=v):v=e[16];let y;e[17]!==s.length||e[18]!==o?(y=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=y):y=e[19];const L=g?.friendlyName??"";let _;e[20]!==p?(_=r.jsx(Dy,{onYolo:p}),e[20]=p,e[21]=_):_=e[21];let k;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==_?(k=r.jsx(Ay,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:_}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=_,e[27]=k):k=e[27];let S;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(S=g?r.jsx(AT,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=S):S=e[31];let w;e[32]!==g?(w=g?r.jsx(Iy,{input:g.input}):null,e[32]=g,e[33]=w):w=e[33];let j;e[34]!==k||e[35]!==S||e[36]!==w||e[37]!==y||e[38]!==L?(j=r.jsx(Lo,{icon:v,label:y,title:L,defaultExpanded:!0,footerLeft:k,footerRight:S,children:w}),e[34]=k,e[35]=S,e[36]=w,e[37]=y,e[38]=L,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==b?(N=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=N):N=e[42];let A;return e[43]!==f.form||e[44]!==N?(A=r.jsx(i1,{...x,children:N}),e[43]=f.form,e[44]=N,e[45]=A):A=e[45],A}function NT(t){return typeof t?.approved=="boolean"}function VT(t){return t.approvalId}function TT(t){return[t.approvalId,{approved:void 0}]}function AT(t){const e=F.c(7),{approvalId:s,control:n,onChange:i}=t,o=re(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:h}=d,u=h.value===!0,f=h.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(he,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!1),i()},"aria-pressed":f,children:o("chat.approval.denyButton")}),r.jsx(he,{type:"button",variant:u?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!0),i()},"aria-pressed":u,children:o("chat.approval.acceptButton")})]})},e[0]=i,e[1]=o,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=r.jsx(Es,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function ET(){const t=F.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Ih,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function PT(t){const e=F.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(ET,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=r.jsx(kT,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let o;return e[4]!==s||e[5]!==n||e[6]!==i?(o=r.jsx(CT,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function RT(t){const e=F.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=re();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==o?(c=o("chat.proposePlan.keepIterating"),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=r.jsx(he,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==o?(h=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=h):h=e[9];let u;e[10]!==a||e[11]!==h?(u=r.jsx(he,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:h}),e[10]=a,e[11]=h,e[12]=u):u=e[12];let f;e[13]!==d||e[14]!==u?(f=r.jsxs(r.Fragment,{children:[d,u]}),e[13]=d,e[14]=u,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(wv,{size:14}),e[16]=p):p=e[16];let g;e[17]!==o?(g=o("chat.proposePlan.planReady"),e[17]=o,e[18]=g):g=e[18];let x;e[19]!==o?(x=o("chat.proposePlan.implementationPlan"),e[19]=o,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=r.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:r.jsx(oj,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=r.jsx(Lo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=v):v=e[27],v}function DT(t){const e=F.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=ky(s),e[0]=s,e[1]=o):o=e[1];const l=o;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=r.jsx(RT,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function My(t){return t?"response"in t?t.response:t.option??t.draft:""}const r3=_i({response:nn().min(1,"Response is required")}),IT=_i({option:nn().nullable(),draft:nn()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),MT=_i({response:Om(["yes","no"])});function $T(t){switch(t.type){case"text":return r3;case"choice":return IT;case"confirm":return MT;default:return r3}}function OT(t){const e={};for(const s of t)e[s.toolCallId]=$T(s.input);return _i(e)}function BT(t){const e=F.c(7),{control:s,name:n,placeholder:i}=t,o=re();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,h=d.value??"";return r.jsxs(up,{children:[r.jsx(hp,{children:r.jsx("div",{className:"px-2",children:r.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(ep,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:h,type:"text",placeholder:i||o("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":o("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(fp,{})]})},e[0]=i,e[1]=o,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=r.jsx(Bv,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function $y(t,e){const s=F.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const o=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),E.useEffect(n,i)}function zT(t){const e=F.c(51),{control:s,name:n,options:i}=t,o=re(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=zg(a),d=`${n}.draft`;let h;e[3]!==s||e[4]!==d?(h={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=h):h=e[5];const{field:u}=zg(h),f=c.value,m=u.value??"";let p;if(e[6]!==c||e[7]!==i?(p=P=>{const M=i[P];M!=null&&c.onChange(M)},e[6]=c,e[7]=i,e[8]=p):p=e[8],$y(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==o?(x=o("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=o,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==o){let P;e[16]!==c||e[17]!==f||e[18]!==o?(P=(M,D)=>{const $=f===M;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(M),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",$&&"bg-accent/50",!$&&"hover:bg-accent/30"),"aria-label":o("chat.userAskQuestion.selectOption",{option:M}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",$?"bg-chart-1 text-white":"bg-muted text-foreground"),children:D+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${D}-${M}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=P):P=e[19],b=i.map(P),e[11]=c,e[12]=f,e[13]=i,e[14]=o,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",y=!g&&"hover:bg-accent/30";let L;e[20]!==v||e[21]!==y?(L=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,y),e[20]=v,e[21]=y,e[22]=L):L=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(ep,{size:16,className:"text-muted-foreground"})}),e[23]=_):_=e[23];const k=g?m:"";let S;e[24]!==u||e[25]!==c||e[26]!==f?(S=P=>{u.onChange(P.target.value),f!==null&&c.onChange(null)},e[24]=u,e[25]=c,e[26]=f,e[27]=S):S=e[27];let w;e[28]!==c||e[29]!==f?(w=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=w):w=e[30];let j;e[31]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let N;e[33]!==o?(N=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=N):N=e[34];let A;e[35]!==k||e[36]!==S||e[37]!==w||e[38]!==j||e[39]!==N?(A=r.jsx("input",{type:"text",value:k,onChange:S,onFocus:w,placeholder:j,"aria-label":N,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=k,e[36]=S,e[37]=w,e[38]=j,e[39]=N,e[40]=A):A=e[40];let C;e[41]!==L||e[42]!==A?(C=r.jsxs("label",{className:L,children:[_,A]}),e[41]=L,e[42]=A,e[43]=C):C=e[43];let T;e[44]!==C||e[45]!==x||e[46]!==b?(T=r.jsx(hp,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=T):T=e[47];let V;e[48]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(fp,{}),e[48]=V):V=e[48];let R;return e[49]!==T?(R=r.jsxs(up,{children:[T,V]}),e[49]=T,e[50]=R):R=e[50],R}function FT(t){const e=F.c(8),{control:s,name:n}=t,i=re();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=E.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{a.current?.onChange(l[u]??"")},e[1]=c):c=e[1],$y(l.length,c);let d;e[2]!==i?(d=u=>{const{field:f}=u;return a.current=f,r.jsxs(up,{children:[r.jsx(hp,{children:r.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=f.value===m;return r.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ie("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),r.jsx(fp,{})]})},e[2]=i,e[3]=d):d=e[3];let h;return e[4]!==s||e[5]!==n||e[6]!==d?(h=r.jsx(Bv,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=h):h=e[7],h}function o3(t){const e=F.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const o=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==o?(l=r.jsx(BT,{control:n,name:o,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=o,e[3]=l):l=e[3],l}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const l=o;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=r.jsx(zT,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const o=`${i}.response`;let l;return e[10]!==n||e[11]!==o?(l=r.jsx(FT,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function UT(t){const e=F.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=OT(s.map(qT)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(WT)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(I,O)=>{const B=My(O);B&&i(I,B)},e[4]=i,e[5]=d):d=e[5];let h;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(h={parts:s,partKey:KT,schema:l,defaultValues:c,isStreaming:n,hasAnswer:HT,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=h):h=e[11];const u=Py(h),f=u.currentPart,m=re();let p;e[12]!==f||e[13]!==u||e[14]!==m?(p=()=>{const I=f;if(!I)return;const O=m("chat.userAskQuestion.skipMessage"),B=I.toolCallId;I.input?.type==="choice"?(u.form.setValue(`${B}.option`,null),u.form.setValue(`${B}.draft`,O)):u.form.setValue(`${B}.response`,O),u.advanceToNextUnanswered()},e[12]=f,e[13]=u,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==u.currentIndex||e[17]!==u.goNext||e[18]!==u.goPrev||e[19]!==s.length?(x=r.jsx(Ay,{currentIndex:u.currentIndex,total:s.length,onPrev:u.goPrev,onNext:u.goNext}),e[16]=u.currentIndex,e[17]=u.goNext,e[18]=u.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let y;e[23]!==g||e[24]!==v?(y=r.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=y):y=e[25];let L;e[26]!==u.isAllAnswered||e[27]!==u.isCurrentAnswered||e[28]!==u.submitOrAdvance||e[29]!==n?(L=r.jsx(LT,{isStreaming:n,isAllAnswered:u.isAllAnswered,isCurrentAnswered:u.isCurrentAnswered,onAdvanceOrSubmit:u.submitOrAdvance}),e[26]=u.isAllAnswered,e[27]=u.isCurrentAnswered,e[28]=u.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let _;e[31]!==y||e[32]!==L?(_=r.jsxs(r.Fragment,{children:[y,L]}),e[31]=y,e[32]=L,e[33]=_):_=e[33];const k=_;if(s.length===1){const I=s[0];if(!I?.input)return null;const O=u.form;let B;e[34]!==u?(B=oe=>{oe.preventDefault(),u.submit()},e[34]=u,e[35]=B):B=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(r1,{size:14}),e[36]=U):U=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let K;e[39]!==I.input?.prompt||e[40]!==m?(K=I.input?.prompt??m("chat.userAskQuestion.question"),e[39]=I.input?.prompt,e[40]=m,e[41]=K):K=e[41];const W=I.input;let Y;e[42]!==u.form.control||e[43]!==I.toolCallId||e[44]!==W?(Y=r.jsx(o3,{input:W,control:u.form.control,toolCallId:I.toolCallId}),e[42]=u.form.control,e[43]=I.toolCallId,e[44]=W,e[45]=Y):Y=e[45];let Q;e[46]!==k||e[47]!==H||e[48]!==K||e[49]!==Y?(Q=r.jsx(Lo,{icon:U,label:H,title:K,defaultExpanded:!0,footerRight:k,children:Y}),e[46]=k,e[47]=H,e[48]=K,e[49]=Y,e[50]=Q):Q=e[50];let te;e[51]!==B||e[52]!==Q?(te=r.jsx("form",{onSubmit:B,autoComplete:"off",children:Q}),e[51]=B,e[52]=Q,e[53]=te):te=e[53];let ee;return e[54]!==u.form||e[55]!==te?(ee=r.jsx(i1,{...O,children:te}),e[54]=u.form,e[55]=te,e[56]=ee):ee=e[56],ee}const S=u.form;let w;e[57]!==u?(w=I=>{I.preventDefault(),u.submit()},e[57]=u,e[58]=w):w=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(r1,{size:14}),e[59]=j):j=e[59];let N;e[60]!==m?(N=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=N):N=e[61];const A=u.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==A?(C=m("chat.userAskQuestion.questionCount",{current:A,total:s.length}),e[62]=s.length,e[63]=m,e[64]=A,e[65]=C):C=e[65];let T;e[66]!==f?.input?.prompt||e[67]!==m?(T=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=T):T=e[68];const V=u.activeKey,R=u.setActiveKey;let P;if(e[69]!==u.form||e[70]!==s){let I;e[72]!==u.form?(I=O=>r.jsx(Yo,{value:O.toolCallId,className:"mt-0",children:r.jsx(o3,{input:O.input,control:u.form.control,toolCallId:O.toolCallId})},O.toolCallId),e[72]=u.form,e[73]=I):I=e[73],P=s.map(I),e[69]=u.form,e[70]=s,e[71]=P}else P=e[71];let M;e[74]!==u.activeKey||e[75]!==u.setActiveKey||e[76]!==P?(M=r.jsx(rc,{value:V,onValueChange:R,children:P}),e[74]=u.activeKey,e[75]=u.setActiveKey,e[76]=P,e[77]=M):M=e[77];let D;e[78]!==b||e[79]!==k||e[80]!==N||e[81]!==C||e[82]!==T||e[83]!==M?(D=r.jsx(Lo,{icon:j,label:N,count:C,title:T,defaultExpanded:!0,footerLeft:b,footerRight:k,children:M}),e[78]=b,e[79]=k,e[80]=N,e[81]=C,e[82]=T,e[83]=M,e[84]=D):D=e[84];let $;e[85]!==w||e[86]!==D?($=r.jsx("form",{onSubmit:w,autoComplete:"off",children:D}),e[85]=w,e[86]=D,e[87]=$):$=e[87];let z;return e[88]!==u.form||e[89]!==$?(z=r.jsx(i1,{...S,children:$}),e[88]=u.form,e[89]=$,e[90]=z):z=e[90],z}function HT(t){return!!My(t)}function KT(t){return t.toolCallId}function WT(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function qT(t){return{toolCallId:t.toolCallId,input:t.input}}function GT(){const t=F.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(r1,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function Oy(t){const e=F.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(YT),e[0]=s,e[1]=o):o=e[1];const l=o;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(GT,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(UT,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function YT(t){return t.state==="input-available"}function QT(t){const e=t.filter(o=>o.status==="in_progress"),s=t.filter(o=>o.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function JT(t){const e=F.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=QT(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx(tA,{status:i.icon}),e[2]=i.icon,e[3]=o):o=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(XT),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=r.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let h;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==o||e[11]!==d?(h=r.jsx(Lo,{icon:o,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=o,e[11]=d,e[12]=h):h=e[12],h}function XT(t,e){return r.jsx(ZT,{todo:t},e)}function ZT(t){const e=F.c(14),{todo:s}=t,n=s.status==="completed",o=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=r.jsx(eA,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ie("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",h=n?"width 300ms ease 200ms":"width 150ms ease";let u;e[4]!==d||e[5]!==h?(u=r.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:h}}),e[4]=d,e[5]=h,e[6]=u):u=e[6];let f;e[7]!==o||e[8]!==c||e[9]!==u?(f=r.jsxs("span",{className:c,children:[o,u]}),e[7]=o,e[8]=c,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=r.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,f]}),e[11]=l,e[12]=f,e[13]=m):m=e[13],m}function eA(t){const e=F.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("svg",{viewBox:"0 0 21 21",children:r.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=o):o=e[0];let l;return e[1]!==n||e[2]!==i?(l=r.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:o}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function tA(t){const e=F.c(13),{status:s}=t,n=re();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:r.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=r.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=r.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let o;return e[11]!==i?(o=r.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=o):o=e[12],o}const sA={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},nA=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function By(t){const e=F.c(65),{onDismiss:s}=t,{org:n}=We(),i=Ot(),{decoKeyId:o}=pp(),l=zs(),a=re(),[c,d]=E.useState(""),[h,u]=E.useState(!1),[f,m]=E.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{st("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),E.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async W=>{const{url:Y}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:W,currency:f});return Y},e[3]=f,e[4]=l,e[5]=b):b=e[5];let v;e[6]!==s?(v=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let y;e[8]!==a?(y=W=>{pe.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=y):y=e[9];let L;e[10]!==b||e[11]!==v||e[12]!==y?(L={mutationFn:b,onSuccess:v,onError:y},e[10]=b,e[11]=v,e[12]=y,e[13]=L):L=e[13];const{mutate:_,isPending:k}=Xs(L),S=parseFloat(c),w=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=N):N=e[16];let A;e[17]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:N.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=A):A=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=C):C=e[18];let T;e[19]!==a?(T=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=T):T=e[20];let V;e[21]!==T?(V=r.jsx($t,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=V):V=e[22];let R;e[23]!==a?(R=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=R):R=e[24];let P;e[25]!==R?(P=r.jsx(Dn,{className:"mt-1.5 text-sm leading-relaxed",children:R}),e[25]=R,e[26]=P):P=e[26];let M;e[27]!==V||e[28]!==P?(M=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[A,r.jsxs(ms,{className:"relative gap-4",children:[C,r.jsxs("div",{children:[V,P]})]})]}),e[27]=V,e[28]=P,e[29]=M):M=e[29];let D;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==o||e[35]!==w||e[36]!==k||e[37]!==h||e[38]!==a||e[39]!==_?(D=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(mp,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:W=>{W&&m(W)},children:[r.jsx(Nd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Nd,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsxs("div",{className:"rounded-xl border border-border p-5",children:[r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:sA[f].map(W=>{const{dollars:Y,labelKey:Q}=W;return r.jsxs("button",{type:"button",disabled:k,onClick:()=>{st("credits_topup_clicked",{amount_cents:Y*100,currency:f,tier_label:Q,source:"exhausted_banner"}),_(Y*100)},className:ie("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,Y]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:a(Q)})]},Y)})}),h?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(pt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:W=>d(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!w||k,onClick:()=>{st("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),_(Math.round(S*100))},children:a(k?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):r.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:a("chat.creditsExhaustedBanner.enterCustom")})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:nA.map(W=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:r.jsx(Et,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:a(W)})]},W))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=S,e[34]=o,e[35]=w,e[36]=k,e[37]=h,e[38]=a,e[39]=_,e[40]=D):D=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let z;e[43]!==s||e[44]!==$?(z=r.jsx(he,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=z):z=e[45];let I;e[46]!==i||e[47]!==s||e[48]!==n.slug?(I=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=I):I=e[49];let O;e[50]!==a?(O=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=O):O=e[51];let B;e[52]!==I||e[53]!==O?(B=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:I,children:O}),e[52]=I,e[53]=O,e[54]=B):B=e[54];let U;e[55]!==z||e[56]!==B?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[z,B]}),e[55]=z,e[56]=B,e[57]=U):U=e[57];let H;e[58]!==M||e[59]!==D||e[60]!==U?(H=r.jsxs(Pt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:iA,children:[M,D,U]}),e[58]=M,e[59]=D,e[60]=U,e[61]=H):H=e[61];let K;return e[62]!==H||e[63]!==j?(K=r.jsx(Rt,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=K):K=e[64],K}function iA(t){return t.preventDefault()}const rA={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function oA(t){const e=F.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=re(),{label:l,title:a}=rA[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(gl,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==o?(d=o(l),e[1]=l,e[2]=o,e[3]=d):d=e[3];let h;e[4]!==o||e[5]!==a?(h=o(a),e[4]=o,e[5]=a,e[6]=h):h=e[6];let u;e[7]!==s||e[8]!==i||e[9]!==o?(u=s==="trial_exhausted"?r.jsx(he,{size:"sm",onClick:i,className:"h-7 text-xs",children:o("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=o,e[10]=u):u=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==h||e[14]!==u?(f=r.jsx(Lo,{icon:c,label:d,title:h,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:u}),e[11]=n,e[12]=d,e[13]=h,e[14]=u,e[15]=f):f=e[15],f}function lA(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),o=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:o?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const aA={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function D0(t){const e=F.c(29),s=re(),{variant:n,onDismiss:i}=t,o=n==="error";let l;e[0]!==o||e[1]!==s?(l=s(o?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=o,e[1]=s,e[2]=l):l=e[2];const a=l,c=o?pn:ko;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const v=aA[t.finishReason];return v?s(v):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const h=d;let u;e[8]!==o||e[9]!==h?(u=o?lA(h):{summary:h,rawDetails:null},e[8]=o,e[9]=h,e[10]=u):u=e[10];const{summary:f,rawDetails:m}=u;let p;e[11]!==c?(p=r.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==o||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=o?r.jsx(he,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(he,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=o,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?r.jsxs("details",{className:"group mx-4",children:[r.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[r.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m4.5 3 3 3-3 3"})}),r.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),r.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>pe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>pe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:r.jsx(on,{className:"size-3.5"})}),r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=r.jsx(Lo,{icon:p,label:a,title:f,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function Jh(){const t=F.c(73),e=re(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=di(),[h,u]=Ei(),{virtualMcpId:f,createTaskWithMessage:m}=en(),{chatMode:p,simpleModeTier:g}=jo(),{mutate:x}=Fv("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let y;t[2]!==p||t[3]!==g||t[4]!==f?(y=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=y):y=t[5];const L=y;let _;t[6]!==h.toolApprovalLevel?(_=h.toolApprovalLevel??hk(),t[6]=h.toolApprovalLevel,t[7]=_):_=t[7];const k=_,S=l.at(-1),w=S?.role==="assistant"?S.parts:[],j=w.filter(hA),N=jy(w),A=Sy(w);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ne)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const T=C;let V;t[12]!==d||t[13]!==e?(V=()=>{const le={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(le)},t[12]=d,t[13]=e,t[14]=V):V=t[14];const R=V;let P;t[15]!==L||t[16]!==k||t[17]!==c?(P=(le,ne)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ne}},L(k))},t[15]=L,t[16]=k,t[17]=c,t[18]=P):P=t[18];const M=P;let D;t[19]!==m||t[20]!==h||t[21]!==u||t[22]!==e||t[23]!==f?(D=le=>{u({...h,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=h,t[21]=u,t[22]=e,t[23]=f,t[24]=D):D=t[24];const $=D,z=uA;let I;t[25]!==L||t[26]!==c?(I=(le,ne,ae,de)=>{c({kind:"approval",approvalId:le,approved:ne,...ae?{reason:ae}:{}},L(de))},t[25]=L,t[26]=c,t[27]=I):I=t[27];const O=I,B=Ny();if(B.isCreditExhausted){let le;return t[28]!==n?(le=r.jsx(By,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:U,showWarning:H,hasApprovals:K}=B,W=j.map(dA).join("|"),Y=ky(N)?.toolCallId??"",Q=A.map(cA).join("|");let te;t[30]!==B.todos?(te=r.jsx(JT,{todos:B.todos}),t[30]=B.todos,t[31]=te):te=t[31];let ee;t[32]!==n||t[33]!==B.subscriptionErrorKind||t[34]!==v?(ee=B.subscriptionErrorKind&&r.jsx(oA,{kind:B.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=B.subscriptionErrorKind,t[34]=v,t[35]=ee):ee=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==U?(oe=U&&r.jsx(D0,{variant:"error",error:s,onDismiss:n,onFixInChat:T}),t[36]=n,t[37]=s,t[38]=T,t[39]=U,t[40]=oe):oe=t[40];let se;t[41]!==o||t[42]!==i||t[43]!==R||t[44]!==H?(se=H&&r.jsx(D0,{variant:"warning",finishReason:i,onDismiss:o,onContinue:R}),t[41]=o,t[42]=i,t[43]=R,t[44]=H,t[45]=se):se=t[45];let G;t[46]!==Q||t[47]!==O||t[48]!==K||t[49]!==a||t[50]!==A?(G=K&&r.jsx(PT,{approvals:A,isStreaming:a,onRespond:O},Q),t[46]=Q,t[47]=O,t[48]=K,t[49]=a,t[50]=A,t[51]=G):G=t[51];let X;t[52]!==B.hasPlans||t[53]!==$||t[54]!==z||t[55]!==a||t[56]!==N||t[57]!==Y?(X=B.hasPlans&&r.jsx(DT,{plans:N,isStreaming:a,onApprove:$,onDismiss:z},Y),t[52]=B.hasPlans,t[53]=$,t[54]=z,t[55]=a,t[56]=N,t[57]=Y,t[58]=X):X=t[58];let q;t[59]!==B.isWaitingForUserInput||t[60]!==M||t[61]!==a||t[62]!==W||t[63]!==j?(q=B.isWaitingForUserInput&&r.jsx(Oy,{userAskParts:j,isStreaming:a,onSubmit:M},W),t[59]=B.isWaitingForUserInput,t[60]=M,t[61]=a,t[62]=W,t[63]=j,t[64]=q):q=t[64];let Z;return t[65]!==oe||t[66]!==se||t[67]!==G||t[68]!==X||t[69]!==q||t[70]!==te||t[71]!==ee?(Z=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[te,ee,oe,se,G,X,q]}),t[65]=oe,t[66]=se,t[67]=G,t[68]=X,t[69]=q,t[70]=te,t[71]=ee,t[72]=Z):Z=t[72],Z}function cA(t){return t.approvalId}function dA(t){return t.toolCallId}function uA(){document.querySelector("[data-chat-input]")?.focus()}function hA(t){return t.type==="tool-user_ask"}Jh.Error=function(e){return r.jsx(D0,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Jh.Warning=function(e){return r.jsx(D0,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Jh.UserAskQuestion=Oy;function fA(t){const e=F.c(20),{taskId:s}=t,n=re(),i=Wb(s),o=Kk(i),l=Wk(),{stop:a,removeLocalMessage:c}=di();if(o.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let h;e[2]!==a?(h=()=>{a()},e[2]=a,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Sh,{size:14}),e[4]=u):u=e[4];let f;e[5]!==d||e[6]!==h?(f=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:h,children:u})}),e[5]=d,e[6]=h,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=r.jsx(He,{side:"top",children:r.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=r.jsxs(Ke,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,v)=>r.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[r.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:v+1}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(y=>{y&&(qk(s,b.messageId),c(b.messageId))})},children:r.jsx(Si,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],r.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[r.jsx("span",{children:n(o.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:o.length})}),g]}),o.map(x)]})}function mA(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const pA={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function gA(t){const e=F.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=re(),h=Bh(),u=new Set(h.map(xA)),f=Gk([i,n,o],u),m=f?.keyId??null,[p,g]=E.useState(m??h[0]?.id??null),x=h.some(D=>D.id===p)?p:m??h[0]?.id??null,b=x?h.find(D=>D.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",y=pA[s];let L;e[0]!==d||e[1]!==y?(L=d(y),e[0]=d,e[1]=y,e[2]=L):L=e[2];let _;e[3]!==L?(_=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=_):_=e[4];let k;e[5]!==a||e[6]!==d||e[7]!==i?(k=i&&r.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=k):k=e[8];let S;e[9]!==_||e[10]!==k?(S=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[_,k]}),e[9]=_,e[10]=k,e[11]=S):S=e[11];const w="flex-1 min-h-0",j=E.Suspense;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(kN,{}),e[12]=N):N=e[12];const A=SN,C=!0,T=mA(m?f:null,b?.providerId??"deco");let V;e[13]!==x||e[14]!==l||e[15]!==g?(V=D=>{const $=D.keyId??x??"";g($),l({keyId:$,modelId:D.modelId,title:D.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=V):V=e[16];let R;e[17]!==A||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==V?(R=r.jsx(A,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:V}),e[17]=A,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=V,e[23]=R):R=e[23];let P;e[24]!==j||e[25]!==R||e[26]!==N?(P=r.jsx("div",{className:w,children:r.jsx(j,{fallback:N,children:R})}),e[24]=j,e[25]=R,e[26]=N,e[27]=P):P=e[27];let M;return e[28]!==P||e[29]!==S?(M=r.jsxs("div",{className:v,children:[S,P]}),e[28]=P,e[29]=S,e[30]=M):M=e[30],M}function xA(t){return t.id}const bA=["fast","smart","thinking"];function zy(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const vA={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function yA(t){const e=F.c(28),{tier:s,pillIcon:n,groups:i}=t,o=re();let l;e[0]!==o?(l=zy(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=E.useState(!1);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=w=>{w.onSelect(),d(!1)},e[2]=h):h=e[2];const u=h,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=r.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Jt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=r.jsx(Ue,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(ts,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(He,{children:f}),e[12]=f,e[13]=y):y=e[13];let L;e[14]!==v||e[15]!==y?(L=r.jsxs(Ke,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=L):L=e[16];let _;if(e[17]!==i||e[18]!==o){let w;e[20]!==o?(w=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(N=>r.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[r.jsxs("button",{type:"button",role:"menuitem","aria-label":N.title,onClick:()=>u(N),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",N.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[N.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:N.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:N.title}),N.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:N.subtitle})]}),N.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(Et,{size:14,className:"text-foreground mt-0.5"})})]}),N.modelOverride&&r.jsx(LA,{label:N.title,render:N.modelOverride})]},N.key))},j.key),e[20]=o,e[21]=w):w=e[21],_=i.map(w),e[17]=i,e[18]=o,e[19]=_}else _=e[19];let k;e[22]!==_?(k=r.jsx(ss,{align:"end",className:"p-1 w-64",onOpenAutoFocus:_A,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:_})}),e[22]=_,e[23]=k):k=e[23];let S;return e[24]!==c||e[25]!==L||e[26]!==k?(S=r.jsxs(ns,{open:c,onOpenChange:d,children:[L,k]}),e[24]=c,e[25]=L,e[26]=k,e[27]=S):S=e[27],S}function _A(t){return t.preventDefault()}function LA(t){const e=F.c(38),{label:s,render:n}=t,i=re(),o=So(),[l,a]=E.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let h;e[1]!==s||e[2]!==i?(h=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=h):h=e[3];const u=l&&"opacity-100";let f;e[4]!==u?(f=ie("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(tp,{size:14}),e[6]=m):m=e[6];let p;e[7]!==h||e[8]!==f?(p=r.jsx("button",{type:"button","aria-label":h,className:f,children:m}),e[7]=h,e[8]=f,e[9]=p):p=e[9];const g=p;if(o){let L;e[10]!==g?(L=r.jsx(dv,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let _;e[12]!==s||e[13]!==i?(_=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=_):_=e[14];let k;e[15]!==_?(k=r.jsx(Vh,{className:"sr-only",children:_}),e[15]=_,e[16]=k):k=e[16];let S;e[17]!==l||e[18]!==n?(S=l&&n(d),e[17]=l,e[18]=n,e[19]=S):S=e[19];let w;e[20]!==S||e[21]!==k?(w=r.jsxs(Th,{className:"p-0 flex flex-col max-h-[95vh]",children:[k,S]}),e[20]=S,e[21]=k,e[22]=w):w=e[22];let j;return e[23]!==l||e[24]!==w||e[25]!==L?(j=r.jsxs(Ah,{open:l,onOpenChange:a,children:[L,w]}),e[23]=l,e[24]=w,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(ts,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let v;e[32]!==b?(v=r.jsx(ss,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let y;return e[34]!==l||e[35]!==x||e[36]!==v?(y=r.jsxs(ns,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=y):y=e[37],y}function l3(t){return t==="fast"?r.jsx(gl,{size:16}):t==="thinking"?r.jsx(Sv,{size:16}):r.jsx(Nr,{size:16})}function wA(t){const e=F.c(13),s=Jk();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const h=s.tiers[d];return h?h.title??h.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let o;e[3]!==i?(o=i("fast"),e[3]=i,e[4]=o):o=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==o||e[10]!==l||e[11]!==a?(c={fast:o,smart:l,thinking:a},e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function SA(){const t=F.c(22),e=re(),{simpleModeTier:s,setSimpleModeTier:n}=jo(),i=AN(),o=Bh(),l=EN(o),a=wA(l),{data:c,error:d}=Yk();let h;t[0]!==c?(h=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=h):h=t[1];const u=h,f=Qk();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==u||t[10]!==d){const y=zy(e);m="decopilot",p=bA.map(L=>{const _=a[L],k=u.tiers[L];return{key:`decopilot-${L}`,icon:l3(L),title:y[L],subtitle:_??e(vA[L]),active:s===L,onSelect:()=>n(L),modelOverride:S=>r.jsxs(r.Fragment,{children:[d&&r.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),r.jsx(gA,{tier:L,orgSlot:i.tiers[L],userSlot:k,autoSlot:l.chat[L],onClose:S,onPick:w=>f.mutate({tier:L,slot:w}),onReset:()=>f.mutate({tier:L,slot:null})},`${L}:${k?.keyId??"org"}:${k?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=f,t[9]=u,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=l3(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=r.jsx(yA,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function $p(t,e,s,n,i,o){if(!$h(e)){pe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!jN(l,e)){const c=Uv(e).parts.map(h=>o(h)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):pe.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){pe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const h=await d,u={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:h};lj(t,{from:n,to:n},u)}catch(c){console.error("Failed to process file:",c),pe.error(`Failed to load file "${s.name}"`)}}function kA(t){const e=F.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=re(),l=E.useRef(CA);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(u,f)=>{await $p(s,n,u,f,i,o)}},c=[s,n,i,o],e[0]=s,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=c):(a=e[4],c=e[5]),E.useEffect(a,c);let d,h;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const u=new Ar("fileDropHandler");s.state.plugins.find(p=>p.spec.key===u)&&s.unregisterPlugin(u);const m=new Nh({key:u,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const y=p.posAtCoords({left:g.clientX,top:g.clientY});if(!y)return!1;const L=Array.from(v);return(async()=>{let _=y.pos;for(const k of L)await l.current?.(k,_),_=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(jA);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const y of b){const L=y.getAsFile();L&&(await l.current?.(L,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(u)}},h=[s],e[6]=s,e[7]=d,e[8]=h):(d=e[7],h=e[8]),E.useEffect(d,h),null}function jA(t){return t.kind==="file"}function CA(){return Promise.resolve()}function NA(t){const e=F.c(43),{info:s,onClose:n}=t,i=re(),o=s!==null;let l;e[0]!==n?(l=C=>!C&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:r.jsx(ko,{size:18})}),e[4]=d):d=e[4];let h;e[5]!==i?(h=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=h):h=e[6];let u;e[7]!==h?(u=r.jsx($t,{className:"text-xl font-semibold tracking-tight",children:h}),e[7]=h,e[8]=u):u=e[8];const f=s?.fileName;let m;e[9]!==f?(m=r.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=r.jsxs(Dn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==u?(x=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(ms,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[u,g]})]})]}),e[16]=g,e[17]=u,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==i||e[20]!==b?(v=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==v?(y=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=y):y=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(kv,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const _=s?.accepted;let k;e[25]!==_?(k=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,r.jsx("span",{className:"capitalize",children:_})]}),e[25]=_,e[26]=k):k=e[26];let S;e[27]!==y||e[28]!==k?(S=r.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:r.jsxs("div",{className:"rounded-xl border border-border p-4",children:[y,k]})}),e[27]=y,e[28]=k,e[29]=S):S=e[29];let w;e[30]!==i?(w=i("chat.uploader.gotIt"),e[30]=i,e[31]=w):w=e[31];let j;e[32]!==n||e[33]!==w?(j=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(he,{onClick:n,children:w})}),e[32]=n,e[33]=w,e[34]=j):j=e[34];let N;e[35]!==x||e[36]!==S||e[37]!==j?(N=r.jsxs(Pt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:VA,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=N):N=e[38];let A;return e[39]!==o||e[40]!==l||e[41]!==N?(A=r.jsx(Rt,{open:o,onOpenChange:l,children:N}),e[39]=o,e[40]=l,e[41]=N,e[42]=A):A=e[42],A}function VA(t){return t.preventDefault()}function TA(){const t=F.c(3),[e,s]=E.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var Fy=aj;var AA=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],a1=AA.join(","),Uy=typeof Element>"u",Pd=Uy?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,I0=!Uy&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},M0=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),o=i===""||i==="true",l=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):M0(e.parentNode));return l},EA=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},PA=function(e,s,n){if(M0(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(a1));return s&&Pd.call(e,a1)&&i.unshift(e),i=i.filter(n),i},c1=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!M0(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=c1(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var h=Pd.call(l,a1);h&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var u=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!M0(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(u&&f){var m=c1(u===!0?l.children:u.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else o.unshift.apply(o,l.children)}}return i},Hy=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ky=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||EA(e))&&!Hy(e)?0:e.tabIndex},RA=function(e,s){var n=Ky(e);return n<0&&s&&!Hy(e)?0:n},DA=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Wy=function(e){return e.tagName==="INPUT"},IA=function(e){return Wy(e)&&e.type==="hidden"},MA=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},$A=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},OA=function(e){if(!e.name)return!0;var s=e.form||I0(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var o=$A(i,e.form);return!o||o===e},BA=function(e){return Wy(e)&&e.type==="radio"},zA=function(e){return BA(e)&&!OA(e)},FA=function(e){var s,n=e&&I0(e),i=(s=n)===null||s===void 0?void 0:s.host,o=!1;if(n&&n!==e){var l,a,c;for(o=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!o&&i;){var d,h,u;n=I0(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((h=i)!==null&&h!==void 0&&(u=h.ownerDocument)!==null&&u!==void 0&&u.contains(i))}}return o},a3=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},UA=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Pd.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Pd.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,h=I0(e);if(d&&!d.shadowRoot&&i(d)===!0)return a3(e);e.assignedSlot?e=e.assignedSlot:!d&&h!==e.ownerDocument?e=h.host:e=d}e=c}if(FA(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return a3(e);return!1},HA=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return Pd.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},KA=function(e,s){return!(s.disabled||IA(s)||UA(s,e)||MA(s)||HA(s))},c3=function(e,s){return!(zA(s)||Ky(s)<0||!KA(e,s))},WA=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},qy=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=RA(a,l),d=l?qy(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:o,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(DA).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},Gy=function(e,s){s=s||{};var n;return s.getShadowRoot?n=c1([e],s.includeContainer,{filter:c3.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:WA}):n=PA(e,s.includeContainer,c3.bind(null,s)),qy(n)};function qA(){return/apple/i.test(navigator.vendor)}const d3="data-floating-ui-focusable";function GA(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function d1(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&fk(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function Nc(t){return"composedPath"in t?t.composedPath()[0]:t.target}function t9(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function YA(t){return t.matches("html,body")}function Rd(t){return t?.ownerDocument||document}function QA(t){return t?t.hasAttribute(d3)?t:t.querySelector("["+d3+"]")||t:null}function x0(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var o;return i.parentId===e&&(!s||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...x0(t,i.id,s)])}function JA(t){return"nativeEvent"in t}var XA=typeof document<"u",ZA=function(){},Qo=XA?E.useLayoutEffect:ZA;const eE={...Cb},tE=eE.useInsertionEffect,sE=tE||(t=>t());function fa(t){const e=E.useRef(()=>{});return sE(()=>{e.current=t}),E.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const Yy=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Qy(t,e){const s=Gy(t,Yy()),n=s.length;if(n===0)return;const i=GA(Rd(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function nE(t){return Qy(Rd(t).body,1)||t}function iE(t){return Qy(Rd(t).body,-1)||t}function s9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!d1(s,n)}function rE(t){Gy(t,Yy()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function u3(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const oE="data-floating-ui-focusable",h3="active",f3="selected",lE={...Cb};let m3=!1,aE=0;const p3=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+aE++;function cE(){const[t,e]=E.useState(()=>m3?p3():void 0);return Qo(()=>{t==null&&e(p3())},[]),E.useEffect(()=>{m3=!0},[]),t}const dE=lE.useId,Op=dE||cE;function uE(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const hE=E.createContext(null),fE=E.createContext(null),Jy=()=>{var t;return((t=E.useContext(hE))==null?void 0:t.id)||null},Xy=()=>E.useContext(fE);function Bp(t){return"data-floating-ui-"+t}const mE={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},g3=E.forwardRef(function(e,s){const[n,i]=E.useState();Qo(()=>{qA()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Bp("focus-guard")]:"",style:mE};return r.jsx("span",{...e,...o})}),pE={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Zy=E.createContext(null),x3=Bp("portal");function gE(t){t===void 0&&(t={});const{id:e,root:s}=t,n=Op(),i=bE(),[o,l]=E.useState(null),a=E.useRef(null);return Qo(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),Qo(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(x3,""),c.appendChild(d),a.current=d,l(d)},[e,n]),Qo(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!vk(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const h=document.createElement("div");h.id=n,h.setAttribute(x3,""),c=d||c,c.appendChild(h),a.current=h,l(h)},[e,s,n,i]),o}function xE(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=gE({id:s,root:n}),[l,a]=E.useState(null),c=E.useRef(null),d=E.useRef(null),h=E.useRef(null),u=E.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return E.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&s9(x)&&(x.type==="focusin"?u3:rE)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,i,f]),E.useEffect(()=>{o&&(m||u3(o))},[m,o]),r.jsxs(Zy.Provider,{value:E.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:h,afterInsideRef:u,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(g3,{"data-type":"outside",ref:c,onFocus:g=>{if(s9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=iE(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:pE}),o&&En.createPortal(e,o),p&&o&&r.jsx(g3,{"data-type":"outside",ref:d,onFocus:g=>{if(s9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=nE(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const bE=()=>E.useContext(Zy),vE={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},yE={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},b3=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function _E(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:o}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:h=!1,referencePressEvent:u="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=Xy(),x=fa(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=E.useRef(!1),{escapeKey:y,outsidePress:L}=b3(m),{escapeKey:_,outsidePress:k}=b3(p),S=E.useRef(!1),w=fa(V=>{var R;if(!s||!l||!a||V.key!=="Escape"||S.current)return;const P=(R=o.current.floatingContext)==null?void 0:R.nodeId,M=g?x0(g.nodesRef.current,P):[];if(!y&&(V.stopPropagation(),M.length>0)){let D=!0;if(M.forEach($=>{var z;if((z=$.context)!=null&&z.open&&!$.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}n(!1,JA(V)?V.nativeEvent:V,"escape-key")}),j=fa(V=>{var R;const P=()=>{var M;w(V),(M=Nc(V))==null||M.removeEventListener("keydown",P)};(R=Nc(V))==null||R.addEventListener("keydown",P)}),N=fa(V=>{var R;const P=o.current.insideReactTree;o.current.insideReactTree=!1;const M=v.current;if(v.current=!1,d==="click"&&M||P||typeof b=="function"&&!b(V))return;const D=Nc(V),$="["+Bp("inert")+"]",z=Rd(i.floating).querySelectorAll($);let I=Ui(D)?D:null;for(;I&&!Qf(I);){const H=gk(I);if(Qf(H)||!Ui(H))break;I=H}if(z.length&&Ui(D)&&!YA(D)&&!d1(D,i.floating)&&Array.from(z).every(H=>!d1(I,H)))return;if(xk(D)&&T){const H=Qf(D),K=bk(D),W=/auto|scroll/,Y=H||W.test(K.overflowX),Q=H||W.test(K.overflowY),te=Y&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,ee=Q&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,oe=K.direction==="rtl",se=ee&&(oe?V.offsetX<=D.offsetWidth-D.clientWidth:V.offsetX>D.clientWidth),G=te&&V.offsetY>D.clientHeight;if(se||G)return}const O=(R=o.current.floatingContext)==null?void 0:R.nodeId,B=g&&x0(g.nodesRef.current,O).some(H=>{var K;return t9(V,(K=H.context)==null?void 0:K.elements.floating)});if(t9(V,i.floating)||t9(V,i.domReference)||B)return;const U=g?x0(g.nodesRef.current,O):[];if(U.length>0){let H=!0;if(U.forEach(K=>{var W;if((W=K.context)!=null&&W.open&&!K.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,V,"outside-press")}),A=fa(V=>{var R;const P=()=>{var M;N(V),(M=Nc(V))==null||M.removeEventListener(d,P)};(R=Nc(V))==null||R.addEventListener(d,P)});E.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=y,o.current.__outsidePressBubbles=L;let V=-1;function R(z){n(!1,z,"ancestor-scroll")}function P(){window.clearTimeout(V),S.current=!0}function M(){V=window.setTimeout(()=>{S.current=!1},pk()?5:0)}const D=Rd(i.floating);a&&(D.addEventListener("keydown",_?j:w,_),D.addEventListener("compositionstart",P),D.addEventListener("compositionend",M)),b&&D.addEventListener(d,k?A:N,k);let $=[];return f&&(Ui(i.domReference)&&($=Yf(i.domReference)),Ui(i.floating)&&($=$.concat(Yf(i.floating))),!Ui(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(Yf(i.reference.contextElement)))),$=$.filter(z=>{var I;return z!==((I=D.defaultView)==null?void 0:I.visualViewport)}),$.forEach(z=>{z.addEventListener("scroll",R,{passive:!0})}),()=>{a&&(D.removeEventListener("keydown",_?j:w,_),D.removeEventListener("compositionstart",P),D.removeEventListener("compositionend",M)),b&&D.removeEventListener(d,k?A:N,k),$.forEach(z=>{z.removeEventListener("scroll",R)}),window.clearTimeout(V)}},[o,i,a,b,d,s,n,f,l,y,L,w,_,j,N,k,A]),E.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const C=E.useMemo(()=>({onKeyDown:w,...h&&{[vE[u]]:V=>{n(!1,V.nativeEvent,"reference-press")},...u!=="click"&&{onClick(V){n(!1,V.nativeEvent,"reference-press")}}}}),[w,n,h,u]),T=E.useMemo(()=>{function V(R){R.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:V,onMouseUp:V,[yE[d]]:()=>{o.current.insideReactTree=!0}}},[w,d,o]);return E.useMemo(()=>l?{reference:C,floating:T}:{},[l,C,T])}function LE(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=Op(),o=E.useRef({}),[l]=E.useState(()=>uE()),a=Jy()!=null,[c,d]=E.useState(n.reference),h=fa((m,p,g)=>{o.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),u=E.useMemo(()=>({setPositionReference:d}),[]),f=E.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return E.useMemo(()=>({dataRef:o,open:e,onOpenChange:h,elements:f,events:l,floatingId:i,refs:u}),[e,h,f,l,i,u])}function wE(t){t===void 0&&(t={});const{nodeId:e}=t,s=LE({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=E.useState(null),[a,c]=E.useState(null),h=i?.domReference||o,u=E.useRef(null),f=Xy();Qo(()=>{h&&(u.current=h)},[h]);const m=mk({...t,elements:{...i,...a&&{reference:a}}}),p=E.useCallback(y=>{const L=Ui(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),getClientRects:()=>y.getClientRects(),contextElement:y}:y;c(L),m.refs.setReference(L)},[m.refs]),g=E.useCallback(y=>{(Ui(y)||y===null)&&(u.current=y,l(y)),(Ui(m.refs.reference.current)||m.refs.reference.current===null||y!==null&&!Ui(y))&&m.refs.setReference(y)},[m.refs]),x=E.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:u}),[m.refs,g,p]),b=E.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),v=E.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return Qo(()=>{n.dataRef.current.floatingContext=v;const y=f?.nodesRef.current.find(L=>L.id===e);y&&(y.context=v)}),E.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function n9(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[h3]:l,[f3]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[oE]:""},...o,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,h]=c;if(!(i&&[h3,f3].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof h=="function"){var u;(u=n.get(d))==null||u.push(h),l[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=h}),l),{})}}function SE(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=E.useCallback(a=>n9(a,t,"reference"),e),o=E.useCallback(a=>n9(a,t,"floating"),s),l=E.useCallback(a=>n9(a,t,"item"),n);return E.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const kE=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function jE(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:o,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=Op(),h=((s=o.domReference)==null?void 0:s.id)||d,u=E.useMemo(()=>{var v;return((v=QA(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=kE.get(c))!=null?n:c,p=Jy()!=null,g=E.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?u:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?u:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:h},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,u,p,i,h,c]),x=E.useMemo(()=>{const v={id:u,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":h}}},[f,u,h,c]),b=E.useCallback(v=>{let{active:y,selected:L}=v;const _={role:"option",...y&&{id:u+"-fui-option"}};switch(c){case"select":case"combobox":return{..._,"aria-selected":L}}return{}},[u,c]);return E.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function CE(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=uj(s),h=new RegExp(`\\s${d}$`),u=l?"^":"",f=i?"":d,m=c?new RegExp(`${u}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),v=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!v)return null;const y=g+x.index;let L=y+x[0].length;return c&&h.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),y<a.pos&&L>=a.pos?{range:{from:y,to:L},query:x[0].slice(s.length),text:x[0]}:null}var NE=new Ar("suggestion");function VE({pluginKey:t=NE,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:h="is-empty",command:u=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=CE,shouldShow:x}){let b;const v=m?.(),y=()=>{const S=e.state.selection.$anchor.pos,w=e.view.coordsAtPos(S),{top:j,right:N,bottom:A,left:C}=w;try{return new DOMRect(C,j,N-C,A-j)}catch{return null}},L=(S,w)=>w?()=>{const j=t.getState(e.state),N=j?.decorationId,A=S.dom.querySelector(`[data-decoration-id="${N}"]`);return A?.getBoundingClientRect()||null}:y;function _(S,w){var j;try{const A=t.getState(S.state),C=A?.decorationId?S.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`):null,T={editor:e,range:A?.range||{from:0,to:0},query:A?.query||null,text:A?.text||null,items:[],command:V=>u({editor:e,range:A?.range||{from:0,to:0},props:V}),decorationNode:C,clientRect:L(S,C)};(j=v?.onExit)==null||j.call(v,T)}catch{}const N=S.state.tr.setMeta(w,{exit:!0});S.dispatch(N)}const k=new Nh({key:t,view(){return{update:async(S,w)=>{var j,N,A,C,T,V,R;const P=(j=this.key)==null?void 0:j.getState(w),M=(N=this.key)==null?void 0:N.getState(S.state),D=P.active&&M.active&&P.range.from!==M.range.from,$=!P.active&&M.active,z=P.active&&!M.active,I=!$&&!z&&P.query!==M.query,O=$||D&&I,B=I||D,U=z||D&&I;if(!O&&!B&&!U)return;const H=U&&!O?P:M,K=S.dom.querySelector(`[data-decoration-id="${H.decorationId}"]`);b={editor:e,range:H.range,query:H.query,text:H.text,items:[],command:W=>u({editor:e,range:H.range,props:W}),decorationNode:K,clientRect:L(S,K)},O&&((A=v?.onBeforeStart)==null||A.call(v,b)),B&&((C=v?.onBeforeUpdate)==null||C.call(v,b)),(B||O)&&(b.items=await f({editor:e,query:H.query})),U&&((T=v?.onExit)==null||T.call(v,b)),B&&((V=v?.onUpdate)==null||V.call(v,b)),O&&((R=v?.onStart)==null||R.call(v,b))},destroy:()=>{var S;b&&((S=v?.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,w,j,N){const{isEditable:A}=e,{composing:C}=e.view,{selection:T}=S,{empty:V,from:R}=T,P={...w},M=S.getMeta(t);if(M&&M.exit)return P.active=!1,P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null,P;if(P.composing=C,A&&(V||e.view.composing)){(R<w.range.from||R>w.range.to)&&!C&&!w.composing&&(P.active=!1);const D=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:T.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;D&&p({editor:e,state:N,range:D.range,isActive:w.active})&&(!x||x({editor:e,range:D.range,query:D.query,text:D.text,transaction:S}))?(P.active=!0,P.decorationId=w.decorationId?w.decorationId:$,P.range=D.range,P.query=D.query,P.text=D.text):P.active=!1}else P.active=!1;return P.active||(P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null),P}},props:{handleKeyDown(S,w){var j,N,A,C;const{active:T,range:V}=k.getState(S.state);if(!T)return!1;if(w.key==="Escape"||w.key==="Esc"){const P=k.getState(S.state),M=(j=b?.decorationNode)!=null?j:null,D=M??(P?.decorationId?S.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`):null);if(((N=v?.onKeyDown)==null?void 0:N.call(v,{view:S,event:w,range:P.range}))||!1)return!0;const z={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:I=>u({editor:e,range:P.range,props:I}),decorationNode:D,clientRect:D?()=>D.getBoundingClientRect()||null:null};return(A=v?.onExit)==null||A.call(v,z),_(S,t),!0}return((C=v?.onKeyDown)==null?void 0:C.call(v,{view:S,event:w,range:V}))||!1},decorations(S){const{active:w,range:j,decorationId:N,query:A}=k.getState(S);if(!w)return null;const C=!A?.length,T=[c];return C&&T.push(h),cj.create(S.doc,[dj.inline(j.from,j.to,{nodeName:a,class:T.join(" "),"data-decoration-id":N,"data-decoration-content":d})])}}});return k}function TE(t){const e=F.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=E.useState(0),d=E.useRef(i),h=E.useRef(a),u=E.useRef(o),f=E.useRef(l),m=E.useDeferredValue(n);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{c(0)},e[0]=p):p=e[0];let g;e[1]!==m?(g=[m],e[1]=m,e[2]=g):g=e[2],E.useEffect(p,g);let x,b;e[3]!==i.length||e[4]!==a?(x=()=>{a>=i.length&&i.length>0&&c(0)},b=[i.length,a],e[3]=i.length,e[4]=a,e[5]=x,e[6]=b):(x=e[5],b=e[6]),E.useEffect(x,b);let v,y;e[7]!==i?(v=()=>{d.current=i},y=[i],e[7]=i,e[8]=v,e[9]=y):(v=e[8],y=e[9]),E.useEffect(v,y);let L,_;e[10]!==a?(L=()=>{h.current=a},_=[a],e[10]=a,e[11]=L,e[12]=_):(L=e[11],_=e[12]),E.useEffect(L,_);let k,S;e[13]!==o?(S=()=>{u.current=o},k=[o],e[13]=o,e[14]=k,e[15]=S):(k=e[14],S=e[15]),E.useEffect(S,k);let w,j;e[16]!==l?(w=()=>{f.current=l},j=[l],e[16]=l,e[17]=w,e[18]=j):(w=e[17],j=e[18]),E.useEffect(w,j);let N,A;e[19]!==s?(N=()=>{if(s?.isDestroyed)return;let V;try{V=s.view.dom}catch{return}if(!V)return;const R=M=>{const D=d.current;if(!D.length)return!1;const $=()=>c(I=>(I+1)%D.length),z=()=>c(I=>(I-1+D.length)%D.length);switch(M.key){case"ArrowUp":return M.preventDefault(),z(),!0;case"ArrowDown":return M.preventDefault(),$(),!0;case"Tab":return M.preventDefault(),M.shiftKey?z():$(),!0;case"Home":return M.preventDefault(),c(0),!0;case"End":return M.preventDefault(),c(D.length-1),!0;case"Enter":{if(M.isComposing)return!1;M.preventDefault();const I=h.current;return I!==-1&&D[I]&&u.current?.(D[I],I),!0}case"Escape":return M.preventDefault(),f.current?.(),!0;default:return!1}},P=M=>{R(M)};return V.addEventListener("keydown",P,!0),()=>{V?.removeEventListener("keydown",P,!0)}},A=[s],e[19]=s,e[20]=N,e[21]=A):(N=e[20],A=e[21]),E.useEffect(N,A);const C=i.length?a:void 0;let T;return e[22]!==C?(T={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=T):T=e[23],T}function AE(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const e6=E.createContext(void 0);function t6(){const t=E.useContext(e6);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function EE(t){const e=F.c(16),{editor:s,char:n,pluginKey:i,allow:o,onOpenChange:l}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[c,d]=E.useReducer(AE,a);let h;e[1]!==l?(h=g=>{l?.(g)},e[1]=l,e[2]=h):h=e[2];const u=E.useEffectEvent(h);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==u||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof Ar?i:new Ar(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=VE({pluginKey:g,editor:s,char:n,allow(v){const y=s.state.doc.resolve(v.range.from);for(let L=y.depth;L>0;L--)if(y.node(L).type.name==="image")return!1;return!(o&&!o(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),u(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),u(!1)}}),items:PE});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=u,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==o||e[11]!==s||e[12]!==i?(m=[s,i,n,d,o],e[9]=n,e[10]=o,e[11]=s,e[12]=i,e[13]=m):m=e[13],E.useEffect(f,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function PE(){return[]}function RE({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=t6(),l=E.useDeferredValue(i.query),{data:a}=Lh({queryKey:it.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(u,f)=>{if(!(i.selectedItem!==null||!i.range)){o({type:"SET_SELECTED_ITEM",payload:u});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(x.to+=1),await n({range:x,item:u})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:h}=TE({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:h,close:c,onSelect:d}}function DE({children:t}){const{state:e,dispatch:s}=t6(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=wE({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[yk(10),_k(),Lk()],whileElementsMounted:wk}),d=_E(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),h=jE(c,{role:"listbox"}),{getFloatingProps:u}=SE([d,h]);return n?r.jsx(xE,{children:r.jsx("div",{ref:l.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const IE=t=>{const e=F.c(29),{item:s,isSelected:n,onSelect:i,isLoading:o,ref:l}=t;let a;if(e[0]!==s){const k=Ji(s._meta);a=s.title||Hm(s.name,k),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,h=s.icon,u=n&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==u||e[3]!==f?(m=ie("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",u,f),e[2]=u,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==h||e[6]!==c?(p=h!==void 0&&r.jsx(yo,{icon:h,name:c,size:"xs",className:"mr-2"}),e[5]=h,e[6]=c,e[7]=p):p=e[7];let g;e[8]!==c?(g=r.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),e[8]=c,e[9]=g):g=e[9];let x;e[10]!==o?(x=o&&r.jsx(Cd,{size:"xs"}),e[10]=o,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==d?(v=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let y;e[17]!==b||e[18]!==v?(y=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=y):y=e[19];let L;e[20]!==s.drillable?(L=s.drillable&&r.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=L):L=e[21];let _;return e[22]!==i||e[23]!==l||e[24]!==y||e[25]!==L||e[26]!==m||e[27]!==p?(_=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,y,L]}),e[22]=i,e[23]=l,e[24]=y,e[25]=L,e[26]=m,e[27]=p,e[28]=_):_=e[28],_},ME=t=>{const e=F.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=re();let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:o},e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:h,selectedItem:u}=RE(a);if(!c.length){let g;e[5]!==l?(g=l("chat.mention.noItemsFound"),e[5]=l,e[6]=g):g=e[6];let x;return e[7]!==g?(x=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:g}),e[7]=g,e[8]=x):x=e[8],x}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=f):f=e[9];let m;if(e[10]!==h||e[11]!==c||e[12]!==d||e[13]!==u?.name){let g;e[15]!==h||e[16]!==d||e[17]!==u?.name?(g=(x,b)=>r.jsx(IE,{item:x,isSelected:b===d,ref:b===d?BE:void 0,onSelect:()=>h(x,b),isLoading:u?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=h,e[16]=d,e[17]=u?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=h,e[11]=c,e[12]=d,e[13]=u?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:r.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function $E(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(OE)}),t[0]=e):e=t[0],e}function OE(t,e){return r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[r.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),r.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function s6(t){const e=F.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let h;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(h={editor:s,char:n,pluginKey:i,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=i,e[5]=h):h=e[5];const{state:u,dispatch:f}=EE(h);let m;e[6]!==f||e[7]!==u?(m={state:u,dispatch:f},e[6]=f,e[7]=u,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx($E,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(DE,{children:r.jsx(E.Suspense,{fallback:p,children:r.jsx(ME,{editor:s,queryKey:o,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=o,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=r.jsx(e6.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function BE(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const zE=t=>{const e=F.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=re(),l=Ls(),{org:a}=We(),c=Qd();let d;e[0]!==c?(d=vp(c),e[0]=c,e[1]=d):d=e[1];const h=d;let u;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(u={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=u):u=e[5];const f=Qt(u);let m;e[6]!==a.id||e[7]!==n?(m=it.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=E.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=E.useEffectEvent(b),y=E.useRef(null),L=E.useRef(!1),_=n??"default";let k;e[11]!==g||e[12]!==a.id||e[13]!==_?(k=["at-mention",a.id,_,g],e[11]=g,e[12]=a.id,e[13]=_,e[14]=k):k=e[14];const S=k;let w;e[15]!==o?(w=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=w):w=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let N;e[19]!==w||e[20]!==j?(N={name:"agents",title:w,description:j,kind:"category",drillable:!0},e[19]=w,e[20]=j,e[21]=N):N=e[21];let A;e[22]!==o?(A=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=A):A=e[23];let C;e[24]!==o?(C=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=C):C=e[25];let T;e[26]!==A||e[27]!==C?(T={name:"resources",title:A,description:C,kind:"category",drillable:!0},e[26]=A,e[27]=C,e[28]=T):T=e[28];let V;e[29]!==T||e[30]!==N?(V=[N,T],e[29]=T,e[30]=N,e[31]=V):V=e[31];const R=V;let P;e[32]!==f||e[33]!==s||e[34]!==o?(P=async B=>{const{item:U,range:H}=B;if(st("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(L.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){Pa(s,H,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&f){try{const K=await Nb(f,U.uri);Pa(s,H,{id:U.uri,name:U.uri,metadata:K.contents,char:"@"})}catch(K){console.error("[at-mention] Failed to fetch resource:",K),pe.error(o("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=o,e[35]=P):P=e[35];const M=P;let D;e[36]!==c||e[37]!==R||e[38]!==f||e[39]!==h||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(D=async B=>{const{query:U}=B,H=v();if(H==="categories"){if(!U.trim())return R;const Y=U.toLowerCase(),Q=c.filter(ee=>ee.status==="active"&&(!ee.id||!A0(ee.id))&&!h.has(ee.id)&&ee.id!==n&&(ee.title.toLowerCase().includes(Y)||ee.description?.toLowerCase().includes(Y))).map(FE),te=await(async()=>{if(!f)return[];let ee=l.getQueryData(p);return ee||(ee=await l.fetchQuery({queryKey:p,queryFn:()=>ld(f),staleTime:6e4})),(ee?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(Y)||oe.name?.toLowerCase().includes(Y)||oe.description?.toLowerCase().includes(Y)).map(UE)})();return[...Q,...te]}if(H==="agents"){let Y=c.filter(Q=>Q.status==="active"&&(!Q.id||!A0(Q.id))&&!h.has(Q.id)&&Q.id!==n);if(U.trim()){const Q=U.toLowerCase();Y=Y.filter(te=>te.title.toLowerCase().includes(Q)||te.description?.toLowerCase().includes(Q))}return Y.map(HE)}if(!f)return[];let K=l.getQueryData(p);K?l.fetchQuery({queryKey:p,queryFn:()=>ld(f),staleTime:6e4}).catch(KE):K=await l.fetchQuery({queryKey:p,queryFn:()=>ld(f),staleTime:6e4});let W=K?.resources??[];if(U.trim()){const Y=U.toLowerCase();W=W.filter(Q=>Q.uri.toLowerCase().includes(Y)||Q.name?.toLowerCase().includes(Y)||Q.description?.toLowerCase().includes(Y))}return W.map(WE)},e[36]=c,e[37]=R,e[38]=f,e[39]=h,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=D):D=e[44];const $=D;let z;e[45]!==i?(z=B=>{if(i&&(i.current=B),B)y.current=Date.now(),L.current=!1,st("chat_picker_opened",{picker:"@"});else{const U=y.current;st("chat_picker_closed",{picker:"@",outcome:L.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),y.current=null,x("categories")}},e[45]=i,e[46]=z):z=e[46];const I=z;let O;return e[47]!==s||e[48]!==$||e[49]!==M||e[50]!==I||e[51]!==S?(O=r.jsx(s6,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:S,queryFn:$,onSelect:M,onOpenChange:I}),e[47]=s,e[48]=$,e[49]=M,e[50]=I,e[51]=S,e[52]=O):O=e[52],O};function FE(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function UE(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function HE(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function KE(){}function WE(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function v3(t,e,s,n,i,o,l){try{const a=await Gd(s,n,o);Pa(t,e,{id:n,name:ec(n,i),metadata:a.messages,char:"/",kind:"prompt",args:o})}catch(a){console.error("[slash] Failed to fetch prompt:",a),pe.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function qE(t,e,s,n,i){try{const o=await Nb(s,n);Pa(t,e,{id:n,name:n,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),pe.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function GE(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await DN(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};Pa(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),pe.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const YE=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=re(),i=Ls(),{org:o}=We(),l=Qt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=it.virtualMcpPrompts(e,o.id),c=it.virtualMcpResources(e,o.id),d=it.slashSkills(o.id),h=["slash-mention",o.id,e??"default"],[u,f]=E.useState(null),[m,p]=E.useState(null),g=hj(t);g&&(g.onEditChip=async S=>{if(l)try{const j=(await y3(i,a,l)).find(N=>N.name===S.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...S,prompt:j})}catch(w){console.error("[slash] Failed to load prompt for editing:",w),pe.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=E.useRef(null),b=E.useRef(!1),v=async({item:S,range:w})=>{if(st("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),b.current=!0,!!l)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){f({range:w,item:S});return}const j=Ji(S._meta);await v3(t,w,l,S.name,j,void 0,{t:n})}else S.kind==="skill"?S.skill&&await GE(t,w,o.slug,S.skill,{t:n}):S.uri&&await qE(t,w,l,S.uri,{t:n})},y=async S=>{if(!u||!l)return;const{range:w,item:j}=u,N=Ji(j._meta);await v3(t,w,l,j.name,N,S,{t:n}),f(null)},L=async S=>{if(!(!m||!l)){if(!fj(t,m.pos,m.promptId)){pe.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const w=await Gd(l,m.promptId,S),j=Ji(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,Ch({id:m.promptId,name:ec(m.promptId,j),metadata:w.messages,char:"/",kind:"prompt",args:S})).run(),st("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(w){console.error("[slash] Failed to update prompt:",w),pe.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},_=async S=>{const{query:w}=S;if(!l)return[];const[j,N,A]=await Promise.all([y3(i,a,l),JE(i,c,l),QE(i,d,o.slug)]),C=w.trim().toLowerCase(),T=(j??[]).filter(P=>!C||P.name.toLowerCase().includes(C)||P.title?.toLowerCase().includes(C)||P.description?.toLowerCase().includes(C)).map(P=>({name:P.name,title:P.title,description:P.description,kind:"prompt",arguments:P.arguments,_meta:P._meta})),V=(N??[]).filter(P=>!C||P.uri.toLowerCase().includes(C)||P.name?.toLowerCase().includes(C)||P.description?.toLowerCase().includes(C)).map(P=>({name:P.name??P.uri,title:P.name,description:P.description,kind:"resource",uri:P.uri})),R=(A??[]).filter(P=>!C||P.name.toLowerCase().includes(C)||P.id.toLowerCase().includes(C)||P.description?.toLowerCase().includes(C)).map(P=>({name:P.name,title:P.name,description:P.description??void 0,kind:"skill",skill:P}));return[...T,...V,...R]},k=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return r.jsxs(r.Fragment,{children:[r.jsx(s6,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:h,queryFn:_,onSelect:v,onOpenChange:S=>{if(s&&(s.current=S),S)x.current=Date.now(),b.current=!1,st("chat_picker_opened",{picker:"/"});else{const w=x.current;st("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:w?Date.now()-w:null}),x.current=null}}}),r.jsx(jd,{prompt:k,setPrompt:()=>f(null),onSubmit:y}),r.jsx(jd,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:L,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function y3(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>s1(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>s1(s),staleTime:6e4}),n?.prompts??[]}async function QE(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>IN(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function JE(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>ld(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>ld(s),staleTime:6e4}),n?.resources??[]}function XE(t){return[Wm.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Fy.configure({placeholder:()=>t.current??"Ask anything, / for prompts & skills, @ for agents & resources...",showOnlyWhenEditable:!1}),pj,gj]}function n6({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=E.useRef(o),d=E.useRef(e),h=E.useRef(n),u=E.useRef(i),f=Km({extensions:XE(u),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&h.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return E.useEffect(()=>{f?.setEditable(!s)},[f,s]),E.useEffect(()=>{c.current=o},[o]),E.useEffect(()=>{d.current=e},[e]),E.useEffect(()=>{h.current=n},[n]),E.useEffect(()=>{u.current=i},[i]),E.useEffect(()=>{if(!f||f.isDestroyed)return;const m=JSON.stringify(f.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&f.commands.setContent(t||{type:"doc",content:[]})},[f,t]),r.jsx(mj.Provider,{value:{editor:f},children:a})}function i6(t){const e=F.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,h=s===void 0?!1:s,u=i===void 0?!1:i,{editor:f}=qd();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const N=f.state.doc.textContent.trim()==="";f.commands.focus("end"),N||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,N)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),N)){f.commands.focus("end");const A=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:A?" "+N:N})}},restoreContent:j=>{f&&f.commands.setContent(j||{type:"doc",content:[]})}}),p=[f],e[0]=f,e[1]=m,e[2]=p):(m=e[1],p=e[2]),E.useImperativeHandle(c??null,m,p),!f)return null;const g=h&&"cursor-not-allowed opacity-70",x=h&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=ie("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let v;e[7]!==f||e[8]!==b?(v=r.jsx(qm,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const y=n??null;let L;e[10]!==f||e[11]!==a||e[12]!==y?(L=r.jsx(E.Suspense,{fallback:null,children:r.jsx(YE,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=y,e[13]=L):L=e[13];const _=n??null;let k;e[14]!==f||e[15]!==a||e[16]!==_?(k=r.jsx(E.Suspense,{fallback:null,children:r.jsx(zE,{editor:f,virtualMcpId:_,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=_,e[17]=k):k=e[17];let S;e[18]!==h||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==u?(S=u&&o&&!h?r.jsx(kA,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=h,e[19]=f,e[20]=l,e[21]=o,e[22]=u,e[23]=S):S=e[23];let w;return e[24]!==L||e[25]!==k||e[26]!==S||e[27]!==v?(w=r.jsxs(r.Fragment,{children:[v,L,k,S]}),e[24]=L,e[25]=k,e[26]=S,e[27]=v,e[28]=w):w=e[28],w}function r6(t){const e=F.c(3),[s]=Ei();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&QN(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const ZE={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},eP=lC.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),tP=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function sP(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1.5",children:tP.map(nP)}),t[0]=e):e=t[0],e}function nP(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function iP({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=re(),[a,c]=E.useState(!1),d=r6(ZE),{org:h}=We(),{editor:u}=qd(),f=E.useRef(null),m=$h(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async W=>{const Y=W.target.files;if(!Y||Y.length===0||!u)return;const Q=Array.from(Y);try{let te=u.state.selection.from;for(const ee of Q)await $p(u,n??null,ee,te,o,l),te=u.state.selection.to}finally{f.current&&(f.current.value="")}},x=Qt({connectionId:s,orgId:h.id,orgSlug:h.slug}),b=it.virtualMcpPrompts(s,h.id),{data:v,isLoading:y}=Vt({queryKey:b,queryFn:()=>s1(x),staleTime:6e4,enabled:a&&!!x}),L=v?.prompts??[],[_,k]=E.useState(null),{chatMode:S,setChatMode:w}=jo(),[j,N]=Ei(),A=Ho.find(W=>W.value===j.toolApprovalLevel)??Ho[0],C=l(A.shortKey),T=W=>{const Y=Ho.find(Q=>Q.value===W);if(Y){if(Y.value===j.toolApprovalLevel){c(!1);return}d(),st("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:Y.value,source:"tools_popover"}),N({...j,toolApprovalLevel:Y.value}),c(!1)}},V=S==="plan",R=()=>{d();const W=V?"default":"plan";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},P=()=>{e(),c(!1)},M=async(W,Y)=>{if(!u||!x)return;const Q=Ji(W._meta),te={from:u.state.selection.from,to:u.state.selection.to};try{const ee=await Gd(x,W.name,Y);Pa(u,te,{id:W.name,name:ec(W.name,Q),metadata:ee.messages,char:"/",kind:"prompt",args:Y})}catch{pe.error(l("chat.toolsPopover.failedLoadPrompt"))}},D=async W=>{c(!1);const Y=!!(W.arguments&&W.arguments.length>0);if(st("chat_prompt_inserted",{prompt_name:W.name,with_arguments:Y}),Y){k(W);return}await M(W)},$=async W=>{_&&(await M(_,W),k(null))},z=()=>{d();const W=S==="gen-image"?"default":"gen-image";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},I=()=>{d();const W=S==="web-search"?"default":"web-search";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},O=()=>{d();const W=S==="deep-research"?"default":"deep-research";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},B=S==="gen-image",U=S==="web-search",H=S==="deep-research",K=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:CN(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[K,r.jsxs(qt,{open:a,onOpenChange:W=>{W&&!a&&st("chat_tools_popover_opened",{chat_mode:S}),c(W)},children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[r.jsx(jv,{size:14}),r.jsx("span",{className:ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:l("chat.toolsPopover.tools")})]})}),r.jsxs(Yt,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(et,{onClick:p,disabled:i,children:[r.jsx(Dt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsxs(et,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[r.jsx(Dt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(He,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(et,{onClick:R,className:ie(V&&"text-special"),children:[r.jsx(Ra,{size:16,className:ie(V&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:ie("text-xs text-muted-foreground",V&&"text-special font-medium"),children:eP})]}),r.jsxs(et,{onClick:z,className:ie(B&&"text-special"),children:[r.jsx(wi,{size:16,className:ie(B&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),B&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(et,{onClick:I,className:ie(U&&"text-special"),children:[r.jsx(Er,{size:16,className:ie(U&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(et,{onClick:O,className:ie(H&&"text-special"),children:[r.jsx(Cv,{size:16,className:ie(H&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),H&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Wi,{children:[r.jsxs(qi,{className:"gap-2",children:[r.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.prompts")})]}),r.jsx(Gi,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:y?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(ut,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):L.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):L.map(W=>r.jsxs(et,{onClick:()=>D(W),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||Hm(W.name,Ji(W._meta))}),W.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),r.jsxs(Wi,{children:[r.jsxs(qi,{className:"gap-2",children:[r.jsx(Ih,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Gi,{className:"w-48 p-1.5",children:r.jsx(Td,{value:j.toolApprovalLevel,onValueChange:T,children:Ho.map(W=>r.jsx(Zi,{value:W.value,children:l(W.labelKey)},W.value))})})]}),r.jsxs(et,{onClick:P,children:[r.jsx(Zm,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(E.Suspense,{children:r.jsx(sP,{})})]})]})]}),r.jsx(jd,{prompt:_,setPrompt:k,onSubmit:$})]})}const rP=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function oP(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1",children:rP.map(lP)}),t[0]=e):e=t[0],e}function lP(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function aP(t){const e=F.c(10),{onClick:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("chat.connectionsBanner.description"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:o}),e[3]=o,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(oP,{}),c=r.jsx(gn,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=a,e[6]=c):(a=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==l?(d=r.jsxs("button",{type:"button",onClick:s,className:i,children:[l,a,c]}),e[7]=s,e[8]=l,e[9]=d):d=e[9],d}const Gc=48;function cP(){const t=F.c(9),[e,s]=E.useState("idle"),[n,i]=E.useState(""),[o,l]=E.useState(""),[a,c]=E.useState(hP),d=E.useRef(null),h=E.useRef(null),u=E.useRef(null),f=E.useRef(null),m=E.useRef(0),p=E.useRef(!1),g=E.useRef(""),x=E.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),h.current?.close().catch(uP),f.current?.getTracks().forEach(dP),u.current=null,h.current=null,f.current=null},t[0]=v):v=t[0];const y=v;let L;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const A=C=>{f.current=C;const T=new AudioContext;h.current=T;const V=T.createMediaStreamSource(C),R=T.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,V.connect(R),u.current=R;const P=new Uint8Array(R.frequencyBinCount),M=()=>{if(!u.current)return;u.current.getByteFrequencyData(P);const D=[];for(let $=0;$<Gc;$++){const z=Math.floor($/Gc*P.length);D.push(Math.max(.04,(P[z]??0)/255))}c(D),m.current=requestAnimationFrame(M)};M()};L=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),A(T);const V=new C;d.current=V,V.interimResults=!0,V.continuous=!0,V.lang=navigator.language||"en-US",V.onresult=R=>{let P="",M="";for(let D=R.resultIndex;D<R.results.length;D++){const $=R.results[D],z=$?.[0]?.transcript??"";$?.isFinal?M=M+z:P=P+z}M&&(g.current=g.current+M,i(g.current)),x.current=P,l(P)},V.onend=()=>{if(p.current)try{V.start()}catch{}};try{V.start()}catch{return p.current=!1,d.current=null,y(),s("idle"),"idle"}return"recording"},t[1]=L}else L=t[1];const _=L;let k;t[2]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.stop(),y(),s("idle"),c(Array(Gc).fill(.05)),l("");const A=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",A},t[2]=k):k=t[2];const S=k;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.abort(),y(),s("idle"),i(""),l(""),c(Array(Gc).fill(.05)),g.current="",x.current=""},t[3]=w):w=t[3];const j=w;let N;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(N={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:_,stopRecording:S,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=N):N=t[8],N}function dP(t){return t.stop()}function uP(){}function hP(){return Array(Gc).fill(.05)}function fP(t){const e=F.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(mP),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=i):i=e[3],i}function mP(t,e){return r.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function pP(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function Vu(t){const e=F.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??r.jsx(Wd,{size:14,className:"shrink-0"}),e[0]=n,e[1]=i):i=e[1];const o=s??"";let l;e[2]!==o?(l=r.jsx("span",{className:"text-sm",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function gP(t,e,s){const n=F.c(7),{editor:i}=qd(),o=re(),[l,a]=E.useState(!1),c=E.useRef(0);let d,h;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(d=()=>{const u=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,a(!0))},f=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&a(!1)},m=xP,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!$h(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=i.state.selection.from;for(const y of b)await $p(i,t,y,v,e,o),v=i.state.selection.to})()};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},h=[i,t,e,o,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=o,n[5]=d,n[6]=h):(d=n[5],h=n[6]),E.useEffect(d,h),l}function xP(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function bP(t){const e=F.c(14),{selectedModel:s}=t,n=re();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=Uv(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Qn,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let h;e[6]!==n?(h=u=>n(u),e[6]=n,e[7]=h):h=e[7],o=n("chat.input.dropFilesHere",{fileTypes:d.map(h).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[8]!==i||e[9]!==o?(a=r.jsx("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function vP(){const t=F.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Wd,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs(r.Fragment,{children:[s,r.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function yP(t){const e=F.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=gP(s,n,i);let l;e[0]!==s?(l=$h(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o?"opacity-100":"opacity-0 pointer-events-none",d=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let h;e[2]!==c||e[3]!==d?(h=ie("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==s||e[6]!==a?(u=a?r.jsx(bP,{selectedModel:s}):r.jsx(vP,{}),e[5]=s,e[6]=a,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=r.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function Tu(t){const e=F.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=ie("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",o),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",l),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=r.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(_s,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=h):h=e[7];let u;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(u=r.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,h]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=u):u=e[13],u}function _P(){const t=F.c(6),e=Ot(),{org:s,locator:n}=We(),{create:i}=Yd();let o;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(o=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),h=c?.id??tc(s.id).id;bv(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:h})}catch{}const u={virtualmcpid:h,autosend:dC};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:u})},t[0]=i,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=o):o=t[5],o}function LP({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=re(),n=Um(),i=Co(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",h=d||mT,u=_P(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:y,setChatMode:L}=jo(),{data:_}=ci.useSession(),k=_?.user?.id,{org:S,locator:w}=We(),j=tc(S.id).id,N=Fs(m?.id),A=ou(),C=ji(N?.metadata,A).active,T=r6(JN),[V,R]=E.useState(!1),{unsupportedFile:P,onUnsupportedFile:M,clearUnsupportedFile:D}=TA(),$=cP(),z=E.useRef(void 0),I=async()=>{z.current=oe;const we=await $.startRecording();st("chat_voice_started",{thread_id:d,outcome:we==="recording"?"started":we==="unsupported"?"unsupported":we==="permission-denied"?"permission_denied":"unknown"})},O=()=>{st("chat_voice_confirmed",{thread_id:d});const we=$.stopRecording();le.current?.syncVoiceText(z.current,we),le.current?.focus()},B=()=>{st("chat_voice_cancelled",{thread_id:d}),$.cancelRecording(),le.current?.restoreContent(z.current)};E.useEffect(()=>{if($.status!=="recording")return;const we=($.transcript+($.interimTranscript?" "+$.interimTranscript:"")).trim();le.current?.syncVoiceText(z.current,we)},[$.transcript,$.interimTranscript,$.status]);const U=i?.activeTask??null,H=U?.created_by,K=!!(k&&H&&H!==k),{data:W}=Zv({enabled:K}),Y=(W?.data?.members??[]).find(we=>we.userId===H),Q=Y?.user?.name??Y?.user?.email?.split("@")[0]??null,te=Fh(),ee=mv({isDesktopApp:te,harnessId:U?.harness_id,sandboxProviderKind:U?.sandbox_provider_kind}),[oe,se]=E.useState(()=>s3(sessionStorage,w,h)??void 0),G=we=>{se(we),g.current=we,Ty(sessionStorage,w,h,we,{onQuotaExceeded:({docSizeBytes:Ne})=>{st("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Ne}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},X=E.useRef(d);if(X.current!==d){X.current=d;const we=s3(sessionStorage,w,h)??void 0;se(we),g.current=we}const Z=[...o].reverse().find(we=>we.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,le=E.useRef(null),ne=E.useRef(!1),ae=y==="plan",de=we=>{T(),st("chat_mode_changed",{from_mode:we,to_mode:"default",source:"pill_dismiss"}),L("default")};E.useEffect(()=>{const we=Ne=>{gv(Ne)&&Ne.code==="KeyL"&&(Ne.preventDefault(),Ne.shiftKey&&L(y==="plan"?"default":"plan"),le.current?.focus())};return document.addEventListener("keydown",we),()=>document.removeEventListener("keydown",we)},[y,L]);const fe=Jb(o),ge=[...o].reverse().find(we=>we.role==="assistant"&&we.metadata?.usage)?.metadata?.usage?.contextTokens??0,J=!p&&!Vy(oe),me=pP({hasDraft:J,isStreaming:l,isRunInProgress:a}),ye=me==="send",Le=me==="stop",ke=we=>{if(we?.preventDefault(),me==="send"&&oe){if(st("chat_message_sent",{thread_id:d||null,mode:y,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:we?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){pe.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(oe)}else u({tiptapDoc:oe,virtualMcp:m});gT(sessionStorage,w,h),G(void 0)}else me==="stop"&&(st("chat_message_stopped",{thread_id:d}),c())};if(K)return r.jsx(Vu,{message:Q?s("chat.input.readOnlyOthersChatNamed",{name:Q}):s("chat.input.readOnlyOthersChat"),icon:Q?r.jsx(Os,{shape:"circle",size:"2xs",url:Y?.user?.image??void 0,fallback:Q.slice(0,2).toUpperCase()}):void 0});if(U?.metadata?.read_only)return r.jsx(Vu,{message:s("chat.input.readOnlyThread")});if(ee)return r.jsx(Vu,{message:s("chat.input.codingAgentRequiresDesktop")});if(C){if(!i)return r.jsx(Vu,{message:s("chat.input.fastPreviewUnavailable")});const we=()=>{const Ne=i.createTask({runtime:"sandbox"});st("coding_session_started",{thread_id:Ne})};return r.jsxs("button",{type:"button",onClick:we,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[r.jsx(To,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),r.jsx(pl,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-col w-full justify-end",children:r.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&r.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&i&&r.jsx(Jh,{}),n&&i&&d?r.jsx(fA,{taskId:d}):null,r.jsx(n6,{tiptapDoc:oe,setTiptapDoc:G,disabled:$.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:ke,suggestionOpenRef:ne,children:r.jsxs("form",{onSubmit:ke,className:ie("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[r.jsx(yP,{selectedModel:f,onUnsupportedFile:M,disabled:$.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(i6,{ref:le,disabled:$.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:M,suggestionOpenRef:ne})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:$.status==="recording"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx(fP,{data:$.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:B,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:r.jsx(_s,{size:16})}),r.jsx("button",{type:"button",onClick:O,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:r.jsx(Et,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(iP,{disabled:!1,onOpenConnections:()=>{st("connections_dialog_opened",{source:"tools_popover",mode:"add"}),R(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:M}),ae&&r.jsx(Tu,{onClick:()=>de("plan"),label:s("chat.input.planMode"),icon:r.jsx(Ra,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),y==="gen-image"&&x&&r.jsx(Tu,{onClick:()=>de("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(wi,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),y==="web-search"&&b&&r.jsx(Tu,{onClick:()=>de("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Er,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),y==="deep-research"&&v&&r.jsx(Tu,{onClick:()=>de("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(Cv,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),Z&&ge>0&&r.jsx(xj,{usage:fe,totalTokens:ge,contextWindow:Z,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(SA,{}),$.isSupported&&r.jsx(he,{type:"button",onClick:I,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",$.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:$.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":$.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(kC,{size:18})}),r.jsx(he,{type:Le?"button":"submit",onClick:we=>{Le&&(we.preventDefault(),we.stopPropagation(),c())},variant:ye||Le?"default":"ghost",size:"icon",disabled:!ye&&!Le,className:ie("size-8 rounded-lg transition-all",!ye&&!Le&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(me==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(me==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:Le?r.jsx(jC,{size:20}):r.jsx(Sh,{size:20})})]})]})})]})},d),e&&r.jsx(aP,{onClick:()=>{st("connections_banner_clicked",{source:"home_chat_input"}),st("connections_dialog_opened",{source:"home_banner",mode:"add"}),R(!0)}})]})}),r.jsx(gp,{mode:"browse",open:V,onOpenChange:R,defaultTab:"all"}),r.jsx(NA,{info:P,onClose:D})]})}function wP(t){let e=0;for(const s of t)for(const n of s.parts??[]){const i=n;i.type==="tool-load_repo"&&i.state==="output-available"&&i.output?.success===!0&&e++}return e}function SP(){const t=F.c(8),e=Ot(),s=Qm(),n=Um()?.messages??[],i=Co()?.taskId??null;let o;t[0]!==n?(o=wP(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=E.useRef(null),c=E.useRef(null);let d,h;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const u=`${i}:${l}`;c.current!==u&&(c.current=u,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e({to:".",search:kP,replace:!0}))},h=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=h):(d=t[6],h=t[7]),E.useEffect(d,h)}function kP(t){return{...t,main:"preview"}}const jP={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function o6(t){return`deco-credits-empty-dismissed:${t}`}function CP(t){try{return localStorage.getItem(o6(t))==="1"}catch{return!1}}function NP(){const t=F.c(68),e=re(),{org:s}=We(),n=Ot(),{decoKeyId:i}=pp(),o=zs(),[l,a]=E.useState(!0),[c,d]=E.useState(""),[h,u]=E.useState(!1),[f,m]=E.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{st("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(o6(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==l||t[3]!==s.id?(b=()=>{l&&st("credits_empty_state_shown",{organization_id:s.id})},v=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),E.useEffect(b,v);let y;t[6]!==f||t[7]!==o?(y=async Q=>{const{url:te}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:Q,currency:f});return te},t[6]=f,t[7]=o,t[8]=y):y=t[8];let L;t[9]!==x?(L=Q=>{Q&&window.open(Q,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=L):L=t[10];let _;t[11]!==e?(_=Q=>{pe.error(e("chat.creditsEmptyState.topUpFailed",{message:Q.message}))},t[11]=e,t[12]=_):_=t[12];let k;t[13]!==y||t[14]!==L||t[15]!==_?(k={mutationFn:y,onSuccess:L,onError:_},t[13]=y,t[14]=L,t[15]=_,t[16]=k):k=t[16];const{mutate:S,isPending:w}=Xs(k),j=parseFloat(c),N=!isNaN(j)&&j>=1;if(!l)return null;let A;t[17]!==x?(A=Q=>!Q&&x(),t[17]=x,t[18]=A):A=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=C):C=t[19];let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(Nv,{size:20,className:"text-warning"})}),t[20]=T):T=t[20];let V;t[21]!==e?(V=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=V):V=t[22];let R;t[23]!==V?(R=r.jsx($t,{className:"text-lg font-semibold",children:V}),t[23]=V,t[24]=R):R=t[24];let P;t[25]!==e?(P=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=P):P=t[26];let M;t[27]!==P?(M=r.jsx(Dn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:P}),t[27]=P,t[28]=M):M=t[28];let D;t[29]!==R||t[30]!==M?(D=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,r.jsxs(ms,{className:"relative gap-3",children:[T,r.jsxs("div",{className:"text-center",children:[R,M]})]})]}),t[29]=R,t[30]=M,t[31]=D):D=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==N||t[38]!==w||t[39]!==h||t[40]!==e||t[41]!==S?($=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(mp,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:Q=>{Q&&m(Q)},children:[r.jsx(Nd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Nd,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:jP[f].map(Q=>{const{dollars:te,labelKey:ee}=Q;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{st("credits_topup_clicked",{amount_cents:te*100,currency:f,tier_label:ee,source:"empty_state"}),S(te*100)},className:ie("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,te]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(ee)})]},te)})}),h?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(pt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:Q=>d(Q.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!N||w,onClick:()=>{st("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),S(Math.round(j*100))},children:e(w?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):r.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=N,t[38]=w,t[39]=h,t[40]=e,t[41]=S,t[42]=$):$=t[42];let z;t[43]!==x||t[44]!==n||t[45]!==s.slug?(z=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=z):z=t[46];let I;t[47]!==e?(I=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=I):I=t[48];let O;t[49]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(pl,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=O):O=t[49];let B;t[50]!==z||t[51]!==I?(B=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:z,children:[I,O]}),t[50]=z,t[51]=I,t[52]=B):B=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let H;t[55]!==x||t[56]!==U?(H=r.jsx(he,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=H):H=t[57];let K;t[58]!==B||t[59]!==H?(K=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,H]}),t[58]=B,t[59]=H,t[60]=K):K=t[60];let W;t[61]!==D||t[62]!==$||t[63]!==K?(W=r.jsxs(Pt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:VP,children:[D,$,K]}),t[61]=D,t[62]=$,t[63]=K,t[64]=W):W=t[64];let Y;return t[65]!==W||t[66]!==A?(Y=r.jsx(Rt,{open:!0,onOpenChange:A,children:W}),t[65]=W,t[66]=A,t[67]=Y):Y=t[67],Y}function VP(t){return t.preventDefault()}function TP(t){const e=F.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const i=n;let o,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=r.jsx(Nv,{size:13,className:"text-success"}),e[2]=o,e[3]=l):(o=e[2],l=e[3]);let a;return e[4]!==i?(a=r.jsxs("div",{className:o,children:[l,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=a):a=e[5],a}function AP(){const t=F.c(8),{org:e}=We(),s=Ot();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let i,o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),o=r.jsx(pn,{size:13,className:"text-warning"}),l=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=o,t[5]=l):(i=t[3],o=t[4],l=t[5]);let a;return t[6]!==n?(a=r.jsxs("button",{type:"button",onClick:n,className:i,children:[o,l]}),t[6]=n,t[7]=a):a=t[7],a}function EP(t){const e=F.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[i,r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),r.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=o):o=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),r.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[r.jsx(Au,{align:"right",width:"w-3/4"}),r.jsx(Au,{align:"left",width:"w-full",lines:3}),r.jsx(Au,{align:"right",width:"w-2/3"}),r.jsx(Au,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:r.jsx("div",{className:"relative flex-1",children:r.jsxs("div",{className:"space-y-2 p-2",children:[r.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),r.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"px-4 py-4",children:r.jsx("div",{className:"mx-auto w-full max-w-2xl",children:r.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[c,r.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),r.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=h):h=e[8];let u;return e[9]!==n?(u=r.jsxs("div",{className:n,children:[l,a,h]}),e[9]=n,e[10]=u):u=e[10],u}function Au(t){const e=F.c(22),{align:s,width:n,lines:i}=t,o=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,e[1]=c):c=e[1];const d=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let h;e[2]!==d?(h=ie("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=u):u=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=ie("min-w-0 rounded-2xl p-4",f,o),e[5]=f,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((y,L)=>r.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",L===l-1?"w-3/4":"w-full"),style:{animationDelay:`${L*.1}s`}},L))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==h?(b=r.jsxs("div",{className:h,children:[u,x]}),e[16]=x,e[17]=h,e[18]=b):b=e[18];let v;return e[19]!==b||e[20]!==c?(v=r.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=v):v=e[21],v}function PP(t){const e=F.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:o,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==s||e[4]!==n?(a=()=>{const d=n.current,h=s.current;if(!d||!h||!i)return;const u=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||o||!i)return;const p=h.scrollHeight,g=h.scrollTop;await l(),requestAnimationFrame(()=>{const x=h.scrollHeight;h.scrollTop=g+(x-p)})},{root:h,rootMargin:"200px 0px 0px 0px"});return u.observe(d),()=>u.disconnect()},c=[s,n,i,o,l],e[0]=l,e[1]=i,e[2]=o,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),E.useEffect(a,c)}function RP(t){const e=F.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=r.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function DP(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function IP(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function MP(){const t=re(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=di(),{taskId:l}=en();SP();const a=Wb(l??""),c=ej(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),h=bj(d),u=h.at(-1),m=fT()*ZV+16,p=E.useRef(null),g=E.useRef(null);PP({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=vj({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(yj,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),h.slice(0,-1).map((v,y)=>r.jsx(Fg,{pair:v,isLastPair:!1,status:y===h.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),u&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(Fg,{pair:u,isLastPair:!0,status:s},`pair-${u.user?.id??u.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(he,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:r.jsx(Hk,{size:14})})]})})}function $P(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}const hs=Object.assign(RP,{Main:DP,Messages:MP,EmptyState:IP,Footer:$P,Input:LP,Provider:Zk,ActiveTaskProvider:Xk,Skeleton:EP,IceBreakers:XV,NoAiProviderEmptyState:NN,CreditsEmptyState:NP,CreditsEyebrow:TP,NoCreditsEyebrow:AP,CreditsExhaustedBanner:By});function OP({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function BP(){const t=F.c(3),e=Bh(),n=Co()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=OP({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function Vc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function i9(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function zP(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function FP(t){const e=F.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(UP),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=i):i=e[3],i}function UP(t){return r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),r.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function HP(t){const e=F.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=re(),l=s+n+i,a=l>0?s/l*100:0,c=l>0?n/l*100:0,d=l>0?i/l*100:0;let h;e[0]!==a?(h=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=h):h=e[1];let u;e[2]!==c?(u=c>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=u):u=e[3];let f;e[4]!==d?(f=d>0&&r.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==f?(m=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[h,u,f]}),e[6]=h,e[7]=u,e[8]=f,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==o||e[12]!==a?(g=o("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=o,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[p,r.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==o?(v=o("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=o,e[19]=v):v=e[19];let y;e[20]!==v?(y=r.jsxs("div",{className:"flex items-center gap-1.5",children:[b,r.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=y):y=e[21];let L;e[22]!==d||e[23]!==i||e[24]!==o?(L=i>0&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=o,e[25]=L):L=e[25];let _;e[26]!==y||e[27]!==L||e[28]!==x?(_=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,y,L]}),e[26]=y,e[27]=L,e[28]=x,e[29]=_):_=e[29];let k;return e[30]!==_||e[31]!==m?(k=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,_]}),e[30]=_,e[31]=m,e[32]=k):k=e[32],k}function KP(t){const e=F.c(14),{agentId:s,isError:n}=t,i=Fs(s),o=re();let l;e[0]!==i?.title||e[1]!==o?(l=i?.title??o("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=o,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=r.jsx(Pi,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=d):d=e[5];const h=n?"text-destructive":"text-foreground";let u;e[6]!==h?(u=ie("shrink-0 font-medium",h),e[6]=h,e[7]=u):u=e[7];let f;e[8]!==a||e[9]!==u?(f=r.jsx("span",{className:u,children:a}),e[8]=a,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==f?(m=r.jsxs(r.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function WP(t){const e=F.c(12),{isError:s}=t,n=re();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const o=i;let l;e[2]!==o?(l=r.jsx(Pi,{icon:null,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=o,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=r.jsx("span",{className:c,children:o}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let h;return e[9]!==l||e[10]!==d?(h=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=h):h=e[11],h}function qP(t){const e=F.c(18),{part:s}=t,n=s.input?.agent_id,i=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==o?(a=r.jsx(WP,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(KP,{agentId:n,isError:o}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=r.jsx(E.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==s.input?(h=s.input?.prompt&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-muted-foreground/50",children:"·"}),r.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=h):h=e[9];let u;e[10]!==l||e[11]!==o||e[12]!==i?(u=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(ut,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(SC,{size:12,className:"text-destructive"}):l?r.jsx(pn,{size:12,className:"text-warning"}):r.jsx(ui,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=u):u=e[13];let f;return e[14]!==d||e[15]!==h||e[16]!==u?(f=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,h,u]}),e[14]=d,e[15]=h,e[16]=u,e[17]=f):f=e[17],f}function GP(t){const e=F.c(78),{onClose:s,back:n,className:i}=t,o=re(),[l,a]=E.useState(null),{messages:c}=di(),{activeTask:d}=en(),{selectedModel:h,selectedVirtualMcp:u}=jo();let f,m,p,g,x,b,v,y;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==h||e[7]!==u?.title||e[8]!==o){y=Symbol.for("react.early_return_sentinel");e:{const k=Jb(c),S=[...c].reverse().find(rR),w=S?.metadata?.usage,j=S?.metadata?.modelLimits?.contextWindow??h?.limits?.contextWindow??null,N=w?.contextTokens??0,A=j&&j>0?(N/j*100).toFixed(1):null,C=c;let T;e[17]!==C?(T=C.filter(iR).reduce(nR,0),e[17]=C,e[18]=T):T=e[18];const V=T,R=c;let P;e[19]!==R?(P=R.filter(sR).reduce(tR,0),e[19]=R,e[20]=P):P=e[20];const M=P,D=Math.max(0,k.totalTokens-V-M),$=c[0],z=c.at(-1),I=$?.metadata?.created_at??d?.created_at,O=z?.metadata?.created_at??d?.updated_at,B=c.filter(eR),U=c.flatMap(XP),H=h?.modelId?zP(h.modelId):"—",K=u?.title??"Super Agent",W=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:B.length},{label:o("chat.contextPanel.agentLabel"),value:K},{label:o("chat.contextPanel.modelLabel"),value:H},{label:o("chat.contextPanel.contextLimitLabel"),value:j?Vc(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:k.totalTokens>0?Vc(k.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:A!==null?`${A}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:k.inputTokens>0?Vc(k.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:k.outputTokens>0?Vc(k.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:k.reasoningTokens>0?Vc(k.reasoningTokens):"0"},{label:o("chat.contextPanel.costLabel"),value:k.cost>0?`$${k.cost<.001?k.cost.toFixed(6):k.cost.toFixed(4)}`:"$0.00"},{label:o("chat.contextPanel.sessionCreatedLabel"),value:i9(I)},{label:o("chat.contextPanel.lastActivityLabel"),value:i9(O)}];if(!d&&B.length===0){let X;e[21]!==i?(X=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=X):X=e[22];let q;e[23]!==o?(q=o("chat.contextPanel.title"),e[23]=o,e[24]=q):q=e[24];let Z;e[25]!==q?(Z=r.jsx("span",{className:"text-sm font-medium text-foreground",children:q}),e[25]=q,e[26]=Z):Z=e[26];let le;e[27]!==n?(le=n?r.jsx(Kg,{size:14,className:"text-muted-foreground"}):r.jsx(Si,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=le):le=e[28];let ne;e[29]!==s||e[30]!==le?(ne=r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:le}),e[29]=s,e[30]=le,e[31]=ne):ne=e[31];let ae;e[32]!==Z||e[33]!==ne?(ae=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Z,ne]}),e[32]=Z,e[33]=ne,e[34]=ae):ae=e[34];let de;e[35]!==o?(de=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=de):de=e[36];let fe;e[37]!==de?(fe=r.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:r.jsx("p",{className:"text-xs text-muted-foreground",children:de})}),e[37]=de,e[38]=fe):fe=e[38];let ue;e[39]!==X||e[40]!==ae||e[41]!==fe?(ue=r.jsxs("div",{className:X,children:[ae,fe]}),e[39]=X,e[40]=ae,e[41]=fe,e[42]=ue):ue=e[42],y=ue;break e}e[43]!==i?(b=ie("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",i),e[43]=i,e[44]=b):b=e[44];let Y;e[45]!==o?(Y=o("chat.contextPanel.title"),e[45]=o,e[46]=Y):Y=e[46];let Q;e[47]!==Y?(Q=r.jsx("span",{className:"text-sm font-medium text-foreground",children:Y}),e[47]=Y,e[48]=Q):Q=e[48];let te;e[49]!==n?(te=n?r.jsx(Kg,{size:14}):r.jsx(Si,{size:14}),e[49]=n,e[50]=te):te=e[50];let ee;e[51]!==s||e[52]!==te?(ee=r.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:te}),e[51]=s,e[52]=te,e[53]=ee):ee=e[53],e[54]!==Q||e[55]!==ee?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[Q,ee]}),e[54]=Q,e[55]=ee,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=U.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.subtasksSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:U.map(JP)})]}),p=r.jsx(FP,{items:W});let oe;e[57]!==o?(oe=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=oe):oe=e[58];let se;e[59]!==oe?(se=r.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=se):se=e[60];let G;e[61]!==M||e[62]!==D||e[63]!==V?(G=r.jsx(HP,{userTokens:V,assistantTokens:M,otherTokens:D}),e[61]=M,e[62]=D,e[63]=V,e[64]=G):G=e[64],e[65]!==se||e[66]!==G?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[se,G]}),e[65]=se,e[66]=G,e[67]=g):g=e[67],x=B.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.rawMessagesSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:B.map(X=>{const q=X.metadata?.created_at,Z=l?.id===X.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(Z?null:X),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:ie("shrink-0 font-medium",X.role==="user"?"text-chart-1":"text-chart-2"),children:X.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:X.id})]}),q&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:i9(q)})]}),Z&&r.jsxs(r.Fragment,{children:[X.role==="assistant"&&(()=>{const le=X.metadata?._request;if(!le)return null;const ne=le.systemSections??[],ae=Math.max(1,...ne.map(QP)),de=ne.reduce(YP,0);return r.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-foreground",children:o("chat.contextPanel.requestLabel")}),r.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[le.activeTools??0," / ",le.tools??0," ",o("chat.contextPanel.toolsActive")]})]}),ne.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"text-muted-foreground",children:[o("chat.contextPanel.systemPromptLabel")," ",r.jsxs("span",{className:"tabular-nums",children:["~",Math.round(de/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),ne.map((fe,ue)=>{const ge=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ue}`,J=fe.chars/ae*100,me=Math.round(fe.chars/4);return r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-mono text-foreground truncate",children:ge}),r.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",me.toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),r.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${J}%`}})})]},ue)})]})]})})(),r.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(X,null,2)})]})]},X.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=h,e[7]=u?.title,e[8]=o,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=y}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let L;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(L=r.jsxs("div",{className:f,children:[m,p,g,x]}),e[68]=f,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=L):L=e[73];let _;return e[74]!==b||e[75]!==v||e[76]!==L?(_=r.jsxs("div",{className:b,children:[v,L]}),e[74]=b,e[75]=v,e[76]=L,e[77]=_):_=e[77],_}function YP(t,e){return t+e.chars}function QP(t){return t.chars}function JP(t,e){return r.jsx(qP,{part:t},e)}function XP(t){return(t.parts??[]).filter(ZP)}function ZP(t){return t.type==="tool-subtask"}function eR(t){return t.role!=="system"}function tR(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function sR(t){return t.role==="assistant"}function nR(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function iR(t){return t.role==="user"}function rR(t){return t.role==="assistant"&&t.metadata?.usage}function oR(t){const e=F.c(21),{onOpenContextPanel:s}=t,{org:n}=We(),{selectedVirtualMcp:i}=jo();let o;e[0]!==n.id?(o=tc(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Fs(a.id)??a,h=d.title??"Super Agent",u=d.icon??null,f=d.description??null;let m;e[2]!==u||e[3]!==h?(m=r.jsx(yo,{icon:u,name:h,size:"lg"}),e[2]=u,e[3]=h,e[4]=m):m=e[4];let p;e[5]!==h?(p=r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:h}),e[5]=h,e[6]=p):p=e[6];let g;e[7]!==f?(g=f?r.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=r.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=r.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(hs.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let y;e[16]!==s?(y=r.jsxs(hs.Footer,{children:[v,r.jsx(hs.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=y):y=e[17];let L;return e[18]!==b||e[19]!==y?(L=r.jsxs(r.Fragment,{children:[b,y]}),e[18]=b,e[19]=y,e[20]=L):L=e[20],L}function _3(t){const e=F.c(17),{outputs:s,collapsed:n,onToggle:i,variant:o}=t,l=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==l?(a=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let h;e[3]!==d?(h=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=h):h=e[4];let u;e[5]!==h?(u=r.jsx(Jt,{className:h}),e[5]=h,e[6]=u):u=e[6];let f;e[7]!==i||e[8]!==u?(f=r.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,u]}),e[7]=i,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&r.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(lR)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==a||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function lR(t){return r.jsx(Lj,{file:t},t.key)}function aR(){const t=F.c(13),e=Co()?.taskId??null,s=_j();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=Xb(e,n),[o,l]=E.useState(!1),[a,c]=E.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(dR),t[2]=d):d=t[2];let h;t[3]!==o||t[4]!==i?(h=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(_3,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=h):h=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>c(cR),t[6]=u):u=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(_3,{variant:"bar",outputs:i,collapsed:a,onToggle:u})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==h||t[11]!==f?(m=r.jsxs(r.Fragment,{children:[h,f]}),t[10]=h,t[11]=f,t[12]=m):m=t[12],m}function cR(t){return!t}function dR(t){return!t}function uR(){const t=F.c(30),{org:e}=We(),{isChatEmpty:s}=di(),[n,i]=E.useState("chat"),o=pp();if(BP()){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(hs,{className:"animate-in fade-in-0 duration-200",children:r.jsx(hs.Main,{className:"flex flex-col items-center",children:r.jsx(hs.EmptyState,{children:r.jsx(hs.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let a;t[1]!==o.hasDecoKey||t[2]!==o.hasOnlyDecoProvider||t[3]!==o.isLoading||t[4]!==o.isZeroBalance||t[5]!==s||t[6]!==e?(a=o.hasDecoKey&&o.isZeroBalance&&o.hasOnlyDecoProvider&&!o.isLoading&&s&&!CP(e.id),t[1]=o.hasDecoKey,t[2]=o.hasOnlyDecoProvider,t[3]=o.isLoading,t[4]=o.isZeroBalance,t[5]=s,t[6]=e,t[7]=a):a=t[7];const c=a;let d;t[8]!==c?(d=c&&r.jsx(hs.CreditsEmptyState,{}),t[8]=c,t[9]=d):d=t[9];const h=n!=="chat"?!0:void 0,u=n!=="chat",f=n!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;t[10]!==f?(m=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[10]=f,t[11]=m):m=t[11];let p;t[12]!==s?(p=s?r.jsx(oR,{onOpenContextPanel:()=>i("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(hs.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(aR,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(hs.Messages,{})})]}),r.jsx(hs.Footer,{children:r.jsx(hs.Input,{onOpenContextPanel:()=>i("context")})})]}),t[12]=s,t[13]=p):p=t[13];let g;t[14]!==h||t[15]!==u||t[16]!==m||t[17]!==p?(g=r.jsx("div",{inert:h,"aria-hidden":u,className:m,children:p}),t[14]=h,t[15]=u,t[16]=m,t[17]=p,t[18]=g):g=t[18];const x=n!=="context"?!0:void 0,b=n!=="context",v=n==="context"?"opacity-100":"opacity-0 pointer-events-none";let y;t[19]!==v?(y=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[19]=v,t[20]=y):y=t[20];let L;t[21]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(GP,{back:!0,onClose:()=>i("chat")}),t[21]=L):L=t[21];let _;t[22]!==y||t[23]!==x||t[24]!==b?(_=r.jsx("div",{inert:x,"aria-hidden":b,className:y,children:L}),t[22]=y,t[23]=x,t[24]=b,t[25]=_):_=t[25];let k;return t[26]!==d||t[27]!==_||t[28]!==g?(k=r.jsxs(hs,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[d,g,_]}),t[26]=d,t[27]=_,t[28]=g,t[29]=k):k=t[29],k}function l6(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(hs.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Js,{fallback:e,children:r.jsx(E.Suspense,{fallback:r.jsx(hs.Skeleton,{}),children:r.jsx(uR,{})})}),t[1]=s):s=t[1],s}function hR(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function zp(t){return t?.name||t?.email?.split("@")[0]||void 0}function Xh(t){const e=hR(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function fR(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const i=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(i)}return n}const a6=["SANDBOX_START"],Eu=new Map,mR=t=>`${t.virtualMcpId}::${t.branch??""}`,pR=t=>t.message.includes("retry shortly"),r9=new Set,u1={mark:(t,e)=>r9.add(`${t}::${e}`),clear:(t,e)=>r9.delete(`${t}::${e}`),isStopped:(t,e)=>r9.has(`${t}::${e}`)};function c6(t,e){const s=Ls();return Xs({mutationKey:a6,retry:(n,i)=>pR(i)&&n<6,retryDelay:n=>nu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&u1.clear(n.virtualMcpId,n.branch);const i=mR(n),o=Eu.get(i);if(o)return o;const l=(async()=>(await fR(t,"SANDBOX_START",n)).structuredContent)();Eu.set(i,l);try{return await l}finally{Eu.get(i)===l&&Eu.delete(i)}},onSuccess:()=>{wd(s),e?.onStarted?.()}})}function gR(t,e){const s=F.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:a6,predicate:o=>{if(!t)return!1;const l=o.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],Qh(n)>0}function L3(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function xR(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function bR(t){const e=t.mainParamValue===0?"0":t.mainParamValue,s=t.entityMetadata?.defaultMainView??null,n=s==null||s.type==="chat",i=t.mainParamPresent?e!=="0":!n,o=n||t.entityMetadata?.chatDefaultOpen?"chat":null,l=t.sidePanelParamPresent?t.sidePanelParamValue===0?null:t.sidePanelParamValue??null:o;return xR({sidePanel:l,mainOpen:i})}function o9(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?L3("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?L3("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function vR(t){return t.sidePanel!==null&&t.mainOpen?{side:33,main:67}:t.sidePanel!==null?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function yR(t){const{sidePanel:e,mainOpen:s}=t.visibility;return e!==null&&(t.sidePanelParamPresent||!s)?e:s?"main":"chat"}function _R(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function LR(t,e){const s=Ot(),n=lr({strict:!1}),i=wh({strict:!1}),{create:o}=Yd(),{threads:l}=oC(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,h=n.main===0?"0":n.main,{sidePanel:u,mainOpen:f}=bR({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:h,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:u,mainOpen:f},p=E.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=A=>({org:c,taskId:A}),v=d?{virtualmcpid:a}:{},y=(A,C)=>{s({to:x,params:b(g),search:T=>({...T,...A}),replace:C?.replace??!1})},L=(A,C)=>{s({to:x,params:b(A),search:T=>{const V={};return C?V.virtualmcpid=C:d&&(V.virtualmcpid=a),V}})},_=()=>{const A=o9({type:"toggleMain",openMainValue:ba(t)},m);A&&y(A,{replace:!0})},k=A=>{const C=o9({type:"toggleSidePanel",sidePanel:A},m);C&&y(C,{replace:!0})},S=A=>{const C=h&&h!=="0"?h:ba(t);y(_R(A,C),{replace:!0})},w=A=>{const C=o9({type:"openSidePanel",sidePanel:A},m);C&&y(C,{replace:!0})},j=async()=>{const A=crypto.randomUUID(),C=l.find(T=>T.id===g)?.branch??null;try{await o({id:A,virtual_mcp_id:a,...C?{branch:C}:{}})}catch{}s({to:x,params:b(A),search:T=>({...v})})},N=A=>{y({main:A==="0"?0:A},{replace:!0})};return{taskId:g,sidePanel:u,mainOpen:f,mainParam:h,sidePanelParamPresent:n.sidepanel!==void 0,setTaskId:L,toggleMain:_,toggleSidePanel:k,setMobileSurface:S,openSidePanel:w,createNewTask:j,openTab:N}}function wR(t){const e=F.c(10),{org:s}=We(),n=Qm(),{data:i}=ci.useSession(),o=i?.user?.id,l=t?.id??null,a=!!t&&!!o&&!!t.created_by&&t.created_by!==o;let c;e[0]!==s.id||e[1]!==l?(c=it.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let h;e[3]!==n||e[4]!==l?(h=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=h):h=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==h?(u={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:h},e[6]=c,e[7]=d,e[8]=h,e[9]=u):u=e[9],Vt(u)}function SR(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function kR(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function jR(t){return t/100*window.innerHeight}function CR(t){return t/100*window.innerWidth}function NR(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function Yc({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=NR(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=kR(e,i);break}case"em":{n=SR(e,i);break}case"vh":{n=jR(i);break}case"vw":{n=CR(i);break}}return n}function wn(t){return parseFloat(t.toFixed(3))}function Ka({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,i)=>(n+=e==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function h1(t){const{panels:e}=t,s=Ka({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:i,panelConstraints:o}=n;let l=0;if(o.collapsedSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=wn(h/s*100)}let a;if(o.defaultSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=wn(h/s*100)}let c=0;if(o.minSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.minSize});c=wn(h/s*100)}let d=100;if(o.maxSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.maxSize});d=wn(h/s*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Ft(t,e="Assertion error"){if(!t)throw Error(e)}function f1(t,e){return Array.from(e).sort(t==="horizontal"?VR:TR)}function VR(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function TR(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function d6(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function u6(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function AR({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,o=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=u6(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Ft(i,"No rect found"),i}let Pu;function ER(){return Pu===void 0&&(typeof matchMedia=="function"?Pu=!!matchMedia("(pointer:coarse)").matches:Pu=!1),Pu}function h6(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=f1(s,Array.from(e.children).filter(d6).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,h=-1,u=0,f,m=[];{let p=-1;for(const g of o)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(u++,d===-1&&(d=p),h=p))}if(u>1){let p=-1;for(const g of o)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let y;if(c){const L=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),_=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{y=[L,_];break}case 1:{const k=m[0],S=AR({orientation:s,rects:[b,v],targetRect:k.element.getBoundingClientRect()});y=[k,S===b?_:L];break}default:{y=m;break}}}else m.length?y=m:y=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const L of y){let _="width"in L?L:L.element.getBoundingClientRect();const k=ER()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(_.width<k){const w=k-_.width;_=new DOMRect(_.x-w/2,_.y,_.width+w,_.height)}if(_.height<k){const w=k-_.height;_=new DOMRect(_.x,_.y-w/2,_.width,_.height+w)}const S=p<=d||p>h;!a&&!S&&l.push({group:t,groupSize:Ka({group:t}),panels:[f,x],separator:"width"in L?void 0:L,rect:_}),a=!1}}c=!1,f=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?m.push(x):(f=void 0,m=[])}else c=!0}return l}let f6=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let i=!1,o=null;const l=Array.from(n);for(let a=0;a<l.length;a++){const c=l[a];try{c.call(null,s)}catch(d){o===null&&(i=!0,o=d)}}if(i)throw o}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(s);i>=0&&n.splice(i,1)}}},La={cursorFlags:0,state:"inactive"};const Fp=new f6;function sl(){return La}function PR(t){return Fp.addListener("change",t)}function RR(t){const e=La,s={...La};s.cursorFlags=t,La=s,Fp.emit("change",{prev:e,next:s})}function wa(t){const e=La;La=t,Fp.emit("change",{prev:e,next:t})}const DR=t=>t,l9=()=>{},m6=1,p6=2,g6=4,x6=8,w3=3,S3=12;let Ru;function k3(){return Ru===void 0&&(Ru=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ru=!0)),Ru}function IR({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&k3()){const o=(t&m6)!==0,l=(t&p6)!==0,a=(t&g6)!==0,c=(t&x6)!==0;if(o)return a?"se-resize":c?"ne-resize":"e-resize";if(l)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return k3()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const j3=new WeakMap;function Up(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=j3.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=sl();switch(n.state){case"active":case"hover":{const i=IR({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(e===o)return;e=o,i?s.cssRules.length===0?s.insertRule(o):s.replaceSync(o):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}j3.set(t,{prevStyle:e,styleSheet:s})}let Yi=new Map;const b6=new f6;function MR(t){Yi=new Map(Yi),Yi.delete(t)}function C3(t,e){for(const[s]of Yi)if(s.id===t)return s}function po(t,e){for(const[s,n]of Yi)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function bl(){return Yi}function Hp(t,e){return b6.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function Mr(t,e,s){const n=Yi.get(t);Yi=new Map(Yi),Yi.set(t,e),b6.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function v6(t){const e=sl();let s=!1;return e.state==="active"&&(wa({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(Up(t),s=!0,e.hitRegions.forEach(n=>{const i=po(n.group.id,!0);Mr(n.group,i,{isUserInteraction:!0})}))),s}function N3(t){t.defaultPrevented||v6(t.currentTarget)}function $R(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=u6(s,o.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=o,i=l);break}case"vertical":{l.y<=i.y&&(n=o,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function OR(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function BR(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:A3(t),b:A3(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Ft(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:T3(V3(s.a)),b:T3(V3(s.b))};if(i.a===i.b){const o=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=o.length;for(;a--;){const c=o[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const zR=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function FR(t){const e=getComputedStyle(y6(t)??t).display;return e==="flex"||e==="inline-flex"}function UR(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||FR(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||zR.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function V3(t){let e=t.length;for(;e--;){const s=t[e];if(Ft(s,"Missing node"),UR(s))return s}return null}function T3(t){return t&&Number(getComputedStyle(t).zIndex)||0}function A3(t){const e=[];for(;t;)e.push(t),t=y6(t);return e}function y6(t){const{parentNode:e}=t;return OR(e)?e.host:e}function HR(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function KR({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!d6(s)||s.contains(t)||t.contains(s))return!0;if(BR(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(HR(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function Kp(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=h6(i),l=$R(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&KR({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function WR(t,e){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 fn(t,e,s=0){return Math.abs(wn(t)-wn(e))<=s}function Fi(t,e){return fn(t,e)?0:t>e?1:-1}function va({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(Fi(n,c)<0)if(o){const d=(i+c)/2;Fi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=wn(n),n}function Dd({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(fn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[h,u]=n;Ft(h!=null,"Invalid first pivot index"),Ft(u!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?u:h,x=s[g];Ft(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const L=a[g];if(Ft(L!=null,`Previous layout not found for panel index ${g}`),fn(L,b)){const _=y-L;Fi(_,Math.abs(t))>0&&(t=t<0?0-_:_)}}}{const g=t<0?h:u,x=s[g];Ft(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const L=a[g];if(Ft(L!=null,`Previous layout not found for panel index ${g}`),fn(L,y)){const _=L-b;Fi(_,Math.abs(t))>0&&(t=t<0?0-_:_)}}}break}default:{const g=t<0?u:h,x=s[g];Ft(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:y,minSize:L}=x;if(v&&Fi(b,L)<0)if(t>0){const _=L-y,k=_/2,S=b+t;Fi(S,L)<0&&(t=Fi(t,k)<=0?0:_)}else{const _=L-y,k=100-_/2,S=b-t;Fi(S,L)<0&&(t=Fi(100+t,k)>0?0:-_)}break}}{const g=t<0?1:-1;let x=t<0?u:h,b=0;for(;;){const y=a[x];Ft(y!=null,`Previous layout not found for panel index ${x}`);const L=va({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:y,size:100})-y;if(b+=L,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?h:u;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Ft(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,y=va({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!fn(b,y)&&(f+=b-y,d[g]=y,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(WR(c,d))return i;{const g=t<0?u:h,x=a[g];Ft(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=va({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!fn(v,b)){let y=b-v,L=t<0?u:h;for(;L>=0&&L<s.length;){const _=d[L];Ft(_!=null,`Previous layout not found for panel index ${L}`);const k=_+y,S=va({overrideDisabledPanels:l,panelConstraints:s[L],prevSize:_,size:k});if(fn(_,S)||(y-=S-_,d[L]=S),fn(y,0))break;t>0?L--:L++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!fn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function nl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Fi(t[s],e[s])!==0)return!1;return!0}function il({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],i=n.reduce((a,c)=>a+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!fn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Ft(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let o=0;for(let a=0;a<e.length;a++){const c=s[a];Ft(c!=null,`No layout data found for index ${a}`);const d=n[a];Ft(d!=null,`No layout data found for index ${a}`);const h=va({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=h&&(o+=d-h,n[a]=h)}if(!fn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Ft(c!=null,`No layout data found for index ${a}`);const d=c+o,h=va({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==h&&(o-=h-c,n[a]=h,fn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function _6({groupId:t,panelId:e}){const s=()=>{const c=bl();for(const[d,{defaultLayoutDeferred:h,derivedPanelConstraints:u,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:h,derivedPanelConstraints:u,group:d,groupSize:m,layout:f,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},i=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},o=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},l=({nextSize:c,panels:d,prevLayout:h,derivedPanelConstraints:u})=>{const f=o(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<f&&(p||d.slice(0,m).every((x,b)=>{const v=u[b];return v?.collapsible&&fn(v.collapsedSize,h[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+h[v.id],0);return{...h,[e]:wn(100-x)}}return Dd({delta:g?f-c:c-f,initialLayout:h,panelConstraints:u,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:h,trigger:"imperative-api"})},a=c=>{const d=o();if(c===d)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:u,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:u}),b=il({layout:x,panelConstraints:u});nl(p,b)||Mr(f,{defaultLayoutDeferred:h,derivedPanelConstraints:u,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:h}=i(),u=o();c&&u!==d&&(h.expandToSize=u,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:h}=n(),{mutableValues:u}=i(),f=o();if(c&&f===d){let m=u.expandToSize??h;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:h}=i(),u=c.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:d,inPixels:u}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),h=o();return c&&fn(d,h)},resize:c=>{const{group:d}=s(),{element:h}=i(),u=Ka({group:d}),f=Yc({groupSize:u,panelElement:h,styleProp:c}),m=wn(f/u*100);a(m)}}}function E3(t){if(t.defaultPrevented)return;const e=bl();Kp(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,o=_6({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function b0(t){const e=bl();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function L6({groupId:t}){const e=()=>{const s=bl();for(const[n,i]of s)if(n.id===t)return{group:n,...i};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:o,groupSize:l,layout:a,separatorToPanels:c}=e(),d=il({layout:s,panelConstraints:i});return n?a:(nl(a,d)||Mr(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function Io(t,e){const s=b0(t),n=po(s.id,!0),i=s.separators.find(h=>h.element===t);Ft(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Ft(o,"Matching panels not found");const l=o.map(h=>s.panels.indexOf(h)),a=L6({groupId:s.id}).getLayout(),c=Dd({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=il({layout:c,panelConstraints:n.derivedPanelConstraints});nl(a,d)||Mr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function P3(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=b0(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&Io(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&Io(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&Io(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&Io(e,-5);break}case"End":{t.preventDefault(),Io(e,100);break}case"Enter":{t.preventDefault();const n=b0(e),i=po(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Ft(c,"Matching separator not found");const d=a.get(c);Ft(d,"Matching panels not found");const h=d[0],u=o.find(f=>f.panelId===h.id);if(Ft(u,"Panel metadata not found"),u.collapsible){const f=l[h.id],m=u.collapsedSize===f?n.mutableState.expandedPanelSizes[h.id]??u.minSize:u.collapsedSize;Io(e,m-f)}break}case"F6":{t.preventDefault();const n=b0(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Ft(i!==null,"Index not found");const o=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[o].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),Io(e,-100);break}}}function R3(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=bl(),s=Kp(t,e),n=new Map;let i=!1;s.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(o.group);l&&n.set(o.group,l.layout)}),wa({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function w6({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:h,groupSize:u}=d,{orientation:f,panels:m}=h,{disableCursor:p}=h.mutableState;let g=0;o?f==="horizontal"?g=(e.clientX-o.x)/u*100:g=(e.clientY-o.y)/u*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(h),b=i.get(h);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:y,groupSize:L,layout:_,separatorToPanels:k}=b;if(y&&_&&k){const S=Dd({delta:g,initialLayout:x,panelConstraints:y,pivotIndices:d.panels.map(w=>m.indexOf(w)),prevLayout:_,trigger:"mouse-or-touch"});if(nl(S,_)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?m6:p6;break}case"vertical":{a|=g<0?g6:x6;break}}}else Mr(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:y,groupSize:L,layout:S,separatorToPanels:k})}});let c=0;e.movementX===0?c|=l&w3:c|=a&w3,e.movementY===0?c|=l&S3:c|=a&S3,RR(c),Up(t)}function D3(t){const e=bl(),s=sl();s.state==="active"&&w6({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function I3(t){if(t.defaultPrevented)return;const e=sl(),s=bl();switch(e.state){case"active":{if(t.buttons===0){wa({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=po(n.group.id,!0);Mr(n.group,i,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:i}=n.separator;i.hasPointerCapture?.(t.pointerId)||i.setPointerCapture?.(t.pointerId)}w6({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=Kp(t,s);n.length===0?e.state!=="inactive"&&wa({cursorFlags:0,state:"inactive"}):wa({cursorFlags:0,hitRegions:n,state:"hover"}),Up(t.currentTarget);break}}}function M3(t){t.relatedTarget instanceof HTMLIFrameElement&&sl().state==="hover"&&wa({cursorFlags:0,state:"inactive"})}function $3(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||v6(t.currentTarget)&&t.preventDefault()}function O3(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=wn(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=wn((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=o)}return n}function qR(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Ka({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:wn(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function GR(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function YR({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,o=0,l=!1;const a=new Map,c=[];for(const u of t.panels){const f=n[u.id]??0;if(u.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=wn(m/e*100);a.set(u.id,p),i+=p}else c.push(u.id),o+=f}if(!l||c.length===0)return n;const d=100-i,h={...n};if(a.forEach((u,f)=>{h[f]=u}),o>0)for(const u of c){const f=n[u]??0;h[u]=wn(f/o*d)}else{const u=wn(d/c.length);for(const f of c)h[f]=u}return h}function QR(t,e){const s=t.map(i=>i.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const i of s)if(!n.includes(i))return!1;return!0}const oa=new Map;function JR(t){let e=!0;Ft(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,o=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Ka({group:t});if(v===0)return;const y=po(t.id);if(!y)return;const L=h1(t),_=y.defaultLayoutDeferred?O3(L):y.layout,k=YR({group:t,nextGroupSize:v,prevGroupSize:y.groupSize,prevLayout:_}),S=il({layout:k,panelConstraints:L});if(!y.defaultLayoutDeferred&&nl(y.layout,S)&&GR(y.derivedPanelConstraints,L)&&y.groupSize===v)return;Mr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:v,layout:S,separatorToPanels:y.separatorToPanels})}}else qR(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Ft(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&o.observe(p.element)});const l=Ka({group:t}),a=h1(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(QR(t.panels,d)||(d=void 0));const h=t.mutableState.layouts[c]??d??O3(a),u=il({layout:h,panelConstraints:a}),f=t.element.ownerDocument;oa.set(f,(oa.get(f)??0)+1);const m=new Map;return h6(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),Mr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:u,separatorToPanels:m}),t.separators.forEach(p=>{Ft(!i.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),i.add(p.id),p.element.addEventListener("keydown",P3)}),oa.get(f)===1&&(f.addEventListener("contextmenu",N3,!0),f.addEventListener("dblclick",E3,!0),f.addEventListener("pointerdown",R3,!0),f.addEventListener("pointerleave",D3),f.addEventListener("pointermove",I3),f.addEventListener("pointerout",M3),f.addEventListener("pointerup",$3,!0)),function(){e=!1,oa.set(f,Math.max(0,(oa.get(f)??0)-1)),MR(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",P3)}),oa.get(f)||(f.removeEventListener("contextmenu",N3,!0),f.removeEventListener("dblclick",E3,!0),f.removeEventListener("pointerdown",R3,!0),f.removeEventListener("pointerleave",D3),f.removeEventListener("pointermove",I3),f.removeEventListener("pointerout",M3),f.removeEventListener("pointerup",$3,!0)),o.disconnect()}}function XR(){const[t,e]=E.useState({}),s=E.useCallback(()=>e({}),[]);return[t,s]}function Wp(t){const e=E.useId();return`${t??e}`}const vl=typeof window<"u"?E.useLayoutEffect:E.useEffect;function cd(t){const e=E.useRef(t);return vl(()=>{e.current=t},[t]),E.useCallback((...s)=>e.current?.(...s),[e])}function qp(...t){return cd(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function Gp(t){const e=E.useRef({...t});return vl(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const S6=E.createContext(null);function ZR(t,e){const s=E.useRef({getLayout:()=>({}),setLayout:DR});E.useImperativeHandle(e,()=>s.current,[]),vl(()=>{Object.assign(s.current,L6({groupId:t}))})}function k6({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:h="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...m}){const p=E.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=cd(A=>{nl(p.current.onLayoutChange,A)||(p.current.onLayoutChange=A,c?.(A))}),x=cd((A,C)=>{nl(p.current.onLayoutChanged,A)||(p.current.onLayoutChanged=A,d?.(A,{isUserInteraction:C}))}),b=Wp(a),v=E.useRef(null),[y,L]=XR(),_=E.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=qp(v,o);ZR(b,l);const S=cd((A,C)=>{const T=sl(),V=C3(A),R=po(A);if(R){let P=!1;return T.state==="active"&&(P=T.hitRegions.some(M=>M.group===V)),{flexGrow:R.layout[C]??1,pointerEvents:P?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),w=Gp({defaultLayout:s,disableCursor:n}),j=E.useMemo(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:S,id:b,orientation:h,registerPanel:A=>{const C=_.current;return C.panels=f1(h,[...C.panels,A]),L(),()=>{C.panels=C.panels.filter(T=>T!==A),L()}},registerSeparator:A=>{const C=_.current;return C.separators=f1(h,[...C.separators,A]),L(),()=>{C.separators=C.separators.filter(T=>T!==A),L()}},updatePanelProps:(A,{disabled:C})=>{const T=_.current.panels.find(P=>P.id===A);T&&(T.panelConstraints.disabled=C);const V=C3(b),R=po(b);V&&R&&Mr(V,{...R,derivedPanelConstraints:h1(V)})},updateSeparatorProps:(A,{disabled:C,disableDoubleClick:T})=>{const V=_.current.separators.find(R=>R.id===A);V&&(V.disabled=C,V.disableDoubleClick=T)}}),[S,b,L,h,w]),N=E.useRef(null);return vl(()=>{const A=v.current;if(A===null)return;const C=_.current;let T;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===C.panels.length){T={};for(const z of C.panels){const I=w.defaultLayout[z.id];I!==void 0&&(T[z.id]=I)}}const V={disabled:!!i,element:A,id:b,mutableState:{defaultLayout:T,disableCursor:!!w.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:h,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};N.current=V;const R=JR(V),{defaultLayoutDeferred:P,derivedPanelConstraints:M,layout:D}=po(V.id,!0);!P&&M.length>0&&(g(D),x(D,!1));const $=Hp(b,z=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:O,layout:B}=z.next;if(I||O.length===0)return;const U=V.panels.map(({id:K})=>K).join(",");V.mutableState.layouts[U]=B,O.forEach(K=>{if(K.collapsible){const{layout:W}=z.prev??{};if(W){const Y=fn(K.collapsedSize,B[K.panelId]),Q=fn(K.collapsedSize,W[K.panelId]);Y&&!Q&&(V.mutableState.expandedPanelSizes[K.panelId]=W[K.panelId])}}});const H=sl().state!=="active";g(B),H&&x(B,z.isUserInteraction)});return()=>{N.current=null,R(),$()}},[i,b,x,g,h,y,w]),E.useEffect(()=>{const A=N.current;A&&(A.mutableState.defaultLayout=s,A.mutableState.disableCursor=!!n)}),r.jsx(S6.Provider,{value:j,children:r.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:t})})}k6.displayName="Group";function Yp(){const t=E.useContext(S6);return Ft(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function eD(t,e){const{id:s}=Yp(),n=E.useRef({collapse:l9,expand:l9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:l9});E.useImperativeHandle(e,()=>n.current,[]),vl(()=>{Object.assign(n.current,_6({groupId:s,panelId:t}))})}function j6({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:o,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:d="100%",minSize:h="0%",onResize:u,panelRef:f,style:m,...p}){const g=!!c,x=Wp(c),b=Gp({disabled:o}),v=E.useRef(null),y=qp(v,l),{getPanelStyles:L,id:_,orientation:k,registerPanel:S,updatePanelProps:w}=Yp(),j=u!==null,N=cd((V,R,P)=>{u?.(V,c,P)});vl(()=>{const V=v.current;if(V!==null){const R={element:V,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:h}};return S(R)}},[a,s,n,i,j,x,g,d,h,N,S,b]),E.useEffect(()=>{w(x,{disabled:o})},[o,x,w]),eD(x,f);const A=()=>{const V=L(_,x);if(V)return JSON.stringify(V)},C=E.useSyncExternalStore(V=>Hp(_,V),A,A);let T;return C?T=JSON.parse(C):i!==void 0?T={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:T={flexGrow:1},r.jsx("div",{...p,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:y,style:{...tD,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...T},children:r.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:t})})}j6.displayName="Panel";const tD={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function sD({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,o;const l=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,d=a.collapsible?a.collapsedSize:a.minSize,h=[n,n+1];o=il({layout:Dd({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:h,prevLayout:t}),panelConstraints:e})[s],i=il({layout:Dd({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:h,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function C6({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=Wp(o),d=Gp({disabled:s,disableDoubleClick:n}),[h,u]=E.useState({}),[f,m]=E.useState("inactive"),[p,g]=E.useState(!1),x=E.useRef(null),b=qp(x,i),{disableCursor:v,id:y,orientation:L,registerSeparator:_,updateSeparatorProps:k}=Yp(),S=L==="horizontal"?"vertical":"horizontal";vl(()=>{const N=x.current;if(N!==null){const A={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:N,id:c},C=_(A),T=PR(R=>{m(R.next.state!=="inactive"&&R.next.hitRegions.some(P=>P.separator===A)?R.next.state:"inactive")}),V=Hp(y,R=>{const{derivedPanelConstraints:P,layout:M,separatorToPanels:D}=R.next,$=D.get(A);if($){const z=$[0],I=$.indexOf(z);u(sD({layout:M,panelConstraints:P,panelId:z.id,panelIndex:I}))}});return()=>{T(),V(),C()}}},[y,c,_,d]),E.useEffect(()=>{k(c,{disabled:s,disableDoubleClick:n})},[s,n,c,k]);let w;s&&!v&&(w="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":h.valueControls,"aria-disabled":s||void 0,"aria-orientation":S,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:w,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}C6.displayName="Separator";function N6(t){const e=F.c(10);let s,n,i;e[0]!==t?({className:s,ref:i,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("flex h-full w-full",s),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==o?(l=r.jsx(k6,{groupRef:i,"data-slot":"resizable-panel-group",className:o,...n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function $0(t){const e=F.c(10);let s,n,i;e[0]!==t?({ref:n,style:i,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==i?(o={overflow:"hidden",...i},e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==o?(l=r.jsx(j6,{panelRef:n,"data-slot":"resizable-panel",style:o,...s}),e[6]=s,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function V6(t){const e=F.c(12);let s,n,i;e[0]!==t?({withHandle:i,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=o):o=e[5];let l;e[6]!==i?(l=i&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(ic,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==o||e[10]!==l?(a=r.jsx(C6,{"data-slot":"resizable-handle",className:o,...n,children:l}),e[8]=n,e[9]=o,e[10]=l,e[11]=a):a=e[11],a}function B3(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function nD(t,e){const s=F.c(8);let n;s[0]!==e?(n=c=>B3(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=Vb(t,n);let l;s[2]!==e||s[3]!==i?(l=B3(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==o||s[6]!==l?(a=[l,o],s[5]=o,s[6]=l,s[7]=a):a=s[7],a}const iD=33;function rD(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Bm.sidePanelWidth(),t[0]=e):e=t[0],nD(e,iD)}function m1(){const t=F.c(3),[e,s]=E.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function T6(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 Qp(t){const e=T6(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(o=>o.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 lu(t){const e=lD(t);return e===null?null:e}function A6(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=A6(s);return!n||!s?null:{number:n,htmlUrl:s}}function z3(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const F3=/[\r\n<>]/,cD=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function au(t){const e=t?.userName?.trim();if(!e||F3.test(e))return null;const s=t?.userEmail?.trim();return!s||F3.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-BKACmRBp.js","assets/index-pn6its_f.js","assets/index-DZ9B9lIh.css","assets/ChevronDown-CKlR5rwM.js","assets/agent-icon-Bs96UMN4.js","assets/AlertCircle-CtXDDPuh.js","assets/Tool01-DCPbUowt.js","assets/ArrowUp-I330YJW3.js","assets/ArrowLeft-DtOVN8vp.js","assets/Tool02-Bu2KnVcQ.js","assets/XCircle-DCQf8XEr.js","assets/TrendUp01-P2ZZoWEf.js","assets/ZapSquare-Cs9IlPcM.js","assets/Users03-BgkkJa8X.js","assets/CheckCircle-yFYdDBYT.js","assets/Check-CDgez8no.js","assets/ChevronRight-BJ3yvnPz.js","assets/ChevronSelectorVertical-DrytqWO7.js","assets/ChevronUp-Bk64bZHd.js","assets/DotsVertical-BVAKyUxS.js","assets/Stars02-BQJTArZQ.js","assets/UserSquare-CVtGfIDn.js","assets/Copy01-DUFwBGHZ.js","assets/CreditCard01-4vl-vsk4.js","assets/Download01-DBszkg_x.js","assets/Settings02-CmGQOcPT.js","assets/Eye-CzwEImrg.js","assets/FilterLines-ByiTdPGm.js","assets/Share07-5YpBA79_.js","assets/Globe01-BT9zQGYP.js","assets/Globe04-CUaWBaQZ.js","assets/SwitchHorizontal01--iR18qCk.js","assets/HardDrive-OvDfsdks.js","assets/Key01-C80140fI.js","assets/LinkExternal01-Crdm3X-P.js","assets/LockUnlocked01-BaCHfPNz.js","assets/LogOut01-W-wJ3HBs.js","assets/Monitor01-Ch5Y4tuq.js","assets/Sun-DNrI0Umm.js","assets/Palette-BcDfqcDI.js","assets/Play-DH1W9sUg.js","assets/Plus-DOqutG8C.js","assets/SearchLg-3rGuCUoM.js","assets/SearchMd-eExvU_Cs.js","assets/Shield01-BnZKrg7I.js","assets/Stars01-RuIE5Zdu.js","assets/Trash01-D17XOrLH.js","assets/Upload01-DzeGUE4j.js","assets/User01-9xZCV673.js","assets/Users01-mNF9ASXd.js","assets/XClose-D3a9ZSmL.js","assets/Zap-DV9Keoy4.js","assets/automation-runs-C2HUGQOX.js","assets/select-CZBrxnZP.js","assets/useInfiniteQuery-BNDjieF7.js","assets/use-infinite-scroll-CFU5iMXa.js","assets/use-connection-BXWPlJBx.js","assets/use-mcp-client-C7DoCN8S.js","assets/constants-_08zpzmT.js","assets/auth-dGsBCMlC.js","assets/use-virtual-mcp-DgRlnk4E.js","assets/table-BDqmn3dR.js","assets/empty-state-mkhi1rfX.js","assets/use-members-BKlO0dvu.js","assets/use-org-auth-client-BnzVw0OX.js","assets/use-clock-tick-DHR8fR-3.js","assets/use-automations-CXawOzXl.js","assets/useSuspenseInfiniteQuery-CPbq2GSv.js","assets/avatar-BenMWCiJ.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-DN7yEEj_.js","assets/dialog-DuSBFSga.js","assets/tab-id-C6YUqvRq.js","assets/hooks-rJKJK9uM.js","assets/decopilot-sse-pool-BeJzOsVO.js","assets/backoff-CrEUbyZT.js","assets/delay-CnY5UFtP.js","assets/chat-context-Dfd1-1Lo.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-ai-providers-BZ3Rr2E-.js","assets/use-decopilot-events-85uKVxiJ.js","assets/use-organization-settings-D0Kz-YEB.js","assets/monaco-editor-DAY5kz0b.js","assets/spinner-Dc2wGodB.js","assets/types-DNCJwL4t.js","assets/shell-layout-DiQgbo88.js","assets/required-auth-layout-DWSFcPaB.js","assets/use-org-sso-Llil0EAX.js","assets/integration-icon-CImpG20B.js","assets/use-navigate-to-agent-mhMqplTl.js","assets/reusable-new-chat-CouMjkYR.js","assets/chart-B6MFUsFo.js","assets/index-BY-CqMte.js","assets/form-Bz1Blvsa.js","assets/label-DzYHqeOW.js","assets/input-Ci4t0s2s.js","assets/file-type-icon-ZBtP7G5F.js","assets/dropdown-menu-C8nav0fy.js","assets/page-seo-form-LlbkmsrH.js","assets/switch-cFSs7XoW.js","assets/use-section-preview-base-DGGZVHGT.js","assets/drawer-CHruCnRr.js","assets/collection-search-DJzt3Gor.js","assets/deco-site-production-url-BjY4ZYd-.js","assets/tabs-DXuBW9wa.js","assets/toggle-group-DMRSkixl.js","assets/use-commerce-diagnostic-Eb4IUPoq.js","assets/popover-k9Q2U8MP.js","assets/self-tool-result-TKX8PVRX.js","assets/alert-dialog-CYISmsp0.js","assets/extract-connection-data-BNJ-imMD.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-wubVjvto.js","assets/authenticate-and-persist-oauth-BPXOHlXS.js","assets/mcp-oauth-BLKHxK_9.js","assets/track-CziUhU91.js","assets/toolbar-DatHEDdN.js","assets/github-repo-picker-B8bIONwq.js","assets/use-mcp-tools-krQNfneB.js","assets/agent-capabilities-C4tLW0Za.js","assets/connection-card-ACuj5E9S.js","assets/use-registry-connections-DL69X8pZ.js","assets/retry-CErkP7V6.js","assets/connection-slug-eyAPH6o3.js","assets/textarea-dPhCEXKr.js","assets/connection-form-helpers-Cfz51jR_.js","assets/collection-tabs-DtP7TjJI.js","assets/badge-CliF6PXU.js","assets/command-CKH2r5eb.js","assets/index-CxtBxDI6.js","assets/select-model-Bx_B88dX.js","assets/checkbox-EYTcqsBG.js","assets/ai-providers-logos-DD3qZ33J.js","assets/cards-CwRuFB_T.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-BcGbFKp2.js","assets/use-file-configs-B0lETjBj.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-BW5BR0e-.js","assets/search-input-Duqb8J7K.js","assets/index-Dfj5Ug_S.js","assets/use-secrets-ddoBQmdq.js","assets/AreaChart-yi4TgkYE.js","assets/task-key-C5WsmOV8.js","assets/use-tags-C_oi6adA.js","assets/get-initials-D-f_fDFw.js","assets/automation-list-row-C3v52KPe.js","assets/use-org-repo-syncs-DOv8ph3D.js","assets/file-explorer-DLJoQEI1.js","assets/app-editor-C4t39sNr.js","assets/post-editor-CdIOS9Pq.js","assets/multi-select-Y2ogFLe9.js","assets/block-document-ecGEHpLp.js","assets/primitives-BLv1hHA7.js","assets/use-autosave-D0cOZ97s.js","assets/record-editor-DwWObGXS.js","assets/category-editor-jfBtBcjQ.js","assets/bulk-category-panel-CPeSnbUk.js","assets/seo-editor-NeW6LrgW.js","assets/variant-calendar-3TFN0yrj.js","assets/view-mode-toggle-BxPtdsgT.js","assets/redirect-editor-Cbkccd6C.js","assets/project-app-view-C3T5V3cO.js"])))=>i.map(i=>d[i]);
2
+ import{p as Ls,r as E,ah as lk,ai as ak,c as F,H as We,n as ie,j as r,E as Js,b as re,t as pe,aa as Tr,a5 as So,a8 as Ue,a9 as He,ab as Ke,aj as _s,ak as _i,al as ck,am as nn,an as Om,I as Bm,B as he,ao as zm,ap as jb,aq as dk,ar as uk,x as Ei,as as Es,at as Ho,au as zg,d as Ot,av as zs,e as Xs,q as st,aw as hk,D as ko,ax as fk,ay as Cb,az as mk,aA as Ui,aB as Yf,aC as En,aD as pk,aE as Qf,aF as gk,aG as xk,aH as bk,aI as vk,z as Lh,K as it,aJ as yk,aK as _k,aL as Lk,aM as wk,aN as Nb,aO as ld,o as Vt,k as ut,a as ci,C as Wd,aP as wd,u as lr,f as wh,R as Vb,aQ as Fm,aR as Sk,aS as kk,L as jk,a3 as Tb,aT as T0,aU as Ko,Y as xt,aV as Ab,aW as Eb,aX as Rn,P as yi,aY as St,s as Pb,aZ as Ck,a_ as Nk,a$ as Vk,b0 as Tk,b1 as Ak,b2 as Rb,b3 as Db,b4 as Ib,b5 as Mb,b6 as $b,b7 as Ob,b8 as Bb,b9 as zb,ba as Fb,bb as Ub,bc as In,bd as Hb,be as Ek,bf as Pk,bg as Kb,bh as Rk,bi as Dk,bj as Ik,bk as Mk,bl as xa,bm as $k,bn as Ok,bo as Bk,bp as zk,M as Fk,ag as Uk}from"./index-pn6its_f.js";import{i as Sh,n as Hk}from"./ArrowUp-I330YJW3.js";import{u as jo,a as di,b as Co,c as en,d as Wb,s as Kk,e as Wk,f as qk,g as Gk,h as Yk,i as Qk,j as Jk,k as Um,A as Xk,l as Zk,m as ej,p as qb,V as tj,E as kh,S as Gb,n as Aa,t as sj,o as nj,q as jh,r as ls,v as Ea,H as Sd,w as kd,x as ra,y as Yb,z as Qb,B as ij}from"./chat-context-Dfd1-1Lo.js";import{c as Ch,s as ec,g as Ji,P as jd,d as Hm,t as Zo,a as rj,M as oj,i as lj,b as Ar,e as Nh,f as aj,D as cj,h as dj,j as uj,k as Pa,l as hj,m as fj,u as Km,E as mj,n as qd,o as pj,F as gj,p as Wm,q as qm,r as Jb,S as xj,v as bj,w as vj,x as yj,y as Fg,z as _j,A as Xb,O as Lj,B as No,C as Ki,G as wj,T as Zb,H as Jf,I as qc,J as Sj,K as kj,L as ev,N as jj,Q as ar,R as Cj,U as Nj,V as tv,W as pr,X as Vj,Y as jc,Z as Tj,_ as sv,$ as nv,a0 as Gm,a1 as iv,a2 as Aj,a3 as Ej,a4 as Pj,a5 as Vo,a6 as Ym,a7 as rv,a8 as ov,a9 as lv,aa as Rj,ab as Dj,ac as av,ad as Ij,ae as Mj,af as $j,ag as Oj,ah as Bj,ai as zj}from"./automation-runs-C2HUGQOX.js";import{S as Cd}from"./spinner-Dc2wGodB.js";import{a as ms,b as $t,d as Pt,e as Rt,h as Dn,c as Gn,i as cv}from"./dialog-DuSBFSga.js";import{c as Fj,b as Vh,a as Th,D as Ah,d as dv,e as Uj,f as Hj}from"./drawer-CHruCnRr.js";import{C as Kj}from"./collection-search-DJzt3Gor.js";import{u as Qt,a as Wj,m as qj}from"./use-mcp-client-C7DoCN8S.js";import{a as tc,i as A0,S as sc,b as Gj,W as uv,c as Yj,C as Ug,g as E0,d as hv,e as Hg,f as Qj,Q as Jj,h as Xj,j as Zj,k as eC}from"./constants-_08zpzmT.js";import{u as fv,g as Gd,l as s1,C as tC,a as sC,b as nC}from"./chart-B6MFUsFo.js";import{t as Jt}from"./ChevronDown-CKlR5rwM.js";import{t as iC,z as rC,s as mv,a as Yd,b as Qm,u as oC,c as pv}from"./hooks-rJKJK9uM.js";import{K as lC,i as gv,u as nc,a as xv,m as aC}from"./shell-layout-DiQgbo88.js";import{u as Qd,a as Fs,b as Jm,c as cC}from"./use-virtual-mcp-DgRlnk4E.js";import{w as bv,A as dC,r as ba,b as uC,p as vv,f as g0,c as yv,d as _v,e as Lv,g as hC,F as fC,h as mC,j as pC,k as gC,l as xC,m as bC,O as vC,n as yC,o as _C}from"./tab-id-C6YUqvRq.js";import{r as Xm,p as LC,s as wC}from"./deco-site-production-url-BjY4ZYd-.js";import{i as pl,b as Zm,a as SC}from"./XCircle-DCQf8XEr.js";import{h as wv,j as ep,k as gl,l as Sv,m as tp,n as kv,A as yo,o as jv,p as Ra,s as Er,q as Cv,r as To,u as kC,v as jC,c as Nv,w as Kg,x as ic,y as Nu,z as CC,B as Li,C as oi,D as NC,E as Vv,f as VC,F as Eh,G as xl,H as TC,I as sp,J as Tv,K as Av,L as n1,M as Xf,N as Wg,e as Ph,O as AC,P as EC,Q as PC,R as RC,S as DC,T as np,U as Ev,V as Yn,W as ip,X as rp,d as Jd,Y as Xd,Z as Pv,_ as Rv,$ as Dv,a0 as IC,a1 as op,a2 as MC,a3 as qg,a4 as $C,a5 as OC,t as Iv,a6 as Rh,a7 as Zd,a8 as BC,a9 as jr,aa as mo,i as Dh,ab as zC,ac as FC,ad as UC,ae as HC,af as KC,ag as WC,ah as Cr,ai as Gg,aj as Mv,ak as qC,al as GC,am as YC,an as Da,ao as lp,ap as QC,aq as Yg,ar as JC,as as XC,at as ZC,au as $v,av as eN,aw as tN,ax as sN,ay as nN,az as iN,aA as rN,aB as oN,aC as lN,aD as aN,aE as Ov,aF as ap,aG as cN,aH as dN,aI as uN,aJ as hN}from"./agent-icon-Bs96UMN4.js";import{i as Et}from"./Check-CDgez8no.js";import{a as wi,i as fN,b as cp,c as dp}from"./Tool01-DCPbUowt.js";import{i as Qn}from"./Upload01-DzeGUE4j.js";import{i as pn}from"./AlertCircle-CtXDDPuh.js";import{a as on}from"./Copy01-DUFwBGHZ.js";import{F as i1,a as up,b as hp,c as fp,d as Bv}from"./form-Bz1Blvsa.js";import{d as At,S as js,a as Cs,b as Ps,c as Ns}from"./select-CZBrxnZP.js";import{t as Ih,i as zv,a as mN}from"./UserSquare-CVtGfIDn.js";import{i as Mh}from"./ArrowLeft-DtOVN8vp.js";import{T as Yo,a as rc,b as Xi,c as eu}from"./tabs-DXuBW9wa.js";import{t as r1}from"./Tool02-Bu2KnVcQ.js";import{T as mp,a as Nd}from"./toggle-group-DMRSkixl.js";import{I as pt}from"./input-Ci4t0s2s.js";import{u as pp,b as gp,g as pN,h as gN,i as xN,C as xp,a as bN,c as vN,T as yN,f as _N,A as LN,N as wN}from"./use-commerce-diagnostic-Eb4IUPoq.js";import{u as Fv,M as SN,a as kN,m as $h,i as jN,g as Uv,b as CN,N as NN,c as VN}from"./select-model-Bx_B88dX.js";import{s as Si}from"./XClose-D3a9ZSmL.js";import{a as ts,b as ss,P as ns,c as TN}from"./popover-k9Q2U8MP.js";import{t as Nr}from"./Stars01-RuIE5Zdu.js";import{c as AN,a as Oh,b as bp,d as Hv,e as Kv,u as Qg}from"./use-organization-settings-D0Kz-YEB.js";import{u as Bh,a as EN}from"./use-ai-providers-BZ3Rr2E-.js";import{b as vp,g as tu,c as Wv,a as Qs,r as qv,f as PN,d as RN}from"./agent-capabilities-C4tLW0Za.js";import{f as DN,a as IN,u as Vd,b as oc,c as Gv,d as MN,e as yp,g as el,h as Yv,i as _p,j as $N,k as Lp,l as wp,m as ON,p as BN,n as zN,o as FN,q as UN,r as HN,F as su,t as Qv,s as KN,v as Jv,S as WN,B as qN,w as Xv,x as GN,R as YN}from"./cards-CwRuFB_T.js";import{c as qt,D as Gt,b as Yt,a as et,d as Wi,e as qi,f as Gi,g as Td,h as Zi,i as er,j as Cc}from"./dropdown-menu-C8nav0fy.js";import{s as Dt}from"./Plus-DOqutG8C.js";import{p as QN,q as JN}from"./question-004-sINsf4GQ.js";import{A as Os}from"./avatar-BenMWCiJ.js";import{u as Zv,a as zh}from"./use-members-BKlO0dvu.js";import{i as gn}from"./ChevronRight-BJ3yvnPz.js";import{u as Fh}from"./use-is-desktop-app-BNujXJc_.js";import{i as ui}from"./CheckCircle-yFYdDBYT.js";import{I as Pi}from"./integration-icon-CImpG20B.js";import{e as nu}from"./backoff-CrEUbyZT.js";import{u as XN}from"./use-status-sounds-BcGbFKp2.js";import{E as _o}from"./empty-state-mkhi1rfX.js";import{T as uo,a as ZN}from"./toolbar-DatHEDdN.js";import{b as ey,n as Sp}from"./ZapSquare-Cs9IlPcM.js";import{i as Pr,a as eV}from"./Share07-5YpBA79_.js";import{i as Mn}from"./Globe01-BT9zQGYP.js";import{i as ty}from"./Monitor01-Ch5Y4tuq.js";import{u as ki,a as kp,b as jp}from"./use-connection-BXWPlJBx.js";import{u as sy,a as Cp,b as ny}from"./use-mcp-tools-krQNfneB.js";import{g as Uh,M as tV}from"./types-DNCJwL4t.js";import{F as nr}from"./file-type-icon-ZBtP7G5F.js";import{d as Np,c as Vp,s as Hh,b as sV}from"./TrendUp01-P2ZZoWEf.js";import{u as Tp,a as iy}from"./use-file-configs-B0lETjBj.js";import{n as Ia}from"./Download01-DBszkg_x.js";import{n as mn}from"./LinkExternal01-Crdm3X-P.js";import{l as ry,w as Jg,M as iu,F as nV}from"./monaco-editor-DAY5kz0b.js";import{i as Kh}from"./Key01-C80140fI.js";import{p as iV,f as rV}from"./pt-BR-CLy76QW2.js";import{g as oV,e as lV}from"./extract-connection-data-BNJ-imMD.js";import{a as aV,i as Xg}from"./mcp-oauth-BLKHxK_9.js";import{A as Ma,a as $a,b as Oa,c as Ba,d as za,e as Fa,f as Ua,g as Ha}from"./alert-dialog-CYISmsp0.js";import{L as Mt}from"./label-DzYHqeOW.js";import{S as Rr}from"./switch-cFSs7XoW.js";import{T as Dr}from"./textarea-dPhCEXKr.js";import{i as tl}from"./Play-DH1W9sUg.js";import{s as Zs}from"./Trash01-D17XOrLH.js";import{u as P0}from"./use-debounced-autosave-BW5BR0e-.js";import{i as Ad}from"./SearchMd-eExvU_Cs.js";import{C as lc}from"./checkbox-EYTcqsBG.js";import{S as Wh}from"./search-input-Duqb8J7K.js";import{C as oy}from"./collection-tabs-DtP7TjJI.js";import{T as ly,u as ay,I as cV,R as dV,a as uV}from"./index-Dfj5Ug_S.js";import{n as hV}from"./LockUnlocked01-BaCHfPNz.js";import{g as fV,s as cy}from"./connection-slug-eyAPH6o3.js";import{a as mV,i as pV}from"./Settings02-CmGQOcPT.js";import{d as ac}from"./delay-CnY5UFtP.js";import{G as kn,a as Ap,u as gV}from"./github-repo-picker-B8bIONwq.js";import{s as R0}from"./User01-9xZCV673.js";import{t as Ep}from"./Users01-mNF9ASXd.js";import{u as dy,a as uy}from"./use-secrets-ddoBQmdq.js";import{i as hy,a as Pp}from"./DotsVertical-BVAKyUxS.js";import{a as cc}from"./format-time-BnbuEtat.js";import{f as fy,g as xV,l as my,a as bV}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as vV}from"./authenticate-and-persist-oauth-BPXOHlXS.js";import{X as yV,A as _V,a as LV}from"./AreaChart-yi4TgkYE.js";import{t as wV,u as py,a as gy,p as SV}from"./task-key-C5WsmOV8.js";import{s as dc}from"./Eye-CzwEImrg.js";import{D as kV,R as jV,i as Ed,a as CV,S as os,b as xy,n as NV}from"./decopilot-sse-pool-BeJzOsVO.js";import{u as Zf}from"./use-copy-DN7yEEj_.js";import{i as Rp,c as by}from"./SwitchHorizontal01--iR18qCk.js";import{u as Dp,a as VV,b as TV}from"./use-tags-C_oi6adA.js";import{g as Wn}from"./get-initials-D-f_fDFw.js";import{C as hi,a as Jn,b as Ut,c as fs,d as fi,e as Ri,f as AV,g as Zg}from"./command-CKH2r5eb.js";import{i as qh}from"./ChevronSelectorVertical-DrytqWO7.js";import{i as Ip}from"./FilterLines-ByiTdPGm.js";import{i as Gh}from"./SearchLg-3rGuCUoM.js";import{u as o1,a as EV,c as PV,p as RV,b as DV}from"./self-tool-result-TKX8PVRX.js";import{a as l1}from"./Palette-BcDfqcDI.js";import{u as Yh}from"./use-debounced-value-wubVjvto.js";import{u as vy}from"./useInfiniteQuery-BNDjieF7.js";import{i as Ir}from"./Zap-DV9Keoy4.js";import{B as IV}from"./badge-CliF6PXU.js";import{u as ru,a as MV,b as $V,c as OV,d as BV}from"./use-automations-CXawOzXl.js";import{s as ad}from"./Stars02-BQJTArZQ.js";import{A as zV}from"./automation-list-row-C3v52KPe.js";import{u as FV,a as UV}from"./use-org-repo-syncs-DOv8ph3D.js";import{n as yy}from"./ChevronUp-Bk64bZHd.js";function Qh(t,e){const s=Ls(e);return HV({filters:{...t,status:"pending"}},s).length}function e3(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function HV(t={},e){const s=Ls(e).getMutationCache(),n=E.useRef(t),i=E.useRef(null);return i.current===null&&(i.current=e3(s,t)),E.useEffect(()=>{n.current=t}),E.useSyncExternalStore(E.useCallback(o=>s.subscribe(()=>{const l=lk(i.current,e3(s,n.current));i.current!==l&&(i.current=l,ak.schedule(o))}),[s]),()=>i.current,()=>i.current)}const t3=3,_y="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",KV="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Ly(t){const e=F.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:o,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=Ji(c._meta);d=c.title??Hm(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(a==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const w=o||i,j=i&&"bg-accent/40",N=(o||i)&&"cursor-not-allowed opacity-50";let A;e[7]!==j||e[8]!==N?(A=ie(KV,"hover:bg-accent/60 text-foreground",j,N),e[7]=j,e[8]=N,e[9]=A):A=e[9];let C;e[10]!==h?(C=r.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=C):C=e[11];let T;e[12]!==i?(T=i&&r.jsx(Cd,{size:"xs"}),e[12]=i,e[13]=T):T=e[13];let V;e[14]!==C||e[15]!==T?(V=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,T]}),e[14]=C,e[15]=T,e[16]=V):V=e[16];let R;e[17]!==u?(R=u&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=R):R=e[18];let P;return e[19]!==V||e[20]!==R||e[21]!==S||e[22]!==w||e[23]!==A?(P=r.jsxs("button",{type:"button",onClick:S,disabled:w,className:A,children:[V,R]}),e[19]=V,e[20]=R,e[21]=S,e[22]=w,e[23]=A,e[24]=P):P=e[24],P}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=o||i,p=i&&"bg-muted/50",g=(o||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(_y,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=r.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(Cd,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let y;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(y=r.jsx(Ue,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=y):y=e[40];const L=u??h;let _;e[41]!==L?(_=r.jsx(He,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=_):_=e[42];let k;return e[43]!==y||e[44]!==_?(k=r.jsxs(Ke,{delayDuration:400,children:[y,_]}),e[43]=y,e[44]=_,e[45]=k):k=e[45],k}function WV(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=re(),[c,d]=E.useState(""),h=!!l;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(C=>{const T=c.toLowerCase();return C.prompt.name.toLowerCase().includes(T)||(C.prompt.title??"").toLowerCase().includes(T)||(C.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,m=So();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==l?.name||e[10]!==i||e[11]!==o){let C;e[13]!==h||e[14]!==l?.name||e[15]!==i||e[16]!==o?(C=T=>r.jsx(Ly,{item:T,variant:"card",onSelect:V=>{i(!1),o(V)},isLoading:l?.name===T.prompt.name,isDisabled:h&&l?.name!==T.prompt.name},T.prompt.name),e[13]=h,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=h,e[9]=l?.name,e[10]=i,e[11]=o,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=C=>{C.key==="Escape"&&d("")},e[23]=y):y=e[23];let L;e[24]!==c||e[25]!==v?(L=r.jsx(Kj,{value:c,onChange:d,placeholder:v,onKeyDown:y}),e[24]=c,e[25]=v,e[26]=L):L=e[26];const _=L;if(m){let C;e[27]!==a?(C=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=C):C=e[28];let T;e[29]!==C?(T=r.jsx(Fj,{className:"sr-only",children:r.jsx(Vh,{children:C})}),e[29]=C,e[30]=T):T=e[30];let V;e[31]!==a?(V=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=V):V=e[32];let R;e[33]!==V?(R=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:V})}),e[33]=V,e[34]=R):R=e[34];let P;e[35]!==b||e[36]!==_||e[37]!==R||e[38]!==T?(P=r.jsxs(Th,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,R,_,b]}),e[35]=b,e[36]=_,e[37]=R,e[38]=T,e[39]=P):P=e[39];let M;return e[40]!==i||e[41]!==n||e[42]!==P?(M=r.jsx(Tr,{delayDuration:400,children:r.jsx(Ah,{open:n,onOpenChange:i,children:P})}),e[40]=i,e[41]=n,e[42]=P,e[43]=M):M=e[43],M}let k;e[44]!==a?(k=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=k):k=e[45];let S;e[46]!==k?(S=r.jsx(ms,{className:"sr-only",children:r.jsx($t,{children:k})}),e[46]=k,e[47]=S):S=e[47];let w;e[48]!==a?(w=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=w):w=e[49];let j;e[50]!==w?(j=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:w})}),e[50]=w,e[51]=j):j=e[51];let N;e[52]!==b||e[53]!==_||e[54]!==j||e[55]!==S?(N=r.jsxs(Pt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,_,b]}),e[52]=b,e[53]=_,e[54]=j,e[55]=S,e[56]=N):N=e[56];let A;return e[57]!==i||e[58]!==n||e[59]!==N?(A=r.jsx(Tr,{delayDuration:400,children:r.jsx(Rt,{open:n,onOpenChange:i,children:N})}),e[57]=i,e[58]=n,e[59]=N,e[60]=A):A=e[60],A}function qV(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=re(),[a,c]=E.useState(!1);if(s.length===0)return null;let d,h,u,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,t3),v=s.slice(t3),y=!!i;let L;e[10]!==y||e[11]!==i?.name||e[12]!==n?(L=k=>r.jsx(Ly,{item:k,onSelect:n,isLoading:i?.name===k.prompt.name,isDisabled:y&&i?.name!==k.prompt.name},k.prompt.name),e[10]=y,e[11]=i?.name,e[12]=n,e[13]=L):L=e[13];const _=b.map(L);d=Tr,m=400,e[14]!==o?(h=ie("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=h):h=e[15],u=_,f=v.length>0&&r.jsx("button",{type:"button",disabled:y,onClick:()=>c(!0),className:ie(_y,"hover:bg-muted/70 hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=o,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]=m}else d=e[5],h=e[6],u=e[7],f=e[8],m=e[9];let p;e[16]!==h||e[17]!==u||e[18]!==f?(p=r.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=r.jsx(WV,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=r.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function GV(){return null}function YV(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 QV(t){const e=F.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=di(),{org:o}=We();let l;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(l={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.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}=fv(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(JV),e[8]=u,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=E.useReducer(YV,p),[b,v]=E.useState(null);let y;e[11]!==a||e[12]!==i||e[13]!==n?(y=async(V,R)=>{if(!a){pe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const P=await Gd(a,V.name,R);x({type:"RESET"});const M={type:"doc",content:[{type:"paragraph",content:[Ch({id:V.name,name:ec(V.name,Ji(V._meta)),metadata:P.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await i(M)}catch(P){console.error("[ice-breakers] Failed to fetch prompt:",P),pe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=y):y=e[14];const L=y;let _;e[15]!==L?(_=async V=>{if(V.arguments&&V.arguments.length>0){x({type:"SELECT_PROMPT",prompt:V}),v(V);return}x({type:"START_LOADING",prompt:V}),await L(V)},e[15]=L,e[16]=_):_=e[16];const k=_;let S;e[17]!==b||e[18]!==L?(S=async V=>{b&&(x({type:"START_LOADING",prompt:b,arguments:V}),v(null),await L(b,V))},e[17]=b,e[18]=L,e[19]=S):S=e[19];const w=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let N;e[20]!==k||e[21]!==m||e[22]!==j?(N=r.jsx(qV,{items:m,onSelect:k,loadingPrompt:j}),e[20]=k,e[21]=m,e[22]=j,e[23]=N):N=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{v(null),x({type:"RESET"})},e[24]=A):A=e[24];let C;e[25]!==b||e[26]!==w?(C=r.jsx(jd,{prompt:b,setPrompt:A,onSubmit:w}),e[25]=b,e[26]=w,e[27]=C):C=e[27];let T;return e[28]!==N||e[29]!==C?(T=r.jsxs(r.Fragment,{children:[N,C]}),e[28]=N,e[29]=C,e[30]=T):T=e[30],T}function JV(t){return{prompt:t}}function XV(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=jo(),{org:i}=We();let o;e[0]!==i.id?(o=tc(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=o.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=r.jsx(GV,{}),e[4]=h):h=e[4];let u;e[5]!==a?(u=r.jsx(QV,{connectionId:a}),e[5]=a,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=r.jsx(Js,{fallback:null,children:r.jsx(E.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const e9="cubic-bezier(0.645, 0.045, 0.355, 1)",ZV=44,eT={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"},tT={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},sT={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Lo(t){const e=F.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,m=re(),[p,g]=E.useState(d),[x,b]=E.useState(!1);let v;e[0]!==u?(v=()=>{b(!0),u?.()},e[0]=u,e[1]=v):v=e[1];const y=v;if(x)return null;const L=tT[f],_=eT[f];let k;e[2]!==L||e[3]!==_?(k=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,_),e[2]=L,e[3]=_,e[4]=k):k=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(nT),e[5]=S):S=e[5];const w=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let N;e[6]!==w||e[7]!==j?(N=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",w,j),e[6]=w,e[7]=j,e[8]=N):N=e[8];const A=sT[f];let C;e[9]!==A?(C=ie("shrink-0",A),e[9]=A,e[10]=C):C=e[10];let T;e[11]!==s||e[12]!==C?(T=r.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=T):T=e[13];let V;e[14]!==n?(V=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=V):V=e[15];let R;e[16]!==i?(R=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=R):R=e[17];const P=p?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==P?(M=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(Jt,{size:16,style:{transform:P,transition:`transform 180ms ${e9}`}})}),e[18]=P,e[19]=M):M=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let z,I;e[24]!==y?(z=Z=>{Z.stopPropagation(),y()},I=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),y())},e[24]=y,e[25]=z,e[26]=I):(z=e[25],I=e[26]);let O;e[27]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(_s,{size:16}),e[27]=O):O=e[27];let B;e[28]!==D||e[29]!==$||e[30]!==z||e[31]!==I?(B=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:$,onClick:z,onKeyDown:I,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:O}),e[28]=D,e[29]=$,e[30]=z,e[31]=I,e[32]=B):B=e[32];let U;e[33]!==p||e[34]!==T||e[35]!==V||e[36]!==R||e[37]!==M||e[38]!==B||e[39]!==N?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:N,children:[T,V,R,M,B]}),e[33]=p,e[34]=T,e[35]=V,e[36]=R,e[37]=M,e[38]=B,e[39]=N,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let K;e[41]!==H?(K={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${e9}`},e[41]=H,e[42]=K):K=e[42];let W;e[43]===Symbol.for("react.memo_cache_sentinel")?(W={overflow:"hidden",minHeight:0},e[43]=W):W=e[43];const Y=p?1:0;let Q;e[44]!==Y?(Q={opacity:Y,transition:`opacity 120ms ${e9}`,maxHeight:"60vh"},e[44]=Y,e[45]=Q):Q=e[45];let te;e[46]!==o?(te=o?r.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:o})}):r.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=o,e[47]=te):te=e[47];let ee;e[48]!==c||e[49]!==o?(ee=c?r.jsx("div",{className:ie("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=ee):ee=e[50];let oe;e[51]!==te||e[52]!==ee?(oe=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[te,ee]}),e[51]=te,e[52]=ee,e[53]=oe):oe=e[53];let se;e[54]!==l||e[55]!==a?(se=l||a?r.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:l}),r.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=se):se=e[56];let G;e[57]!==Q||e[58]!==oe||e[59]!==se?(G=r.jsx("div",{style:W,children:r.jsxs("div",{className:"flex flex-col",style:Q,children:[oe,se]})}),e[57]=Q,e[58]=oe,e[59]=se,e[60]=G):G=e[60];let X;e[61]!==K||e[62]!==G?(X=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:G}),e[61]=K,e[62]=G,e[63]=X):X=e[63];let q;return e[64]!==U||e[65]!==X||e[66]!==k||e[67]!==f?(q=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:k,children:[U,X]}),e[64]=U,e[65]=X,e[66]=k,e[67]=f,e[68]=q):q=e[68],q}function nT(t){return!t}const iT=_i({content:nn().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Om(["pending","in_progress","completed"]),activeForm:nn().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),wy=_i({todos:ck(iT)}),rT="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.";iC({description:rT,inputSchema:rC(wy),execute:async({todos:t})=>({ok:!0,count:t.length})});const oT="tool-todo_write",lT=new Set(["input-available","output-available"]);function aT(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 o=n[i];if(o.type!==oT||typeof o.state!="string"||!lT.has(o.state))continue;const l=wy.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function Sy(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:Zo(rj(n)),input:s.input})}return e}function ky(t){return t.at(-1)}function jy(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 cT(t){return t?t.message.startsWith("[CREDITS]"):!1}const dT="[SUBSCRIPTION_REQUIRED]";function Cy(t){return t?.message.startsWith(dT)?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 uT={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function hT(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&cT(s))return{...uT,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,h=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,u=jy(a),f=Sy(c),m=aT(e),p=i?null:Cy(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=u.length>0,y=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:y,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:m}}function Ny(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=di(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==o||t[2]!==e||t[3]!==l||t[4]!==a?(c=hT({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:o}),t[0]=i,t[1]=o,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function fT(){const t=Ny();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 Vy(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 mT="__home__";function Mp(t,e){return Bm.chatDraft(t,e)}function pT(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 Ty(t,e,s,n,i){const o=Mp(e,s);if(Vy(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(xT(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function s3(t,e,s){const n=Mp(e,s),i=t.getItem(n),o=pT(i);return i!==null&&o===null&&t.removeItem(n),o}function gT(t,e,s){t.removeItem(Mp(e,s))}function xT(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function bT(t){return t==="cms"||t==="sandbox"?t:null}function vT(t,e){const s=Xm(t),n=!!s&&t?.fastPreview===!0;return{runtime:bT(e?.runtime)==="sandbox"?"sandbox":n?"cms":"sandbox",fastPreviewCapability:n,previewServerUrl:s}}function ji(t,e){const{runtime:s,previewServerUrl:n}=vT(t,e);return{previewServerUrl:n,active:s==="cms"}}function yT(t,e){const s=ji(t).active,n=ji(t,e).active;return s&&!n}function ou(){return Co()?.activeTask?.metadata}function _T(t){const e=F.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=re();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ie("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]!==l?(h=l("chat.pagination.previousLabel"),e[2]=l,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Mh,{size:14}),e[4]=u):u=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==h?(f=r.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":h,children:u}),e[5]=i,e[6]=a,e[7]=d,e[8]=h,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=r.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let v;e[16]!==b?(v=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let y;e[18]!==l?(y=l("chat.pagination.nextLabel"),e[18]=l,e[19]=y):y=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(pl,{size:14}),e[20]=L):L=e[20];let _;e[21]!==o||e[22]!==x||e[23]!==v||e[24]!==y?(_=r.jsx("button",{type:"button",onClick:o,disabled:x,className:v,"aria-label":y,children:L}),e[21]=o,e[22]=x,e[23]=v,e[24]=y,e[25]=_):_=e[25];let k;return e[26]!==_||e[27]!==f||e[28]!==g?(k=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,_]}),e[26]=_,e[27]=f,e[28]=g,e[29]=k):k=e[29],k}function Ay(t){const e=F.c(8),{currentIndex:s,total:n,onPrev:i,onNext:o,extraLeft:l}=t;let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a=r.jsx(_T,{current:s,total:n,onPrev:i,onNext:o}),e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=r.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function LT(t){const e=F.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,submitLabel:l,nextLabel:a}=t,h=n?l===void 0?"Submit":l:a===void 0?"Next":a,u=n?s:!i,f=u?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==u||e[1]!==o?(m=()=>{u||o()},e[0]=u,e[1]=o,e[2]=m):m=e[2];const p=u&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==u||e[6]!==h||e[7]!==m||e[8]!==g?(x=r.jsx(he,{type:"button",size:"sm","aria-disabled":u,onClick:m,className:g,children:h}),e[5]=u,e[6]=h,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let v;e[10]!==b?(v=r.jsx(Ue,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(He,{children:f}),e[12]=f,e[13]=y):y=e[13];let L;return e[14]!==v||e[15]!==y?(L=r.jsxs(Ke,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=L):L=e[16],L}function Ey(t,e,s){return t.findIndex(n=>e(n)===s)}function n3(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function i3(t,e,s,n,i){if(t.length===0)return null;const o=Ey(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(o+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function wT(t){return!t.isStreaming&&t.allAnswered}function Py(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,h]=E.useState(c),[u,f]=E.useState(!1),m=zm({resolver:jb(n),defaultValues:i}),p=m.watch(),g=Ey(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=n3(e,s,p,l),y=wT({isStreaming:o,allAnswered:v}),L=()=>{if(g>0){const A=e[g-1];A&&h(s(A))}},_=()=>{if(g>=0&&g<e.length-1){const A=e[g+1];A&&h(s(A))}},k=()=>{const A=m.getValues(),C=i3(e,s,A,l,d);C&&h(C)},S=()=>{m.handleSubmit(A=>{const C=A;for(const T of e)a(T,C[s(T)])})()},w=E.useRef(S);w.current=S;const j=()=>{y&&(f(!1),w.current())},N=()=>{const A=m.getValues();if(n3(e,s,A,l)){if(o){f(!0);return}f(!1),w.current()}else{const C=i3(e,s,A,l,d);C&&h(C)}};return E.useEffect(()=>{if(u&&!o){if(!v){f(!1);return}f(!1),w.current()}},[u,o,v]),{form:m,activeKey:d,setActiveKey:h,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:y,goPrev:L,goNext:_,advanceToNextUnanswered:k,submit:j,submitOrAdvance:N}}const Ry="chat.approval.defaultDenyReason";function Dy(t){const e=F.c(36),{onYolo:s}=t,n=re(),[i,o]=Ei();let l,a,c,d,h,u,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const L=Ho.find(S=>S.value===i.toolApprovalLevel)??Ho[0];let _;e[13]!==s||e[14]!==i||e[15]!==o?(_=S=>{const w=S,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:w}),w==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=_):_=e[16];const k=_;c=js,m=i.toolApprovalLevel,p=k,a=Cs,h="xs",u="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=ST,l=Ps,d=n(L.shortKey),e[0]=s,e[1]=i,e[2]=o,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=h,e[9]=u,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],h=e[8],u=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=r.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==h||e[22]!==u||e[23]!==f||e[24]!==g?(x=r.jsx(a,{size:h,className:u,onClick:f,children:g}),e[20]=a,e[21]=h,e[22]=u,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=Ho.map(L=>r.jsx(At,{value:L.value,children:n(L.labelKey)},L.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=r.jsx(Ns,{children:b}),e[28]=b,e[29]=v):v=e[29];let y;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(y=r.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=y):y=e[35],y}function ST(t){return t.stopPropagation()}function Iy(t){const e=F.c(8),{input:s}=t,n=re();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=r.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let o;return e[6]!==i?(o=r.jsx("div",{className:"px-4",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[6]=i,e[7]=o):o=e[7],o}function kT(t){const e=F.c(38),{approval:s,onRespond:n}=t,i=re(),[o]=Ei(),l=o.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(Ry),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const h=d;let u;e[9]!==s.approvalId||e[10]!==n?(u=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=u):u=e[11];const f=u;let m;e[12]!==f?(m=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(Dy,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=r.jsx(he,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let v;e[21]!==h||e[22]!==b?(v=r.jsx(he,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:h,children:b}),e[21]=h,e[22]=b,e[23]=v):v=e[23];let y;e[24]!==x||e[25]!==v?(y=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=y):y=e[26];const L=y;let _;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(Ih,{size:14}),e[27]=_):_=e[27];let k;e[28]!==i?(k=i("chat.approval.needsApproval"),e[28]=i,e[29]=k):k=e[29];let S;e[30]!==s.input?(S=r.jsx(Iy,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let w;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==k||e[36]!==S?(w=r.jsx(Lo,{icon:_,label:k,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=k,e[36]=S,e[37]=w):w=e[37],w}const jT=dk(nn(),_i({approved:uk().optional(),levelOverride:Om(["auto","readonly"]).optional()}));function CT(t){const e=F.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=re(),[l]=Ei(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(TT)),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==a||e[3]!==i||e[4]!==o?(h=(C,T)=>{const V=T;typeof V?.approved=="boolean"&&i(C.approvalId,V.approved,V.approved===!1?o(Ry):void 0,V.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=h):h=e[5];let u;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==h?(u={parts:s,partKey:VT,schema:jT,defaultValues:d,isStreaming:n,hasAnswer:NT,onSubmit:h},e[6]=s,e[7]=d,e[8]=n,e[9]=h,e[10]=u):u=e[10];const f=Py(u);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:C}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(Ih,{size:14}),e[16]=v):v=e[16];let y;e[17]!==s.length||e[18]!==o?(y=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=y):y=e[19];const L=g?.friendlyName??"";let _;e[20]!==p?(_=r.jsx(Dy,{onYolo:p}),e[20]=p,e[21]=_):_=e[21];let k;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==_?(k=r.jsx(Ay,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:_}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=_,e[27]=k):k=e[27];let S;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(S=g?r.jsx(AT,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=S):S=e[31];let w;e[32]!==g?(w=g?r.jsx(Iy,{input:g.input}):null,e[32]=g,e[33]=w):w=e[33];let j;e[34]!==k||e[35]!==S||e[36]!==w||e[37]!==y||e[38]!==L?(j=r.jsx(Lo,{icon:v,label:y,title:L,defaultExpanded:!0,footerLeft:k,footerRight:S,children:w}),e[34]=k,e[35]=S,e[36]=w,e[37]=y,e[38]=L,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==b?(N=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=N):N=e[42];let A;return e[43]!==f.form||e[44]!==N?(A=r.jsx(i1,{...x,children:N}),e[43]=f.form,e[44]=N,e[45]=A):A=e[45],A}function NT(t){return typeof t?.approved=="boolean"}function VT(t){return t.approvalId}function TT(t){return[t.approvalId,{approved:void 0}]}function AT(t){const e=F.c(7),{approvalId:s,control:n,onChange:i}=t,o=re(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:h}=d,u=h.value===!0,f=h.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(he,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!1),i()},"aria-pressed":f,children:o("chat.approval.denyButton")}),r.jsx(he,{type:"button",variant:u?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!0),i()},"aria-pressed":u,children:o("chat.approval.acceptButton")})]})},e[0]=i,e[1]=o,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=r.jsx(Es,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function ET(){const t=F.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Ih,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function PT(t){const e=F.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(ET,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=r.jsx(kT,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let o;return e[4]!==s||e[5]!==n||e[6]!==i?(o=r.jsx(CT,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function RT(t){const e=F.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=re();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==o?(c=o("chat.proposePlan.keepIterating"),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=r.jsx(he,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==o?(h=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=h):h=e[9];let u;e[10]!==a||e[11]!==h?(u=r.jsx(he,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:h}),e[10]=a,e[11]=h,e[12]=u):u=e[12];let f;e[13]!==d||e[14]!==u?(f=r.jsxs(r.Fragment,{children:[d,u]}),e[13]=d,e[14]=u,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(wv,{size:14}),e[16]=p):p=e[16];let g;e[17]!==o?(g=o("chat.proposePlan.planReady"),e[17]=o,e[18]=g):g=e[18];let x;e[19]!==o?(x=o("chat.proposePlan.implementationPlan"),e[19]=o,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=r.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:r.jsx(oj,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=r.jsx(Lo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=v):v=e[27],v}function DT(t){const e=F.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=ky(s),e[0]=s,e[1]=o):o=e[1];const l=o;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=r.jsx(RT,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function My(t){return t?"response"in t?t.response:t.option??t.draft:""}const r3=_i({response:nn().min(1,"Response is required")}),IT=_i({option:nn().nullable(),draft:nn()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),MT=_i({response:Om(["yes","no"])});function $T(t){switch(t.type){case"text":return r3;case"choice":return IT;case"confirm":return MT;default:return r3}}function OT(t){const e={};for(const s of t)e[s.toolCallId]=$T(s.input);return _i(e)}function BT(t){const e=F.c(7),{control:s,name:n,placeholder:i}=t,o=re();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,h=d.value??"";return r.jsxs(up,{children:[r.jsx(hp,{children:r.jsx("div",{className:"px-2",children:r.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(ep,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:h,type:"text",placeholder:i||o("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":o("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(fp,{})]})},e[0]=i,e[1]=o,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=r.jsx(Bv,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function $y(t,e){const s=F.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const o=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),E.useEffect(n,i)}function zT(t){const e=F.c(51),{control:s,name:n,options:i}=t,o=re(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=zg(a),d=`${n}.draft`;let h;e[3]!==s||e[4]!==d?(h={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=h):h=e[5];const{field:u}=zg(h),f=c.value,m=u.value??"";let p;if(e[6]!==c||e[7]!==i?(p=P=>{const M=i[P];M!=null&&c.onChange(M)},e[6]=c,e[7]=i,e[8]=p):p=e[8],$y(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==o?(x=o("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=o,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==o){let P;e[16]!==c||e[17]!==f||e[18]!==o?(P=(M,D)=>{const $=f===M;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(M),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",$&&"bg-accent/50",!$&&"hover:bg-accent/30"),"aria-label":o("chat.userAskQuestion.selectOption",{option:M}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",$?"bg-chart-1 text-white":"bg-muted text-foreground"),children:D+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${D}-${M}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=P):P=e[19],b=i.map(P),e[11]=c,e[12]=f,e[13]=i,e[14]=o,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",y=!g&&"hover:bg-accent/30";let L;e[20]!==v||e[21]!==y?(L=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,y),e[20]=v,e[21]=y,e[22]=L):L=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(ep,{size:16,className:"text-muted-foreground"})}),e[23]=_):_=e[23];const k=g?m:"";let S;e[24]!==u||e[25]!==c||e[26]!==f?(S=P=>{u.onChange(P.target.value),f!==null&&c.onChange(null)},e[24]=u,e[25]=c,e[26]=f,e[27]=S):S=e[27];let w;e[28]!==c||e[29]!==f?(w=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=w):w=e[30];let j;e[31]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let N;e[33]!==o?(N=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=N):N=e[34];let A;e[35]!==k||e[36]!==S||e[37]!==w||e[38]!==j||e[39]!==N?(A=r.jsx("input",{type:"text",value:k,onChange:S,onFocus:w,placeholder:j,"aria-label":N,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=k,e[36]=S,e[37]=w,e[38]=j,e[39]=N,e[40]=A):A=e[40];let C;e[41]!==L||e[42]!==A?(C=r.jsxs("label",{className:L,children:[_,A]}),e[41]=L,e[42]=A,e[43]=C):C=e[43];let T;e[44]!==C||e[45]!==x||e[46]!==b?(T=r.jsx(hp,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=T):T=e[47];let V;e[48]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(fp,{}),e[48]=V):V=e[48];let R;return e[49]!==T?(R=r.jsxs(up,{children:[T,V]}),e[49]=T,e[50]=R):R=e[50],R}function FT(t){const e=F.c(8),{control:s,name:n}=t,i=re();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=E.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{a.current?.onChange(l[u]??"")},e[1]=c):c=e[1],$y(l.length,c);let d;e[2]!==i?(d=u=>{const{field:f}=u;return a.current=f,r.jsxs(up,{children:[r.jsx(hp,{children:r.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=f.value===m;return r.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ie("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),r.jsx(fp,{})]})},e[2]=i,e[3]=d):d=e[3];let h;return e[4]!==s||e[5]!==n||e[6]!==d?(h=r.jsx(Bv,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=h):h=e[7],h}function o3(t){const e=F.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const o=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==o?(l=r.jsx(BT,{control:n,name:o,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=o,e[3]=l):l=e[3],l}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const l=o;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=r.jsx(zT,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const o=`${i}.response`;let l;return e[10]!==n||e[11]!==o?(l=r.jsx(FT,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function UT(t){const e=F.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=OT(s.map(qT)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(WT)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(I,O)=>{const B=My(O);B&&i(I,B)},e[4]=i,e[5]=d):d=e[5];let h;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(h={parts:s,partKey:KT,schema:l,defaultValues:c,isStreaming:n,hasAnswer:HT,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=h):h=e[11];const u=Py(h),f=u.currentPart,m=re();let p;e[12]!==f||e[13]!==u||e[14]!==m?(p=()=>{const I=f;if(!I)return;const O=m("chat.userAskQuestion.skipMessage"),B=I.toolCallId;I.input?.type==="choice"?(u.form.setValue(`${B}.option`,null),u.form.setValue(`${B}.draft`,O)):u.form.setValue(`${B}.response`,O),u.advanceToNextUnanswered()},e[12]=f,e[13]=u,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==u.currentIndex||e[17]!==u.goNext||e[18]!==u.goPrev||e[19]!==s.length?(x=r.jsx(Ay,{currentIndex:u.currentIndex,total:s.length,onPrev:u.goPrev,onNext:u.goNext}),e[16]=u.currentIndex,e[17]=u.goNext,e[18]=u.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let y;e[23]!==g||e[24]!==v?(y=r.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=y):y=e[25];let L;e[26]!==u.isAllAnswered||e[27]!==u.isCurrentAnswered||e[28]!==u.submitOrAdvance||e[29]!==n?(L=r.jsx(LT,{isStreaming:n,isAllAnswered:u.isAllAnswered,isCurrentAnswered:u.isCurrentAnswered,onAdvanceOrSubmit:u.submitOrAdvance}),e[26]=u.isAllAnswered,e[27]=u.isCurrentAnswered,e[28]=u.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let _;e[31]!==y||e[32]!==L?(_=r.jsxs(r.Fragment,{children:[y,L]}),e[31]=y,e[32]=L,e[33]=_):_=e[33];const k=_;if(s.length===1){const I=s[0];if(!I?.input)return null;const O=u.form;let B;e[34]!==u?(B=oe=>{oe.preventDefault(),u.submit()},e[34]=u,e[35]=B):B=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(r1,{size:14}),e[36]=U):U=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let K;e[39]!==I.input?.prompt||e[40]!==m?(K=I.input?.prompt??m("chat.userAskQuestion.question"),e[39]=I.input?.prompt,e[40]=m,e[41]=K):K=e[41];const W=I.input;let Y;e[42]!==u.form.control||e[43]!==I.toolCallId||e[44]!==W?(Y=r.jsx(o3,{input:W,control:u.form.control,toolCallId:I.toolCallId}),e[42]=u.form.control,e[43]=I.toolCallId,e[44]=W,e[45]=Y):Y=e[45];let Q;e[46]!==k||e[47]!==H||e[48]!==K||e[49]!==Y?(Q=r.jsx(Lo,{icon:U,label:H,title:K,defaultExpanded:!0,footerRight:k,children:Y}),e[46]=k,e[47]=H,e[48]=K,e[49]=Y,e[50]=Q):Q=e[50];let te;e[51]!==B||e[52]!==Q?(te=r.jsx("form",{onSubmit:B,autoComplete:"off",children:Q}),e[51]=B,e[52]=Q,e[53]=te):te=e[53];let ee;return e[54]!==u.form||e[55]!==te?(ee=r.jsx(i1,{...O,children:te}),e[54]=u.form,e[55]=te,e[56]=ee):ee=e[56],ee}const S=u.form;let w;e[57]!==u?(w=I=>{I.preventDefault(),u.submit()},e[57]=u,e[58]=w):w=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(r1,{size:14}),e[59]=j):j=e[59];let N;e[60]!==m?(N=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=N):N=e[61];const A=u.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==A?(C=m("chat.userAskQuestion.questionCount",{current:A,total:s.length}),e[62]=s.length,e[63]=m,e[64]=A,e[65]=C):C=e[65];let T;e[66]!==f?.input?.prompt||e[67]!==m?(T=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=T):T=e[68];const V=u.activeKey,R=u.setActiveKey;let P;if(e[69]!==u.form||e[70]!==s){let I;e[72]!==u.form?(I=O=>r.jsx(Yo,{value:O.toolCallId,className:"mt-0",children:r.jsx(o3,{input:O.input,control:u.form.control,toolCallId:O.toolCallId})},O.toolCallId),e[72]=u.form,e[73]=I):I=e[73],P=s.map(I),e[69]=u.form,e[70]=s,e[71]=P}else P=e[71];let M;e[74]!==u.activeKey||e[75]!==u.setActiveKey||e[76]!==P?(M=r.jsx(rc,{value:V,onValueChange:R,children:P}),e[74]=u.activeKey,e[75]=u.setActiveKey,e[76]=P,e[77]=M):M=e[77];let D;e[78]!==b||e[79]!==k||e[80]!==N||e[81]!==C||e[82]!==T||e[83]!==M?(D=r.jsx(Lo,{icon:j,label:N,count:C,title:T,defaultExpanded:!0,footerLeft:b,footerRight:k,children:M}),e[78]=b,e[79]=k,e[80]=N,e[81]=C,e[82]=T,e[83]=M,e[84]=D):D=e[84];let $;e[85]!==w||e[86]!==D?($=r.jsx("form",{onSubmit:w,autoComplete:"off",children:D}),e[85]=w,e[86]=D,e[87]=$):$=e[87];let z;return e[88]!==u.form||e[89]!==$?(z=r.jsx(i1,{...S,children:$}),e[88]=u.form,e[89]=$,e[90]=z):z=e[90],z}function HT(t){return!!My(t)}function KT(t){return t.toolCallId}function WT(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function qT(t){return{toolCallId:t.toolCallId,input:t.input}}function GT(){const t=F.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(r1,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function Oy(t){const e=F.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(YT),e[0]=s,e[1]=o):o=e[1];const l=o;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(GT,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(UT,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function YT(t){return t.state==="input-available"}function QT(t){const e=t.filter(o=>o.status==="in_progress"),s=t.filter(o=>o.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function JT(t){const e=F.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=QT(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx(tA,{status:i.icon}),e[2]=i.icon,e[3]=o):o=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(XT),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=r.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let h;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==o||e[11]!==d?(h=r.jsx(Lo,{icon:o,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=o,e[11]=d,e[12]=h):h=e[12],h}function XT(t,e){return r.jsx(ZT,{todo:t},e)}function ZT(t){const e=F.c(14),{todo:s}=t,n=s.status==="completed",o=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=r.jsx(eA,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ie("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",h=n?"width 300ms ease 200ms":"width 150ms ease";let u;e[4]!==d||e[5]!==h?(u=r.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:h}}),e[4]=d,e[5]=h,e[6]=u):u=e[6];let f;e[7]!==o||e[8]!==c||e[9]!==u?(f=r.jsxs("span",{className:c,children:[o,u]}),e[7]=o,e[8]=c,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=r.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,f]}),e[11]=l,e[12]=f,e[13]=m):m=e[13],m}function eA(t){const e=F.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("svg",{viewBox:"0 0 21 21",children:r.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=o):o=e[0];let l;return e[1]!==n||e[2]!==i?(l=r.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:o}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function tA(t){const e=F.c(13),{status:s}=t,n=re();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:r.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=r.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=r.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let o;return e[11]!==i?(o=r.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=o):o=e[12],o}const sA={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},nA=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function By(t){const e=F.c(65),{onDismiss:s}=t,{org:n}=We(),i=Ot(),{decoKeyId:o}=pp(),l=zs(),a=re(),[c,d]=E.useState(""),[h,u]=E.useState(!1),[f,m]=E.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{st("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),E.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async W=>{const{url:Y}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:W,currency:f});return Y},e[3]=f,e[4]=l,e[5]=b):b=e[5];let v;e[6]!==s?(v=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let y;e[8]!==a?(y=W=>{pe.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=y):y=e[9];let L;e[10]!==b||e[11]!==v||e[12]!==y?(L={mutationFn:b,onSuccess:v,onError:y},e[10]=b,e[11]=v,e[12]=y,e[13]=L):L=e[13];const{mutate:_,isPending:k}=Xs(L),S=parseFloat(c),w=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=N):N=e[16];let A;e[17]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:N.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=A):A=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=C):C=e[18];let T;e[19]!==a?(T=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=T):T=e[20];let V;e[21]!==T?(V=r.jsx($t,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=V):V=e[22];let R;e[23]!==a?(R=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=R):R=e[24];let P;e[25]!==R?(P=r.jsx(Dn,{className:"mt-1.5 text-sm leading-relaxed",children:R}),e[25]=R,e[26]=P):P=e[26];let M;e[27]!==V||e[28]!==P?(M=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[A,r.jsxs(ms,{className:"relative gap-4",children:[C,r.jsxs("div",{children:[V,P]})]})]}),e[27]=V,e[28]=P,e[29]=M):M=e[29];let D;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==o||e[35]!==w||e[36]!==k||e[37]!==h||e[38]!==a||e[39]!==_?(D=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(mp,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:W=>{W&&m(W)},children:[r.jsx(Nd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Nd,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsxs("div",{className:"rounded-xl border border-border p-5",children:[r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:sA[f].map(W=>{const{dollars:Y,labelKey:Q}=W;return r.jsxs("button",{type:"button",disabled:k,onClick:()=>{st("credits_topup_clicked",{amount_cents:Y*100,currency:f,tier_label:Q,source:"exhausted_banner"}),_(Y*100)},className:ie("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,Y]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:a(Q)})]},Y)})}),h?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(pt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:W=>d(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!w||k,onClick:()=>{st("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),_(Math.round(S*100))},children:a(k?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):r.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:a("chat.creditsExhaustedBanner.enterCustom")})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:nA.map(W=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:r.jsx(Et,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:a(W)})]},W))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=S,e[34]=o,e[35]=w,e[36]=k,e[37]=h,e[38]=a,e[39]=_,e[40]=D):D=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let z;e[43]!==s||e[44]!==$?(z=r.jsx(he,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=z):z=e[45];let I;e[46]!==i||e[47]!==s||e[48]!==n.slug?(I=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=I):I=e[49];let O;e[50]!==a?(O=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=O):O=e[51];let B;e[52]!==I||e[53]!==O?(B=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:I,children:O}),e[52]=I,e[53]=O,e[54]=B):B=e[54];let U;e[55]!==z||e[56]!==B?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[z,B]}),e[55]=z,e[56]=B,e[57]=U):U=e[57];let H;e[58]!==M||e[59]!==D||e[60]!==U?(H=r.jsxs(Pt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:iA,children:[M,D,U]}),e[58]=M,e[59]=D,e[60]=U,e[61]=H):H=e[61];let K;return e[62]!==H||e[63]!==j?(K=r.jsx(Rt,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=K):K=e[64],K}function iA(t){return t.preventDefault()}const rA={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function oA(t){const e=F.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=re(),{label:l,title:a}=rA[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(gl,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==o?(d=o(l),e[1]=l,e[2]=o,e[3]=d):d=e[3];let h;e[4]!==o||e[5]!==a?(h=o(a),e[4]=o,e[5]=a,e[6]=h):h=e[6];let u;e[7]!==s||e[8]!==i||e[9]!==o?(u=s==="trial_exhausted"?r.jsx(he,{size:"sm",onClick:i,className:"h-7 text-xs",children:o("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=o,e[10]=u):u=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==h||e[14]!==u?(f=r.jsx(Lo,{icon:c,label:d,title:h,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:u}),e[11]=n,e[12]=d,e[13]=h,e[14]=u,e[15]=f):f=e[15],f}function lA(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),o=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:o?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const aA={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function D0(t){const e=F.c(29),s=re(),{variant:n,onDismiss:i}=t,o=n==="error";let l;e[0]!==o||e[1]!==s?(l=s(o?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=o,e[1]=s,e[2]=l):l=e[2];const a=l,c=o?pn:ko;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const v=aA[t.finishReason];return v?s(v):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const h=d;let u;e[8]!==o||e[9]!==h?(u=o?lA(h):{summary:h,rawDetails:null},e[8]=o,e[9]=h,e[10]=u):u=e[10];const{summary:f,rawDetails:m}=u;let p;e[11]!==c?(p=r.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==o||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=o?r.jsx(he,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(he,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=o,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?r.jsxs("details",{className:"group mx-4",children:[r.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[r.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m4.5 3 3 3-3 3"})}),r.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),r.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>pe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>pe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:r.jsx(on,{className:"size-3.5"})}),r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=r.jsx(Lo,{icon:p,label:a,title:f,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function Jh(){const t=F.c(73),e=re(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=di(),[h,u]=Ei(),{virtualMcpId:f,createTaskWithMessage:m}=en(),{chatMode:p,simpleModeTier:g}=jo(),{mutate:x}=Fv("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let y;t[2]!==p||t[3]!==g||t[4]!==f?(y=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=y):y=t[5];const L=y;let _;t[6]!==h.toolApprovalLevel?(_=h.toolApprovalLevel??hk(),t[6]=h.toolApprovalLevel,t[7]=_):_=t[7];const k=_,S=l.at(-1),w=S?.role==="assistant"?S.parts:[],j=w.filter(hA),N=jy(w),A=Sy(w);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ne)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const T=C;let V;t[12]!==d||t[13]!==e?(V=()=>{const le={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(le)},t[12]=d,t[13]=e,t[14]=V):V=t[14];const R=V;let P;t[15]!==L||t[16]!==k||t[17]!==c?(P=(le,ne)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ne}},L(k))},t[15]=L,t[16]=k,t[17]=c,t[18]=P):P=t[18];const M=P;let D;t[19]!==m||t[20]!==h||t[21]!==u||t[22]!==e||t[23]!==f?(D=le=>{u({...h,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=h,t[21]=u,t[22]=e,t[23]=f,t[24]=D):D=t[24];const $=D,z=uA;let I;t[25]!==L||t[26]!==c?(I=(le,ne,ae,de)=>{c({kind:"approval",approvalId:le,approved:ne,...ae?{reason:ae}:{}},L(de))},t[25]=L,t[26]=c,t[27]=I):I=t[27];const O=I,B=Ny();if(B.isCreditExhausted){let le;return t[28]!==n?(le=r.jsx(By,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:U,showWarning:H,hasApprovals:K}=B,W=j.map(dA).join("|"),Y=ky(N)?.toolCallId??"",Q=A.map(cA).join("|");let te;t[30]!==B.todos?(te=r.jsx(JT,{todos:B.todos}),t[30]=B.todos,t[31]=te):te=t[31];let ee;t[32]!==n||t[33]!==B.subscriptionErrorKind||t[34]!==v?(ee=B.subscriptionErrorKind&&r.jsx(oA,{kind:B.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=B.subscriptionErrorKind,t[34]=v,t[35]=ee):ee=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==U?(oe=U&&r.jsx(D0,{variant:"error",error:s,onDismiss:n,onFixInChat:T}),t[36]=n,t[37]=s,t[38]=T,t[39]=U,t[40]=oe):oe=t[40];let se;t[41]!==o||t[42]!==i||t[43]!==R||t[44]!==H?(se=H&&r.jsx(D0,{variant:"warning",finishReason:i,onDismiss:o,onContinue:R}),t[41]=o,t[42]=i,t[43]=R,t[44]=H,t[45]=se):se=t[45];let G;t[46]!==Q||t[47]!==O||t[48]!==K||t[49]!==a||t[50]!==A?(G=K&&r.jsx(PT,{approvals:A,isStreaming:a,onRespond:O},Q),t[46]=Q,t[47]=O,t[48]=K,t[49]=a,t[50]=A,t[51]=G):G=t[51];let X;t[52]!==B.hasPlans||t[53]!==$||t[54]!==z||t[55]!==a||t[56]!==N||t[57]!==Y?(X=B.hasPlans&&r.jsx(DT,{plans:N,isStreaming:a,onApprove:$,onDismiss:z},Y),t[52]=B.hasPlans,t[53]=$,t[54]=z,t[55]=a,t[56]=N,t[57]=Y,t[58]=X):X=t[58];let q;t[59]!==B.isWaitingForUserInput||t[60]!==M||t[61]!==a||t[62]!==W||t[63]!==j?(q=B.isWaitingForUserInput&&r.jsx(Oy,{userAskParts:j,isStreaming:a,onSubmit:M},W),t[59]=B.isWaitingForUserInput,t[60]=M,t[61]=a,t[62]=W,t[63]=j,t[64]=q):q=t[64];let Z;return t[65]!==oe||t[66]!==se||t[67]!==G||t[68]!==X||t[69]!==q||t[70]!==te||t[71]!==ee?(Z=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[te,ee,oe,se,G,X,q]}),t[65]=oe,t[66]=se,t[67]=G,t[68]=X,t[69]=q,t[70]=te,t[71]=ee,t[72]=Z):Z=t[72],Z}function cA(t){return t.approvalId}function dA(t){return t.toolCallId}function uA(){document.querySelector("[data-chat-input]")?.focus()}function hA(t){return t.type==="tool-user_ask"}Jh.Error=function(e){return r.jsx(D0,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Jh.Warning=function(e){return r.jsx(D0,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Jh.UserAskQuestion=Oy;function fA(t){const e=F.c(20),{taskId:s}=t,n=re(),i=Wb(s),o=Kk(i),l=Wk(),{stop:a,removeLocalMessage:c}=di();if(o.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let h;e[2]!==a?(h=()=>{a()},e[2]=a,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Sh,{size:14}),e[4]=u):u=e[4];let f;e[5]!==d||e[6]!==h?(f=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:h,children:u})}),e[5]=d,e[6]=h,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=r.jsx(He,{side:"top",children:r.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=r.jsxs(Ke,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,v)=>r.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[r.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:v+1}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(y=>{y&&(qk(s,b.messageId),c(b.messageId))})},children:r.jsx(Si,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],r.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[r.jsx("span",{children:n(o.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:o.length})}),g]}),o.map(x)]})}function mA(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const pA={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function gA(t){const e=F.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=re(),h=Bh(),u=new Set(h.map(xA)),f=Gk([i,n,o],u),m=f?.keyId??null,[p,g]=E.useState(m??h[0]?.id??null),x=h.some(D=>D.id===p)?p:m??h[0]?.id??null,b=x?h.find(D=>D.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",y=pA[s];let L;e[0]!==d||e[1]!==y?(L=d(y),e[0]=d,e[1]=y,e[2]=L):L=e[2];let _;e[3]!==L?(_=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=_):_=e[4];let k;e[5]!==a||e[6]!==d||e[7]!==i?(k=i&&r.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=k):k=e[8];let S;e[9]!==_||e[10]!==k?(S=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[_,k]}),e[9]=_,e[10]=k,e[11]=S):S=e[11];const w="flex-1 min-h-0",j=E.Suspense;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(kN,{}),e[12]=N):N=e[12];const A=SN,C=!0,T=mA(m?f:null,b?.providerId??"deco");let V;e[13]!==x||e[14]!==l||e[15]!==g?(V=D=>{const $=D.keyId??x??"";g($),l({keyId:$,modelId:D.modelId,title:D.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=V):V=e[16];let R;e[17]!==A||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==V?(R=r.jsx(A,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:V}),e[17]=A,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=V,e[23]=R):R=e[23];let P;e[24]!==j||e[25]!==R||e[26]!==N?(P=r.jsx("div",{className:w,children:r.jsx(j,{fallback:N,children:R})}),e[24]=j,e[25]=R,e[26]=N,e[27]=P):P=e[27];let M;return e[28]!==P||e[29]!==S?(M=r.jsxs("div",{className:v,children:[S,P]}),e[28]=P,e[29]=S,e[30]=M):M=e[30],M}function xA(t){return t.id}const bA=["fast","smart","thinking"];function zy(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const vA={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function yA(t){const e=F.c(28),{tier:s,pillIcon:n,groups:i}=t,o=re();let l;e[0]!==o?(l=zy(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=E.useState(!1);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=w=>{w.onSelect(),d(!1)},e[2]=h):h=e[2];const u=h,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=r.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Jt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=r.jsx(Ue,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(ts,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(He,{children:f}),e[12]=f,e[13]=y):y=e[13];let L;e[14]!==v||e[15]!==y?(L=r.jsxs(Ke,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=L):L=e[16];let _;if(e[17]!==i||e[18]!==o){let w;e[20]!==o?(w=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(N=>r.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[r.jsxs("button",{type:"button",role:"menuitem","aria-label":N.title,onClick:()=>u(N),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",N.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[N.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:N.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:N.title}),N.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:N.subtitle})]}),N.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(Et,{size:14,className:"text-foreground mt-0.5"})})]}),N.modelOverride&&r.jsx(LA,{label:N.title,render:N.modelOverride})]},N.key))},j.key),e[20]=o,e[21]=w):w=e[21],_=i.map(w),e[17]=i,e[18]=o,e[19]=_}else _=e[19];let k;e[22]!==_?(k=r.jsx(ss,{align:"end",className:"p-1 w-64",onOpenAutoFocus:_A,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:_})}),e[22]=_,e[23]=k):k=e[23];let S;return e[24]!==c||e[25]!==L||e[26]!==k?(S=r.jsxs(ns,{open:c,onOpenChange:d,children:[L,k]}),e[24]=c,e[25]=L,e[26]=k,e[27]=S):S=e[27],S}function _A(t){return t.preventDefault()}function LA(t){const e=F.c(38),{label:s,render:n}=t,i=re(),o=So(),[l,a]=E.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let h;e[1]!==s||e[2]!==i?(h=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=h):h=e[3];const u=l&&"opacity-100";let f;e[4]!==u?(f=ie("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(tp,{size:14}),e[6]=m):m=e[6];let p;e[7]!==h||e[8]!==f?(p=r.jsx("button",{type:"button","aria-label":h,className:f,children:m}),e[7]=h,e[8]=f,e[9]=p):p=e[9];const g=p;if(o){let L;e[10]!==g?(L=r.jsx(dv,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let _;e[12]!==s||e[13]!==i?(_=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=_):_=e[14];let k;e[15]!==_?(k=r.jsx(Vh,{className:"sr-only",children:_}),e[15]=_,e[16]=k):k=e[16];let S;e[17]!==l||e[18]!==n?(S=l&&n(d),e[17]=l,e[18]=n,e[19]=S):S=e[19];let w;e[20]!==S||e[21]!==k?(w=r.jsxs(Th,{className:"p-0 flex flex-col max-h-[95vh]",children:[k,S]}),e[20]=S,e[21]=k,e[22]=w):w=e[22];let j;return e[23]!==l||e[24]!==w||e[25]!==L?(j=r.jsxs(Ah,{open:l,onOpenChange:a,children:[L,w]}),e[23]=l,e[24]=w,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(ts,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let v;e[32]!==b?(v=r.jsx(ss,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let y;return e[34]!==l||e[35]!==x||e[36]!==v?(y=r.jsxs(ns,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=y):y=e[37],y}function l3(t){return t==="fast"?r.jsx(gl,{size:16}):t==="thinking"?r.jsx(Sv,{size:16}):r.jsx(Nr,{size:16})}function wA(t){const e=F.c(13),s=Jk();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const h=s.tiers[d];return h?h.title??h.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let o;e[3]!==i?(o=i("fast"),e[3]=i,e[4]=o):o=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==o||e[10]!==l||e[11]!==a?(c={fast:o,smart:l,thinking:a},e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function SA(){const t=F.c(22),e=re(),{simpleModeTier:s,setSimpleModeTier:n}=jo(),i=AN(),o=Bh(),l=EN(o),a=wA(l),{data:c,error:d}=Yk();let h;t[0]!==c?(h=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=h):h=t[1];const u=h,f=Qk();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==u||t[10]!==d){const y=zy(e);m="decopilot",p=bA.map(L=>{const _=a[L],k=u.tiers[L];return{key:`decopilot-${L}`,icon:l3(L),title:y[L],subtitle:_??e(vA[L]),active:s===L,onSelect:()=>n(L),modelOverride:S=>r.jsxs(r.Fragment,{children:[d&&r.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),r.jsx(gA,{tier:L,orgSlot:i.tiers[L],userSlot:k,autoSlot:l.chat[L],onClose:S,onPick:w=>f.mutate({tier:L,slot:w}),onReset:()=>f.mutate({tier:L,slot:null})},`${L}:${k?.keyId??"org"}:${k?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=f,t[9]=u,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=l3(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=r.jsx(yA,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function $p(t,e,s,n,i,o){if(!$h(e)){pe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!jN(l,e)){const c=Uv(e).parts.map(h=>o(h)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):pe.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){pe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const h=await d,u={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:h};lj(t,{from:n,to:n},u)}catch(c){console.error("Failed to process file:",c),pe.error(`Failed to load file "${s.name}"`)}}function kA(t){const e=F.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=re(),l=E.useRef(CA);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(u,f)=>{await $p(s,n,u,f,i,o)}},c=[s,n,i,o],e[0]=s,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=c):(a=e[4],c=e[5]),E.useEffect(a,c);let d,h;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const u=new Ar("fileDropHandler");s.state.plugins.find(p=>p.spec.key===u)&&s.unregisterPlugin(u);const m=new Nh({key:u,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const y=p.posAtCoords({left:g.clientX,top:g.clientY});if(!y)return!1;const L=Array.from(v);return(async()=>{let _=y.pos;for(const k of L)await l.current?.(k,_),_=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(jA);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const y of b){const L=y.getAsFile();L&&(await l.current?.(L,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(u)}},h=[s],e[6]=s,e[7]=d,e[8]=h):(d=e[7],h=e[8]),E.useEffect(d,h),null}function jA(t){return t.kind==="file"}function CA(){return Promise.resolve()}function NA(t){const e=F.c(43),{info:s,onClose:n}=t,i=re(),o=s!==null;let l;e[0]!==n?(l=C=>!C&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:r.jsx(ko,{size:18})}),e[4]=d):d=e[4];let h;e[5]!==i?(h=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=h):h=e[6];let u;e[7]!==h?(u=r.jsx($t,{className:"text-xl font-semibold tracking-tight",children:h}),e[7]=h,e[8]=u):u=e[8];const f=s?.fileName;let m;e[9]!==f?(m=r.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=r.jsxs(Dn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==u?(x=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(ms,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[u,g]})]})]}),e[16]=g,e[17]=u,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==i||e[20]!==b?(v=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==v?(y=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=y):y=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(kv,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const _=s?.accepted;let k;e[25]!==_?(k=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,r.jsx("span",{className:"capitalize",children:_})]}),e[25]=_,e[26]=k):k=e[26];let S;e[27]!==y||e[28]!==k?(S=r.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:r.jsxs("div",{className:"rounded-xl border border-border p-4",children:[y,k]})}),e[27]=y,e[28]=k,e[29]=S):S=e[29];let w;e[30]!==i?(w=i("chat.uploader.gotIt"),e[30]=i,e[31]=w):w=e[31];let j;e[32]!==n||e[33]!==w?(j=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(he,{onClick:n,children:w})}),e[32]=n,e[33]=w,e[34]=j):j=e[34];let N;e[35]!==x||e[36]!==S||e[37]!==j?(N=r.jsxs(Pt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:VA,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=N):N=e[38];let A;return e[39]!==o||e[40]!==l||e[41]!==N?(A=r.jsx(Rt,{open:o,onOpenChange:l,children:N}),e[39]=o,e[40]=l,e[41]=N,e[42]=A):A=e[42],A}function VA(t){return t.preventDefault()}function TA(){const t=F.c(3),[e,s]=E.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var Fy=aj;var AA=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],a1=AA.join(","),Uy=typeof Element>"u",Pd=Uy?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,I0=!Uy&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},M0=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),o=i===""||i==="true",l=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):M0(e.parentNode));return l},EA=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},PA=function(e,s,n){if(M0(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(a1));return s&&Pd.call(e,a1)&&i.unshift(e),i=i.filter(n),i},c1=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!M0(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=c1(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var h=Pd.call(l,a1);h&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var u=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!M0(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(u&&f){var m=c1(u===!0?l.children:u.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else o.unshift.apply(o,l.children)}}return i},Hy=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ky=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||EA(e))&&!Hy(e)?0:e.tabIndex},RA=function(e,s){var n=Ky(e);return n<0&&s&&!Hy(e)?0:n},DA=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Wy=function(e){return e.tagName==="INPUT"},IA=function(e){return Wy(e)&&e.type==="hidden"},MA=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},$A=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},OA=function(e){if(!e.name)return!0;var s=e.form||I0(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var o=$A(i,e.form);return!o||o===e},BA=function(e){return Wy(e)&&e.type==="radio"},zA=function(e){return BA(e)&&!OA(e)},FA=function(e){var s,n=e&&I0(e),i=(s=n)===null||s===void 0?void 0:s.host,o=!1;if(n&&n!==e){var l,a,c;for(o=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!o&&i;){var d,h,u;n=I0(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((h=i)!==null&&h!==void 0&&(u=h.ownerDocument)!==null&&u!==void 0&&u.contains(i))}}return o},a3=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},UA=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Pd.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Pd.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,h=I0(e);if(d&&!d.shadowRoot&&i(d)===!0)return a3(e);e.assignedSlot?e=e.assignedSlot:!d&&h!==e.ownerDocument?e=h.host:e=d}e=c}if(FA(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return a3(e);return!1},HA=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return Pd.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},KA=function(e,s){return!(s.disabled||IA(s)||UA(s,e)||MA(s)||HA(s))},c3=function(e,s){return!(zA(s)||Ky(s)<0||!KA(e,s))},WA=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},qy=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=RA(a,l),d=l?qy(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:o,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(DA).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},Gy=function(e,s){s=s||{};var n;return s.getShadowRoot?n=c1([e],s.includeContainer,{filter:c3.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:WA}):n=PA(e,s.includeContainer,c3.bind(null,s)),qy(n)};function qA(){return/apple/i.test(navigator.vendor)}const d3="data-floating-ui-focusable";function GA(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function d1(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&fk(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function Nc(t){return"composedPath"in t?t.composedPath()[0]:t.target}function t9(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function YA(t){return t.matches("html,body")}function Rd(t){return t?.ownerDocument||document}function QA(t){return t?t.hasAttribute(d3)?t:t.querySelector("["+d3+"]")||t:null}function x0(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var o;return i.parentId===e&&(!s||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...x0(t,i.id,s)])}function JA(t){return"nativeEvent"in t}var XA=typeof document<"u",ZA=function(){},Qo=XA?E.useLayoutEffect:ZA;const eE={...Cb},tE=eE.useInsertionEffect,sE=tE||(t=>t());function fa(t){const e=E.useRef(()=>{});return sE(()=>{e.current=t}),E.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const Yy=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Qy(t,e){const s=Gy(t,Yy()),n=s.length;if(n===0)return;const i=GA(Rd(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function nE(t){return Qy(Rd(t).body,1)||t}function iE(t){return Qy(Rd(t).body,-1)||t}function s9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!d1(s,n)}function rE(t){Gy(t,Yy()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function u3(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const oE="data-floating-ui-focusable",h3="active",f3="selected",lE={...Cb};let m3=!1,aE=0;const p3=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+aE++;function cE(){const[t,e]=E.useState(()=>m3?p3():void 0);return Qo(()=>{t==null&&e(p3())},[]),E.useEffect(()=>{m3=!0},[]),t}const dE=lE.useId,Op=dE||cE;function uE(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const hE=E.createContext(null),fE=E.createContext(null),Jy=()=>{var t;return((t=E.useContext(hE))==null?void 0:t.id)||null},Xy=()=>E.useContext(fE);function Bp(t){return"data-floating-ui-"+t}const mE={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},g3=E.forwardRef(function(e,s){const[n,i]=E.useState();Qo(()=>{qA()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Bp("focus-guard")]:"",style:mE};return r.jsx("span",{...e,...o})}),pE={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Zy=E.createContext(null),x3=Bp("portal");function gE(t){t===void 0&&(t={});const{id:e,root:s}=t,n=Op(),i=bE(),[o,l]=E.useState(null),a=E.useRef(null);return Qo(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),Qo(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(x3,""),c.appendChild(d),a.current=d,l(d)},[e,n]),Qo(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!vk(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const h=document.createElement("div");h.id=n,h.setAttribute(x3,""),c=d||c,c.appendChild(h),a.current=h,l(h)},[e,s,n,i]),o}function xE(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=gE({id:s,root:n}),[l,a]=E.useState(null),c=E.useRef(null),d=E.useRef(null),h=E.useRef(null),u=E.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return E.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&s9(x)&&(x.type==="focusin"?u3:rE)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,i,f]),E.useEffect(()=>{o&&(m||u3(o))},[m,o]),r.jsxs(Zy.Provider,{value:E.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:h,afterInsideRef:u,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(g3,{"data-type":"outside",ref:c,onFocus:g=>{if(s9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=iE(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:pE}),o&&En.createPortal(e,o),p&&o&&r.jsx(g3,{"data-type":"outside",ref:d,onFocus:g=>{if(s9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=nE(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const bE=()=>E.useContext(Zy),vE={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},yE={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},b3=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function _E(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:o}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:h=!1,referencePressEvent:u="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=Xy(),x=fa(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=E.useRef(!1),{escapeKey:y,outsidePress:L}=b3(m),{escapeKey:_,outsidePress:k}=b3(p),S=E.useRef(!1),w=fa(V=>{var R;if(!s||!l||!a||V.key!=="Escape"||S.current)return;const P=(R=o.current.floatingContext)==null?void 0:R.nodeId,M=g?x0(g.nodesRef.current,P):[];if(!y&&(V.stopPropagation(),M.length>0)){let D=!0;if(M.forEach($=>{var z;if((z=$.context)!=null&&z.open&&!$.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}n(!1,JA(V)?V.nativeEvent:V,"escape-key")}),j=fa(V=>{var R;const P=()=>{var M;w(V),(M=Nc(V))==null||M.removeEventListener("keydown",P)};(R=Nc(V))==null||R.addEventListener("keydown",P)}),N=fa(V=>{var R;const P=o.current.insideReactTree;o.current.insideReactTree=!1;const M=v.current;if(v.current=!1,d==="click"&&M||P||typeof b=="function"&&!b(V))return;const D=Nc(V),$="["+Bp("inert")+"]",z=Rd(i.floating).querySelectorAll($);let I=Ui(D)?D:null;for(;I&&!Qf(I);){const H=gk(I);if(Qf(H)||!Ui(H))break;I=H}if(z.length&&Ui(D)&&!YA(D)&&!d1(D,i.floating)&&Array.from(z).every(H=>!d1(I,H)))return;if(xk(D)&&T){const H=Qf(D),K=bk(D),W=/auto|scroll/,Y=H||W.test(K.overflowX),Q=H||W.test(K.overflowY),te=Y&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,ee=Q&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,oe=K.direction==="rtl",se=ee&&(oe?V.offsetX<=D.offsetWidth-D.clientWidth:V.offsetX>D.clientWidth),G=te&&V.offsetY>D.clientHeight;if(se||G)return}const O=(R=o.current.floatingContext)==null?void 0:R.nodeId,B=g&&x0(g.nodesRef.current,O).some(H=>{var K;return t9(V,(K=H.context)==null?void 0:K.elements.floating)});if(t9(V,i.floating)||t9(V,i.domReference)||B)return;const U=g?x0(g.nodesRef.current,O):[];if(U.length>0){let H=!0;if(U.forEach(K=>{var W;if((W=K.context)!=null&&W.open&&!K.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,V,"outside-press")}),A=fa(V=>{var R;const P=()=>{var M;N(V),(M=Nc(V))==null||M.removeEventListener(d,P)};(R=Nc(V))==null||R.addEventListener(d,P)});E.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=y,o.current.__outsidePressBubbles=L;let V=-1;function R(z){n(!1,z,"ancestor-scroll")}function P(){window.clearTimeout(V),S.current=!0}function M(){V=window.setTimeout(()=>{S.current=!1},pk()?5:0)}const D=Rd(i.floating);a&&(D.addEventListener("keydown",_?j:w,_),D.addEventListener("compositionstart",P),D.addEventListener("compositionend",M)),b&&D.addEventListener(d,k?A:N,k);let $=[];return f&&(Ui(i.domReference)&&($=Yf(i.domReference)),Ui(i.floating)&&($=$.concat(Yf(i.floating))),!Ui(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(Yf(i.reference.contextElement)))),$=$.filter(z=>{var I;return z!==((I=D.defaultView)==null?void 0:I.visualViewport)}),$.forEach(z=>{z.addEventListener("scroll",R,{passive:!0})}),()=>{a&&(D.removeEventListener("keydown",_?j:w,_),D.removeEventListener("compositionstart",P),D.removeEventListener("compositionend",M)),b&&D.removeEventListener(d,k?A:N,k),$.forEach(z=>{z.removeEventListener("scroll",R)}),window.clearTimeout(V)}},[o,i,a,b,d,s,n,f,l,y,L,w,_,j,N,k,A]),E.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const C=E.useMemo(()=>({onKeyDown:w,...h&&{[vE[u]]:V=>{n(!1,V.nativeEvent,"reference-press")},...u!=="click"&&{onClick(V){n(!1,V.nativeEvent,"reference-press")}}}}),[w,n,h,u]),T=E.useMemo(()=>{function V(R){R.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:V,onMouseUp:V,[yE[d]]:()=>{o.current.insideReactTree=!0}}},[w,d,o]);return E.useMemo(()=>l?{reference:C,floating:T}:{},[l,C,T])}function LE(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=Op(),o=E.useRef({}),[l]=E.useState(()=>uE()),a=Jy()!=null,[c,d]=E.useState(n.reference),h=fa((m,p,g)=>{o.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),u=E.useMemo(()=>({setPositionReference:d}),[]),f=E.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return E.useMemo(()=>({dataRef:o,open:e,onOpenChange:h,elements:f,events:l,floatingId:i,refs:u}),[e,h,f,l,i,u])}function wE(t){t===void 0&&(t={});const{nodeId:e}=t,s=LE({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=E.useState(null),[a,c]=E.useState(null),h=i?.domReference||o,u=E.useRef(null),f=Xy();Qo(()=>{h&&(u.current=h)},[h]);const m=mk({...t,elements:{...i,...a&&{reference:a}}}),p=E.useCallback(y=>{const L=Ui(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),getClientRects:()=>y.getClientRects(),contextElement:y}:y;c(L),m.refs.setReference(L)},[m.refs]),g=E.useCallback(y=>{(Ui(y)||y===null)&&(u.current=y,l(y)),(Ui(m.refs.reference.current)||m.refs.reference.current===null||y!==null&&!Ui(y))&&m.refs.setReference(y)},[m.refs]),x=E.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:u}),[m.refs,g,p]),b=E.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),v=E.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return Qo(()=>{n.dataRef.current.floatingContext=v;const y=f?.nodesRef.current.find(L=>L.id===e);y&&(y.context=v)}),E.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function n9(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[h3]:l,[f3]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[oE]:""},...o,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,h]=c;if(!(i&&[h3,f3].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof h=="function"){var u;(u=n.get(d))==null||u.push(h),l[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=h}),l),{})}}function SE(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=E.useCallback(a=>n9(a,t,"reference"),e),o=E.useCallback(a=>n9(a,t,"floating"),s),l=E.useCallback(a=>n9(a,t,"item"),n);return E.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const kE=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function jE(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:o,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=Op(),h=((s=o.domReference)==null?void 0:s.id)||d,u=E.useMemo(()=>{var v;return((v=QA(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=kE.get(c))!=null?n:c,p=Jy()!=null,g=E.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?u:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?u:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:h},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,u,p,i,h,c]),x=E.useMemo(()=>{const v={id:u,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":h}}},[f,u,h,c]),b=E.useCallback(v=>{let{active:y,selected:L}=v;const _={role:"option",...y&&{id:u+"-fui-option"}};switch(c){case"select":case"combobox":return{..._,"aria-selected":L}}return{}},[u,c]);return E.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function CE(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=uj(s),h=new RegExp(`\\s${d}$`),u=l?"^":"",f=i?"":d,m=c?new RegExp(`${u}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),v=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!v)return null;const y=g+x.index;let L=y+x[0].length;return c&&h.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),y<a.pos&&L>=a.pos?{range:{from:y,to:L},query:x[0].slice(s.length),text:x[0]}:null}var NE=new Ar("suggestion");function VE({pluginKey:t=NE,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:h="is-empty",command:u=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=CE,shouldShow:x}){let b;const v=m?.(),y=()=>{const S=e.state.selection.$anchor.pos,w=e.view.coordsAtPos(S),{top:j,right:N,bottom:A,left:C}=w;try{return new DOMRect(C,j,N-C,A-j)}catch{return null}},L=(S,w)=>w?()=>{const j=t.getState(e.state),N=j?.decorationId,A=S.dom.querySelector(`[data-decoration-id="${N}"]`);return A?.getBoundingClientRect()||null}:y;function _(S,w){var j;try{const A=t.getState(S.state),C=A?.decorationId?S.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`):null,T={editor:e,range:A?.range||{from:0,to:0},query:A?.query||null,text:A?.text||null,items:[],command:V=>u({editor:e,range:A?.range||{from:0,to:0},props:V}),decorationNode:C,clientRect:L(S,C)};(j=v?.onExit)==null||j.call(v,T)}catch{}const N=S.state.tr.setMeta(w,{exit:!0});S.dispatch(N)}const k=new Nh({key:t,view(){return{update:async(S,w)=>{var j,N,A,C,T,V,R;const P=(j=this.key)==null?void 0:j.getState(w),M=(N=this.key)==null?void 0:N.getState(S.state),D=P.active&&M.active&&P.range.from!==M.range.from,$=!P.active&&M.active,z=P.active&&!M.active,I=!$&&!z&&P.query!==M.query,O=$||D&&I,B=I||D,U=z||D&&I;if(!O&&!B&&!U)return;const H=U&&!O?P:M,K=S.dom.querySelector(`[data-decoration-id="${H.decorationId}"]`);b={editor:e,range:H.range,query:H.query,text:H.text,items:[],command:W=>u({editor:e,range:H.range,props:W}),decorationNode:K,clientRect:L(S,K)},O&&((A=v?.onBeforeStart)==null||A.call(v,b)),B&&((C=v?.onBeforeUpdate)==null||C.call(v,b)),(B||O)&&(b.items=await f({editor:e,query:H.query})),U&&((T=v?.onExit)==null||T.call(v,b)),B&&((V=v?.onUpdate)==null||V.call(v,b)),O&&((R=v?.onStart)==null||R.call(v,b))},destroy:()=>{var S;b&&((S=v?.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,w,j,N){const{isEditable:A}=e,{composing:C}=e.view,{selection:T}=S,{empty:V,from:R}=T,P={...w},M=S.getMeta(t);if(M&&M.exit)return P.active=!1,P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null,P;if(P.composing=C,A&&(V||e.view.composing)){(R<w.range.from||R>w.range.to)&&!C&&!w.composing&&(P.active=!1);const D=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:T.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;D&&p({editor:e,state:N,range:D.range,isActive:w.active})&&(!x||x({editor:e,range:D.range,query:D.query,text:D.text,transaction:S}))?(P.active=!0,P.decorationId=w.decorationId?w.decorationId:$,P.range=D.range,P.query=D.query,P.text=D.text):P.active=!1}else P.active=!1;return P.active||(P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null),P}},props:{handleKeyDown(S,w){var j,N,A,C;const{active:T,range:V}=k.getState(S.state);if(!T)return!1;if(w.key==="Escape"||w.key==="Esc"){const P=k.getState(S.state),M=(j=b?.decorationNode)!=null?j:null,D=M??(P?.decorationId?S.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`):null);if(((N=v?.onKeyDown)==null?void 0:N.call(v,{view:S,event:w,range:P.range}))||!1)return!0;const z={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:I=>u({editor:e,range:P.range,props:I}),decorationNode:D,clientRect:D?()=>D.getBoundingClientRect()||null:null};return(A=v?.onExit)==null||A.call(v,z),_(S,t),!0}return((C=v?.onKeyDown)==null?void 0:C.call(v,{view:S,event:w,range:V}))||!1},decorations(S){const{active:w,range:j,decorationId:N,query:A}=k.getState(S);if(!w)return null;const C=!A?.length,T=[c];return C&&T.push(h),cj.create(S.doc,[dj.inline(j.from,j.to,{nodeName:a,class:T.join(" "),"data-decoration-id":N,"data-decoration-content":d})])}}});return k}function TE(t){const e=F.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=E.useState(0),d=E.useRef(i),h=E.useRef(a),u=E.useRef(o),f=E.useRef(l),m=E.useDeferredValue(n);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{c(0)},e[0]=p):p=e[0];let g;e[1]!==m?(g=[m],e[1]=m,e[2]=g):g=e[2],E.useEffect(p,g);let x,b;e[3]!==i.length||e[4]!==a?(x=()=>{a>=i.length&&i.length>0&&c(0)},b=[i.length,a],e[3]=i.length,e[4]=a,e[5]=x,e[6]=b):(x=e[5],b=e[6]),E.useEffect(x,b);let v,y;e[7]!==i?(v=()=>{d.current=i},y=[i],e[7]=i,e[8]=v,e[9]=y):(v=e[8],y=e[9]),E.useEffect(v,y);let L,_;e[10]!==a?(L=()=>{h.current=a},_=[a],e[10]=a,e[11]=L,e[12]=_):(L=e[11],_=e[12]),E.useEffect(L,_);let k,S;e[13]!==o?(S=()=>{u.current=o},k=[o],e[13]=o,e[14]=k,e[15]=S):(k=e[14],S=e[15]),E.useEffect(S,k);let w,j;e[16]!==l?(w=()=>{f.current=l},j=[l],e[16]=l,e[17]=w,e[18]=j):(w=e[17],j=e[18]),E.useEffect(w,j);let N,A;e[19]!==s?(N=()=>{if(s?.isDestroyed)return;let V;try{V=s.view.dom}catch{return}if(!V)return;const R=M=>{const D=d.current;if(!D.length)return!1;const $=()=>c(I=>(I+1)%D.length),z=()=>c(I=>(I-1+D.length)%D.length);switch(M.key){case"ArrowUp":return M.preventDefault(),z(),!0;case"ArrowDown":return M.preventDefault(),$(),!0;case"Tab":return M.preventDefault(),M.shiftKey?z():$(),!0;case"Home":return M.preventDefault(),c(0),!0;case"End":return M.preventDefault(),c(D.length-1),!0;case"Enter":{if(M.isComposing)return!1;M.preventDefault();const I=h.current;return I!==-1&&D[I]&&u.current?.(D[I],I),!0}case"Escape":return M.preventDefault(),f.current?.(),!0;default:return!1}},P=M=>{R(M)};return V.addEventListener("keydown",P,!0),()=>{V?.removeEventListener("keydown",P,!0)}},A=[s],e[19]=s,e[20]=N,e[21]=A):(N=e[20],A=e[21]),E.useEffect(N,A);const C=i.length?a:void 0;let T;return e[22]!==C?(T={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=T):T=e[23],T}function AE(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const e6=E.createContext(void 0);function t6(){const t=E.useContext(e6);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function EE(t){const e=F.c(16),{editor:s,char:n,pluginKey:i,allow:o,onOpenChange:l}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[c,d]=E.useReducer(AE,a);let h;e[1]!==l?(h=g=>{l?.(g)},e[1]=l,e[2]=h):h=e[2];const u=E.useEffectEvent(h);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==u||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof Ar?i:new Ar(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=VE({pluginKey:g,editor:s,char:n,allow(v){const y=s.state.doc.resolve(v.range.from);for(let L=y.depth;L>0;L--)if(y.node(L).type.name==="image")return!1;return!(o&&!o(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),u(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),u(!1)}}),items:PE});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=u,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==o||e[11]!==s||e[12]!==i?(m=[s,i,n,d,o],e[9]=n,e[10]=o,e[11]=s,e[12]=i,e[13]=m):m=e[13],E.useEffect(f,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function PE(){return[]}function RE({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=t6(),l=E.useDeferredValue(i.query),{data:a}=Lh({queryKey:it.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(u,f)=>{if(!(i.selectedItem!==null||!i.range)){o({type:"SET_SELECTED_ITEM",payload:u});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(x.to+=1),await n({range:x,item:u})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:h}=TE({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:h,close:c,onSelect:d}}function DE({children:t}){const{state:e,dispatch:s}=t6(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=wE({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[yk(10),_k(),Lk()],whileElementsMounted:wk}),d=_E(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),h=jE(c,{role:"listbox"}),{getFloatingProps:u}=SE([d,h]);return n?r.jsx(xE,{children:r.jsx("div",{ref:l.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const IE=t=>{const e=F.c(29),{item:s,isSelected:n,onSelect:i,isLoading:o,ref:l}=t;let a;if(e[0]!==s){const k=Ji(s._meta);a=s.title||Hm(s.name,k),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,h=s.icon,u=n&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==u||e[3]!==f?(m=ie("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",u,f),e[2]=u,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==h||e[6]!==c?(p=h!==void 0&&r.jsx(yo,{icon:h,name:c,size:"xs",className:"mr-2"}),e[5]=h,e[6]=c,e[7]=p):p=e[7];let g;e[8]!==c?(g=r.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),e[8]=c,e[9]=g):g=e[9];let x;e[10]!==o?(x=o&&r.jsx(Cd,{size:"xs"}),e[10]=o,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==d?(v=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let y;e[17]!==b||e[18]!==v?(y=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=y):y=e[19];let L;e[20]!==s.drillable?(L=s.drillable&&r.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=L):L=e[21];let _;return e[22]!==i||e[23]!==l||e[24]!==y||e[25]!==L||e[26]!==m||e[27]!==p?(_=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,y,L]}),e[22]=i,e[23]=l,e[24]=y,e[25]=L,e[26]=m,e[27]=p,e[28]=_):_=e[28],_},ME=t=>{const e=F.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=re();let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:o},e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:h,selectedItem:u}=RE(a);if(!c.length){let g;e[5]!==l?(g=l("chat.mention.noItemsFound"),e[5]=l,e[6]=g):g=e[6];let x;return e[7]!==g?(x=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:g}),e[7]=g,e[8]=x):x=e[8],x}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=f):f=e[9];let m;if(e[10]!==h||e[11]!==c||e[12]!==d||e[13]!==u?.name){let g;e[15]!==h||e[16]!==d||e[17]!==u?.name?(g=(x,b)=>r.jsx(IE,{item:x,isSelected:b===d,ref:b===d?BE:void 0,onSelect:()=>h(x,b),isLoading:u?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=h,e[16]=d,e[17]=u?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=h,e[11]=c,e[12]=d,e[13]=u?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:r.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function $E(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(OE)}),t[0]=e):e=t[0],e}function OE(t,e){return r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[r.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),r.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function s6(t){const e=F.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let h;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(h={editor:s,char:n,pluginKey:i,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=i,e[5]=h):h=e[5];const{state:u,dispatch:f}=EE(h);let m;e[6]!==f||e[7]!==u?(m={state:u,dispatch:f},e[6]=f,e[7]=u,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx($E,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(DE,{children:r.jsx(E.Suspense,{fallback:p,children:r.jsx(ME,{editor:s,queryKey:o,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=o,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=r.jsx(e6.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function BE(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const zE=t=>{const e=F.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=re(),l=Ls(),{org:a}=We(),c=Qd();let d;e[0]!==c?(d=vp(c),e[0]=c,e[1]=d):d=e[1];const h=d;let u;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(u={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=u):u=e[5];const f=Qt(u);let m;e[6]!==a.id||e[7]!==n?(m=it.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=E.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=E.useEffectEvent(b),y=E.useRef(null),L=E.useRef(!1),_=n??"default";let k;e[11]!==g||e[12]!==a.id||e[13]!==_?(k=["at-mention",a.id,_,g],e[11]=g,e[12]=a.id,e[13]=_,e[14]=k):k=e[14];const S=k;let w;e[15]!==o?(w=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=w):w=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let N;e[19]!==w||e[20]!==j?(N={name:"agents",title:w,description:j,kind:"category",drillable:!0},e[19]=w,e[20]=j,e[21]=N):N=e[21];let A;e[22]!==o?(A=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=A):A=e[23];let C;e[24]!==o?(C=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=C):C=e[25];let T;e[26]!==A||e[27]!==C?(T={name:"resources",title:A,description:C,kind:"category",drillable:!0},e[26]=A,e[27]=C,e[28]=T):T=e[28];let V;e[29]!==T||e[30]!==N?(V=[N,T],e[29]=T,e[30]=N,e[31]=V):V=e[31];const R=V;let P;e[32]!==f||e[33]!==s||e[34]!==o?(P=async B=>{const{item:U,range:H}=B;if(st("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(L.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){Pa(s,H,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&f){try{const K=await Nb(f,U.uri);Pa(s,H,{id:U.uri,name:U.uri,metadata:K.contents,char:"@"})}catch(K){console.error("[at-mention] Failed to fetch resource:",K),pe.error(o("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=o,e[35]=P):P=e[35];const M=P;let D;e[36]!==c||e[37]!==R||e[38]!==f||e[39]!==h||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(D=async B=>{const{query:U}=B,H=v();if(H==="categories"){if(!U.trim())return R;const Y=U.toLowerCase(),Q=c.filter(ee=>ee.status==="active"&&(!ee.id||!A0(ee.id))&&!h.has(ee.id)&&ee.id!==n&&(ee.title.toLowerCase().includes(Y)||ee.description?.toLowerCase().includes(Y))).map(FE),te=await(async()=>{if(!f)return[];let ee=l.getQueryData(p);return ee||(ee=await l.fetchQuery({queryKey:p,queryFn:()=>ld(f),staleTime:6e4})),(ee?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(Y)||oe.name?.toLowerCase().includes(Y)||oe.description?.toLowerCase().includes(Y)).map(UE)})();return[...Q,...te]}if(H==="agents"){let Y=c.filter(Q=>Q.status==="active"&&(!Q.id||!A0(Q.id))&&!h.has(Q.id)&&Q.id!==n);if(U.trim()){const Q=U.toLowerCase();Y=Y.filter(te=>te.title.toLowerCase().includes(Q)||te.description?.toLowerCase().includes(Q))}return Y.map(HE)}if(!f)return[];let K=l.getQueryData(p);K?l.fetchQuery({queryKey:p,queryFn:()=>ld(f),staleTime:6e4}).catch(KE):K=await l.fetchQuery({queryKey:p,queryFn:()=>ld(f),staleTime:6e4});let W=K?.resources??[];if(U.trim()){const Y=U.toLowerCase();W=W.filter(Q=>Q.uri.toLowerCase().includes(Y)||Q.name?.toLowerCase().includes(Y)||Q.description?.toLowerCase().includes(Y))}return W.map(WE)},e[36]=c,e[37]=R,e[38]=f,e[39]=h,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=D):D=e[44];const $=D;let z;e[45]!==i?(z=B=>{if(i&&(i.current=B),B)y.current=Date.now(),L.current=!1,st("chat_picker_opened",{picker:"@"});else{const U=y.current;st("chat_picker_closed",{picker:"@",outcome:L.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),y.current=null,x("categories")}},e[45]=i,e[46]=z):z=e[46];const I=z;let O;return e[47]!==s||e[48]!==$||e[49]!==M||e[50]!==I||e[51]!==S?(O=r.jsx(s6,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:S,queryFn:$,onSelect:M,onOpenChange:I}),e[47]=s,e[48]=$,e[49]=M,e[50]=I,e[51]=S,e[52]=O):O=e[52],O};function FE(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function UE(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function HE(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function KE(){}function WE(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function v3(t,e,s,n,i,o,l){try{const a=await Gd(s,n,o);Pa(t,e,{id:n,name:ec(n,i),metadata:a.messages,char:"/",kind:"prompt",args:o})}catch(a){console.error("[slash] Failed to fetch prompt:",a),pe.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function qE(t,e,s,n,i){try{const o=await Nb(s,n);Pa(t,e,{id:n,name:n,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),pe.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function GE(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await DN(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};Pa(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),pe.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const YE=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=re(),i=Ls(),{org:o}=We(),l=Qt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=it.virtualMcpPrompts(e,o.id),c=it.virtualMcpResources(e,o.id),d=it.slashSkills(o.id),h=["slash-mention",o.id,e??"default"],[u,f]=E.useState(null),[m,p]=E.useState(null),g=hj(t);g&&(g.onEditChip=async S=>{if(l)try{const j=(await y3(i,a,l)).find(N=>N.name===S.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...S,prompt:j})}catch(w){console.error("[slash] Failed to load prompt for editing:",w),pe.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=E.useRef(null),b=E.useRef(!1),v=async({item:S,range:w})=>{if(st("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),b.current=!0,!!l)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){f({range:w,item:S});return}const j=Ji(S._meta);await v3(t,w,l,S.name,j,void 0,{t:n})}else S.kind==="skill"?S.skill&&await GE(t,w,o.slug,S.skill,{t:n}):S.uri&&await qE(t,w,l,S.uri,{t:n})},y=async S=>{if(!u||!l)return;const{range:w,item:j}=u,N=Ji(j._meta);await v3(t,w,l,j.name,N,S,{t:n}),f(null)},L=async S=>{if(!(!m||!l)){if(!fj(t,m.pos,m.promptId)){pe.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const w=await Gd(l,m.promptId,S),j=Ji(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,Ch({id:m.promptId,name:ec(m.promptId,j),metadata:w.messages,char:"/",kind:"prompt",args:S})).run(),st("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(w){console.error("[slash] Failed to update prompt:",w),pe.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},_=async S=>{const{query:w}=S;if(!l)return[];const[j,N,A]=await Promise.all([y3(i,a,l),JE(i,c,l),QE(i,d,o.slug)]),C=w.trim().toLowerCase(),T=(j??[]).filter(P=>!C||P.name.toLowerCase().includes(C)||P.title?.toLowerCase().includes(C)||P.description?.toLowerCase().includes(C)).map(P=>({name:P.name,title:P.title,description:P.description,kind:"prompt",arguments:P.arguments,_meta:P._meta})),V=(N??[]).filter(P=>!C||P.uri.toLowerCase().includes(C)||P.name?.toLowerCase().includes(C)||P.description?.toLowerCase().includes(C)).map(P=>({name:P.name??P.uri,title:P.name,description:P.description,kind:"resource",uri:P.uri})),R=(A??[]).filter(P=>!C||P.name.toLowerCase().includes(C)||P.id.toLowerCase().includes(C)||P.description?.toLowerCase().includes(C)).map(P=>({name:P.name,title:P.name,description:P.description??void 0,kind:"skill",skill:P}));return[...T,...V,...R]},k=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return r.jsxs(r.Fragment,{children:[r.jsx(s6,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:h,queryFn:_,onSelect:v,onOpenChange:S=>{if(s&&(s.current=S),S)x.current=Date.now(),b.current=!1,st("chat_picker_opened",{picker:"/"});else{const w=x.current;st("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:w?Date.now()-w:null}),x.current=null}}}),r.jsx(jd,{prompt:k,setPrompt:()=>f(null),onSubmit:y}),r.jsx(jd,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:L,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function y3(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>s1(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>s1(s),staleTime:6e4}),n?.prompts??[]}async function QE(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>IN(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function JE(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>ld(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>ld(s),staleTime:6e4}),n?.resources??[]}function XE(t){return[Wm.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Fy.configure({placeholder:()=>t.current??"Ask anything, / for prompts & skills, @ for agents & resources...",showOnlyWhenEditable:!1}),pj,gj]}function n6({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=E.useRef(o),d=E.useRef(e),h=E.useRef(n),u=E.useRef(i),f=Km({extensions:XE(u),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&h.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return E.useEffect(()=>{f?.setEditable(!s)},[f,s]),E.useEffect(()=>{c.current=o},[o]),E.useEffect(()=>{d.current=e},[e]),E.useEffect(()=>{h.current=n},[n]),E.useEffect(()=>{u.current=i},[i]),E.useEffect(()=>{if(!f||f.isDestroyed)return;const m=JSON.stringify(f.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&f.commands.setContent(t||{type:"doc",content:[]})},[f,t]),r.jsx(mj.Provider,{value:{editor:f},children:a})}function i6(t){const e=F.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,h=s===void 0?!1:s,u=i===void 0?!1:i,{editor:f}=qd();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const N=f.state.doc.textContent.trim()==="";f.commands.focus("end"),N||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,N)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),N)){f.commands.focus("end");const A=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:A?" "+N:N})}},restoreContent:j=>{f&&f.commands.setContent(j||{type:"doc",content:[]})}}),p=[f],e[0]=f,e[1]=m,e[2]=p):(m=e[1],p=e[2]),E.useImperativeHandle(c??null,m,p),!f)return null;const g=h&&"cursor-not-allowed opacity-70",x=h&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=ie("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let v;e[7]!==f||e[8]!==b?(v=r.jsx(qm,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const y=n??null;let L;e[10]!==f||e[11]!==a||e[12]!==y?(L=r.jsx(E.Suspense,{fallback:null,children:r.jsx(YE,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=y,e[13]=L):L=e[13];const _=n??null;let k;e[14]!==f||e[15]!==a||e[16]!==_?(k=r.jsx(E.Suspense,{fallback:null,children:r.jsx(zE,{editor:f,virtualMcpId:_,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=_,e[17]=k):k=e[17];let S;e[18]!==h||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==u?(S=u&&o&&!h?r.jsx(kA,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=h,e[19]=f,e[20]=l,e[21]=o,e[22]=u,e[23]=S):S=e[23];let w;return e[24]!==L||e[25]!==k||e[26]!==S||e[27]!==v?(w=r.jsxs(r.Fragment,{children:[v,L,k,S]}),e[24]=L,e[25]=k,e[26]=S,e[27]=v,e[28]=w):w=e[28],w}function r6(t){const e=F.c(3),[s]=Ei();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&QN(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const ZE={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},eP=lC.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),tP=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function sP(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1.5",children:tP.map(nP)}),t[0]=e):e=t[0],e}function nP(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function iP({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=re(),[a,c]=E.useState(!1),d=r6(ZE),{org:h}=We(),{editor:u}=qd(),f=E.useRef(null),m=$h(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async W=>{const Y=W.target.files;if(!Y||Y.length===0||!u)return;const Q=Array.from(Y);try{let te=u.state.selection.from;for(const ee of Q)await $p(u,n??null,ee,te,o,l),te=u.state.selection.to}finally{f.current&&(f.current.value="")}},x=Qt({connectionId:s,orgId:h.id,orgSlug:h.slug}),b=it.virtualMcpPrompts(s,h.id),{data:v,isLoading:y}=Vt({queryKey:b,queryFn:()=>s1(x),staleTime:6e4,enabled:a&&!!x}),L=v?.prompts??[],[_,k]=E.useState(null),{chatMode:S,setChatMode:w}=jo(),[j,N]=Ei(),A=Ho.find(W=>W.value===j.toolApprovalLevel)??Ho[0],C=l(A.shortKey),T=W=>{const Y=Ho.find(Q=>Q.value===W);if(Y){if(Y.value===j.toolApprovalLevel){c(!1);return}d(),st("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:Y.value,source:"tools_popover"}),N({...j,toolApprovalLevel:Y.value}),c(!1)}},V=S==="plan",R=()=>{d();const W=V?"default":"plan";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},P=()=>{e(),c(!1)},M=async(W,Y)=>{if(!u||!x)return;const Q=Ji(W._meta),te={from:u.state.selection.from,to:u.state.selection.to};try{const ee=await Gd(x,W.name,Y);Pa(u,te,{id:W.name,name:ec(W.name,Q),metadata:ee.messages,char:"/",kind:"prompt",args:Y})}catch{pe.error(l("chat.toolsPopover.failedLoadPrompt"))}},D=async W=>{c(!1);const Y=!!(W.arguments&&W.arguments.length>0);if(st("chat_prompt_inserted",{prompt_name:W.name,with_arguments:Y}),Y){k(W);return}await M(W)},$=async W=>{_&&(await M(_,W),k(null))},z=()=>{d();const W=S==="gen-image"?"default":"gen-image";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},I=()=>{d();const W=S==="web-search"?"default":"web-search";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},O=()=>{d();const W=S==="deep-research"?"default":"deep-research";st("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),w(W),c(!1)},B=S==="gen-image",U=S==="web-search",H=S==="deep-research",K=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:CN(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[K,r.jsxs(qt,{open:a,onOpenChange:W=>{W&&!a&&st("chat_tools_popover_opened",{chat_mode:S}),c(W)},children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[r.jsx(jv,{size:14}),r.jsx("span",{className:ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:l("chat.toolsPopover.tools")})]})}),r.jsxs(Yt,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(et,{onClick:p,disabled:i,children:[r.jsx(Dt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsxs(et,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[r.jsx(Dt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(He,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(et,{onClick:R,className:ie(V&&"text-special"),children:[r.jsx(Ra,{size:16,className:ie(V&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:ie("text-xs text-muted-foreground",V&&"text-special font-medium"),children:eP})]}),r.jsxs(et,{onClick:z,className:ie(B&&"text-special"),children:[r.jsx(wi,{size:16,className:ie(B&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),B&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(et,{onClick:I,className:ie(U&&"text-special"),children:[r.jsx(Er,{size:16,className:ie(U&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(et,{onClick:O,className:ie(H&&"text-special"),children:[r.jsx(Cv,{size:16,className:ie(H&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),H&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Wi,{children:[r.jsxs(qi,{className:"gap-2",children:[r.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.prompts")})]}),r.jsx(Gi,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:y?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(ut,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):L.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):L.map(W=>r.jsxs(et,{onClick:()=>D(W),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||Hm(W.name,Ji(W._meta))}),W.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),r.jsxs(Wi,{children:[r.jsxs(qi,{className:"gap-2",children:[r.jsx(Ih,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Gi,{className:"w-48 p-1.5",children:r.jsx(Td,{value:j.toolApprovalLevel,onValueChange:T,children:Ho.map(W=>r.jsx(Zi,{value:W.value,children:l(W.labelKey)},W.value))})})]}),r.jsxs(et,{onClick:P,children:[r.jsx(Zm,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(E.Suspense,{children:r.jsx(sP,{})})]})]})]}),r.jsx(jd,{prompt:_,setPrompt:k,onSubmit:$})]})}const rP=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function oP(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1",children:rP.map(lP)}),t[0]=e):e=t[0],e}function lP(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function aP(t){const e=F.c(10),{onClick:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("chat.connectionsBanner.description"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:o}),e[3]=o,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(oP,{}),c=r.jsx(gn,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=a,e[6]=c):(a=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==l?(d=r.jsxs("button",{type:"button",onClick:s,className:i,children:[l,a,c]}),e[7]=s,e[8]=l,e[9]=d):d=e[9],d}const Gc=48;function cP(){const t=F.c(9),[e,s]=E.useState("idle"),[n,i]=E.useState(""),[o,l]=E.useState(""),[a,c]=E.useState(hP),d=E.useRef(null),h=E.useRef(null),u=E.useRef(null),f=E.useRef(null),m=E.useRef(0),p=E.useRef(!1),g=E.useRef(""),x=E.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),h.current?.close().catch(uP),f.current?.getTracks().forEach(dP),u.current=null,h.current=null,f.current=null},t[0]=v):v=t[0];const y=v;let L;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const A=C=>{f.current=C;const T=new AudioContext;h.current=T;const V=T.createMediaStreamSource(C),R=T.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,V.connect(R),u.current=R;const P=new Uint8Array(R.frequencyBinCount),M=()=>{if(!u.current)return;u.current.getByteFrequencyData(P);const D=[];for(let $=0;$<Gc;$++){const z=Math.floor($/Gc*P.length);D.push(Math.max(.04,(P[z]??0)/255))}c(D),m.current=requestAnimationFrame(M)};M()};L=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),A(T);const V=new C;d.current=V,V.interimResults=!0,V.continuous=!0,V.lang=navigator.language||"en-US",V.onresult=R=>{let P="",M="";for(let D=R.resultIndex;D<R.results.length;D++){const $=R.results[D],z=$?.[0]?.transcript??"";$?.isFinal?M=M+z:P=P+z}M&&(g.current=g.current+M,i(g.current)),x.current=P,l(P)},V.onend=()=>{if(p.current)try{V.start()}catch{}};try{V.start()}catch{return p.current=!1,d.current=null,y(),s("idle"),"idle"}return"recording"},t[1]=L}else L=t[1];const _=L;let k;t[2]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.stop(),y(),s("idle"),c(Array(Gc).fill(.05)),l("");const A=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",A},t[2]=k):k=t[2];const S=k;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.abort(),y(),s("idle"),i(""),l(""),c(Array(Gc).fill(.05)),g.current="",x.current=""},t[3]=w):w=t[3];const j=w;let N;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(N={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:_,stopRecording:S,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=N):N=t[8],N}function dP(t){return t.stop()}function uP(){}function hP(){return Array(Gc).fill(.05)}function fP(t){const e=F.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(mP),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=i):i=e[3],i}function mP(t,e){return r.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function pP(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function Vu(t){const e=F.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??r.jsx(Wd,{size:14,className:"shrink-0"}),e[0]=n,e[1]=i):i=e[1];const o=s??"";let l;e[2]!==o?(l=r.jsx("span",{className:"text-sm",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function gP(t,e,s){const n=F.c(7),{editor:i}=qd(),o=re(),[l,a]=E.useState(!1),c=E.useRef(0);let d,h;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(d=()=>{const u=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,a(!0))},f=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&a(!1)},m=xP,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!$h(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=i.state.selection.from;for(const y of b)await $p(i,t,y,v,e,o),v=i.state.selection.to})()};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},h=[i,t,e,o,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=o,n[5]=d,n[6]=h):(d=n[5],h=n[6]),E.useEffect(d,h),l}function xP(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function bP(t){const e=F.c(14),{selectedModel:s}=t,n=re();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=Uv(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Qn,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let h;e[6]!==n?(h=u=>n(u),e[6]=n,e[7]=h):h=e[7],o=n("chat.input.dropFilesHere",{fileTypes:d.map(h).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[8]!==i||e[9]!==o?(a=r.jsx("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function vP(){const t=F.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Wd,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs(r.Fragment,{children:[s,r.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function yP(t){const e=F.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=gP(s,n,i);let l;e[0]!==s?(l=$h(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o?"opacity-100":"opacity-0 pointer-events-none",d=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let h;e[2]!==c||e[3]!==d?(h=ie("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==s||e[6]!==a?(u=a?r.jsx(bP,{selectedModel:s}):r.jsx(vP,{}),e[5]=s,e[6]=a,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=r.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function Tu(t){const e=F.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=ie("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",o),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",l),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=r.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(_s,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=h):h=e[7];let u;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(u=r.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,h]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=u):u=e[13],u}function _P(){const t=F.c(6),e=Ot(),{org:s,locator:n}=We(),{create:i}=Yd();let o;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(o=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),h=c?.id??tc(s.id).id;bv(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:h})}catch{}const u={virtualmcpid:h,autosend:dC};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:u})},t[0]=i,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=o):o=t[5],o}function LP({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=re(),n=Um(),i=Co(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",h=d||mT,u=_P(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:y,setChatMode:L}=jo(),{data:_}=ci.useSession(),k=_?.user?.id,{org:S,locator:w}=We(),j=tc(S.id).id,N=Fs(m?.id),A=ou(),C=ji(N?.metadata,A).active,T=r6(JN),[V,R]=E.useState(!1),{unsupportedFile:P,onUnsupportedFile:M,clearUnsupportedFile:D}=TA(),$=cP(),z=E.useRef(void 0),I=async()=>{z.current=oe;const we=await $.startRecording();st("chat_voice_started",{thread_id:d,outcome:we==="recording"?"started":we==="unsupported"?"unsupported":we==="permission-denied"?"permission_denied":"unknown"})},O=()=>{st("chat_voice_confirmed",{thread_id:d});const we=$.stopRecording();le.current?.syncVoiceText(z.current,we),le.current?.focus()},B=()=>{st("chat_voice_cancelled",{thread_id:d}),$.cancelRecording(),le.current?.restoreContent(z.current)};E.useEffect(()=>{if($.status!=="recording")return;const we=($.transcript+($.interimTranscript?" "+$.interimTranscript:"")).trim();le.current?.syncVoiceText(z.current,we)},[$.transcript,$.interimTranscript,$.status]);const U=i?.activeTask??null,H=U?.created_by,K=!!(k&&H&&H!==k),{data:W}=Zv({enabled:K}),Y=(W?.data?.members??[]).find(we=>we.userId===H),Q=Y?.user?.name??Y?.user?.email?.split("@")[0]??null,te=Fh(),ee=mv({isDesktopApp:te,harnessId:U?.harness_id,sandboxProviderKind:U?.sandbox_provider_kind}),[oe,se]=E.useState(()=>s3(sessionStorage,w,h)??void 0),G=we=>{se(we),g.current=we,Ty(sessionStorage,w,h,we,{onQuotaExceeded:({docSizeBytes:Ne})=>{st("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Ne}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},X=E.useRef(d);if(X.current!==d){X.current=d;const we=s3(sessionStorage,w,h)??void 0;se(we),g.current=we}const Z=[...o].reverse().find(we=>we.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,le=E.useRef(null),ne=E.useRef(!1),ae=y==="plan",de=we=>{T(),st("chat_mode_changed",{from_mode:we,to_mode:"default",source:"pill_dismiss"}),L("default")};E.useEffect(()=>{const we=Ne=>{gv(Ne)&&Ne.code==="KeyL"&&(Ne.preventDefault(),Ne.shiftKey&&L(y==="plan"?"default":"plan"),le.current?.focus())};return document.addEventListener("keydown",we),()=>document.removeEventListener("keydown",we)},[y,L]);const fe=Jb(o),ge=[...o].reverse().find(we=>we.role==="assistant"&&we.metadata?.usage)?.metadata?.usage?.contextTokens??0,J=!p&&!Vy(oe),me=pP({hasDraft:J,isStreaming:l,isRunInProgress:a}),ye=me==="send",Le=me==="stop",ke=we=>{if(we?.preventDefault(),me==="send"&&oe){if(st("chat_message_sent",{thread_id:d||null,mode:y,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:we?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){pe.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(oe)}else u({tiptapDoc:oe,virtualMcp:m});gT(sessionStorage,w,h),G(void 0)}else me==="stop"&&(st("chat_message_stopped",{thread_id:d}),c())};if(K)return r.jsx(Vu,{message:Q?s("chat.input.readOnlyOthersChatNamed",{name:Q}):s("chat.input.readOnlyOthersChat"),icon:Q?r.jsx(Os,{shape:"circle",size:"2xs",url:Y?.user?.image??void 0,fallback:Q.slice(0,2).toUpperCase()}):void 0});if(U?.metadata?.read_only)return r.jsx(Vu,{message:s("chat.input.readOnlyThread")});if(ee)return r.jsx(Vu,{message:s("chat.input.codingAgentRequiresDesktop")});if(C){if(!i)return r.jsx(Vu,{message:s("chat.input.fastPreviewUnavailable")});const we=()=>{const Ne=i.createTask({runtime:"sandbox"});st("coding_session_started",{thread_id:Ne})};return r.jsxs("button",{type:"button",onClick:we,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[r.jsx(To,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),r.jsx(pl,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-col w-full justify-end",children:r.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&r.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&i&&r.jsx(Jh,{}),n&&i&&d?r.jsx(fA,{taskId:d}):null,r.jsx(n6,{tiptapDoc:oe,setTiptapDoc:G,disabled:$.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:ke,suggestionOpenRef:ne,children:r.jsxs("form",{onSubmit:ke,className:ie("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[r.jsx(yP,{selectedModel:f,onUnsupportedFile:M,disabled:$.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(i6,{ref:le,disabled:$.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:M,suggestionOpenRef:ne})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:$.status==="recording"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx(fP,{data:$.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:B,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:r.jsx(_s,{size:16})}),r.jsx("button",{type:"button",onClick:O,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:r.jsx(Et,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(iP,{disabled:!1,onOpenConnections:()=>{st("connections_dialog_opened",{source:"tools_popover",mode:"add"}),R(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:M}),ae&&r.jsx(Tu,{onClick:()=>de("plan"),label:s("chat.input.planMode"),icon:r.jsx(Ra,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),y==="gen-image"&&x&&r.jsx(Tu,{onClick:()=>de("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(wi,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),y==="web-search"&&b&&r.jsx(Tu,{onClick:()=>de("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Er,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),y==="deep-research"&&v&&r.jsx(Tu,{onClick:()=>de("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(Cv,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),Z&&ge>0&&r.jsx(xj,{usage:fe,totalTokens:ge,contextWindow:Z,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(SA,{}),$.isSupported&&r.jsx(he,{type:"button",onClick:I,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",$.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:$.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":$.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(kC,{size:18})}),r.jsx(he,{type:Le?"button":"submit",onClick:we=>{Le&&(we.preventDefault(),we.stopPropagation(),c())},variant:ye||Le?"default":"ghost",size:"icon",disabled:!ye&&!Le,className:ie("size-8 rounded-lg transition-all",!ye&&!Le&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(me==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(me==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:Le?r.jsx(jC,{size:20}):r.jsx(Sh,{size:20})})]})]})})]})},d),e&&r.jsx(aP,{onClick:()=>{st("connections_banner_clicked",{source:"home_chat_input"}),st("connections_dialog_opened",{source:"home_banner",mode:"add"}),R(!0)}})]})}),r.jsx(gp,{mode:"browse",open:V,onOpenChange:R,defaultTab:"all"}),r.jsx(NA,{info:P,onClose:D})]})}function wP(t){let e=0;for(const s of t)for(const n of s.parts??[]){const i=n;i.type==="tool-load_repo"&&i.state==="output-available"&&i.output?.success===!0&&e++}return e}function SP(){const t=F.c(8),e=Ot(),s=Qm(),n=Um()?.messages??[],i=Co()?.taskId??null;let o;t[0]!==n?(o=wP(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=E.useRef(null),c=E.useRef(null);let d,h;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const u=`${i}:${l}`;c.current!==u&&(c.current=u,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e({to:".",search:kP,replace:!0}))},h=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=h):(d=t[6],h=t[7]),E.useEffect(d,h)}function kP(t){return{...t,main:"preview"}}const jP={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function o6(t){return`deco-credits-empty-dismissed:${t}`}function CP(t){try{return localStorage.getItem(o6(t))==="1"}catch{return!1}}function NP(){const t=F.c(68),e=re(),{org:s}=We(),n=Ot(),{decoKeyId:i}=pp(),o=zs(),[l,a]=E.useState(!0),[c,d]=E.useState(""),[h,u]=E.useState(!1),[f,m]=E.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{st("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(o6(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==l||t[3]!==s.id?(b=()=>{l&&st("credits_empty_state_shown",{organization_id:s.id})},v=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),E.useEffect(b,v);let y;t[6]!==f||t[7]!==o?(y=async Q=>{const{url:te}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:Q,currency:f});return te},t[6]=f,t[7]=o,t[8]=y):y=t[8];let L;t[9]!==x?(L=Q=>{Q&&window.open(Q,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=L):L=t[10];let _;t[11]!==e?(_=Q=>{pe.error(e("chat.creditsEmptyState.topUpFailed",{message:Q.message}))},t[11]=e,t[12]=_):_=t[12];let k;t[13]!==y||t[14]!==L||t[15]!==_?(k={mutationFn:y,onSuccess:L,onError:_},t[13]=y,t[14]=L,t[15]=_,t[16]=k):k=t[16];const{mutate:S,isPending:w}=Xs(k),j=parseFloat(c),N=!isNaN(j)&&j>=1;if(!l)return null;let A;t[17]!==x?(A=Q=>!Q&&x(),t[17]=x,t[18]=A):A=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=C):C=t[19];let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(Nv,{size:20,className:"text-warning"})}),t[20]=T):T=t[20];let V;t[21]!==e?(V=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=V):V=t[22];let R;t[23]!==V?(R=r.jsx($t,{className:"text-lg font-semibold",children:V}),t[23]=V,t[24]=R):R=t[24];let P;t[25]!==e?(P=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=P):P=t[26];let M;t[27]!==P?(M=r.jsx(Dn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:P}),t[27]=P,t[28]=M):M=t[28];let D;t[29]!==R||t[30]!==M?(D=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,r.jsxs(ms,{className:"relative gap-3",children:[T,r.jsxs("div",{className:"text-center",children:[R,M]})]})]}),t[29]=R,t[30]=M,t[31]=D):D=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==N||t[38]!==w||t[39]!==h||t[40]!==e||t[41]!==S?($=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(mp,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:Q=>{Q&&m(Q)},children:[r.jsx(Nd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Nd,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:jP[f].map(Q=>{const{dollars:te,labelKey:ee}=Q;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{st("credits_topup_clicked",{amount_cents:te*100,currency:f,tier_label:ee,source:"empty_state"}),S(te*100)},className:ie("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,te]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(ee)})]},te)})}),h?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(pt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:Q=>d(Q.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!N||w,onClick:()=>{st("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),S(Math.round(j*100))},children:e(w?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):r.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=N,t[38]=w,t[39]=h,t[40]=e,t[41]=S,t[42]=$):$=t[42];let z;t[43]!==x||t[44]!==n||t[45]!==s.slug?(z=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=z):z=t[46];let I;t[47]!==e?(I=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=I):I=t[48];let O;t[49]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(pl,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=O):O=t[49];let B;t[50]!==z||t[51]!==I?(B=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:z,children:[I,O]}),t[50]=z,t[51]=I,t[52]=B):B=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let H;t[55]!==x||t[56]!==U?(H=r.jsx(he,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=H):H=t[57];let K;t[58]!==B||t[59]!==H?(K=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,H]}),t[58]=B,t[59]=H,t[60]=K):K=t[60];let W;t[61]!==D||t[62]!==$||t[63]!==K?(W=r.jsxs(Pt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:VP,children:[D,$,K]}),t[61]=D,t[62]=$,t[63]=K,t[64]=W):W=t[64];let Y;return t[65]!==W||t[66]!==A?(Y=r.jsx(Rt,{open:!0,onOpenChange:A,children:W}),t[65]=W,t[66]=A,t[67]=Y):Y=t[67],Y}function VP(t){return t.preventDefault()}function TP(t){const e=F.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const i=n;let o,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=r.jsx(Nv,{size:13,className:"text-success"}),e[2]=o,e[3]=l):(o=e[2],l=e[3]);let a;return e[4]!==i?(a=r.jsxs("div",{className:o,children:[l,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=a):a=e[5],a}function AP(){const t=F.c(8),{org:e}=We(),s=Ot();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let i,o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),o=r.jsx(pn,{size:13,className:"text-warning"}),l=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=o,t[5]=l):(i=t[3],o=t[4],l=t[5]);let a;return t[6]!==n?(a=r.jsxs("button",{type:"button",onClick:n,className:i,children:[o,l]}),t[6]=n,t[7]=a):a=t[7],a}function EP(t){const e=F.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[i,r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),r.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=o):o=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),r.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[r.jsx(Au,{align:"right",width:"w-3/4"}),r.jsx(Au,{align:"left",width:"w-full",lines:3}),r.jsx(Au,{align:"right",width:"w-2/3"}),r.jsx(Au,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:r.jsx("div",{className:"relative flex-1",children:r.jsxs("div",{className:"space-y-2 p-2",children:[r.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),r.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"px-4 py-4",children:r.jsx("div",{className:"mx-auto w-full max-w-2xl",children:r.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[c,r.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),r.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=h):h=e[8];let u;return e[9]!==n?(u=r.jsxs("div",{className:n,children:[l,a,h]}),e[9]=n,e[10]=u):u=e[10],u}function Au(t){const e=F.c(22),{align:s,width:n,lines:i}=t,o=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,e[1]=c):c=e[1];const d=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let h;e[2]!==d?(h=ie("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=u):u=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=ie("min-w-0 rounded-2xl p-4",f,o),e[5]=f,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((y,L)=>r.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",L===l-1?"w-3/4":"w-full"),style:{animationDelay:`${L*.1}s`}},L))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==h?(b=r.jsxs("div",{className:h,children:[u,x]}),e[16]=x,e[17]=h,e[18]=b):b=e[18];let v;return e[19]!==b||e[20]!==c?(v=r.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=v):v=e[21],v}function PP(t){const e=F.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:o,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==s||e[4]!==n?(a=()=>{const d=n.current,h=s.current;if(!d||!h||!i)return;const u=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||o||!i)return;const p=h.scrollHeight,g=h.scrollTop;await l(),requestAnimationFrame(()=>{const x=h.scrollHeight;h.scrollTop=g+(x-p)})},{root:h,rootMargin:"200px 0px 0px 0px"});return u.observe(d),()=>u.disconnect()},c=[s,n,i,o,l],e[0]=l,e[1]=i,e[2]=o,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),E.useEffect(a,c)}function RP(t){const e=F.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=r.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function DP(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function IP(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function MP(){const t=re(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=di(),{taskId:l}=en();SP();const a=Wb(l??""),c=ej(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),h=bj(d),u=h.at(-1),m=fT()*ZV+16,p=E.useRef(null),g=E.useRef(null);PP({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=vj({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(yj,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),h.slice(0,-1).map((v,y)=>r.jsx(Fg,{pair:v,isLastPair:!1,status:y===h.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),u&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(Fg,{pair:u,isLastPair:!0,status:s},`pair-${u.user?.id??u.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(he,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:r.jsx(Hk,{size:14})})]})})}function $P(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}const hs=Object.assign(RP,{Main:DP,Messages:MP,EmptyState:IP,Footer:$P,Input:LP,Provider:Zk,ActiveTaskProvider:Xk,Skeleton:EP,IceBreakers:XV,NoAiProviderEmptyState:NN,CreditsEmptyState:NP,CreditsEyebrow:TP,NoCreditsEyebrow:AP,CreditsExhaustedBanner:By});function OP({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function BP(){const t=F.c(3),e=Bh(),n=Co()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=OP({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function Vc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function i9(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function zP(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function FP(t){const e=F.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(UP),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=i):i=e[3],i}function UP(t){return r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),r.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function HP(t){const e=F.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=re(),l=s+n+i,a=l>0?s/l*100:0,c=l>0?n/l*100:0,d=l>0?i/l*100:0;let h;e[0]!==a?(h=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=h):h=e[1];let u;e[2]!==c?(u=c>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=u):u=e[3];let f;e[4]!==d?(f=d>0&&r.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==f?(m=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[h,u,f]}),e[6]=h,e[7]=u,e[8]=f,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==o||e[12]!==a?(g=o("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=o,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[p,r.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==o?(v=o("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=o,e[19]=v):v=e[19];let y;e[20]!==v?(y=r.jsxs("div",{className:"flex items-center gap-1.5",children:[b,r.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=y):y=e[21];let L;e[22]!==d||e[23]!==i||e[24]!==o?(L=i>0&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=o,e[25]=L):L=e[25];let _;e[26]!==y||e[27]!==L||e[28]!==x?(_=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,y,L]}),e[26]=y,e[27]=L,e[28]=x,e[29]=_):_=e[29];let k;return e[30]!==_||e[31]!==m?(k=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,_]}),e[30]=_,e[31]=m,e[32]=k):k=e[32],k}function KP(t){const e=F.c(14),{agentId:s,isError:n}=t,i=Fs(s),o=re();let l;e[0]!==i?.title||e[1]!==o?(l=i?.title??o("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=o,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=r.jsx(Pi,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=d):d=e[5];const h=n?"text-destructive":"text-foreground";let u;e[6]!==h?(u=ie("shrink-0 font-medium",h),e[6]=h,e[7]=u):u=e[7];let f;e[8]!==a||e[9]!==u?(f=r.jsx("span",{className:u,children:a}),e[8]=a,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==f?(m=r.jsxs(r.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function WP(t){const e=F.c(12),{isError:s}=t,n=re();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const o=i;let l;e[2]!==o?(l=r.jsx(Pi,{icon:null,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=o,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=r.jsx("span",{className:c,children:o}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let h;return e[9]!==l||e[10]!==d?(h=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=h):h=e[11],h}function qP(t){const e=F.c(18),{part:s}=t,n=s.input?.agent_id,i=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==o?(a=r.jsx(WP,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(KP,{agentId:n,isError:o}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=r.jsx(E.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==s.input?(h=s.input?.prompt&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-muted-foreground/50",children:"·"}),r.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=h):h=e[9];let u;e[10]!==l||e[11]!==o||e[12]!==i?(u=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(ut,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(SC,{size:12,className:"text-destructive"}):l?r.jsx(pn,{size:12,className:"text-warning"}):r.jsx(ui,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=u):u=e[13];let f;return e[14]!==d||e[15]!==h||e[16]!==u?(f=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,h,u]}),e[14]=d,e[15]=h,e[16]=u,e[17]=f):f=e[17],f}function GP(t){const e=F.c(78),{onClose:s,back:n,className:i}=t,o=re(),[l,a]=E.useState(null),{messages:c}=di(),{activeTask:d}=en(),{selectedModel:h,selectedVirtualMcp:u}=jo();let f,m,p,g,x,b,v,y;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==h||e[7]!==u?.title||e[8]!==o){y=Symbol.for("react.early_return_sentinel");e:{const k=Jb(c),S=[...c].reverse().find(rR),w=S?.metadata?.usage,j=S?.metadata?.modelLimits?.contextWindow??h?.limits?.contextWindow??null,N=w?.contextTokens??0,A=j&&j>0?(N/j*100).toFixed(1):null,C=c;let T;e[17]!==C?(T=C.filter(iR).reduce(nR,0),e[17]=C,e[18]=T):T=e[18];const V=T,R=c;let P;e[19]!==R?(P=R.filter(sR).reduce(tR,0),e[19]=R,e[20]=P):P=e[20];const M=P,D=Math.max(0,k.totalTokens-V-M),$=c[0],z=c.at(-1),I=$?.metadata?.created_at??d?.created_at,O=z?.metadata?.created_at??d?.updated_at,B=c.filter(eR),U=c.flatMap(XP),H=h?.modelId?zP(h.modelId):"—",K=u?.title??"Super Agent",W=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:B.length},{label:o("chat.contextPanel.agentLabel"),value:K},{label:o("chat.contextPanel.modelLabel"),value:H},{label:o("chat.contextPanel.contextLimitLabel"),value:j?Vc(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:k.totalTokens>0?Vc(k.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:A!==null?`${A}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:k.inputTokens>0?Vc(k.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:k.outputTokens>0?Vc(k.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:k.reasoningTokens>0?Vc(k.reasoningTokens):"0"},{label:o("chat.contextPanel.costLabel"),value:k.cost>0?`$${k.cost<.001?k.cost.toFixed(6):k.cost.toFixed(4)}`:"$0.00"},{label:o("chat.contextPanel.sessionCreatedLabel"),value:i9(I)},{label:o("chat.contextPanel.lastActivityLabel"),value:i9(O)}];if(!d&&B.length===0){let X;e[21]!==i?(X=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=X):X=e[22];let q;e[23]!==o?(q=o("chat.contextPanel.title"),e[23]=o,e[24]=q):q=e[24];let Z;e[25]!==q?(Z=r.jsx("span",{className:"text-sm font-medium text-foreground",children:q}),e[25]=q,e[26]=Z):Z=e[26];let le;e[27]!==n?(le=n?r.jsx(Kg,{size:14,className:"text-muted-foreground"}):r.jsx(Si,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=le):le=e[28];let ne;e[29]!==s||e[30]!==le?(ne=r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:le}),e[29]=s,e[30]=le,e[31]=ne):ne=e[31];let ae;e[32]!==Z||e[33]!==ne?(ae=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Z,ne]}),e[32]=Z,e[33]=ne,e[34]=ae):ae=e[34];let de;e[35]!==o?(de=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=de):de=e[36];let fe;e[37]!==de?(fe=r.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:r.jsx("p",{className:"text-xs text-muted-foreground",children:de})}),e[37]=de,e[38]=fe):fe=e[38];let ue;e[39]!==X||e[40]!==ae||e[41]!==fe?(ue=r.jsxs("div",{className:X,children:[ae,fe]}),e[39]=X,e[40]=ae,e[41]=fe,e[42]=ue):ue=e[42],y=ue;break e}e[43]!==i?(b=ie("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",i),e[43]=i,e[44]=b):b=e[44];let Y;e[45]!==o?(Y=o("chat.contextPanel.title"),e[45]=o,e[46]=Y):Y=e[46];let Q;e[47]!==Y?(Q=r.jsx("span",{className:"text-sm font-medium text-foreground",children:Y}),e[47]=Y,e[48]=Q):Q=e[48];let te;e[49]!==n?(te=n?r.jsx(Kg,{size:14}):r.jsx(Si,{size:14}),e[49]=n,e[50]=te):te=e[50];let ee;e[51]!==s||e[52]!==te?(ee=r.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:te}),e[51]=s,e[52]=te,e[53]=ee):ee=e[53],e[54]!==Q||e[55]!==ee?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[Q,ee]}),e[54]=Q,e[55]=ee,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=U.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.subtasksSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:U.map(JP)})]}),p=r.jsx(FP,{items:W});let oe;e[57]!==o?(oe=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=oe):oe=e[58];let se;e[59]!==oe?(se=r.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=se):se=e[60];let G;e[61]!==M||e[62]!==D||e[63]!==V?(G=r.jsx(HP,{userTokens:V,assistantTokens:M,otherTokens:D}),e[61]=M,e[62]=D,e[63]=V,e[64]=G):G=e[64],e[65]!==se||e[66]!==G?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[se,G]}),e[65]=se,e[66]=G,e[67]=g):g=e[67],x=B.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.rawMessagesSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:B.map(X=>{const q=X.metadata?.created_at,Z=l?.id===X.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(Z?null:X),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:ie("shrink-0 font-medium",X.role==="user"?"text-chart-1":"text-chart-2"),children:X.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:X.id})]}),q&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:i9(q)})]}),Z&&r.jsxs(r.Fragment,{children:[X.role==="assistant"&&(()=>{const le=X.metadata?._request;if(!le)return null;const ne=le.systemSections??[],ae=Math.max(1,...ne.map(QP)),de=ne.reduce(YP,0);return r.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-foreground",children:o("chat.contextPanel.requestLabel")}),r.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[le.activeTools??0," / ",le.tools??0," ",o("chat.contextPanel.toolsActive")]})]}),ne.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"text-muted-foreground",children:[o("chat.contextPanel.systemPromptLabel")," ",r.jsxs("span",{className:"tabular-nums",children:["~",Math.round(de/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),ne.map((fe,ue)=>{const ge=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ue}`,J=fe.chars/ae*100,me=Math.round(fe.chars/4);return r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-mono text-foreground truncate",children:ge}),r.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",me.toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),r.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${J}%`}})})]},ue)})]})]})})(),r.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(X,null,2)})]})]},X.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=h,e[7]=u?.title,e[8]=o,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=y}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let L;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(L=r.jsxs("div",{className:f,children:[m,p,g,x]}),e[68]=f,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=L):L=e[73];let _;return e[74]!==b||e[75]!==v||e[76]!==L?(_=r.jsxs("div",{className:b,children:[v,L]}),e[74]=b,e[75]=v,e[76]=L,e[77]=_):_=e[77],_}function YP(t,e){return t+e.chars}function QP(t){return t.chars}function JP(t,e){return r.jsx(qP,{part:t},e)}function XP(t){return(t.parts??[]).filter(ZP)}function ZP(t){return t.type==="tool-subtask"}function eR(t){return t.role!=="system"}function tR(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function sR(t){return t.role==="assistant"}function nR(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function iR(t){return t.role==="user"}function rR(t){return t.role==="assistant"&&t.metadata?.usage}function oR(t){const e=F.c(21),{onOpenContextPanel:s}=t,{org:n}=We(),{selectedVirtualMcp:i}=jo();let o;e[0]!==n.id?(o=tc(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Fs(a.id)??a,h=d.title??"Super Agent",u=d.icon??null,f=d.description??null;let m;e[2]!==u||e[3]!==h?(m=r.jsx(yo,{icon:u,name:h,size:"lg"}),e[2]=u,e[3]=h,e[4]=m):m=e[4];let p;e[5]!==h?(p=r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:h}),e[5]=h,e[6]=p):p=e[6];let g;e[7]!==f?(g=f?r.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=r.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=r.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(hs.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let y;e[16]!==s?(y=r.jsxs(hs.Footer,{children:[v,r.jsx(hs.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=y):y=e[17];let L;return e[18]!==b||e[19]!==y?(L=r.jsxs(r.Fragment,{children:[b,y]}),e[18]=b,e[19]=y,e[20]=L):L=e[20],L}function _3(t){const e=F.c(17),{outputs:s,collapsed:n,onToggle:i,variant:o}=t,l=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==l?(a=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let h;e[3]!==d?(h=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=h):h=e[4];let u;e[5]!==h?(u=r.jsx(Jt,{className:h}),e[5]=h,e[6]=u):u=e[6];let f;e[7]!==i||e[8]!==u?(f=r.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,u]}),e[7]=i,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&r.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(lR)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==a||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function lR(t){return r.jsx(Lj,{file:t},t.key)}function aR(){const t=F.c(13),e=Co()?.taskId??null,s=_j();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=Xb(e,n),[o,l]=E.useState(!1),[a,c]=E.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(dR),t[2]=d):d=t[2];let h;t[3]!==o||t[4]!==i?(h=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(_3,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=h):h=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>c(cR),t[6]=u):u=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(_3,{variant:"bar",outputs:i,collapsed:a,onToggle:u})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==h||t[11]!==f?(m=r.jsxs(r.Fragment,{children:[h,f]}),t[10]=h,t[11]=f,t[12]=m):m=t[12],m}function cR(t){return!t}function dR(t){return!t}function uR(){const t=F.c(30),{org:e}=We(),{isChatEmpty:s}=di(),[n,i]=E.useState("chat"),o=pp();if(BP()){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(hs,{className:"animate-in fade-in-0 duration-200",children:r.jsx(hs.Main,{className:"flex flex-col items-center",children:r.jsx(hs.EmptyState,{children:r.jsx(hs.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let a;t[1]!==o.hasDecoKey||t[2]!==o.hasOnlyDecoProvider||t[3]!==o.isLoading||t[4]!==o.isZeroBalance||t[5]!==s||t[6]!==e?(a=o.hasDecoKey&&o.isZeroBalance&&o.hasOnlyDecoProvider&&!o.isLoading&&s&&!CP(e.id),t[1]=o.hasDecoKey,t[2]=o.hasOnlyDecoProvider,t[3]=o.isLoading,t[4]=o.isZeroBalance,t[5]=s,t[6]=e,t[7]=a):a=t[7];const c=a;let d;t[8]!==c?(d=c&&r.jsx(hs.CreditsEmptyState,{}),t[8]=c,t[9]=d):d=t[9];const h=n!=="chat"?!0:void 0,u=n!=="chat",f=n!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;t[10]!==f?(m=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[10]=f,t[11]=m):m=t[11];let p;t[12]!==s?(p=s?r.jsx(oR,{onOpenContextPanel:()=>i("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(hs.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(aR,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(hs.Messages,{})})]}),r.jsx(hs.Footer,{children:r.jsx(hs.Input,{onOpenContextPanel:()=>i("context")})})]}),t[12]=s,t[13]=p):p=t[13];let g;t[14]!==h||t[15]!==u||t[16]!==m||t[17]!==p?(g=r.jsx("div",{inert:h,"aria-hidden":u,className:m,children:p}),t[14]=h,t[15]=u,t[16]=m,t[17]=p,t[18]=g):g=t[18];const x=n!=="context"?!0:void 0,b=n!=="context",v=n==="context"?"opacity-100":"opacity-0 pointer-events-none";let y;t[19]!==v?(y=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[19]=v,t[20]=y):y=t[20];let L;t[21]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(GP,{back:!0,onClose:()=>i("chat")}),t[21]=L):L=t[21];let _;t[22]!==y||t[23]!==x||t[24]!==b?(_=r.jsx("div",{inert:x,"aria-hidden":b,className:y,children:L}),t[22]=y,t[23]=x,t[24]=b,t[25]=_):_=t[25];let k;return t[26]!==d||t[27]!==_||t[28]!==g?(k=r.jsxs(hs,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[d,g,_]}),t[26]=d,t[27]=_,t[28]=g,t[29]=k):k=t[29],k}function l6(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(hs.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Js,{fallback:e,children:r.jsx(E.Suspense,{fallback:r.jsx(hs.Skeleton,{}),children:r.jsx(uR,{})})}),t[1]=s):s=t[1],s}function hR(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function zp(t){return t?.name||t?.email?.split("@")[0]||void 0}function Xh(t){const e=hR(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function fR(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const i=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(i)}return n}const a6=["SANDBOX_START"],Eu=new Map,mR=t=>`${t.virtualMcpId}::${t.branch??""}`,pR=t=>t.message.includes("retry shortly"),r9=new Set,u1={mark:(t,e)=>r9.add(`${t}::${e}`),clear:(t,e)=>r9.delete(`${t}::${e}`),isStopped:(t,e)=>r9.has(`${t}::${e}`)};function c6(t,e){const s=Ls();return Xs({mutationKey:a6,retry:(n,i)=>pR(i)&&n<6,retryDelay:n=>nu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&u1.clear(n.virtualMcpId,n.branch);const i=mR(n),o=Eu.get(i);if(o)return o;const l=(async()=>(await fR(t,"SANDBOX_START",n)).structuredContent)();Eu.set(i,l);try{return await l}finally{Eu.get(i)===l&&Eu.delete(i)}},onSuccess:()=>{wd(s),e?.onStarted?.()}})}function gR(t,e){const s=F.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:a6,predicate:o=>{if(!t)return!1;const l=o.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],Qh(n)>0}function L3(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function xR(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function bR(t){const e=t.mainParamValue===0?"0":t.mainParamValue,s=t.entityMetadata?.defaultMainView??null,n=s==null||s.type==="chat",i=t.mainParamPresent?e!=="0":!n,o=n||t.entityMetadata?.chatDefaultOpen?"chat":null,l=t.sidePanelParamPresent?t.sidePanelParamValue===0?null:t.sidePanelParamValue??null:o;return xR({sidePanel:l,mainOpen:i})}function o9(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?L3("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?L3("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function vR(t){return t.sidePanel!==null&&t.mainOpen?{side:33,main:67}:t.sidePanel!==null?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function yR(t){const{sidePanel:e,mainOpen:s}=t.visibility;return e!==null&&(t.sidePanelParamPresent||!s)?e:s?"main":"chat"}function _R(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function LR(t,e){const s=Ot(),n=lr({strict:!1}),i=wh({strict:!1}),{create:o}=Yd(),{threads:l}=oC(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,h=n.main===0?"0":n.main,{sidePanel:u,mainOpen:f}=bR({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:h,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:u,mainOpen:f},p=E.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=A=>({org:c,taskId:A}),v=d?{virtualmcpid:a}:{},y=(A,C)=>{s({to:x,params:b(g),search:T=>({...T,...A}),replace:C?.replace??!1})},L=(A,C)=>{s({to:x,params:b(A),search:T=>{const V={};return C?V.virtualmcpid=C:d&&(V.virtualmcpid=a),V}})},_=()=>{const A=o9({type:"toggleMain",openMainValue:ba(t)},m);A&&y(A,{replace:!0})},k=A=>{const C=o9({type:"toggleSidePanel",sidePanel:A},m);C&&y(C,{replace:!0})},S=A=>{const C=h&&h!=="0"?h:ba(t);y(_R(A,C),{replace:!0})},w=A=>{const C=o9({type:"openSidePanel",sidePanel:A},m);C&&y(C,{replace:!0})},j=async()=>{const A=crypto.randomUUID(),C=l.find(T=>T.id===g)?.branch??null;try{await o({id:A,virtual_mcp_id:a,...C?{branch:C}:{}})}catch{}s({to:x,params:b(A),search:T=>({...v})})},N=A=>{y({main:A==="0"?0:A},{replace:!0})};return{taskId:g,sidePanel:u,mainOpen:f,mainParam:h,sidePanelParamPresent:n.sidepanel!==void 0,setTaskId:L,toggleMain:_,toggleSidePanel:k,setMobileSurface:S,openSidePanel:w,createNewTask:j,openTab:N}}function wR(t){const e=F.c(10),{org:s}=We(),n=Qm(),{data:i}=ci.useSession(),o=i?.user?.id,l=t?.id??null,a=!!t&&!!o&&!!t.created_by&&t.created_by!==o;let c;e[0]!==s.id||e[1]!==l?(c=it.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let h;e[3]!==n||e[4]!==l?(h=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=h):h=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==h?(u={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:h},e[6]=c,e[7]=d,e[8]=h,e[9]=u):u=e[9],Vt(u)}function SR(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function kR(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function jR(t){return t/100*window.innerHeight}function CR(t){return t/100*window.innerWidth}function NR(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function Yc({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=NR(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=kR(e,i);break}case"em":{n=SR(e,i);break}case"vh":{n=jR(i);break}case"vw":{n=CR(i);break}}return n}function wn(t){return parseFloat(t.toFixed(3))}function Ka({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,i)=>(n+=e==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function h1(t){const{panels:e}=t,s=Ka({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:i,panelConstraints:o}=n;let l=0;if(o.collapsedSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=wn(h/s*100)}let a;if(o.defaultSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=wn(h/s*100)}let c=0;if(o.minSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.minSize});c=wn(h/s*100)}let d=100;if(o.maxSize!==void 0){const h=Yc({groupSize:s,panelElement:i,styleProp:o.maxSize});d=wn(h/s*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Ft(t,e="Assertion error"){if(!t)throw Error(e)}function f1(t,e){return Array.from(e).sort(t==="horizontal"?VR:TR)}function VR(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function TR(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function d6(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function u6(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function AR({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,o=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=u6(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Ft(i,"No rect found"),i}let Pu;function ER(){return Pu===void 0&&(typeof matchMedia=="function"?Pu=!!matchMedia("(pointer:coarse)").matches:Pu=!1),Pu}function h6(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=f1(s,Array.from(e.children).filter(d6).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,h=-1,u=0,f,m=[];{let p=-1;for(const g of o)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(u++,d===-1&&(d=p),h=p))}if(u>1){let p=-1;for(const g of o)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let y;if(c){const L=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),_=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{y=[L,_];break}case 1:{const k=m[0],S=AR({orientation:s,rects:[b,v],targetRect:k.element.getBoundingClientRect()});y=[k,S===b?_:L];break}default:{y=m;break}}}else m.length?y=m:y=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const L of y){let _="width"in L?L:L.element.getBoundingClientRect();const k=ER()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(_.width<k){const w=k-_.width;_=new DOMRect(_.x-w/2,_.y,_.width+w,_.height)}if(_.height<k){const w=k-_.height;_=new DOMRect(_.x,_.y-w/2,_.width,_.height+w)}const S=p<=d||p>h;!a&&!S&&l.push({group:t,groupSize:Ka({group:t}),panels:[f,x],separator:"width"in L?void 0:L,rect:_}),a=!1}}c=!1,f=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?m.push(x):(f=void 0,m=[])}else c=!0}return l}let f6=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let i=!1,o=null;const l=Array.from(n);for(let a=0;a<l.length;a++){const c=l[a];try{c.call(null,s)}catch(d){o===null&&(i=!0,o=d)}}if(i)throw o}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(s);i>=0&&n.splice(i,1)}}},La={cursorFlags:0,state:"inactive"};const Fp=new f6;function sl(){return La}function PR(t){return Fp.addListener("change",t)}function RR(t){const e=La,s={...La};s.cursorFlags=t,La=s,Fp.emit("change",{prev:e,next:s})}function wa(t){const e=La;La=t,Fp.emit("change",{prev:e,next:t})}const DR=t=>t,l9=()=>{},m6=1,p6=2,g6=4,x6=8,w3=3,S3=12;let Ru;function k3(){return Ru===void 0&&(Ru=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ru=!0)),Ru}function IR({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&k3()){const o=(t&m6)!==0,l=(t&p6)!==0,a=(t&g6)!==0,c=(t&x6)!==0;if(o)return a?"se-resize":c?"ne-resize":"e-resize";if(l)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return k3()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const j3=new WeakMap;function Up(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=j3.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=sl();switch(n.state){case"active":case"hover":{const i=IR({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(e===o)return;e=o,i?s.cssRules.length===0?s.insertRule(o):s.replaceSync(o):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}j3.set(t,{prevStyle:e,styleSheet:s})}let Yi=new Map;const b6=new f6;function MR(t){Yi=new Map(Yi),Yi.delete(t)}function C3(t,e){for(const[s]of Yi)if(s.id===t)return s}function po(t,e){for(const[s,n]of Yi)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function bl(){return Yi}function Hp(t,e){return b6.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function Mr(t,e,s){const n=Yi.get(t);Yi=new Map(Yi),Yi.set(t,e),b6.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function v6(t){const e=sl();let s=!1;return e.state==="active"&&(wa({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(Up(t),s=!0,e.hitRegions.forEach(n=>{const i=po(n.group.id,!0);Mr(n.group,i,{isUserInteraction:!0})}))),s}function N3(t){t.defaultPrevented||v6(t.currentTarget)}function $R(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=u6(s,o.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=o,i=l);break}case"vertical":{l.y<=i.y&&(n=o,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function OR(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function BR(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:A3(t),b:A3(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Ft(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:T3(V3(s.a)),b:T3(V3(s.b))};if(i.a===i.b){const o=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=o.length;for(;a--;){const c=o[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const zR=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function FR(t){const e=getComputedStyle(y6(t)??t).display;return e==="flex"||e==="inline-flex"}function UR(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||FR(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||zR.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function V3(t){let e=t.length;for(;e--;){const s=t[e];if(Ft(s,"Missing node"),UR(s))return s}return null}function T3(t){return t&&Number(getComputedStyle(t).zIndex)||0}function A3(t){const e=[];for(;t;)e.push(t),t=y6(t);return e}function y6(t){const{parentNode:e}=t;return OR(e)?e.host:e}function HR(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function KR({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!d6(s)||s.contains(t)||t.contains(s))return!0;if(BR(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(HR(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function Kp(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=h6(i),l=$R(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&KR({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function WR(t,e){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 fn(t,e,s=0){return Math.abs(wn(t)-wn(e))<=s}function Fi(t,e){return fn(t,e)?0:t>e?1:-1}function va({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(Fi(n,c)<0)if(o){const d=(i+c)/2;Fi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=wn(n),n}function Dd({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(fn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[h,u]=n;Ft(h!=null,"Invalid first pivot index"),Ft(u!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?u:h,x=s[g];Ft(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const L=a[g];if(Ft(L!=null,`Previous layout not found for panel index ${g}`),fn(L,b)){const _=y-L;Fi(_,Math.abs(t))>0&&(t=t<0?0-_:_)}}}{const g=t<0?h:u,x=s[g];Ft(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const L=a[g];if(Ft(L!=null,`Previous layout not found for panel index ${g}`),fn(L,y)){const _=L-b;Fi(_,Math.abs(t))>0&&(t=t<0?0-_:_)}}}break}default:{const g=t<0?u:h,x=s[g];Ft(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:y,minSize:L}=x;if(v&&Fi(b,L)<0)if(t>0){const _=L-y,k=_/2,S=b+t;Fi(S,L)<0&&(t=Fi(t,k)<=0?0:_)}else{const _=L-y,k=100-_/2,S=b-t;Fi(S,L)<0&&(t=Fi(100+t,k)>0?0:-_)}break}}{const g=t<0?1:-1;let x=t<0?u:h,b=0;for(;;){const y=a[x];Ft(y!=null,`Previous layout not found for panel index ${x}`);const L=va({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:y,size:100})-y;if(b+=L,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?h:u;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Ft(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,y=va({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!fn(b,y)&&(f+=b-y,d[g]=y,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(WR(c,d))return i;{const g=t<0?u:h,x=a[g];Ft(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=va({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!fn(v,b)){let y=b-v,L=t<0?u:h;for(;L>=0&&L<s.length;){const _=d[L];Ft(_!=null,`Previous layout not found for panel index ${L}`);const k=_+y,S=va({overrideDisabledPanels:l,panelConstraints:s[L],prevSize:_,size:k});if(fn(_,S)||(y-=S-_,d[L]=S),fn(y,0))break;t>0?L--:L++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!fn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function nl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Fi(t[s],e[s])!==0)return!1;return!0}function il({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],i=n.reduce((a,c)=>a+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!fn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Ft(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let o=0;for(let a=0;a<e.length;a++){const c=s[a];Ft(c!=null,`No layout data found for index ${a}`);const d=n[a];Ft(d!=null,`No layout data found for index ${a}`);const h=va({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=h&&(o+=d-h,n[a]=h)}if(!fn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Ft(c!=null,`No layout data found for index ${a}`);const d=c+o,h=va({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==h&&(o-=h-c,n[a]=h,fn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function _6({groupId:t,panelId:e}){const s=()=>{const c=bl();for(const[d,{defaultLayoutDeferred:h,derivedPanelConstraints:u,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:h,derivedPanelConstraints:u,group:d,groupSize:m,layout:f,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},i=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},o=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},l=({nextSize:c,panels:d,prevLayout:h,derivedPanelConstraints:u})=>{const f=o(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<f&&(p||d.slice(0,m).every((x,b)=>{const v=u[b];return v?.collapsible&&fn(v.collapsedSize,h[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+h[v.id],0);return{...h,[e]:wn(100-x)}}return Dd({delta:g?f-c:c-f,initialLayout:h,panelConstraints:u,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:h,trigger:"imperative-api"})},a=c=>{const d=o();if(c===d)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:u,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:u}),b=il({layout:x,panelConstraints:u});nl(p,b)||Mr(f,{defaultLayoutDeferred:h,derivedPanelConstraints:u,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:h}=i(),u=o();c&&u!==d&&(h.expandToSize=u,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:h}=n(),{mutableValues:u}=i(),f=o();if(c&&f===d){let m=u.expandToSize??h;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:h}=i(),u=c.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:d,inPixels:u}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),h=o();return c&&fn(d,h)},resize:c=>{const{group:d}=s(),{element:h}=i(),u=Ka({group:d}),f=Yc({groupSize:u,panelElement:h,styleProp:c}),m=wn(f/u*100);a(m)}}}function E3(t){if(t.defaultPrevented)return;const e=bl();Kp(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,o=_6({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function b0(t){const e=bl();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function L6({groupId:t}){const e=()=>{const s=bl();for(const[n,i]of s)if(n.id===t)return{group:n,...i};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:o,groupSize:l,layout:a,separatorToPanels:c}=e(),d=il({layout:s,panelConstraints:i});return n?a:(nl(a,d)||Mr(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function Io(t,e){const s=b0(t),n=po(s.id,!0),i=s.separators.find(h=>h.element===t);Ft(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Ft(o,"Matching panels not found");const l=o.map(h=>s.panels.indexOf(h)),a=L6({groupId:s.id}).getLayout(),c=Dd({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=il({layout:c,panelConstraints:n.derivedPanelConstraints});nl(a,d)||Mr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function P3(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=b0(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&Io(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&Io(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&Io(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&Io(e,-5);break}case"End":{t.preventDefault(),Io(e,100);break}case"Enter":{t.preventDefault();const n=b0(e),i=po(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Ft(c,"Matching separator not found");const d=a.get(c);Ft(d,"Matching panels not found");const h=d[0],u=o.find(f=>f.panelId===h.id);if(Ft(u,"Panel metadata not found"),u.collapsible){const f=l[h.id],m=u.collapsedSize===f?n.mutableState.expandedPanelSizes[h.id]??u.minSize:u.collapsedSize;Io(e,m-f)}break}case"F6":{t.preventDefault();const n=b0(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Ft(i!==null,"Index not found");const o=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[o].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),Io(e,-100);break}}}function R3(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=bl(),s=Kp(t,e),n=new Map;let i=!1;s.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(o.group);l&&n.set(o.group,l.layout)}),wa({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function w6({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:h,groupSize:u}=d,{orientation:f,panels:m}=h,{disableCursor:p}=h.mutableState;let g=0;o?f==="horizontal"?g=(e.clientX-o.x)/u*100:g=(e.clientY-o.y)/u*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(h),b=i.get(h);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:y,groupSize:L,layout:_,separatorToPanels:k}=b;if(y&&_&&k){const S=Dd({delta:g,initialLayout:x,panelConstraints:y,pivotIndices:d.panels.map(w=>m.indexOf(w)),prevLayout:_,trigger:"mouse-or-touch"});if(nl(S,_)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?m6:p6;break}case"vertical":{a|=g<0?g6:x6;break}}}else Mr(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:y,groupSize:L,layout:S,separatorToPanels:k})}});let c=0;e.movementX===0?c|=l&w3:c|=a&w3,e.movementY===0?c|=l&S3:c|=a&S3,RR(c),Up(t)}function D3(t){const e=bl(),s=sl();s.state==="active"&&w6({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function I3(t){if(t.defaultPrevented)return;const e=sl(),s=bl();switch(e.state){case"active":{if(t.buttons===0){wa({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=po(n.group.id,!0);Mr(n.group,i,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:i}=n.separator;i.hasPointerCapture?.(t.pointerId)||i.setPointerCapture?.(t.pointerId)}w6({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=Kp(t,s);n.length===0?e.state!=="inactive"&&wa({cursorFlags:0,state:"inactive"}):wa({cursorFlags:0,hitRegions:n,state:"hover"}),Up(t.currentTarget);break}}}function M3(t){t.relatedTarget instanceof HTMLIFrameElement&&sl().state==="hover"&&wa({cursorFlags:0,state:"inactive"})}function $3(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||v6(t.currentTarget)&&t.preventDefault()}function O3(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=wn(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=wn((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=o)}return n}function qR(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Ka({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:wn(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function GR(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function YR({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,o=0,l=!1;const a=new Map,c=[];for(const u of t.panels){const f=n[u.id]??0;if(u.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=wn(m/e*100);a.set(u.id,p),i+=p}else c.push(u.id),o+=f}if(!l||c.length===0)return n;const d=100-i,h={...n};if(a.forEach((u,f)=>{h[f]=u}),o>0)for(const u of c){const f=n[u]??0;h[u]=wn(f/o*d)}else{const u=wn(d/c.length);for(const f of c)h[f]=u}return h}function QR(t,e){const s=t.map(i=>i.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const i of s)if(!n.includes(i))return!1;return!0}const oa=new Map;function JR(t){let e=!0;Ft(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,o=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Ka({group:t});if(v===0)return;const y=po(t.id);if(!y)return;const L=h1(t),_=y.defaultLayoutDeferred?O3(L):y.layout,k=YR({group:t,nextGroupSize:v,prevGroupSize:y.groupSize,prevLayout:_}),S=il({layout:k,panelConstraints:L});if(!y.defaultLayoutDeferred&&nl(y.layout,S)&&GR(y.derivedPanelConstraints,L)&&y.groupSize===v)return;Mr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:v,layout:S,separatorToPanels:y.separatorToPanels})}}else qR(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Ft(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&o.observe(p.element)});const l=Ka({group:t}),a=h1(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(QR(t.panels,d)||(d=void 0));const h=t.mutableState.layouts[c]??d??O3(a),u=il({layout:h,panelConstraints:a}),f=t.element.ownerDocument;oa.set(f,(oa.get(f)??0)+1);const m=new Map;return h6(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),Mr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:u,separatorToPanels:m}),t.separators.forEach(p=>{Ft(!i.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),i.add(p.id),p.element.addEventListener("keydown",P3)}),oa.get(f)===1&&(f.addEventListener("contextmenu",N3,!0),f.addEventListener("dblclick",E3,!0),f.addEventListener("pointerdown",R3,!0),f.addEventListener("pointerleave",D3),f.addEventListener("pointermove",I3),f.addEventListener("pointerout",M3),f.addEventListener("pointerup",$3,!0)),function(){e=!1,oa.set(f,Math.max(0,(oa.get(f)??0)-1)),MR(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",P3)}),oa.get(f)||(f.removeEventListener("contextmenu",N3,!0),f.removeEventListener("dblclick",E3,!0),f.removeEventListener("pointerdown",R3,!0),f.removeEventListener("pointerleave",D3),f.removeEventListener("pointermove",I3),f.removeEventListener("pointerout",M3),f.removeEventListener("pointerup",$3,!0)),o.disconnect()}}function XR(){const[t,e]=E.useState({}),s=E.useCallback(()=>e({}),[]);return[t,s]}function Wp(t){const e=E.useId();return`${t??e}`}const vl=typeof window<"u"?E.useLayoutEffect:E.useEffect;function cd(t){const e=E.useRef(t);return vl(()=>{e.current=t},[t]),E.useCallback((...s)=>e.current?.(...s),[e])}function qp(...t){return cd(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function Gp(t){const e=E.useRef({...t});return vl(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const S6=E.createContext(null);function ZR(t,e){const s=E.useRef({getLayout:()=>({}),setLayout:DR});E.useImperativeHandle(e,()=>s.current,[]),vl(()=>{Object.assign(s.current,L6({groupId:t}))})}function k6({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:h="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...m}){const p=E.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=cd(A=>{nl(p.current.onLayoutChange,A)||(p.current.onLayoutChange=A,c?.(A))}),x=cd((A,C)=>{nl(p.current.onLayoutChanged,A)||(p.current.onLayoutChanged=A,d?.(A,{isUserInteraction:C}))}),b=Wp(a),v=E.useRef(null),[y,L]=XR(),_=E.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=qp(v,o);ZR(b,l);const S=cd((A,C)=>{const T=sl(),V=C3(A),R=po(A);if(R){let P=!1;return T.state==="active"&&(P=T.hitRegions.some(M=>M.group===V)),{flexGrow:R.layout[C]??1,pointerEvents:P?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),w=Gp({defaultLayout:s,disableCursor:n}),j=E.useMemo(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:S,id:b,orientation:h,registerPanel:A=>{const C=_.current;return C.panels=f1(h,[...C.panels,A]),L(),()=>{C.panels=C.panels.filter(T=>T!==A),L()}},registerSeparator:A=>{const C=_.current;return C.separators=f1(h,[...C.separators,A]),L(),()=>{C.separators=C.separators.filter(T=>T!==A),L()}},updatePanelProps:(A,{disabled:C})=>{const T=_.current.panels.find(P=>P.id===A);T&&(T.panelConstraints.disabled=C);const V=C3(b),R=po(b);V&&R&&Mr(V,{...R,derivedPanelConstraints:h1(V)})},updateSeparatorProps:(A,{disabled:C,disableDoubleClick:T})=>{const V=_.current.separators.find(R=>R.id===A);V&&(V.disabled=C,V.disableDoubleClick=T)}}),[S,b,L,h,w]),N=E.useRef(null);return vl(()=>{const A=v.current;if(A===null)return;const C=_.current;let T;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===C.panels.length){T={};for(const z of C.panels){const I=w.defaultLayout[z.id];I!==void 0&&(T[z.id]=I)}}const V={disabled:!!i,element:A,id:b,mutableState:{defaultLayout:T,disableCursor:!!w.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:h,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};N.current=V;const R=JR(V),{defaultLayoutDeferred:P,derivedPanelConstraints:M,layout:D}=po(V.id,!0);!P&&M.length>0&&(g(D),x(D,!1));const $=Hp(b,z=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:O,layout:B}=z.next;if(I||O.length===0)return;const U=V.panels.map(({id:K})=>K).join(",");V.mutableState.layouts[U]=B,O.forEach(K=>{if(K.collapsible){const{layout:W}=z.prev??{};if(W){const Y=fn(K.collapsedSize,B[K.panelId]),Q=fn(K.collapsedSize,W[K.panelId]);Y&&!Q&&(V.mutableState.expandedPanelSizes[K.panelId]=W[K.panelId])}}});const H=sl().state!=="active";g(B),H&&x(B,z.isUserInteraction)});return()=>{N.current=null,R(),$()}},[i,b,x,g,h,y,w]),E.useEffect(()=>{const A=N.current;A&&(A.mutableState.defaultLayout=s,A.mutableState.disableCursor=!!n)}),r.jsx(S6.Provider,{value:j,children:r.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:t})})}k6.displayName="Group";function Yp(){const t=E.useContext(S6);return Ft(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function eD(t,e){const{id:s}=Yp(),n=E.useRef({collapse:l9,expand:l9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:l9});E.useImperativeHandle(e,()=>n.current,[]),vl(()=>{Object.assign(n.current,_6({groupId:s,panelId:t}))})}function j6({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:o,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:d="100%",minSize:h="0%",onResize:u,panelRef:f,style:m,...p}){const g=!!c,x=Wp(c),b=Gp({disabled:o}),v=E.useRef(null),y=qp(v,l),{getPanelStyles:L,id:_,orientation:k,registerPanel:S,updatePanelProps:w}=Yp(),j=u!==null,N=cd((V,R,P)=>{u?.(V,c,P)});vl(()=>{const V=v.current;if(V!==null){const R={element:V,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:h}};return S(R)}},[a,s,n,i,j,x,g,d,h,N,S,b]),E.useEffect(()=>{w(x,{disabled:o})},[o,x,w]),eD(x,f);const A=()=>{const V=L(_,x);if(V)return JSON.stringify(V)},C=E.useSyncExternalStore(V=>Hp(_,V),A,A);let T;return C?T=JSON.parse(C):i!==void 0?T={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:T={flexGrow:1},r.jsx("div",{...p,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:y,style:{...tD,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...T},children:r.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:t})})}j6.displayName="Panel";const tD={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function sD({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,o;const l=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,d=a.collapsible?a.collapsedSize:a.minSize,h=[n,n+1];o=il({layout:Dd({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:h,prevLayout:t}),panelConstraints:e})[s],i=il({layout:Dd({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:h,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function C6({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=Wp(o),d=Gp({disabled:s,disableDoubleClick:n}),[h,u]=E.useState({}),[f,m]=E.useState("inactive"),[p,g]=E.useState(!1),x=E.useRef(null),b=qp(x,i),{disableCursor:v,id:y,orientation:L,registerSeparator:_,updateSeparatorProps:k}=Yp(),S=L==="horizontal"?"vertical":"horizontal";vl(()=>{const N=x.current;if(N!==null){const A={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:N,id:c},C=_(A),T=PR(R=>{m(R.next.state!=="inactive"&&R.next.hitRegions.some(P=>P.separator===A)?R.next.state:"inactive")}),V=Hp(y,R=>{const{derivedPanelConstraints:P,layout:M,separatorToPanels:D}=R.next,$=D.get(A);if($){const z=$[0],I=$.indexOf(z);u(sD({layout:M,panelConstraints:P,panelId:z.id,panelIndex:I}))}});return()=>{T(),V(),C()}}},[y,c,_,d]),E.useEffect(()=>{k(c,{disabled:s,disableDoubleClick:n})},[s,n,c,k]);let w;s&&!v&&(w="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":h.valueControls,"aria-disabled":s||void 0,"aria-orientation":S,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:w,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}C6.displayName="Separator";function N6(t){const e=F.c(10);let s,n,i;e[0]!==t?({className:s,ref:i,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("flex h-full w-full",s),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==o?(l=r.jsx(k6,{groupRef:i,"data-slot":"resizable-panel-group",className:o,...n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function $0(t){const e=F.c(10);let s,n,i;e[0]!==t?({ref:n,style:i,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==i?(o={overflow:"hidden",...i},e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==o?(l=r.jsx(j6,{panelRef:n,"data-slot":"resizable-panel",style:o,...s}),e[6]=s,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function V6(t){const e=F.c(12);let s,n,i;e[0]!==t?({withHandle:i,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=o):o=e[5];let l;e[6]!==i?(l=i&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(ic,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==o||e[10]!==l?(a=r.jsx(C6,{"data-slot":"resizable-handle",className:o,...n,children:l}),e[8]=n,e[9]=o,e[10]=l,e[11]=a):a=e[11],a}function B3(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function nD(t,e){const s=F.c(8);let n;s[0]!==e?(n=c=>B3(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=Vb(t,n);let l;s[2]!==e||s[3]!==i?(l=B3(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==o||s[6]!==l?(a=[l,o],s[5]=o,s[6]=l,s[7]=a):a=s[7],a}const iD=33;function rD(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Bm.sidePanelWidth(),t[0]=e):e=t[0],nD(e,iD)}function m1(){const t=F.c(3),[e,s]=E.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function T6(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 Qp(t){const e=T6(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(o=>o.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 lu(t){const e=lD(t);return e===null?null:e}function A6(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=A6(s);return!n||!s?null:{number:n,htmlUrl:s}}function z3(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const F3=/[\r\n<>]/,cD=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function au(t){const e=t?.userName?.trim();if(!e||F3.test(e))return null;const s=t?.userEmail?.trim();return!s||F3.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 E6(t,e){const s=au(e);if(!s)return t;const n=dD(t),i=uD(s);if(n.includes(i))return n;const o=n.trimEnd();return o.length>0?`${o}
5
5
 
@@ -537,10 +537,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
537
537
  22% { opacity: 0; }
538
538
  }
539
539
  `}),e[26]=L):L=e[26];let _;return e[27]!==y||e[28]!==h?(_=r.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[h,y,L]}),e[27]=y,e[28]=h,e[29]=_):_=e[29],_}function Qu(t){const e=F.c(10),{phase:s,current:n,children:i}=t,o=s-n,l=o<0,a=o===0,c=l?90:o*-22,d=l?.94:1-Math.max(o,0)*.04,h=l?0:a?1:o===1?.8:.55,u=l?10:30-o,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==h||e[2]!==p||e[3]!==g||e[4]!==u?(x={transform:p,opacity:h,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=h,e[2]=p,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=r.jsx("div",{"aria-hidden":f,className:m,style:x,children:i}),e[6]=i,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function Tf(t){const e=F.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,o,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:ie("size-2.5 rounded-full",ii)}),o=r.jsx("div",{className:ie("size-2.5 rounded-full",ii)}),l=r.jsx("div",{className:ie("size-2.5 rounded-full",ii)}),e[0]=i,e[1]=o,e[2]=l):(i=e[0],o=e[1],l=e[2]);let a;e[3]!==n?(a=n&&r.jsx("div",{className:ie("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",Hi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,o,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function lY(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Tf,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"flex flex-1 px-8 py-5",children:r.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:tY.map(aY)})})]}),t[1]=s):s=t[1],s}function aY(t,e){if(e===aL)return r.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 r.jsx("div",{className:ie("relative rounded-md",ii),children:r.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${cL}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function cY(){const t=F.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Tf,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:ie("w-[18%] rounded-md",Hi),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=r.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=r.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 o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[r.jsx("div",{className:ie("rounded-md",Hi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),r.jsx("div",{className:ie("rounded-md",Hi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function dY(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Tf,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:r.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:iY.map(uY)})})]}),t[1]=s):s=t[1],s}function uY(t,e){return r.jsx("div",{className:ie("aspect-square rounded-md",rY[e]?"bg-chart-2/70":ii),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function hY(){const t=F.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Tf,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,o,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=r.jsx("div",{className:ie("h-1.5 w-[70%] rounded-sm",ii)}),i=r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",ii)}),o=r.jsx("div",{className:ie("h-1.5 w-[80%] rounded-sm",ii)}),l=r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",ii)}),t[1]=s,t[2]=n,t[3]=i,t[4]=o,t[5]=l):(s=t[1],n=t[2],i=t[3],o=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=r.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,o,l,r.jsx("div",{className:"mt-auto",children:r.jsx("div",{className:ie("h-4 rounded-md",ii)})})]}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:r.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[r.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",Hi)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[r.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),r.jsx("div",{className:ie("h-4 w-10 rounded-full",Hi)}),r.jsx("div",{className:ie("h-4 w-14 rounded-full",Hi)})]}),t[8]=d):d=t[8];let h;t[9]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsxs("div",{className:ie("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",Hi),children:[r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",ii)}),r.jsx("div",{className:ie("h-1 w-[75%] rounded-sm",ii)})]}),t[9]=h):h=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[h,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[r.jsx("div",{className:ie("rounded-md",Hi)}),r.jsx("div",{className:ie("rounded-md",Hi)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function Va(t){const e=F.c(52),s=re();if(t.kind==="starting"){let m;return e[0]!==t.claimPhase||e[1]!==t.progress?(m=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsx(oY,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=m):m=e[2],m}if(t.kind==="errored"){const m=t.error.code===_1.githubNotAuthenticated,p=t.error.code===_1.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(ko,{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=r.jsx("h3",{className:"text-lg font-medium",children:x}),e[6]=x,e[7]=b):b=e[7];let v;e[8]!==p||e[9]!==m||e[10]!==t.error.message||e[11]!==s?(v=p?s("sandbox.stateCard.githubConnectionMissingMessage"):m?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=p,e[9]=m,e[10]=t.error.message,e[11]=s,e[12]=v):v=e[12];let y;e[13]!==v?(y=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:v}),e[13]=v,e[14]=y):y=e[14];let L;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(L=(m||p)&&t.connectionsHref&&r.jsx(he,{asChild:!0,children:r.jsx("a",{href:t.connectionsHref,children:s(p?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=p,e[16]=m,e[17]=t.connectionsHref,e[18]=s,e[19]=L):L=e[19];const _=t.onRetry;let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Rn,{className:"size-4"}),e[20]=k):k=e[20];let S;e[21]!==s?(S=s("sandbox.stateCard.retry"),e[21]=s,e[22]=S):S=e[22];let w;e[23]!==t.onRetry||e[24]!==S?(w=r.jsxs(he,{variant:"outline",onClick:_,children:[k," ",S]}),e[23]=t.onRetry,e[24]=S,e[25]=w):w=e[25];let j;e[26]!==L||e[27]!==w?(j=r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[L,w]}),e[26]=L,e[27]=w,e[28]=j):j=e[28];let N;return e[29]!==j||e[30]!==b||e[31]!==y?(N=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[g,b,y,j]})}),e[29]=j,e[30]=b,e[31]=y,e[32]=N):N=e[32],N}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(zC,{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 o;e[36]!==i?(o=r.jsx("h3",{className:"text-lg font-medium",children:i}),e[36]=i,e[37]=o):o=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=r.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=r.jsx(tl,{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=r.jsxs(he,{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]!==o||e[49]!==a||e[50]!==u?(f=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,o,a,u]})}),e[48]=o,e[49]=a,e[50]=u,e[51]=f):f=e[51],f}function tg(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function fY(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,o]of Object.entries(e.params))typeof o=="string"&&(n[i]=o);return{path:e.path,pageKey:s,params:n}}catch{return null}}function sg(t){try{return fY(localStorage.getItem(t))}catch{return null}}function mY(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function dL(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"}}}function oh(t,e){const n=e.replace(/\\/g,"/").replace(/^(?!\/)/,"/").split("/").map(i=>encodeURIComponent(i).replace(/%3A/gi,":")).join("/");return`${t}://file${n}?windowId=_blank`}const p4="site-links",pY=/details?page|\bpdp\b/i,gY=/listingpage|\bplp\b/i;function xY(t,e,s){const n=new Set;for(const a of s)pY.test(a)&&n.add("product"),gY.test(a)&&n.add("category");const i=O0(go(t)),o=i[i.length-1],l=i[i.length-2];return o?.type==="text"&&o.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 bY=["rosa","preto","pink","black"];function Ju(t,e){const s=e.trim();return s?t(s):bY.flatMap(n=>t(n))}function vY(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const o=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:o,count:10}}),n}const uL=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function ng(t){return t.split("/")[0]??""}function yY(t){const e=new Set;for(const s of t){const n=ng(s);uL.has(n)&&e.add(n)}return e}function _Y(t,e){const s=ng(t);return!uL.has(s)||e.size===0?!0:e.has(s)}const LY=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>Ju(s=>vY(t,s),e),optionsFromPayload:Xu},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ju(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:Xu},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ju(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:Xu},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ju(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:Xu},{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:VY}];function wY(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of LY){if(d.kind!==a)continue;const h=n.find(u=>d.test(u)&&_Y(u,s));h&&c.push({cand:d,resolveType:h})}return c.find(d=>s.has(ng(d.resolveType)))??c[0]},o=(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(o(c.cand,c.resolveType,!1))}return t.size>0&&l.push(SY(t.has("category")?"category":"product")),l}function SY(t){return{kind:t,id:p4,resolveType:p4,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>RY(e,s)}}function Wo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function kY(t,e,s){const n=new Set,i=new Set,o=l=>{if(Array.isArray(l)){for(const d of l)o(d);return}const a=Wo(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=Wo(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),o(e[c])}}for(const d of Object.values(a))o(d)};return o(t),n}function hL(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 fL(t){try{return decodeURIComponent(t)}catch{return t}}function jY(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function CY(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=jY(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function mL(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=O0(go(e)),{pattern:o,order:l}=CY(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(o);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?fL(d):null}function Xu(t,e){const s=Wo(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],o=new Set;for(const l of n){const a=Wo(l);if(!a)continue;const c=mL(a.url,e.template,e.paramName);if(!c||o.has(c))continue;o.add(c);const d=Wo(a.isVariantOf),h=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,u=Array.isArray(a.image)?Wo(a.image[0]):null,f=typeof u?.url=="string"?u.url:void 0;i.push({value:c,label:h,image:f})}return i}function NY(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?fL(s):null}function VY(t){const e=[],s=new Set,n=(i,o)=>{const l=Wo(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...o,a]:o,d=NY(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 TY=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 AY(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function EY(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 o=n[1]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:o,text:l})}return e}function PY(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 o,l=0;for(;(o=n.exec(t))!==null&&l++<3e3;){const a=(o[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(o.index,o.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:o[2]??"",image:c||void 0})}return e}function RY(t,e){const s=[],n=new Set,i=(o,l,a,c)=>{if(s.length>=200)return;const d=mL(o,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&TY.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:AY(d),kind:a,image:c}))};for(const{url:o,name:l,image:a}of PY(t))i(o,l,"product",a);for(const{href:o,text:l}of EY(t))o.startsWith("/")&&!o.startsWith("//")&&i(o,l,"category");return s}function Dc(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(o=>o.label.toLowerCase().includes(n)||o.value.toLowerCase().includes(n)):t).slice(0,s)}const pL=1e4;function DY(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 IY(t,{resolveType:e,props:s}){const n=await fetch(F6(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(pL)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function g4(t,e){const s=await fetch(z6(t,e),{signal:AbortSignal.timeout(pL)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function MY(t,e,s){const n=e.optionsFromPayload(await g4(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const o=_r(s.template,{[s.paramName]:i.value});if(o==="/")return n;try{const l=e.optionsFromPayload(await g4(t,o),s).filter(a=>a.kind==="product");return hL([n,l])}catch{return n}}function $Y(t,e,s){return it.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function OY(t,e,s,n){if(e.homepageLinks)return MY(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const o=await Promise.allSettled(i.map(a=>IY(t,a))),l=o.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=o.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return hL(l.map(a=>e.optionsFromPayload(a,n)))}function H1(t,e,s,n,i){return{queryKey:$Y(t,e,s),queryFn:()=>OY(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Ic(t){const e=F.c(16),{heading:s,iconKind:n,options:i,template:o,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]!==o){let u;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==o?(u=f=>r.jsxs(Ut,{value:`${a}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:f.image?r.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):r.jsx(Jd,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:f.label}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:_r(o,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=o,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]=o,e[6]=d}else d=e[6];let h;return e[13]!==s||e[14]!==d?(h=r.jsx(fs,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=h):h=e[15],h}function x4(t){const e=F.c(2),{text:s}=t;let n;return e[0]!==s?(n=r.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 BY(t){const e=F.c(52),{sources:s,template:n,paramName:i,value:o,sandboxRef:l,onCommit:a}=t,c=re(),[d,h]=E.useState(!1),[u,f]=E.useState(""),[m,p]=E.useState(""),g=E.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=DY(c),y=[...new Set(s.map(_e=>b[_e.kind].noun))].join(" or ");let L;e[0]!==c||e[1]!==y?(L=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=c,e[1]=y,e[2]=L):L=e[2];const _=L,k={template:n,paramName:i};let S;e[3]!==u?(S=(_e,Ee)=>({source:_e,query:Ee,options:_e.clientFilter?Dc(Ee.data??[],u):Ee.data??[]}),e[3]=u,e[4]=S):S=e[4];const w=S,j=s.filter(GY),N=s.filter(qY),A=o1({queries:j.map(_e=>H1(l,_e,m,k,d))});let C;e[5]!==A||e[6]!==w?(C=(_e,Ee)=>w(_e,A[Ee]),e[5]=A,e[6]=w,e[7]=C):C=e[7];const T=j.map(C),V=T.length===0||T.every(WY),R=o1({queries:N.map(_e=>H1(l,_e,m,k,d&&V))});let P;e[8]!==R||e[9]!==w?(P=(_e,Ee)=>w(_e,R[Ee]),e[8]=R,e[9]=w,e[10]=P):P=e[10];const M=N.map(P),D=V?M:T,$=D.length===1&&D[0]?.source.homepageLinks?D[0]:null,I=$&&!$.query.isLoading&&!$.query.isError?$?.query.data??[]:[],O=Dc(I.filter(KY),u),B=Dc(I.filter(HY),u),U=O.length>0&&B.length>0,H=_e=>{h(_e),g.current&&clearTimeout(g.current),f(_e?o:""),p(_e?o:"")};let K;e[11]===Symbol.for("react.memo_cache_sentinel")?(K=_e=>{f(_e),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(_e)},300)},e[11]=K):K=e[11];const W=K,Y=_e=>{a(_e),H(!1)},Q=t8(u),te=_r(n,{[i]:Q}),ee=Rt,oe=Pt,se="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",G=UY;let X;e[12]!==x||e[13]!==c?(X=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=X):X=e[14];let q;e[15]!==X?(q=r.jsx(ms,{className:"sr-only",children:r.jsx($t,{children:X})}),e[15]=X,e[16]=q):q=e[16];let Z;e[17]===Symbol.for("react.memo_cache_sentinel")?(Z=r.jsx(Jd,{size:16,className:"shrink-0 text-foreground"}),e[17]=Z):Z=e[17];let le;e[18]!==c?(le=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=le):le=e[19];let ne;e[20]!==x?(ne=r.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]=ne):ne=e[21];let ae;e[22]!==le||e[23]!==ne?(ae=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[Z,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[le," ",ne]})]}),e[22]=le,e[23]=ne,e[24]=ae):ae=e[24];const de=Ri,fe=!1,ue="min-h-0 flex-1";let ge;e[25]!==_||e[26]!==u?(ge=r.jsx(hi,{autoFocus:!0,placeholder:_,value:u,onValueChange:W}),e[25]=_,e[26]=u,e[27]=ge):ge=e[27];const J=fi,me="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ye;e[28]!==c?(ye=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ye):ye=e[29];let Le;e[30]!==ye?(Le=r.jsx(Jn,{children:ye}),e[30]=ye,e[31]=Le):Le=e[31];const ke=Q&&r.jsx(fs,{className:"shrink-0",children:r.jsxs(Ut,{value:`__raw__:${Q}`,className:"gap-3 py-2",onSelect:()=>Y(Q),children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:r.jsx(pl,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:Q,paramLabel:x})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:te})]})]})}),we=U?r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:r.jsx(Ic,{heading:b.category.heading,iconKind:"category",options:O,template:n,paramName:i,keyPrefix:`${$?.source.id}:cat`,onSelect:Y})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(Ic,{heading:b.product.heading,iconKind:"product",options:B,template:n,paramName:i,keyPrefix:`${$?.source.id}:prod`,onSelect:Y})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:D.map(_e=>{const{source:Ee,query:De,options:Ve}=_e,{noun:Ge}=b[Ee.kind];if(De.isLoading)return r.jsx(x4,{text:c("sandbox.pathParamPickerChip.loading",{noun:Ge})},Ee.id);if(De.isError)return r.jsx(x4,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ee.id);if(Ee.homepageLinks){const $e=De.data??[];return r.jsxs(E.Fragment,{children:[r.jsx(Ic,{heading:b.category.heading,iconKind:"category",options:Dc($e.filter(FY),u),template:n,paramName:i,keyPrefix:`${Ee.id}:cat`,onSelect:Y}),r.jsx(Ic,{heading:b.product.heading,iconKind:"product",options:Dc($e.filter(zY),u),template:n,paramName:i,keyPrefix:`${Ee.id}:prod`,onSelect:Y})]},Ee.id)}return r.jsx(Ic,{heading:D.length>1?b[Ee.kind].heading:void 0,iconKind:Ee.kind,options:Ve,template:n,paramName:i,keyPrefix:Ee.id,onSelect:Y},Ee.id)})});let Ne;e[32]!==J||e[33]!==Le||e[34]!==ke||e[35]!==we?(Ne=r.jsxs(J,{className:me,children:[Le,ke,we]}),e[32]=J,e[33]=Le,e[34]=ke,e[35]=we,e[36]=Ne):Ne=e[36];let Ae;e[37]!==de||e[38]!==ge||e[39]!==Ne?(Ae=r.jsxs(de,{shouldFilter:fe,className:ue,children:[ge,Ne]}),e[37]=de,e[38]=ge,e[39]=Ne,e[40]=Ae):Ae=e[40];let be;e[41]!==oe||e[42]!==q||e[43]!==ae||e[44]!==Ae||e[45]!==G?(be=r.jsxs(oe,{className:se,onClick:G,children:[q,ae,Ae]}),e[41]=oe,e[42]=q,e[43]=ae,e[44]=Ae,e[45]=G,e[46]=be):be=e[46];let Se;return e[47]!==ee||e[48]!==H||e[49]!==d||e[50]!==be?(Se=r.jsx(ee,{open:d,onOpenChange:H,children:be}),e[47]=ee,e[48]=H,e[49]=d,e[50]=be,e[51]=Se):Se=e[51],r.jsxs(r.Fragment,{children:[r.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:_e=>{_e.stopPropagation(),H(!0)},children:o||x}),Se]})}function zY(t){return t.kind==="product"}function FY(t){return t.kind!=="product"}function UY(t){return t.stopPropagation()}function HY(t){return t.kind==="product"}function KY(t){return t.kind!=="product"}function WY(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function qY(t){return t.isFallback}function GY(t){return!t.isFallback}function YY(t){const e=F.c(8),{sources:s,template:n,paramName:i,sandboxRef:o,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==o||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(QY);c=o1,a=p.map(g=>H1(o,g,"",m,!0)),e[0]=i,e[1]=o,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]=E.useState(!1);if(!u)for(const m of h){if(m.isLoading)break;const p=m.data?.[0];if(p){f(!0),queueMicrotask(()=>l(p.value));break}}return null}function QY(t){return!t.isFallback}function JY(t){const e=F.c(31),{name:s,value:n,onCommit:i}=t,o=re(),[l,a]=E.useState(n),[c,d]=E.useState(!1),h=E.useRef(!1);let u;e[0]!==s||e[1]!==o?(u=s==="*"?o("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=o,e[2]=u):u=e[2];const f=u,m=l||f;let p;e[3]!==m?(p=r.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:m}),e[3]=m,e[4]=p):p=e[4];let g;e[5]!==f||e[6]!==o?(g=o("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=o,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=w=>a(w.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let v;e[10]!==n?(v=w=>{w.key==="Enter"&&w.currentTarget.blur(),w.key==="Escape"&&(h.current=!0,a(n),w.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let y;e[12]!==l||e[13]!==i||e[14]!==n?(y=()=>{if(d(!1),h.current){h.current=!1;return}const w=t8(l);a(w),w!==n&&i(w)},e[12]=l,e[13]=i,e[14]=n,e[15]=y):y=e[15];let L;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==y?(L=r.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:XY,onChange:x,onFocus:b,onKeyDown:v,onBlur:y}),e[16]=l,e[17]=f,e[18]=g,e[19]=v,e[20]=y,e[21]=L):L=e[21];let _;e[22]!==p||e[23]!==L?(_=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,L]}),e[22]=p,e[23]=L,e[24]=_):_=e[24];let k;e[25]!==c||e[26]!==o?(k=c&&r.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-[10px] text-muted-foreground",children:[r.jsx(FC,{size:10}),o("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=o,e[27]=k):k=e[27];let S;return e[28]!==k||e[29]!==_?(S=r.jsxs(r.Fragment,{children:[_,k]}),e[28]=k,e[29]=_,e[30]=S):S=e[30],S}function XY(t){return t.stopPropagation()}const ZY={loaders:"loader",actions:"action"},gL=new Set(["workflows"]);function xL(t){return ZY[t]}function eQ(t,e,s){const n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(s)&&e in o)return!0;return!1}function tQ(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(o))s.add(l);return s}function sQ(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function bL(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[o,l]of Object.entries(s))if(o.includes(e))for(const a of Object.keys(l))i.add(a);for(const o of i){if(o.toLowerCase().includes("preview")||l8.has(o)||gL.has(ig(o))||sQ(o,i))continue;const l=Ao(o,t);if(l.hidden)continue;const a=l.title&&l.title!==o?l.title:vs(o);n.push({resolveType:o,title:a})}return n.sort((o,l)=>o.title.localeCompare(l.title))}function b4(t,e){return bL(t,e).length}function ig(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const nQ={deco:"Deco",std:"Deco Standard",website:"Website"};function iQ(t){return nQ[t]??t}function vL(t){const e=ig(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 yL(t,e,s){const n=[];for(const[i,o]of Object.entries(e)){if(i.includes("/")||lf(i)||!o||typeof o!="object"||Array.isArray(o))continue;const l=o,a=l.__resolveType;typeof a=="string"&&(l8.has(a)||gL.has(ig(a))||eQ(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,o)=>i.title.localeCompare(o.title))}function _L(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...o}=s??{},l=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:o,title:l}}function LL(t){const e=F.c(12),{orgSlug:s,virtualMcpId:n,branch:i,enabled:o}=t,l=o===void 0?!0:o;let a;e[0]!==i||e[1]!==s||e[2]!==n?(a=it.sandboxRepoDir(s,n,i),e[0]=i,e[1]=s,e[2]=n,e[3]=a):a=e[3];let c;e[4]!==i||e[5]!==s||e[6]!==n?(c=async()=>{const u=`/api/${s}/sandbox/${encodeURIComponent(n)}/${encodeURIComponent(i)}/config`,f=await fetch(u);return f.ok?(await f.json()).repoDir??null:null},e[4]=i,e[5]=s,e[6]=n,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d={queryKey:a,queryFn:c,enabled:l,staleTime:1/0},e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],Vt(d).data??null}const rQ={target:null,editSeoPageKey:null,variantOverride:null};function oQ(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 wL=E.createContext(null);function lQ(t){const e=F.c(9),{children:s}=t,[n,i]=E.useReducer(oQ,rQ);let o,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o,e[1]=l,e[2]=a,e[3]=c):(o=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:o,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=r.jsx(wL,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=h):h=e[8],h}function SL(){const t=E.use(wL);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}function rg(t){return(e,s)=>{K6(e),t(e,s)}}const aQ="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function Af(t){return Fs(t)?.metadata?.fieldDescriptionTooltips??!1}function og(t){const e=F.c(9),{description:s,virtualMcpId:n,children:i}=t,o=Af(n);if(!s||!o)return i;let l;e[0]!==i?(l=E.cloneElement(i,{className:ie(i.props.className,aQ)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx(Ue,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=r.jsx(He,{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=r.jsxs(Ke,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function $s(t){const e=F.c(17),{htmlFor:s,label:n,description:i,labelClassName:o,virtualMcpId:l}=t;if(!Af(l)){let h;e[0]!==s||e[1]!==n||e[2]!==o?(h=r.jsx(Mt,{htmlFor:s,className:o,children:n}),e[0]=s,e[1]=n,e[2]=o,e[3]=h):h=e[3];let u;e[4]!==i?(u=i&&r.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=r.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]!==o?(c=r.jsx(Mt,{htmlFor:s,className:o,children:n}),e[9]=s,e[10]=n,e[11]=o,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==l?(d=r.jsx(og,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}var cQ=ar.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")}}}),dQ=cQ,uQ=20,kL=(t,e=0)=>{const s=[];return!t.children.length||e>uQ||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...kL(n,e+1))}),s},hQ=t=>{if(!t.children.length)return;const e=kL(t);e&&e.forEach(s=>{var n,i;const o=s.getAttribute("style"),l=(i=(n=s.parentElement)==null?void 0:n.closest("span"))==null?void 0:i.getAttribute("style");s.setAttribute("style",`${l};${o}`)})},jL=Oj.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&hQ(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Gm(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.isTextblock)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),fQ=ar.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.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()}}}),CL=ar.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.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()}}}),mQ=ar.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>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()}}}),NL=ar.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>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()}}}),pQ=ar.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>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()}}});ar.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(fQ.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(CL.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(mQ.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(NL.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(pQ.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(jL.configure(this.options.textStyle)),t}});const gQ=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function xQ(t){const e=F.c(30),{editor:s,currentColor:n,open:i,onOpenChange:o}=t,l=re(),[a,c]=E.useState("#000000");let d;e[0]!==s||e[1]!==o?(d=k=>{s.chain().focus().setColor(k).run(),o(!1)},e[0]=s,e[1]=o,e[2]=d):d=e[2];const h=d;let u;e[3]!==s||e[4]!==o?(u=()=>{s.chain().focus().unsetColor().run(),o(!1)},e[3]=s,e[4]=o,e[5]=u):u=e[5];const f=u,m=i||n!==null;let p;e[6]!==l?(p=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=p):p=e[7];let g;e[8]!==o||e[9]!==i?(g=()=>o(!i),e[8]=o,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(l1,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let v;e[12]!==b?(v=r.jsxs("span",{className:"relative flex flex-col items-center",children:[x,r.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=v):v=e[13];let y;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(y=r.jsx(Wt,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=y):y=e[18];let L;e[19]!==h||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==o||e[24]!==i||e[25]!==l?(L=i&&r.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:k=>{k.currentTarget.contains(k.relatedTarget)||o(!1)},children:[r.jsx("div",{className:"grid grid-cols-6 gap-1",children:gQ.map(k=>r.jsx("button",{type:"button","aria-label":k,"aria-pressed":n===k,onMouseDown:yQ,onClick:()=>h(k),className:ie("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===k&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:k}},k))}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.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:[r.jsx("input",{type:"color",value:a,onMouseDown:vQ,onChange:k=>c(k.target.value),onBlur:()=>h(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),r.jsx("button",{type:"button",onMouseDown:bQ,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]=o,e[24]=i,e[25]=l,e[26]=L):L=e[26];let _;return e[27]!==L||e[28]!==y?(_=r.jsxs("div",{className:"relative",children:[y,L]}),e[27]=L,e[28]=y,e[29]=_):_=e[29],_}function bQ(t){return t.preventDefault()}function vQ(t){return t.stopPropagation()}function yQ(t){return t.preventDefault()}const Zu=[1,2,3,4,5,6];function _Q(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 LQ=8,wQ=128,SQ=16,v4=1;function kQ({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o,inline:l=!1}){const a=re(),c=typeof e=="string"?e:"",d=E.useRef(s);d.current=s;const[h,u]=E.useState(!1),[f,m]=E.useState(!1),p=Km({extensions:[Wm.configure({heading:l?!1:{levels:[...Zu]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[dQ.configure({types:["heading","paragraph"]})],jL,NL,CL],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:_})=>{const k=_.getHTML(),S=l?_Q(k):k;d.current(S==="<p></p>"||S===""?"":S)}}),g=tv({editor:p,selector:({editor:_})=>({bold:_?.isActive("bold")??!1,italic:_?.isActive("italic")??!1,underline:_?.isActive("underline")??!1,strike:_?.isActive("strike")??!1,headingLevel:Zu.find(k=>_?.isActive("heading",{level:k})??!1)??0,fontSize:_?.getAttributes("textStyle").fontSize??null,color:_?.getAttributes("textStyle").color??null,bulletList:_?.isActive("bulletList")??!1,orderedList:_?.isActive("orderedList")??!1,link:_?.isActive("link")??!1,alignLeft:_?.isActive({textAlign:"left"})??!1,alignCenter:_?.isActive({textAlign:"center"})??!1,alignRight:_?.isActive({textAlign:"right"})??!1,alignJustify:_?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=_=>{const k=p.chain().focus();if(_==="paragraph"){k.setParagraph().run();return}const S=Zu.find(w=>`h${w}`===_);S&&k.setHeading({level:S}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,y=Number.isFinite(v)?v:SQ,L=_=>{const k=Math.min(wQ,Math.max(LQ,_));p.chain().focus().setFontSize(`${k}px`).run()};return r.jsxs("div",{className:"space-y-2",children:[r.jsx($s,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),r.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[r.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:[r.jsx(Wt,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:r.jsx(Pv,{size:14})}),r.jsx(Wt,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:r.jsx(Rv,{size:14})}),r.jsx(Wt,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:r.jsx(UC,{size:14})}),r.jsx(Wt,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:r.jsx(Dv,{size:14})}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs(js,{value:x,onValueChange:b,children:[r.jsx(Cs,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:_=>_.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:r.jsx(Ps,{})}),r.jsxs(Ns,{children:[r.jsx(At,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),Zu.map(_=>r.jsx(At,{value:`h${_}`,children:a("sectionsEditor.richTextField.styleHeading",{level:_})},_))]})]})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Wt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>L(y-v4),children:r.jsx(rp,{size:14})}),r.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:y}),r.jsx(Wt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>L(y+v4),children:r.jsx(Dt,{size:14})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(xQ,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(Wt,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:r.jsx(Rp,{size:14})}),r.jsx(Wt,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:r.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(qF,{editor:p,active:g.link,open:h,onOpenChange:u}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(Wt,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:r.jsx(fN,{size:14})}),r.jsx(Wt,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:r.jsx(HC,{size:14})}),r.jsx(Wt,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:r.jsx(KC,{size:14})}),r.jsx(Wt,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:r.jsx(WC,{size:14})})]})]}),r.jsx(qm,{editor:p})]})]})}const ya=t=>String(t).padStart(2,"0"),jQ="1900-01-01",CQ="2099-12-31",NQ="1900-01-01T00:00",VQ="2099-12-31T23:59";function TQ(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()}-${ya(s.getUTCMonth()+1)}-${ya(s.getUTCDate())}`}function AQ(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function EQ(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${ya(e.getMonth()+1)}-${ya(e.getDate())}T${ya(e.getHours())}:${ya(e.getMinutes())}`}function PQ(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function RQ(t){const e=F.c(41),{id:s,withTime:n,value:i,onChange:o,calendarLabel:l}=t,[a,c]=E.useState(!1);let d;e[0]!==n?(d=$=>n?EQ($):TQ($),e[0]=n,e[1]=d):d=e[1];const h=d;let u;e[2]!==n?(u=$=>n?PQ($):AQ($),e[2]=n,e[3]=u):u=e[3];const f=u;let m;e[4]!==h||e[5]!==i?(m=()=>h(i),e[4]=h,e[5]=i,e[6]=m):m=e[6];const[p,g]=E.useState(m),[x,b]=E.useState(i);if(i!==x){b(i);const $=h(i);$!==p&&g($)}let v;e[7]!==o||e[8]!==f?(v=$=>{g($.target.value),o(f($.target.value))},e[7]=o,e[8]=f,e[9]=v):v=e[9];const y=v;let L;if(e[10]!==i){const $=i?new Date(i):null;L=$&&!Number.isNaN($.getTime())?$:null,e[10]=i,e[11]=L}else L=e[11];const _=L;let k;e[12]!==o||e[13]!==_||e[14]!==h||e[15]!==n?(k=$=>{if(!$)return;n&&_?$.setHours(_.getHours(),_.getMinutes(),0,0):$.setHours(0,0,0,0);const z=$.toISOString();g(h(z)),b(z),o(z),c(!1)},e[12]=o,e[13]=_,e[14]=h,e[15]=n,e[16]=k):k=e[16];const S=k,w=n?"datetime-local":"date",j=n?NQ:jQ,N=n?VQ:CQ;let A;e[17]!==h||e[18]!==i?(A=()=>g(h(i)),e[17]=h,e[18]=i,e[19]=A):A=e[19];let C;e[20]!==y||e[21]!==s||e[22]!==p||e[23]!==A||e[24]!==w||e[25]!==j||e[26]!==N?(C=r.jsx(pt,{id:s,type:w,min:j,max:N,value:p,onChange:y,onBlur:A,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=y,e[21]=s,e[22]=p,e[23]=A,e[24]=w,e[25]=j,e[26]=N,e[27]=C):C=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(jr,{className:"h-4 w-4"}),e[28]=T):T=e[28];let V;e[29]!==l?(V=r.jsx(ts,{asChild:!0,children:r.jsx(he,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:T})}),e[29]=l,e[30]=V):V=e[30];const R=_??void 0;let P;e[31]!==S||e[32]!==R?(P=r.jsx(ss,{className:"w-auto p-0",align:"end",onCloseAutoFocus:DQ,children:r.jsx(Ym,{mode:"single",selected:R,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=R,e[33]=P):P=e[33];let M;e[34]!==a||e[35]!==V||e[36]!==P?(M=r.jsxs(ns,{open:a,onOpenChange:c,children:[V,P]}),e[34]=a,e[35]=V,e[36]=P,e[37]=M):M=e[37];let D;return e[38]!==C||e[39]!==M?(D=r.jsxs("div",{className:"flex gap-1",children:[C,M]}),e[38]=C,e[39]=M,e[40]=D):D=e[40],D}function DQ(t){return t.preventDefault()}function e0(t){const e=F.c(76),{schema:s,value:n,onChange:i,path:o,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 v=h==="rich-text-inline";let y;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==a||e[4]!==s||e[5]!==v||e[6]!==n?(y=r.jsx(kQ,{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a,inline:v}),e[0]=l,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=v,e[6]=n,e[7]=y):y=e[7],y}if(h==="textarea"||h==="markdown"){const v=a?.virtualMcpId;let y;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==v?(y=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=v,e[12]=y):y=e[12];let L;e[13]!==i?(L=S=>i(S.target.value),e[13]=i,e[14]=L):L=e[14];let _;e[15]!==o||e[16]!==d||e[17]!==L?(_=r.jsx(Dr,{id:o,value:d,onChange:L,rows:4}),e[15]=o,e[16]=d,e[17]=L,e[18]=_):_=e[18];let k;return e[19]!==y||e[20]!==_?(k=r.jsxs("div",{className:"space-y-2",children:[y,_]}),e[19]=y,e[20]=_,e[21]=k):k=e[21],k}if(h==="date"||h==="date-time"){const v=a?.virtualMcpId;let y;e[22]!==l||e[23]!==o||e[24]!==s.description||e[25]!==v?(y=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[22]=l,e[23]=o,e[24]=s.description,e[25]=v,e[26]=y):y=e[26];const L=h==="date-time";let _;e[27]!==c?(_=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=_):_=e[28];let k;e[29]!==i||e[30]!==o||e[31]!==d||e[32]!==L||e[33]!==_?(k=r.jsx(RQ,{id:o,withTime:L,value:d,onChange:i,calendarLabel:_}),e[29]=i,e[30]=o,e[31]=d,e[32]=L,e[33]=_,e[34]=k):k=e[34];let S;return e[35]!==y||e[36]!==k?(S=r.jsxs("div",{className:"space-y-2",children:[y,k]}),e[35]=y,e[36]=k,e[37]=S):S=e[37],S}if(h==="color-input"||h==="color"){const v=a?.virtualMcpId;let y;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==v?(y=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=v,e[42]=y):y=e[42];const L=d||"#000000";let _;e[43]!==i?(_=A=>i(A.target.value),e[43]=i,e[44]=_):_=e[44];let k;e[45]!==L||e[46]!==_?(k=r.jsx("input",{type:"color",value:L,onChange:_,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=L,e[46]=_,e[47]=k):k=e[47];let S;e[48]!==i?(S=A=>i(A.target.value),e[48]=i,e[49]=S):S=e[49];let w;e[50]!==o||e[51]!==d||e[52]!==S?(w=r.jsx(pt,{id:o,value:d,onChange:S,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=o,e[51]=d,e[52]=S,e[53]=w):w=e[53];let j;e[54]!==k||e[55]!==w?(j=r.jsxs("div",{className:"flex items-center gap-2",children:[k,w]}),e[54]=k,e[55]=w,e[56]=j):j=e[56];let N;return e[57]!==y||e[58]!==j?(N=r.jsxs("div",{className:"space-y-2",children:[y,j]}),e[57]=y,e[58]=j,e[59]=N):N=e[59],N}const u=a?.virtualMcpId;let f;e[60]!==l||e[61]!==o||e[62]!==s.description||e[63]!==u?(f=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:u}),e[60]=l,e[61]=o,e[62]=s.description,e[63]=u,e[64]=f):f=e[64];const m=h==="url"?"url":"text";let p;e[65]!==i?(p=v=>i(v.target.value),e[65]=i,e[66]=p):p=e[66];const g=s.default!=null?String(s.default):void 0;let x;e[67]!==o||e[68]!==d||e[69]!==m||e[70]!==p||e[71]!==g?(x=r.jsx(pt,{id:o,type:m,value:d,onChange:p,placeholder:g,className:"h-10"}),e[67]=o,e[68]=d,e[69]=m,e[70]=p,e[71]=g,e[72]=x):x=e[72];let b;return e[73]!==f||e[74]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[f,x]}),e[73]=f,e[74]=x,e[75]=b):b=e[75],b}const IQ=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,MQ=/^[+-]?\d*$/;function $Q(t,e){return(e?MQ:IQ).test(t)}function OQ(t){const e=F.c(16),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,h]=E.useState(c),[u,f]=E.useState(c);c!==u&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||h(c));const m=a?.virtualMcpId;let p;e[0]!==l||e[1]!==o||e[2]!==s.description||e[3]!==m?(p=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=o,e[2]=s.description,e[3]=m,e[4]=p):p=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=y=>{const L=y.target.value,_=s.type==="integer";if(L!==""&&!$Q(L,_))return;h(L);const k=Number(L);i(L===""||Number.isNaN(k)?void 0:k)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==o||e[9]!==d||e[10]!==g||e[11]!==x?(b=r.jsx(pt,{id:o,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=o,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let v;return e[13]!==p||e[14]!==b?(v=r.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=v):v=e[15],v}function BQ(t){const e=F.c(14),{value:s,onChange:n,path:i,label:o,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let h;e[0]!==o||e[1]!==i||e[2]!==l.description||e[3]!==d?(h=r.jsx($s,{htmlFor:i,label:o,description:l.description,virtualMcpId:d}),e[0]=o,e[1]=i,e[2]=l.description,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==n?(u=p=>n(p),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==u?(f=r.jsx(Rr,{id:i,checked:c,onCheckedChange:u}),e[7]=c,e[8]=i,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==h||e[12]!==f?(m=r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13],m}const lg="__enum_empty__",VL="__enum_clear__";function ag(t){return t===""?lg:String(t)}function zQ(t,e){if(t===lg)return"";const s=e.find(n=>ag(n)===t);return s!==void 0?s:t}function FQ(t,e){if(t!==VL)return zQ(t,e)}function UQ(t,e){return t==null?e.some(s=>s==="")?lg:void 0:ag(t)}function HQ(t){return t===""?"":String(t)}function KQ(t){const e=F.c(39),{schema:s,value:n,onChange:i,path:o,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=UQ(n,u),e[2]=u,e[3]=n,e[4]=f):f=e[4];const m=f;let p;e[5]!==u||e[6]!==a?(p=!a&&!u.some(qQ),e[5]=u,e[6]=a,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==x?(b=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:x}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let v;e[13]!==i||e[14]!==u?(v=A=>i(FQ(A,u)),e[13]=i,e[14]=u,e[15]=v):v=e[15];let y;e[16]!==d?(y=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=y):y=e[17];let L;e[18]!==y?(L=r.jsx(Ps,{placeholder:y}),e[18]=y,e[19]=L):L=e[19];let _;e[20]!==o||e[21]!==L?(_=r.jsx(Cs,{id:o,className:"h-10",children:L}),e[20]=o,e[21]=L,e[22]=_):_=e[22];let k;e[23]!==g||e[24]!==d?(k=g&&r.jsx(At,{value:VL,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=k):k=e[25];let S;e[26]!==u?(S=u.map(WQ),e[26]=u,e[27]=S):S=e[27];let w;e[28]!==k||e[29]!==S?(w=r.jsxs(Ns,{children:[k,S]}),e[28]=k,e[29]=S,e[30]=w):w=e[30];let j;e[31]!==m||e[32]!==w||e[33]!==v||e[34]!==_?(j=r.jsxs(js,{value:m,onValueChange:v,children:[_,w]}),e[31]=m,e[32]=w,e[33]=v,e[34]=_,e[35]=j):j=e[35];let N;return e[36]!==j||e[37]!==b?(N=r.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=N):N=e[38],N}function WQ(t){const e=ag(t);return r.jsx(At,{value:e,children:HQ(t)},e)}function qQ(t){return t===""}const TL={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function AL(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function pd(t){return AL(t)?.variants?.[0]?.rule?.__resolveType===uc}function y4(t){return{__resolveType:_l,variants:[{value:t,rule:{__resolveType:uc}}]}}function EL(t){return pd(t)?AL(t)?.variants?.[0]?.value:t}function ed(t){return pd(t)?EL(t):t}function cg(t){const e=t.__resolveType;if(typeof e!="string")return null;if(ln(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function GQ(t){return t.includes("flags/multivariate")}function YQ(t){return vs(t)}function QQ(t,e){const s=[...t],n=new Set(s.map(o=>o.resolveType)),i=(o,l)=>{!o||n.has(o)||(n.add(o),s.push({resolveType:o,title:l??YQ(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=cg(e.editorValue);o?.includes("/")&&i(o)}return s}function JQ(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,o=i.__resolveType;if(typeof o=="string"){if(ir(o)){const u=e.find(f=>f.resolveType===o);return u?u.resolveType:o}const d=e.find(u=>W3(u.resolveType,o));if(d)return d.resolveType;const h=e.find(u=>u.resolveType===o);if(h)return h.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(h=>h.discriminatorValue===l||h.resolveType===l||W3(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 _4(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=cg(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=ai(n,e);return i||(n.includes("/")?null:s??null)}function XQ(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 PL(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!ln(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function ZQ(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=cg(s);return n&&GQ(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function dg(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(o=>o.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(o=>typeof o.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:""}function RL(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function DL(t,e){if(e.length===0)return 0;const s=RL(t);for(let o=0;o<e.length;o++){const l=e[o].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return o}let n=0,i=-1;for(let o=0;o<e.length;o++){const l=e[o],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=o)}return n}function eJ(t,e){const s=RL(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}function tJ(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function sJ(t){if(Array.isArray(t.variants)){const e=t.variants,s=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof s?.value=="string")return s.value;const n=e.find(i=>typeof i.value=="string");if(n)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 IL(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(IL);const e=t;return e.__resolveType?sJ(e)??t:ML(e)}function ML(t){const e={};for(const[s,n]of Object.entries(t))e[s]=IL(n);return e}function nJ(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function $L(t){return t==null?"":Array.isArray(t)?t.map($L).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function lh(t,e){if(!t.includes("{"))return;const s=ML(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return $L(nJ(s,a))}).trim()||void 0}function iJ(t){return t.replace(/<[^>]*>/g,"").trim()}function rJ(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function oJ(t){return/^Option \d+$/.test(t)}function lJ(t,e){if(e.includes("{"))return lh(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 OL(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=ed(t);const i=PL(n);if(i&&(n=i),s?.titleBy){const l=lJ(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=DL(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!oJ(a)){const c=lh(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=iJ(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 o=n.__resolveType;if(typeof o=="string"&&o)return vs(o);if(s?.title){const l=lh(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function ah(t,e){return t.map((s,n)=>OL(s,n,e))}function BL(t,e,s){return OL(t,e,s)}function aJ(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 L4(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=aJ(e);if(!s)return;const n=lh(s,t);if(!n)return;const i=dg(n)||n;return tJ(i)}function zL(t){return t===hc||t===_l}function Ef(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function ch(t,e){const s=t.__resolveType??"";if(!s)return null;if(ln(s)){const n=t.section??{};return FL(n,e)}if(zL(s)){const n=t.variants?.[0]?.value;return n?ch(n,e):null}return!ir(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:Ef(s,e)}function FL(t,e){const s=t.__resolveType??"";if(!s)return null;if(zL(s)){const n=t.variants?.[0]?.value;return n?ch(n,e):null}return!ir(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:Ef(s,e)}function UL(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!ir(n)||!Object.hasOwn(e,n))return null;const i=Ef(n,e);return i?{blockKey:n,...i}:null}function cJ(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ef(n,s)}if(e.isHidden){const o=(ln(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return ch(o,s)}if(e.isLazy||ln(t.__resolveType)){const n=t.section??{};return FL(n,s)}return ch(t,s)}function Pn(t){return typeof t=="string"?t:t.label}function Pf(t){return typeof t=="object"}function w4(t){return Pf(t)?t.arrayLabel:void 0}function dJ(t){return Pf(t)?t.fieldKey:void 0}function S4(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function Od(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function cl(t){return t.normalize("NFC").trim()}function uJ(t,e){return e.length>0&&cl(Pn(e[0]))===cl(t)?e:[t,...e]}function Zt(t,e){return cl(t)===cl(e)}function dh(t,e){return cl(t).replace(/\s+/g,"").toLowerCase()===cl(e).replace(/\s+/g,"").toLowerCase()}function hJ(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||Zt(e,t)||s?.arrayKey!=null&&Zt(e,s.arrayKey)}function t0(t,e,s,n,i){const o=cl(s);if(t.some(a=>Zt(Pn(a),o)||Zt(Pn(a),s)))return t;const l={label:s,itemIndex:n};return hJ(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function fJ(t,e){return t.slice(0,t.length-e.length)}function mJ(t,e,s,n){if(s.length===0)return s;const i=s[0];if(Pf(i))return s;const o=n??dl(t,e),l=Pn(i);return Zt(l,o)||Zt(l,t)?s.slice(1):s}function dl(t,e){return e.title??Od(t)}function Bd(t,e,s){const n=s[t];if(!n)return Od(t);const i=dl(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&dl(l,a)===i})?Od(t):i}function J0e(t,e){return e.isMultivariateSectionTop?0:t-2}function X0e(t,e){return e<=0?[]:t.slice(0,e)}function Ta(t,e){return t.type==="array"&&t.items||Vf(t)?!0:Array.isArray(e)}function HL(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&&(Ta(n)||n.type==="object"&&HL(n,e+1)))return!0}return!1}function KL(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("__")&&KL(n,e+1))return!0;return!1}function pJ(t,e,s={}){const n=t.filter(i=>{const o=e[i];if(!o)return!1;if(o.type==="object"&&HL(o))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?KL(l):!1});return n.length>1?new Set(n):new Set}function k4(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function gJ(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=BL(t,e);return s===`Item ${e+1}`?void 0:s}function uh(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 o=t[i];if(--s.n<=0)return!1;const l=gJ(o,i);if(l&&Zt(l,e)||uh(o,e,s,n+1))return!0}return!1}for(const[i,o]of Object.entries(t))if(!i.startsWith("__")){if(--s.n<=0)return!1;if((Array.isArray(o)||o!=null&&typeof o=="object")&&(dh(Od(i),e)||dh(i,e))||uh(o,e,s,n+1))return!0}return!1}function WL(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 o=ai(i,s)?.properties;if(!o)return!1;const l=Object.keys(o);for(const a of l){const c=o[a];if(!c)continue;if(Ta(c)){const h=Bd(a,l,o);if(Zt(h,e)||Zt(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&WL(d,e,s,n+1))return!0}return!1}function qo(t,e,s,n,i,o){if(n.length===0)return null;const l=Pn(n[0]);for(const p of t){const g=e[p];if(!(!g||!Ta(g,s[p]))&&n.some(x=>dJ(x)===p))return p}for(const p of t){const g=e[p];if(!g||!Ta(g,s[p]))continue;const x=Bd(p,t,e);if(Zt(l,x)||Zt(l,p)||n.some(b=>{if(Zt(Pn(b),x)||Zt(Pn(b),p))return!0;const v=w4(b);return v!=null&&(Zt(v,x)||Zt(v,p))}))return p}for(const p of t){const g=e[p];if(!g||!Ta(g,s[p]))continue;const x=s[p];if(!Array.isArray(x))continue;if(ah(x,g.items).some(v=>Zt(v,l)))return p}let a=null,c=!1,d=null,h=!1;for(const p of t){const g=e[p];if(g?.type!=="object"||!g.properties)continue;const x=Object.keys(g.properties),b=k4(s[p]),v=Bd(p,t,e);if((Zt(l,v)||Zt(l,p))&&qo(x,g.properties,b,n.slice(1),i,o)!=null){a===null?a=p:c=!0;continue}qo(x,g.properties,b,n,i,o)!=null&&(d===null?d=p:h=!0)}if(a!==null)return c?null:a;if(d!==null)return h?null:d;for(const p of t){const g=e[p];if(g?.type!=="inline-union"||!g.inlineUnionBranches?.length)continue;const x=k4(s[p]),b=dl(p,g);for(const v of g.inlineUnionBranches){const y=v.schema?.properties;if(!y)continue;const L=Object.keys(y);if(qo(L,y,x,n,i,o)||(Zt(l,b)||Zt(l,p))&&qo(L,y,x,n.slice(1),i,o))return p}}let u=null;const f=[],m=n.map(w4).filter(p=>p!=null);for(const p of t){const g=e[p];if(g?.type!=="block-ref")continue;const x=dl(p,g);if(l!==x&&l!==p){const b=s[p],y=(i?UL(b,i):null)?.data??b;(uh(y,l)||m.some(L=>uh(y,L)||WL(y,L,o)))&&f.push(p);continue}if(n.length>1){const b=s[p];if(b&&typeof b=="object"&&!Array.isArray(b)){const v=Pn(n[1]);if(Object.keys(b).some(L=>!L.startsWith("__")&&(dh(Od(L),v)||dh(L,v))))return p}}u||(u=p)}return u||(f.length===1?f[0]:(f.length>1,null))}function xJ(t,e,s,n,i,o){return qo(t,e,s,n,i,o)}function bJ(t,e,s,n,i,o,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if(qo(a,s.properties,n,i,o,l))return!0;const c=Pn(i[0]);return!Zt(c,e)&&!Zt(c,t)?!1:i.length>1||qo(a,s.properties,n,i.slice(1),o,l)!==null}function j4(t,e,s,n,i){if(!Pf(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 o=ah(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&Zt(o[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const l=n!=null?o[n]:void 0;return l!==void 0&&Zt(l,s.label)?n:o.findIndex(a=>Zt(a,s.label))}function vJ(t,e,s,n,i,o){if(e.length===0)return null;for(let a=0;a<e.length;a++){const c=e[a],d=j4(s,n,c,i,o);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>Zt(Pn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=j4(s,n,a,i,o);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function S9(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===hc}function yJ(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>S9(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>S9(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>S9(s.resolveType)):!1}function _J(t,e){if(e==="global"||e==="sections"||Vf(t))return!0;const s=t.type==="array"?t.items:void 0;return s?yJ(s):!1}function C4(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function qL(t){return t.map((e,s)=>({...e,index:s}))}function LJ(t,e){if(e===t.length)return t;if(e<t.length)return qL(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 wJ(t,e){const s=t.findIndex(o=>o.index===e),n=t.map(o=>o.index>e?{...o,index:o.index+1}:o),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function SJ(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const kJ="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",jJ="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]",CJ="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 N4(t,e){return ie("h-6 shrink-0 overflow-hidden",e?kJ:t?CJ:jJ)}function NJ(t){const e=F.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(ic,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n&&r.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==s?(l=r.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs(r.Fragment,{children:[i,r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[o,l]})]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function VJ(t){const e=F.c(67),{sortableId:s,labelText:n,imageSrc:i,hidden:o,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,h=re();let u;e[0]!==s?(u={id:s,animateLayoutChanges:PJ},e[0]=s,e[1]=u):u=e[1];const{attributes:f,listeners:m,setNodeRef:p,transform:g,isDragging:x}=yf(u);let b;e[2]!==g?(b=Ni.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let y;e[4]!==b||e[5]!==v?(y={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=y):y=e[6];const L=y;let _;e[7]!==a?(_=Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),a())},e[7]=a,e[8]=_):_=e[8];const k=x?"cursor-grabbing":"cursor-pointer";let S;e[9]!==k?(S=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",k),e[9]=k,e[10]=S):S=e[10];let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(ic,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=w):w=e[11];let j;e[12]!==i?(j=i&&r.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=j):j=e[13];const N=o&&"line-through opacity-50";let A;e[14]!==N?(A=ie("min-w-0 flex-1 truncate text-sm",N),e[14]=N,e[15]=A):A=e[15];let C;e[16]!==n||e[17]!==A?(C=r.jsx("span",{className:A,children:n}),e[16]=n,e[17]=A,e[18]=C):C=e[18];let T;e[19]!==o||e[20]!==l||e[21]!==h?(T=l&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":h(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ie(N4(o===!0,o===!0)),onClick:Q=>{Q.stopPropagation(),l()},onPointerDown:EJ,children:o?r.jsx(pV,{size:14}):r.jsx(dc,{size:14})})}),r.jsx(He,{side:"bottom",children:h(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=o,e[20]=l,e[21]=h,e[22]=T):T=e[22];let V;e[23]!==n||e[24]!==h?(V=h("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=h,e[25]=V):V=e[25];let R;e[26]!==o?(R=ie(N4(o===!0,!1),"data-[state=open]:ml-0 data-[state=open]:w-6 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]"),e[26]=o,e[27]=R):R=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(Yn,{size:14}),e[28]=P):P=e[28];let M;e[29]!==V||e[30]!==R?(M=r.jsx(Gt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":V,className:R,onClick:AJ,onPointerDown:TJ,children:P})}),e[29]=V,e[30]=R,e[31]=M):M=e[31];let D;e[32]!==c?(D=Q=>{Q.stopPropagation(),c()},e[32]=c,e[33]=D):D=e[33];let $;e[34]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(on,{size:14}),e[34]=$):$=e[34];let z;e[35]!==h?(z=h("sectionsEditor.arrayField.duplicate"),e[35]=h,e[36]=z):z=e[36];let I;e[37]!==D||e[38]!==z?(I=r.jsxs(et,{onClick:D,children:[$,z]}),e[37]=D,e[38]=z,e[39]=I):I=e[39];let O;e[40]!==d?(O=Q=>{Q.stopPropagation(),d()},e[40]=d,e[41]=O):O=e[41];let B;e[42]===Symbol.for("react.memo_cache_sentinel")?(B=r.jsx(Zs,{size:14}),e[42]=B):B=e[42];let U;e[43]!==h?(U=h("sectionsEditor.arrayField.delete"),e[43]=h,e[44]=U):U=e[44];let H;e[45]!==O||e[46]!==U?(H=r.jsxs(et,{className:"text-destructive focus:text-destructive",onClick:O,children:[B,U]}),e[45]=O,e[46]=U,e[47]=H):H=e[47];let K;e[48]!==I||e[49]!==H?(K=r.jsxs(Yt,{align:"end",children:[I,H]}),e[48]=I,e[49]=H,e[50]=K):K=e[50];let W;e[51]!==M||e[52]!==K?(W=r.jsxs(qt,{children:[M,K]}),e[51]=M,e[52]=K,e[53]=W):W=e[53];let Y;return e[54]!==f||e[55]!==n||e[56]!==m||e[57]!==a||e[58]!==p||e[59]!==L||e[60]!==C||e[61]!==T||e[62]!==W||e[63]!==_||e[64]!==S||e[65]!==j?(Y=r.jsxs("div",{ref:p,style:L,...f,...m,role:"button",tabIndex:0,onClick:a,onKeyDown:_,className:S,title:n,children:[w,j,C,T,W]}),e[54]=f,e[55]=n,e[56]=m,e[57]=a,e[58]=p,e[59]=L,e[60]=C,e[61]=T,e[62]=W,e[63]=_,e[64]=S,e[65]=j,e[66]=Y):Y=e[66],Y}function TJ(t){return t.stopPropagation()}function AJ(t){return t.stopPropagation()}function EJ(t){return t.stopPropagation()}function PJ(){return!1}function RJ(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 o=t.__resolveType;if(typeof o=="string"&&s){const l=ai(o,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=ai(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function DJ(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function s0({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:o=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:h,containerResolveType:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=re(),b=Af(g?.virtualMcpId),v=Array.isArray(e)?e:[],y=t.items,L=DJ(n),_={arrayKey:L,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(y?.titleBy||y?.inlineUnionBranches?.length)},k=_J(t,L),S=!k&&y?.type==="object",[w,j]=E.useState(null),N=vJ(i,o,v,y,w,L),A=N?.index??null;N===null?w!==null&&j(null):N.index!==w&&j(N.index);const[C,T]=E.useState(()=>C4(v.length)),[V,R]=E.useState(null),[P,M]=E.useState(n),[D,$]=E.useState(v.length),z=E.useRef(!1),I=E.useRef(null);P!==n?(M(n),$(v.length),T(C4(v.length)),j(null)):D!==v.length&&($(v.length),T(ae=>LJ(ae,v.length)));const O=(ae,de)=>BL(ed(ae),de,y),B=ae=>{if(z.current)return;const de=O(v[ae],ae);j(ae),l?.(t0(o,i,de,ae,_))},U=ae=>{const de=[...v,ae];s(de);const fe=de.length-1;j(fe);const ue=O(ae,fe);l?.(t0(o,i,ue,fe,_))},H=()=>{const ae=y?.type,de=y?.default!==void 0?y.default:ae==="object"?{}:ae==="block-ref"?(()=>{const J=y?.anyOfRefs?.[0]?.resolveType;return typeof J!="string"||dd(J)?{}:{__resolveType:J}})():ae==="number"||ae==="integer"?0:ae==="boolean"?!1:ae==="array"?[]:"",fe=[...v,de];s(fe);const ue=fe.length-1;j(ue);const ge=O(de,ue);l?.(t0(o,i,ge,ue,_))},K=()=>{if(k){if(!f){pe.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(p){p({append:U});return}pe.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}H()},W=ae=>{const de=v[ae],fe=typeof structuredClone=="function"?structuredClone(de):JSON.parse(JSON.stringify(de??null)),ue=[...v.slice(0,ae+1),fe,...v.slice(ae+1)];s(ue),T(ge=>wJ(ge,ae))},Y=ae=>{const de=v[ae],fe=[...v];fe[ae]=pd(de)?EL(de):y4(de),s(fe)},Q=ae=>{s(v.filter((de,fe)=>fe!==ae)),T(de=>SJ(de,ae))},te=(ae,de)=>{const fe=[...v];if(fe[ae]=pd(v[ae])?y4(de):de,s(fe),ae===A&&N){const ue=O(v[ae],ae),ge=O(fe[ae],ae);if(I.current={path:n,index:ae,label:ge},ue!==ge){const J=[...o];J[N.crumbIndex]=S4(o[N.crumbIndex],ge,ae),l?.(J)}}},ee=fu(rr(Sl,{activationConstraint:{distance:8}}),rr(wl,{coordinateGetter:_f})),oe=C.map(ae=>ae.id),se=ae=>{R(String(ae.active.id))},G=ae=>{R(null);const{active:de,over:fe}=ae;if(!fe||de.id===fe.id)return;const ue=oe.indexOf(String(de.id)),ge=oe.indexOf(String(fe.id));ue===-1||ge===-1||(T(J=>qL(ol([...J],ue,ge))),s(ol([...v],ue,ge)),z.current=!0,requestAnimationFrame(()=>{z.current=!1}))},X=()=>{R(null)},q=V?C.find(ae=>ae.id===V):null,Z=q!=null?v[q.index]:void 0,le=q!=null&&Z!==void 0?ah(v,y)[q.index]:null,ne=q!=null&&Z!==void 0?L4(ed(Z),y):void 0;if(A!==null&&A<v.length){const ae=ed(v[A]),de=RJ(ae,y,c,u,L),fe=()=>{if(!N)return t0(o,i,O(ae,A),A,_);const ue=o.slice(0,N.crumbIndex+1),ge=I.current,J=ge?.path===n&&ge.index===A?ge.label:O(ae,A);return ue[N.crumbIndex]=S4(ue[N.crumbIndex],J,A),ue};return r.jsx("div",{className:"min-w-0",children:de?.type==="object"&&de.properties?r.jsx($r,{schema:de,value:ae,onChange:ue=>te(A,ue),basePath:`${n}.${A}`,breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:ue=>{l?.([...fe(),...ue])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):de?Ja({schema:de,value:ae,onChange:ue=>te(A,ue),path:`${n}.${A}`,required:!0,label:de.title&&!de.title.includes("{{")?de.title:O(ae,A),breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:ue=>{l?.([...fe(),...ue])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):null})}return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(og,{description:t.description,virtualMcpId:g?.virtualMcpId,children:r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i})}),v.length>0&&r.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:v.length})]}),!b&&t.description&&r.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),v.length>0&&r.jsx("div",{className:ie(V&&"cursor-grabbing"),children:r.jsxs(pu,{sensors:ee,collisionDetection:x2,onDragStart:se,onDragEnd:G,onDragCancel:X,children:[r.jsx(vf,{items:oe,strategy:bf,children:r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const ae=ah(v,y);return C.map(de=>{const fe=v[de.index];if(fe===void 0)return null;const ue=ae[de.index]??O(fe,de.index),ge=L4(ed(fe),y);return r.jsx(VJ,{sortableId:de.id,labelText:ue,imageSrc:ge,hidden:pd(fe),onToggleHidden:S?()=>Y(de.index):void 0,onOpen:()=>B(de.index),onDuplicate:()=>W(de.index),onRemove:()=>Q(de.index)},de.id)})})()})}),En.createPortal(r.jsx(xf,{dropAnimation:TL,children:le?r.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:r.jsx(NJ,{labelText:le,imageSrc:ne})}):null}),document.body)]})}),r.jsxs("button",{type:"button",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",children:[r.jsx(Dt,{size:14}),x(k?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function IJ(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==a?(b=a===void 0?[]:a,e[0]=a,e[1]=b):b=e[1];const v=b,[y,L]=E.useState(!1),_=Af(x?.virtualMcpId);let k;e[2]!==n?(k=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=k):k=e[3];const S=k;if(!s.properties)return null;let w;e[4]!==v||e[5]!==u||e[6]!==h||e[7]!==S||e[8]!==p||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==f||e[13]!==o||e[14]!==m||e[15]!==x||e[16]!==s?(w=r.jsx($r,{schema:s,value:S,onChange:i,basePath:o,breadcrumbPath:v,onBreadcrumbChange:c,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=v,e[5]=u,e[6]=h,e[7]=S,e[8]=p,e[9]=c,e[10]=i,e[11]=g,e[12]=f,e[13]=o,e[14]=m,e[15]=x,e[16]=s,e[17]=w):w=e[17];const j=w;if(d)return j;let N;e[18]!==o?(N=o.split(".").pop()??o,e[18]=o,e[19]=N):N=e[19];const A=N;let C;e[20]!==v||e[21]!==u||e[22]!==A||e[23]!==l||e[24]!==h||e[25]!==S||e[26]!==s?(C=bJ(A,l,s,S,v,u,h),e[20]=v,e[21]=u,e[22]=A,e[23]=l,e[24]=h,e[25]=S,e[26]=s,e[27]=C):C=e[27];const V=y||C,R=`${o}-fields`;let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=()=>L(MJ),e[28]=P):P=e[28];let M;e[29]!==V?(M=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:V?r.jsx(Jt,{size:16}):r.jsx(gn,{size:16})}),e[29]=V,e[30]=M):M=e[30];const D=x?.virtualMcpId;let $;e[31]!==l?($=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[31]=l,e[32]=$):$=e[32];let z;e[33]!==s.description||e[34]!==$||e[35]!==D?(z=r.jsx(og,{description:s.description,virtualMcpId:D,children:$}),e[33]=s.description,e[34]=$,e[35]=D,e[36]=z):z=e[36];let I;e[37]!==R||e[38]!==V||e[39]!==z||e[40]!==M?(I=r.jsxs("button",{type:"button","aria-expanded":V,"aria-controls":R,onClick:P,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:[M,z]}),e[37]=R,e[38]=V,e[39]=z,e[40]=M,e[41]=I):I=e[41];let O;e[42]!==s.description||e[43]!==_?(O=!_&&s.description&&r.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[42]=s.description,e[43]=_,e[44]=O):O=e[44];let B;e[45]!==R||e[46]!==j||e[47]!==V?(B=V&&r.jsx("div",{id:R,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=R,e[46]=j,e[47]=V,e[48]=B):B=e[48];let U;return e[49]!==I||e[50]!==O||e[51]!==B?(U=r.jsxs("div",{className:"min-w-0 space-y-2",children:[I,O,B]}),e[49]=I,e[50]=O,e[51]=B,e[52]=U):U=e[52],U}function MJ(t){return!t}function Z0e(t,e,s,n,i){const o={...t[e]};if(i.length>1){const l=o.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),o.sections={...l,variants:a}}else o.sections=s;return o}function ehe(t){return structuredClone(t)}function the(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function GL(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 ug(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 hg(t){const e=F.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:o,onSubmit:l}=t,a=i===void 0?"":i,c=o===void 0?!1:o,[d,h]=E.useState(a),[u,f]=E.useState(s);s!==u&&(f(s),s&&h(a));let m;e[0]!==c||e[1]!==n?(m=O=>{!O&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=m):m=e[2];const p=m;let g;e[3]!==d||e[4]!==c||e[5]!==l?(g=async O=>{O.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 v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx($t,{children:v}),e[9]=v,e[10]=y):y=e[10];let L;e[11]!==b?(L=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=L):L=e[12];let _;e[13]!==L?(_=r.jsx(Dn,{children:L}),e[13]=L,e[14]=_):_=e[14];let k;e[15]!==y||e[16]!==_?(k=r.jsxs(ms,{children:[y,_]}),e[15]=y,e[16]=_,e[17]=k):k=e[17];let S;e[18]!==b?(S=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=S):S=e[19];let w;e[20]!==S?(w=r.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:S}),e[20]=S,e[21]=w):w=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=O=>h(O.target.value),e[22]=j):j=e[22];let N;e[23]!==b?(N=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=N):N=e[24];let A;e[25]!==d||e[26]!==c||e[27]!==N?(A=r.jsx(pt,{id:"block-id",value:d,onChange:j,placeholder:N,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=N,e[28]=A):A=e[28];let C;e[29]!==w||e[30]!==A?(C=r.jsxs("div",{className:"py-4 space-y-2",children:[w,A]}),e[29]=w,e[30]=A,e[31]=C):C=e[31];let T;e[32]!==n?(T=()=>n(!1),e[32]=n,e[33]=T):T=e[33];let V;e[34]!==b?(V=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=V):V=e[35];let R;e[36]!==c||e[37]!==T||e[38]!==V?(R=r.jsx(he,{type:"button",variant:"outline",onClick:T,disabled:c,children:V}),e[36]=c,e[37]=T,e[38]=V,e[39]=R):R=e[39];let P;e[40]!==d||e[41]!==c?(P=!d.trim()||c,e[40]=d,e[41]=c,e[42]=P):P=e[42];let M;e[43]!==c||e[44]!==b?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=M):M=e[45];let D;e[46]!==P||e[47]!==M?(D=r.jsx(he,{type:"submit",disabled:P,children:M}),e[46]=P,e[47]=M,e[48]=D):D=e[48];let $;e[49]!==R||e[50]!==D?($=r.jsxs(Gn,{children:[R,D]}),e[49]=R,e[50]=D,e[51]=$):$=e[51];let z;e[52]!==x||e[53]!==C||e[54]!==$||e[55]!==k?(z=r.jsx(Pt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:x,children:[k,C,$]})}),e[52]=x,e[53]=C,e[54]=$,e[55]=k,e[56]=z):z=e[56];let I;return e[57]!==p||e[58]!==s||e[59]!==z?(I=r.jsx(Rt,{open:s,onOpenChange:p,children:z}),e[57]=p,e[58]=s,e[59]=z,e[60]=I):I=e[60],I}function $J(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 OJ(t){const e=F.c(13),{blockKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Mn,{size:11}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(Ue,{asChild:!0,children:r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i,o]})}),e[3]=o,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=r.jsx(He,{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=r.jsxs(Ke,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function BJ(t){const e=F.c(36),{path:s,open:n,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:h}=t,u=re(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=ie("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?r.jsx(Jt,{size:16}):r.jsx(gn,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==o?(b=r.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:o}),e[7]=o,e[8]=b):b=e[8];let v;e[9]!==c?(v=c&&r.jsx(OJ,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let y;e[11]!==b||e[12]!==v?(y=r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=y):y=e[13];let L;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==y?(L=r.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,y]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=y,e[19]=L):L=e[19];let _;e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==u?(_=(d||h)&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":u("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:r.jsx(Yn,{size:16})})}),r.jsxs(Yt,{align:"end",className:"w-48",children:[c&&d&&r.jsxs(et,{onClick:d,children:[r.jsx(Cr,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.detach")]}),!c&&h&&r.jsxs(et,{onClick:h,children:[r.jsx(Mn,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=h,e[23]=u,e[24]=_):_=e[24];let k;e[25]!==L||e[26]!==_?(k=r.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:[L,_]}),e[25]=L,e[26]=_,e[27]=k):k=e[27];let S;e[28]!==f||e[29]!==l||e[30]!==n?(S=n&&r.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:r.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[28]=f,e[29]=l,e[30]=n,e[31]=S):S=e[31];let w;return e[32]!==k||e[33]!==S||e[34]!==p?(w=r.jsxs("div",{className:p,children:[k,S]}),e[32]=k,e[33]=S,e[34]=p,e[35]=w):w=e[35],w}function V4(t){const e=F.c(42),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=re(),x=(s.anyOfRefs??[]).filter(UJ),b=h&&n?UL(n,h):null,v=b?.data??n,y=b?null:PL(v),L=y??v,_=QQ(x,{savedBlockKey:b?.blockKey,editorValue:v}),k=_.length>0?JQ(v,_,b?.blockKey):_[0]?.resolveType??"",w=s.type==="block-ref"&&_.some(FJ);let j;e[0]!==l||e[1]!==o?(j=l??(o.includes(".")?o.split(".")[0]:o),e[0]=l,e[1]=o,e[2]=j):j=e[2];const N=j;let A;e[3]!==a?(A=a??[],e[3]=a,e[4]=A):A=e[4];const C=A,T=w&&C.length>0&&Pn(C[0])===N,V=T?C.slice(1):C,R=T?ee=>{c?.([N,...ee])}:c,[P,M]=E.useState(k),[D,$]=E.useState(k);D!==k&&($(k),M(k));const[z,I]=E.useState(()=>ZQ(v,b?.blockKey)),[O,B]=E.useState(!1);if(_.length>0){const ee=P||k;let oe;e[5]!==ee?(oe=Ae=>Ae.resolveType===ee,e[5]=ee,e[6]=oe):oe=e[6];const se=_.find(oe),G=_4(v,d,se?.schema),X=XQ(G??se?.schema??null,s.discriminatorKey),q=s.discriminatorKey,Z=Ae=>{M(Ae);const be=_.find(Ge=>Ge.resolveType===Ae),Se=_4(v,d,be?.schema),_e=new Set(Object.keys((Se??be?.schema)?.properties??{})),Ee=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},De=Object.fromEntries(Object.entries(Ee).filter(Ge=>{const[$e]=Ge;return _e.has($e)})),Ve={...$J(be?.schema),...De};if(q){const Ge=be?.discriminatorValue??Ae;i({...Ve,[q]:Ge});return}if(dd(Ae)){i(Ve);return}i({...Ve,__resolveType:Ae})};let le;e[7]!==ee||e[8]!==q||e[9]!==i?(le=Ae=>{if(q||!dd(ee)||Ae===null||typeof Ae!="object"||Array.isArray(Ae)){i(Ae);return}const{__resolveType:be,...Se}=Ae;i(Se)},e[7]=ee,e[8]=q,e[9]=i,e[10]=le):le=e[10];const ne=le,ae=X?.properties?r.jsx($r,{schema:X,value:L,onChange:Ae=>{if(b&&u){u(b.blockKey,Ae);return}if(y){i({...v,section:Ae});return}ne(Ae)},basePath:o,breadcrumbPath:V,onBreadcrumbChange:R,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(w&&ae&&V.length>0){let Ae;return e[11]!==ae?(Ae=r.jsx("div",{className:"min-w-0",children:ae}),e[11]=ae,e[12]=Ae):Ae=e[12],Ae}let de;e[13]!==o?(de=o.includes("."),e[13]=o,e[14]=de):de=e[14];const fe=de,ue=b?()=>{const{name:Ae,...be}=b.data;i(be)}:void 0,ge=!b&&!y&&!!u&&w&&!dd(ee)&&ee.includes("/"),J=L&&typeof L=="object"&&!Array.isArray(L)?L:{},me=Ae=>{if(!u)return;const be=Ae.trim(),Se=h?ug(be,h):null;if(Se){pe.error(Se);return}u(be,{...J,__resolveType:ee,name:be}),i({__resolveType:be}),B(!1),pe.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:be}))},ye=f?.virtualMcpId;let Le;e[15]!==l||e[16]!==o||e[17]!==s.description||e[18]!==ye?(Le=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:ye}),e[15]=l,e[16]=o,e[17]=s.description,e[18]=ye,e[19]=Le):Le=e[19];let ke;e[20]!==g?(ke=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=ke):ke=e[21];let we;e[22]!==ke?(we=r.jsx(Ps,{placeholder:ke}),e[22]=ke,e[23]=we):we=e[23];let Ne;return e[24]!==o||e[25]!==we?(Ne=r.jsx(Cs,{id:o,children:we}),e[24]=o,e[25]=we,e[26]=Ne):Ne=e[26],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[Le,r.jsxs(js,{value:ee||void 0,onValueChange:Z,children:[Ne,r.jsx(Ns,{children:_.map(zJ)})]})]}),ae&&(w?r.jsx(BJ,{path:o,open:z,onOpenChange:I,title:g(fe?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:ae,nestedBlockRef:fe,globalBlockKey:b?.blockKey,onDetach:ue,onMakeGlobal:ge?()=>B(!0):void 0}):ae),ge&&r.jsx(hg,{open:O,onOpenChange:B,defaultBlockId:GL(vs(ee)),onSubmit:me})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=f?.virtualMcpId;let H;e[27]!==l||e[28]!==o||e[29]!==s.description||e[30]!==U?(H=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:U}),e[27]=l,e[28]=o,e[29]=s.description,e[30]=U,e[31]=H):H=e[31];const K=n!=null?String(n):"";let W;e[32]!==i?(W=ee=>i(ee.target.value),e[32]=i,e[33]=W):W=e[33];const Y=s.description??"";let Q;e[34]!==o||e[35]!==K||e[36]!==W||e[37]!==Y?(Q=r.jsx("input",{id:o,type:"text",value:K,onChange:W,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:Y}),e[34]=o,e[35]=K,e[36]=W,e[37]=Y,e[38]=Q):Q=e[38];let te;return e[39]!==H||e[40]!==Q?(te=r.jsxs("div",{className:"space-y-1.5",children:[H,Q]}),e[39]=H,e[40]=Q,e[41]=te):te=e[41],te}function zJ(t){const e=t.title&&!t.title.includes("/")?t.title:g1(t.resolveType)??vs(t.resolveType);return r.jsx(At,{value:t.resolveType,children:e},t.resolveType)}function FJ(t){return t.resolveType.includes("/")&&!dd(t.resolveType)}function UJ(t){return t.resolveType!==""}const k9=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function HJ(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]??"",o=n[2]??"",l=k9(i,"id");if(!l)continue;const a=k9(i,"viewBox"),c=k9(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${o}</svg>`}return e}async function KJ(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return HJ(await e.text())}function WJ(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 qJ(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 GJ(t,e){return t.length>0?t:e}function YJ(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function QJ({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:o}){return!!t&&!e&&s===0&&o&&n.length>0&&!i.includes(n)}function YL(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 JJ(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function XJ(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return YL(t.icon,e)}async function ZJ(t,e,s){const n={};s&&(n.term=s);const o=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(o,{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 WJ(a)}function T4(t){const e=F.c(9),{option:s,className:n,fg:i}=t;let o;e[0]!==i||e[1]!==s?(o=XJ(s,i),e[0]=i,e[1]=s,e[2]=o):o=e[2];const l=o;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=r.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function eX(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=s.options,h=a?.previewUrl,[u,f]=E.useState(!1),[m,p]=E.useState(""),[g,x]=E.useState(""),b=E.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=ne=>{p(ne),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(ne)},300)},e[0]=v):v=e[0];const y=v,L=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",_=typeof n=="string"?n:"",k=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==L?(S=it.sandboxInvoke(L,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=L,e[4]=S):S=e[4];let w;e[5]!==g||e[6]!==d||e[7]!==h?(w=()=>ZJ(h,d,g||void 0),e[5]=g,e[6]=d,e[7]=h,e[8]=w):w=e[8];const j=!!h&&!!d&&(u||!!_);let N;e[9]!==S||e[10]!==w||e[11]!==j?(N={queryKey:S,queryFn:w,enabled:j,staleTime:6e4,retry:1},e[9]=S,e[10]=w,e[11]=j,e[12]=N):N=e[12];const A=Vt(N),C=A.data??[];let T;e[13]!==L?(T=it.sandboxSprite(L),e[13]=L,e[14]=T):T=e[14];let V;e[15]!==h||e[16]!==a?(V=()=>KJ(H6({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,previewUrl:h},"/sprites.svg")),e[15]=h,e[16]=a,e[17]=V):V=e[17];const R=k&&!!a&&(u||!!_)&&(!d||A.isFetched&&C.length===0);let P;e[18]!==T||e[19]!==V||e[20]!==R?(P={queryKey:T,queryFn:V,enabled:R,staleTime:3e5,retry:1},e[18]=T,e[19]=V,e[20]=R,e[21]=P):P=e[21];const M=Vt(P),D=qJ(s.enum),$=M.data??{},z=JJ(),I=Object.fromEntries(Object.entries($).map(ne=>{const[ae,de]=ne;return[ae,YL(de,z)]})),O=k&&Object.keys(I).length>0?D.map(ne=>({...ne,previewSrc:I[ne.value]})):D,B=GJ(C,O),U=YJ(B,m);let H;e[22]!==_?(H=ne=>ne.value===_,e[22]=_,e[23]=H):H=e[23];const K=B.find(H),W=m.trim(),Y=A.isFetched&&!A.isFetching&&m===g,Q=QJ({loaderPath:d,isIconSelect:k,enumFallbackCount:D.length,trimmedSearch:W,optionValues:B.map(tX),optionsSettled:Y});if((!h||!d)&&D.length===0){const ne=a?.virtualMcpId;let ae;e[24]!==l||e[25]!==o||e[26]!==s.description||e[27]!==ne?(ae=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:ne}),e[24]=l,e[25]=o,e[26]=s.description,e[27]=ne,e[28]=ae):ae=e[28];let de;e[29]!==i?(de=ge=>i(ge.target.value),e[29]=i,e[30]=de):de=e[30];let fe;e[31]!==_||e[32]!==o||e[33]!==de?(fe=r.jsx(pt,{id:o,type:"text",value:_,onChange:de}),e[31]=_,e[32]=o,e[33]=de,e[34]=fe):fe=e[34];let ue;return e[35]!==ae||e[36]!==fe?(ue=r.jsxs("div",{className:"space-y-2",children:[ae,fe]}),e[35]=ae,e[36]=fe,e[37]=ue):ue=e[37],ue}const ee=a?.virtualMcpId;let oe;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==ee?(oe=r.jsx($s,{htmlFor:o,label:l,description:s.description,virtualMcpId:ee}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=ee,e[42]=oe):oe=e[42];const se=K?r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(T4,{option:K,className:"h-6 w-6",fg:z}),r.jsx("span",{className:"truncate",children:K.label??K.value})]}):_?r.jsx("span",{className:"truncate",children:_}):r.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let G;e[43]===Symbol.for("react.memo_cache_sentinel")?(G=r.jsx(qh,{className:"size-4 shrink-0 opacity-50"}),e[43]=G):G=e[43];let X;e[44]!==u||e[45]!==se?(X=r.jsx(ts,{asChild:!0,children:r.jsxs(he,{variant:"outline",role:"combobox","aria-expanded":u,className:"h-10 w-full justify-between font-normal",children:[se,G]})}),e[44]=u,e[45]=se,e[46]=X):X=e[46];let q;e[47]===Symbol.for("react.memo_cache_sentinel")?(q={width:"var(--radix-popover-trigger-width)"},e[47]=q):q=e[47];let Z;e[48]!==c?(Z=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=Z):Z=e[49];let le;return e[50]!==m||e[51]!==Z?(le=r.jsx(hi,{placeholder:Z,className:"h-9",value:m,onValueChange:y}),e[50]=m,e[51]=Z,e[52]=le):le=e[52],r.jsxs("div",{className:"space-y-2",children:[oe,r.jsxs(ns,{open:u,onOpenChange:f,children:[X,r.jsx(ss,{className:"p-0",style:q,children:r.jsxs(Ri,{shouldFilter:!1,children:[le,r.jsxs(fi,{children:[!Q&&r.jsx(Jn,{children:A.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),r.jsx(fs,{children:U.map(ne=>r.jsxs(Ut,{value:ne.value,className:"cursor-pointer",onSelect:()=>{i(ne.value===_?"":ne.value),f(!1)},children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(T4,{option:ne,className:ie(ne.image?"h-9 w-9":"h-6 w-6"),fg:z}),r.jsx("span",{className:"truncate",children:ne.label??ne.value})]}),r.jsx(Et,{className:ie("ml-auto size-4 shrink-0",_===ne.value?"opacity-100":"opacity-0")})]},ne.value))}),Q&&r.jsx(fs,{children:r.jsx(Ut,{value:W,className:"cursor-pointer",onSelect:()=>{i(W),p(""),x(""),f(!1)},children:r.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:W})})})})]})]})})]})]})}function tX(t){return t.value}function QL(t){const e=F.c(17),{org:s}=We(),n=zs();let i,o,l,a;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(o=t.search?.trim()||void 0,i=t.imageOnly??!1,a=vy,l=it.filePickerObjects(s.id,t.configId,o,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=o,e[6]=l,e[7]=a):(i=e[4],o=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]!==o||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:o,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=o,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:sX},e[13]=l,e[14]=c,e[15]=d,e[16]=h):h=e[16],a(h)}function sX(t){return t.nextCursor??void 0}function Rf(){const t=F.c(2),{org:e}=We();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",o=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(!o.ok){const l=await o.text().catch(nX);let a=`${o.status} ${o.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 o.json()}},t[0]=e,t[1]=s):s=t[1],Xs(s)}function nX(){return""}function iX(){const t=F.c(8),{org:e}=We(),s=zs(),n=Ls();let i;t[0]!==s?(i=a=>s.call("FILE_OBJECT_DELETE",a),t[0]=s,t[1]=i):i=t[1];let o;t[2]!==e||t[3]!==n?(o=(a,c)=>{n.invalidateQueries({queryKey:it.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=o):o=t[4];let l;return t[5]!==i||t[6]!==o?(l={mutationFn:i,onSuccess:o},t[5]=i,t[6]=o,t[7]=l):l=t[7],Xs(l)}function fg(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function JL(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function hh(t){const e=t.split("/");return e[e.length-1]??t}function XL(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const Df="file-picker:last-config-id";function ZL(t){const e=F.c(31),s=re(),n=t.open,i=t.onOpenChange;let o;e[0]!==t.mode||e[1]!==s?(o=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx($t,{children:o}),e[3]=o,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=r.jsx(Dn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.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:v}=b;return r.jsx(rX,{error:v??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=h):h=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(xt,{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 m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(m=r.jsx(E.Suspense,{fallback:u,children:r.jsx(oX,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==h?(p=r.jsx(Js,{fallback:h,children:m}),e[21]=m,e[22]=h,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=r.jsxs(Pt,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,p]}),e[24]=p,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=r.jsx(Rt,{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 rX(t){const e=F.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(pn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=r.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,r.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function oX(t){const e=F.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,o=iy();if(o.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(cX,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==o||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=o.find(x),e[1]=o,e[2]=n,e[3]=p}else p=e[3];const g=p;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=r.jsx(j9,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(o.length===1){const p=o[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=r.jsx(j9,{config:p,mode:s,onSelect:i}),e[10]=p,e[11]=s,e[12]=i,e[13]=g):g=e[13],g}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=typeof window<"u"?window.localStorage.getItem(Df):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==o?(c=o.find(p=>p.id===a)?.id??o[0].id,e[15]=o,e[16]=c):c=e[16];const d=c;let h;e[17]!==o?(h=o.map(lX),e[17]=o,e[18]=h):h=e[18];let u;e[19]!==h?(u=r.jsx(eu,{className:"self-start",children:h}),e[19]=h,e[20]=u):u=e[20];let f;if(e[21]!==o||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>r.jsx(Yo,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:r.jsx(j9,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],f=o.map(p),e[21]=o,e[22]=s,e[23]=i,e[24]=f}else f=e[24];let m;return e[28]!==d||e[29]!==u||e[30]!==f?(m=r.jsxs(rc,{defaultValue:d,onValueChange:aX,className:"min-h-0 flex-1 flex flex-col",children:[u,f]}),e[28]=d,e[29]=u,e[30]=f,e[31]=m):m=e[31],m}function lX(t){return r.jsx(Xi,{value:t.id,children:t.name},t.id)}function aX(t){typeof window<"u"&&window.localStorage.setItem(Df,t)}function cX(){const t=F.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Qn,{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=r.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function j9({config:t,mode:e,onSelect:s}){const n=re(),[i,o]=E.useState(""),l=Yh(i,300),a=QL({configId:t.id,search:l,imageOnly:e==="image"}),c=Rf(),[d,h]=E.useState(!1),u=E.useRef(null),f=e==="image"?"image/*":void 0;async function m(S){if(!S)return;const w=Array.from(S);if(w.length===0)return;let j=null;const N=[];for(const A of w)try{const C=await c.mutateAsync({configId:t.id,file:A});j??=C.publicUrl}catch(C){N.push(`${A.name} (${C instanceof Error?C.message:"upload failed"})`)}await a.refetch(),N.length>0&&pe.error(N.length===w.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:N.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:N.join("; ")})),j&&s(j)}function p(S){S.preventDefault(),h(!0)}function g(){h(!1)}function x(S){S.preventDefault(),S.stopPropagation(),h(!1),m(S.dataTransfer.files)}const v=(a.data?.pages??[]).flatMap(S=>S.items),y=v.filter(S=>e==="image"?fg(S.key):!0),L=l.trim(),_=v.length>0||i.trim().length>0,k=i!==l||a.isFetching&&!a.isFetchingNextPage;return r.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[r.jsxs("button",{type:"button",onClick:()=>u.current?.click(),onDragOver:p,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:[r.jsx(Qn,{size:18,className:"text-muted-foreground"}),r.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),r.jsx("input",{ref:u,type:"file",accept:f,multiple:!0,className:"hidden",onChange:S=>{const w=Array.from(S.target.files??[]);S.target.value="",m(w)}})]}),_?r.jsx(Wh,{value:i,onChange:o,isSearching:k,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[y.length===0?L?r.jsx(hX,{query:L}):e==="image"&&v.length>0?r.jsx(uX,{}):r.jsx(dX,{}):e==="image"?r.jsx(fX,{items:y,onSelect:s}):r.jsx(mX,{items:y,onSelect:s}),a.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function dX(){const t=F.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(wi,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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 uX(){const t=F.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(wi,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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 hX(t){const e=F.c(13),{query:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(wi,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s||e[2]!==n?(o=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==o?(l=r.jsx("p",{className:"text-sm font-medium",children:o}),e[4]=o,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=r.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=r.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 fX(t){const e=F.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx(ew,{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 o;return e[5]!==i?(o=r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=o):o=e[6],o}function mX(t){const e=F.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx("li",{children:r.jsx(ew,{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 o;return e[5]!==i?(o=r.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=o):o=e[6],o}function ew(t){const e=F.c(58),{item:s,variant:n,onSelect:i}=t;let o;e[0]!==s.key?(o=JL(s.key),e[0]=s.key,e[1]=o):o=e[1];const l=o;if(n==="image"){let y;e[2]!==s.publicUrl||e[3]!==i?(y=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=y):y=e[4];let L;e[5]!==s.key||e[6]!==s.publicUrl?(L=r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:pX}),e[5]=s.key,e[6]=s.publicUrl,e[7]=L):L=e[7];let _;e[8]!==s.key||e[9]!==y||e[10]!==L?(_=r.jsx("button",{type:"button",onClick:y,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:L}),e[8]=s.key,e[9]=y,e[10]=L,e[11]=_):_=e[11];let k;e[12]!==l?(k=r.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]=k):k=e[13];let S;e[14]!==s||e[15]!==i?(S=r.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:r.jsx(A4,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=S):S=e[16];let w;e[17]!==s.key?(w=hh(s.key),e[17]=s.key,e[18]=w):w=e[18];let j;e[19]!==w?(j=r.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:r.jsx("p",{className:"truncate text-xs text-white",children:w})}),e[19]=w,e[20]=j):j=e[20];let N;return e[21]!==_||e[22]!==k||e[23]!==S||e[24]!==j?(N=r.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[_,k,S,j]}),e[21]=_,e[22]=k,e[23]=S,e[24]=j,e[25]=N):N=e[25],N}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=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:fg(s.key)?r.jsx(wi,{size:16,className:"text-muted-foreground"}):r.jsx(Li,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=hh(s.key),e[31]=s.key,e[32]=d):d=e[32];let h;e[33]!==d?(h=r.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=r.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=r.jsxs("div",{className:"min-w-0 flex-1",children:[h,u]}),e[37]=h,e[38]=u,e[39]=f):f=e[39];let m;e[40]!==l?(m=r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:l}),e[40]=l,e[41]=m):m=e[41];let p;e[42]!==s.size?(p=XL(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==a||e[48]!==c||e[49]!==f||e[50]!==m?(x=r.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,m,g]}),e[46]=g,e[47]=a,e[48]=c,e[49]=f,e[50]=m,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=r.jsx(A4,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let v;return e[55]!==x||e[56]!==b?(v=r.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[x,b]}),e[55]=x,e[56]=b,e[57]=v):v=e[57],v}function pX(t){t.target.style.display="none"}function A4(t){const e=F.c(39),{item:s,onSelect:n}=t,i=re(),[o,l]=E.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(N){N.preventDefault(),N.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{pe.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=r.jsx(Pp,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=r.jsx(Gt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:bX,"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 m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Et,{size:14}),e[11]=m):m=e[11];let p;e[12]!==i?(p=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=p):p=e[13];let g;e[14]!==f||e[15]!==p?(g=r.jsxs(et,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==o?(x=o?r.jsx(Et,{size:14}):r.jsx(on,{size:14}),e[17]=o,e[18]=x):x=e[18];let b;e[19]!==o||e[20]!==i?(b=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=o,e[20]=i,e[21]=b):b=e[21];let v;e[22]!==c||e[23]!==b||e[24]!==x?(v=r.jsxs(et,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const y=s.publicUrl;let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(mn,{size:14}),e[26]=L):L=e[26];let _;e[27]!==i?(_=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=_):_=e[28];let k;e[29]!==s.publicUrl||e[30]!==_?(k=r.jsx(et,{asChild:!0,children:r.jsxs("a",{href:y,target:"_blank",rel:"noreferrer",onClick:gX,children:[L,_]})}),e[29]=s.publicUrl,e[30]=_,e[31]=k):k=e[31];let S;e[32]!==v||e[33]!==k||e[34]!==g?(S=r.jsxs(Yt,{align:"end",onClick:xX,children:[g,v,k]}),e[32]=v,e[33]=k,e[34]=g,e[35]=S):S=e[35];let w;return e[36]!==S||e[37]!==u?(w=r.jsxs(qt,{children:[u,S]}),e[36]=S,e[37]=u,e[38]=w):w=e[38],w}function gX(t){return t.stopPropagation()}function xX(t){return t.stopPropagation()}function bX(t){return t.stopPropagation()}function tw(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.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:r.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[r.jsx(Qn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function sw(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function nw(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const vX=["low","medium","high","original"];function iw(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function rw(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=yX(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 ow(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",o=n>=0?t.slice(0,n):t,l=o.indexOf("?"),a=l>=0?o.slice(0,l):o,c=(l>=0?o.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 yX(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 _X(t){if(!t)return;const e=rw(t,"quality");return iw(e)?e:void 0}function LX(t,e){return ow(t,"quality",e)}function wX(t){return t?rw(t,"muted")!=="false":!0}function SX(t,e){return ow(t,"muted",e?void 0:"false")}function lw(t){const e=F.c(36),{value:s,onChange:n,showMuted:i}=t,o=i===void 0?!1:i,l=re(),a=E.useId();let c;e[0]!==s?(c=_X(s),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==s?(h=wX(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 m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Pp,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=r.jsx(ts,{asChild:!0,children:r.jsx(he,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:m})}),e[7]=f,e[8]=p):p=e[8];let g;e[9]!==l?(g=l("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=l,e[10]=g):g=e[10];let x;e[11]!==g?(x=r.jsx(Mt,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let v;e[13]!==n||e[14]!==s?(v=j=>n(LX(s,iw(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=vX.map(kX),e[16]=y):y=e[16];let L;e[17]!==v||e[18]!==b?(L=r.jsx(mp,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:y}),e[17]=v,e[18]=b,e[19]=L):L=e[19];let _;e[20]!==L||e[21]!==x?(_=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,L]}),e[20]=L,e[21]=x,e[22]=_):_=e[22];let k;e[23]!==u||e[24]!==a||e[25]!==n||e[26]!==o||e[27]!==l||e[28]!==s?(k=o&&r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Mt,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),r.jsx(Rr,{id:a,checked:u,onCheckedChange:j=>n(SX(s,j))})]}),e[23]=u,e[24]=a,e[25]=n,e[26]=o,e[27]=l,e[28]=s,e[29]=k):k=e[29];let S;e[30]!==_||e[31]!==k?(S=r.jsx(ss,{align:"end",className:"w-auto min-w-52 p-3",children:r.jsxs("div",{className:"flex flex-col gap-3",children:[_,k]})}),e[30]=_,e[31]=k,e[32]=S):S=e[32];let w;return e[33]!==S||e[34]!==p?(w=r.jsxs(ns,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=w):w=e[35],w}function kX(t){return r.jsx(Nd,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function aw(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function E4(t){const e=F.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=r.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 jX(t){const e=F.c(81),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=s.format==="video-uri",h=dg(n),[u,f]=E.useState(!1),[m,p]=E.useState(!1),g=h?sw(h):"",x=g?nw(g):"",b=Tp(),v=Rf();let y;e[0]!==b.data?.configs?(y=b.data?.configs??[],e[0]=b.data?.configs,e[1]=y):y=e[1];const L=a?.siteSlug;let _;e[2]!==y||e[3]!==L?(_=df(y,L),e[2]=y,e[3]=L,e[4]=_):_=e[4];const k=_;let S;e[5]!==b.data?.configs||e[6]!==d||e[7]!==k?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==v?(S=async function(G){if(!G)return;let X=Array.from(G);if(X.length===0)return;if(d&&(X=X.filter(CX),X.length===0)){pe.error(c("sectionsEditor.fileField.videoFileError"));return}const q=aw(b.data?.configs??[],k?.id,typeof window<"u"?window.localStorage.getItem(Df):null);if(!q){f(!0);return}try{const Z=await v.mutateAsync({configId:q,file:X[0]});i(Z.publicUrl),X.length>1&&pe.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:X[0].name}))}catch(Z){const le=Z;pe.error(le instanceof Error?le.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=k?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=v,e[12]=S):S=e[12];const w=S;let j;e[13]!==p?(j=function(G){G.preventDefault(),G.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const N=j;let A;e[15]!==p?(A=function(G){G.currentTarget===G.target&&p(!1)},e[15]=p,e[16]=A):A=e[16];const C=A;let T;e[17]!==w||e[18]!==p?(T=function(G){G.preventDefault(),G.stopPropagation(),p(!1),w(G.dataTransfer.files)},e[17]=w,e[18]=p,e[19]=T):T=e[19];const V=T,R=a?.virtualMcpId;let P;e[20]!==l||e[21]!==o||e[22]!==s.description||e[23]!==R?(P=r.jsx("div",{className:"min-w-0",children:r.jsx($s,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:R})}),e[20]=l,e[21]=o,e[22]=s.description,e[23]=R,e[24]=P):P=e[24];const M=m&&"border-primary ring-2 ring-primary/30",D=v.isPending&&"pointer-events-none opacity-60";let $;e[25]!==M||e[26]!==D?($=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",M,D),e[25]=M,e[26]=D,e[27]=$):$=e[27];let z;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==h||e[33]!==c||e[34]!==v.isPending?(z=h?d?r.jsxs(r.Fragment,{children:[r.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:[r.jsx("video",{src:h,preload:"metadata",className:"h-full w-full object-contain"},h),r.jsx(tw,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(Gg,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),r.jsx(E4,{ext:x})]})]}):r.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:[r.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:r.jsx(Li,{size:18,className:"text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium",children:g}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:h})]}),r.jsx(E4,{ext:x})]}):r.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?r.jsx(Gg,{size:20}):r.jsx(Li,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=f,e[32]=h,e[33]=c,e[34]=v.isPending,e[35]=z):z=e[35];let I;e[36]!==m||e[37]!==c?(I=m&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=m,e[37]=c,e[38]=I):I=e[38];let O;e[39]!==C||e[40]!==N||e[41]!==V||e[42]!==$||e[43]!==z||e[44]!==I?(O=r.jsxs("div",{onDragOver:N,onDragLeave:C,onDrop:V,className:$,children:[z,I]}),e[39]=C,e[40]=N,e[41]=V,e[42]=$,e[43]=z,e[44]=I,e[45]=O):O=e[45];let B;e[46]!==i?(B=se=>i(se.target.value),e[46]=i,e[47]=B):B=e[47];let U;e[48]!==o||e[49]!==h||e[50]!==B?(U=r.jsx(pt,{id:o,type:"url",value:h,onChange:B,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=o,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&&r.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[r.jsx(Qn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=h,e[54]=c,e[55]=H):H=e[55];let K;e[56]!==d||e[57]!==i||e[58]!==h?(K=d&&h&&r.jsx(lw,{value:h,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=h,e[59]=K):K=e[59];let W;e[60]!==i||e[61]!==h||e[62]!==c?(W=h&&r.jsx(he,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:r.jsx(Zs,{size:14})}),e[60]=i,e[61]=h,e[62]=c,e[63]=W):W=e[63];let Y;e[64]!==U||e[65]!==H||e[66]!==K||e[67]!==W?(Y=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,H,K,W]}),e[64]=U,e[65]=H,e[66]=K,e[67]=W,e[68]=Y):Y=e[68];let Q;e[69]!==i?(Q=se=>i(se),e[69]=i,e[70]=Q):Q=e[70];const te=k?.id??null;let ee;e[71]!==u||e[72]!==f||e[73]!==Q||e[74]!==te?(ee=r.jsx(ZL,{open:u,onOpenChange:f,mode:"any",onSelect:Q,lockedConfigId:te}),e[71]=u,e[72]=f,e[73]=Q,e[74]=te,e[75]=ee):ee=e[75];let oe;return e[76]!==O||e[77]!==Y||e[78]!==ee||e[79]!==P?(oe=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[P,O,Y,ee]}),e[76]=O,e[77]=Y,e[78]=ee,e[79]=P,e[80]=oe):oe=e[80],oe}function CX(t){return t.type.startsWith("video/")}const NX=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function VX(t){const e=F.c(86),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=dg(n),[h,u]=E.useState(!1),[f,m]=E.useState(!1),[p,g]=E.useState(!1),[x,b]=E.useState(!1),v=d?sw(d):"",y=v?nw(v):"",L=Tp(),_=Rf();let k;e[0]!==L.data?.configs?(k=L.data?.configs??[],e[0]=L.data?.configs,e[1]=k):k=e[1];const S=a?.siteSlug;let w;e[2]!==k||e[3]!==S?(w=df(k,S),e[2]=k,e[3]=S,e[4]=w):w=e[4];const j=w;let N;e[5]!==i||e[6]!==b||e[7]!==g?(N=function(ne){g(!1),b(!1),i(ne)},e[5]=i,e[6]=b,e[7]=g,e[8]=N):N=e[8];const A=N;let C;e[9]!==L.data?.configs||e[10]!==j?.id||e[11]!==u||e[12]!==A||e[13]!==c||e[14]!==_?(C=async function(ne){if(!ne)return;const ae=Array.from(ne).filter(TX);if(ae.length===0){pe.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const de=aw(L.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(Df):null);if(!de){u(!0);return}try{const fe=await _.mutateAsync({configId:de,file:ae[0]});A(fe.publicUrl),ae.length>1&&pe.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:ae[0].name}))}catch(fe){const ue=fe;pe.error(ue instanceof Error?ue.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=L.data?.configs,e[10]=j?.id,e[11]=u,e[12]=A,e[13]=c,e[14]=_,e[15]=C):C=e[15];const T=C;let V;e[16]!==m?(V=function(ne){ne.preventDefault(),ne.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=V):V=e[17];const R=V;let P;e[18]!==m?(P=function(ne){ne.currentTarget===ne.target&&m(!1)},e[18]=m,e[19]=P):P=e[19];const M=P;let D;e[20]!==T||e[21]!==m?(D=function(ne){ne.preventDefault(),ne.stopPropagation(),m(!1),T(ne.dataTransfer.files)},e[20]=T,e[21]=m,e[22]=D):D=e[22];const $=D,z=a?.virtualMcpId;let I;e[23]!==l||e[24]!==o||e[25]!==s.description||e[26]!==z?(I=r.jsx("div",{className:"min-w-0",children:r.jsx($s,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:z})}),e[23]=l,e[24]=o,e[25]=s.description,e[26]=z,e[27]=I):I=e[27];const O=f&&"border-primary ring-2 ring-primary/30",B=_.isPending&&"pointer-events-none opacity-60";let U;e[28]!==O||e[29]!==B?(U=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",O,B),e[28]=O,e[29]=B,e[30]=U):U=e[30];let H;e[31]!==y||e[32]!==v||e[33]!==x||e[34]!==p||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==u||e[39]!==d||e[40]!==c||e[41]!==_.isPending?(H=d?r.jsxs(r.Fragment,{children:[r.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&&r.jsx("img",{src:d,alt:l,className:ie("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[r.jsx(wi,{size:20}),r.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&r.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),r.jsx(tw,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:v}),y&&r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:y})]})]}):r.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:[r.jsx(wi,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:_.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=y,e[32]=v,e[33]=x,e[34]=p,e[35]=l,e[36]=b,e[37]=g,e[38]=u,e[39]=d,e[40]=c,e[41]=_.isPending,e[42]=H):H=e[42];let K;e[43]!==f||e[44]!==c?(K=f&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.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]=K):K=e[45];let W;e[46]!==M||e[47]!==R||e[48]!==$||e[49]!==U||e[50]!==H||e[51]!==K?(W=r.jsxs("div",{onDragOver:R,onDragLeave:M,onDrop:$,className:U,children:[H,K]}),e[46]=M,e[47]=R,e[48]=$,e[49]=U,e[50]=H,e[51]=K,e[52]=W):W=e[52];let Y;e[53]!==A?(Y=le=>A(le.target.value),e[53]=A,e[54]=Y):Y=e[54];let Q;e[55]!==c?(Q=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=Q):Q=e[56];let te;e[57]!==o||e[58]!==d||e[59]!==Y||e[60]!==Q?(te=r.jsx(pt,{id:o,type:"url",value:d,onChange:Y,placeholder:Q,className:"h-9 min-w-0 flex-1"}),e[57]=o,e[58]=d,e[59]=Y,e[60]=Q,e[61]=te):te=e[61];let ee;e[62]!==u||e[63]!==d||e[64]!==c?(ee=!d&&r.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),className:"h-9 shrink-0",children:[r.jsx(Qn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=u,e[63]=d,e[64]=c,e[65]=ee):ee=e[65];let oe;e[66]!==A||e[67]!==d||e[68]!==c?(oe=d&&r.jsxs(r.Fragment,{children:[r.jsx(lw,{value:d,onChange:A}),r.jsx(he,{type:"button",variant:"ghost",size:"sm",onClick:()=>A(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:r.jsx(Zs,{size:14})})]}),e[66]=A,e[67]=d,e[68]=c,e[69]=oe):oe=e[69];let se;e[70]!==te||e[71]!==ee||e[72]!==oe?(se=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[te,ee,oe]}),e[70]=te,e[71]=ee,e[72]=oe,e[73]=se):se=e[73];let G;e[74]!==A?(G=le=>A(le),e[74]=A,e[75]=G):G=e[75];const X=j?.id??null;let q;e[76]!==h||e[77]!==u||e[78]!==G||e[79]!==X?(q=r.jsx(ZL,{open:h,onOpenChange:u,mode:"image",onSelect:G,lockedConfigId:X}),e[76]=h,e[77]=u,e[78]=G,e[79]=X,e[80]=q):q=e[80];let Z;return e[81]!==I||e[82]!==W||e[83]!==se||e[84]!==q?(Z=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[I,W,se,q]}),e[81]=I,e[82]=W,e[83]=se,e[84]=q,e[85]=Z):Z=e[85],Z}function TX(t){return NX.has(t.type||"")}const AX="0 0 1080 1080",EX="matrix(1 0 0 1 540 540)",mg=[{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 PX({selected:t,onSelect:e}){const s=re(),[n,i]=E.useState(AX),o=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 r.jsx("svg",{ref:o,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:r.jsx("g",{transform:EX,children:mg.map(l=>{const a=l.code===t;return r.jsx("g",{transform:l.gTransform,children:r.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 RX=[{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"}],DX="BR";function IX(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 MX(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 $X(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function P4(t){const e=F.c(37),{id:s,options:n,value:i,placeholder:o,emptyMessage:l,onChange:a}=t,[c,d]=E.useState(!1);let h;if(e[0]!==n||e[1]!==i){let S;e[3]!==i?(S=w=>w.value===i,e[3]=i,e[4]=S):S=e[4],h=n.find(S),e[0]=n,e[1]=i,e[2]=h}else h=e[2];const u=h;let f;e[5]!==o||e[6]!==u?(f=u?r.jsx("span",{className:"truncate",children:u.label}):r.jsx("span",{className:"text-muted-foreground",children:o}),e[5]=o,e[6]=u,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(qh,{className:"size-4 shrink-0 opacity-50"}),e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==c||e[11]!==f?(p=r.jsx(ts,{asChild:!0,children:r.jsxs(he,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,m]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==o?(x=r.jsx(hi,{placeholder:o,className:"h-9"}),e[14]=o,e[15]=x):x=e[15];let b;e[16]!==l?(b=r.jsx(Jn,{children:l}),e[16]=l,e[17]=b):b=e[17];let v;if(e[18]!==a||e[19]!==n||e[20]!==i){let S;e[22]!==a||e[23]!==i?(S=w=>r.jsxs(Ut,{value:`${w.label} ${w.value}`,onSelect:()=>{a(w.value===i?"":w.value),d(!1)},children:[r.jsx("span",{className:"truncate",children:w.label}),r.jsx(Et,{className:ie("ml-auto size-4 shrink-0",i===w.value?"opacity-100":"opacity-0")})]},w.value),e[22]=a,e[23]=i,e[24]=S):S=e[24],v=n.map(S),e[18]=a,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let y;e[25]!==v?(y=r.jsx(fs,{children:v}),e[25]=v,e[26]=y):y=e[26];let L;e[27]!==b||e[28]!==y?(L=r.jsxs(fi,{children:[b,y]}),e[27]=b,e[28]=y,e[29]=L):L=e[29];let _;e[30]!==L||e[31]!==x?(_=r.jsx(ss,{className:"p-0",style:g,children:r.jsxs(Ri,{children:[x,L]})}),e[30]=L,e[31]=x,e[32]=_):_=e[32];let k;return e[33]!==c||e[34]!==_||e[35]!==p?(k=r.jsxs(ns,{open:c,onOpenChange:d,children:[p,_]}),e[33]=c,e[34]=_,e[35]=p,e[36]=k):k=e[36],k}const OX=RX.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),BX=mg.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function cw(t){const e=F.c(66),{schema:s,value:n,onChange:i,path:o,sandbox:l}=t,a=re();let c;e[0]!==n?(c=MX(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:h,regionCode:u,country:f}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==a?(g=p.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==a?(b=p.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const v=b;let y;e[10]!==p.city?.title||e[11]!==a?(y=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=y):y=e[12];const L=y;let _;e[13]!==d||e[14]!==i?(_=j=>{i($X(d,j))},e[13]=d,e[14]=i,e[15]=_):_=e[15];const k=_,S=f===DX;let w;if(e[16]!==h||e[17]!==L||e[18]!==f||e[19]!==x||e[20]!==k||e[21]!==S||e[22]!==o||e[23]!==u||e[24]!==v||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 N=mg.find(j),A=`${o}.country`;let C;e[32]!==s.title||e[33]!==a?(C=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=C):C=e[34];const T=l?.virtualMcpId;let V;e[35]!==s.description||e[36]!==C||e[37]!==T||e[38]!==A?(V=r.jsx($s,{htmlFor:A,label:C,description:s.description,virtualMcpId:T}),e[35]=s.description,e[36]=C,e[37]=T,e[38]=A,e[39]=V):V=e[39];const R=`${o}.country`;let P;e[40]!==x||e[41]!==R?(P=r.jsx(Mt,{htmlFor:R,className:"text-xs",children:x}),e[40]=x,e[41]=R,e[42]=P):P=e[42];const M=`${o}.country`;let D;e[43]!==a?(D=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=D):D=e[44];let $;e[45]!==a?($=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=$):$=e[46];let z;e[47]!==k?(z=U=>k({country:U,regionCode:"",city:""}),e[47]=k,e[48]=z):z=e[48];let I;e[49]!==f||e[50]!==M||e[51]!==D||e[52]!==$||e[53]!==z?(I=r.jsx(P4,{id:M,options:OX,value:f,placeholder:D,emptyMessage:$,onChange:z}),e[49]=f,e[50]=M,e[51]=D,e[52]=$,e[53]=z,e[54]=I):I=e[54];let O;e[55]!==P||e[56]!==I?(O=r.jsxs("div",{className:"space-y-1.5",children:[P,I]}),e[55]=P,e[56]=I,e[57]=O):O=e[57];let B;e[58]!==f||e[59]!==k||e[60]!==S||e[61]!==o||e[62]!==u||e[63]!==v||e[64]!==a?(B=f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Mt,{htmlFor:`${o}.regionCode`,className:"text-xs",children:v}),S?r.jsxs("div",{className:"space-y-2",children:[r.jsx(PX,{selected:u,onSelect:U=>k({regionCode:U===u?"":U,city:""})}),r.jsx(P4,{id:`${o}.regionCode`,options:BX,value:u,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>k({regionCode:U,city:""})})]}):r.jsxs(r.Fragment,{children:[r.jsx(pt,{id:`${o}.regionCode`,type:"text",value:u,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>k({regionCode:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=k,e[60]=S,e[61]=o,e[62]=u,e[63]=v,e[64]=a,e[65]=B):B=e[65],w=r.jsxs("div",{className:"space-y-4",children:[V,O,B,f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Mt,{htmlFor:`${o}.city`,className:"text-xs",children:L}),r.jsx(pt,{id:`${o}.city`,type:"text",value:h,placeholder:S&&N?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:N.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>k({city:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=h,e[17]=L,e[18]=f,e[19]=x,e[20]=k,e[21]=S,e[22]=o,e[23]=u,e[24]=v,e[25]=l?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=a,e[29]=w}else w=e[29];return w}function zX(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,o]of Object.entries(e.properties))s.has(i)||(n[i]=o);return Object.keys(n).length===0?null:{...e,properties:n}}function FX(t){const e=F.c(52),s=re(),{schema:n,value:i,onChange:o,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=DL(i,c.map(UX)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const h=d,[u,f]=E.useState(h),[m,p]=E.useState(h);m!==h&&(p(h),f(h));const g=Math.min(u,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==o?(b=D=>{const $=Number(D);f($),o({...c[$]?.discriminators??{}})},e[4]=c,e[5]=o,e[6]=b):b=e[6];const v=b;if(c.length===0)return null;let y;e[7]!==x?(y=x?zX(x):null,e[7]=x,e[8]=y):y=e[8];const L=y;let _;if(e[9]!==x?.schema?.properties||e[10]!==i){let D;e[12]!==x?.schema?.properties?(D=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=D):D=e[13],_=eJ(i,Object.keys(D)),e[9]=x?.schema?.properties,e[10]=i,e[11]=_}else _=e[11];const k=_;let S;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=a&&r.jsx($s,{htmlFor:l,label:a,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=a,e[15]=l,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=S):S=e[18];const w=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let N;e[21]!==j?(N=r.jsx(Ps,{placeholder:j}),e[21]=j,e[22]=N):N=e[22];let A;e[23]!==l||e[24]!==N?(A=r.jsx(Cs,{id:l,children:N}),e[23]=l,e[24]=N,e[25]=A):A=e[25];let C;if(e[26]!==c||e[27]!==s){let D;e[29]!==s?(D=($,z)=>r.jsx(At,{value:String(z),children:rJ($.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:z+1})},$.title),e[29]=s,e[30]=D):D=e[30],C=c.map(D),e[26]=c,e[27]=s,e[28]=C}else C=e[28];let T;e[31]!==C?(T=r.jsx(Ns,{children:C}),e[31]=C,e[32]=T):T=e[32];let V;e[33]!==v||e[34]!==T||e[35]!==w||e[36]!==A?(V=r.jsxs(js,{value:w,onValueChange:v,children:[A,T]}),e[33]=v,e[34]=T,e[35]=w,e[36]=A,e[37]=V):V=e[37];let R;e[38]!==V||e[39]!==S?(R=r.jsxs("div",{className:"space-y-1.5",children:[S,V]}),e[38]=V,e[39]=S,e[40]=R):R=e[40];let P;e[41]!==x||e[42]!==L||e[43]!==o||e[44]!==l||e[45]!==k||e[46]!==t||e[47]!==i?(P=x&&(IX(x.schema?.properties)?r.jsx(cw,{...t,schema:x.schema,onChange:D=>o({...k,...D,...x.discriminators??{}})}):L?r.jsx($r,{schema:L,value:i,onChange:D=>o({...D,...x.discriminators??{}}),basePath:l,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection}):null),e[41]=x,e[42]=L,e[43]=o,e[44]=l,e[45]=k,e[46]=t,e[47]=i,e[48]=P):P=e[48];let M;return e[49]!==R||e[50]!==P?(M=r.jsxs("div",{className:"space-y-3",children:[R,P]}),e[49]=R,e[50]=P,e[51]=M):M=e[51],M}function UX(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const HX={lat:-21.9,lng:-41.42},K1=1e5;let n0=null;function KX(t){return n0||(n0=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"))},o=document.querySelector("script[data-google-maps-loader]");if(o){o.addEventListener("load",i),o.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)}),n0)}function WX(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:K1}}function qX({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o}){const l=$k().googleMapsApiKey,a=E.useRef(s);a.current=s;const c=E.useRef(WX(e)),[d,h]=E.useState(null),u=E.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return KX(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:HX,v=x?.radius??K1,y=new g.Map(m,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),L=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:y,center:b,radius:v});p.circle=L;const _=()=>{const S=L.getCenter(),w=L.getRadius();S&&a.current(`${S.lat()},${S.lng()},${w}`)},k=S=>{S&&p.listeners.push(S)};k(y.addListener("click",S=>{S.latLng&&(L.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),L.getRadius()||L.setRadius(K1),_())})),k(L.addListener("radius_changed",_)),k(L.addListener("dragend",_))},g=>{p.disposed||h(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return u.current||(u.current=f),r.jsxs("div",{className:"space-y-2",children:[r.jsx($s,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),l?d?r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):r.jsx("div",{ref:u.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):r.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"," ",r.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const GX="oklch(0.65 0.15 160)",YX="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)]",dw="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)]",she="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 R4(t){return t.map(e=>e.label).join(`
540
- `)}function D4(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function QX(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 JX(t){return t.map((e,s)=>({...e,index:s}))}function uw(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:o,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=r.jsx(ic,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Cr,{className:"h-4 w-4 shrink-0",style:{color:GX}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==c?(p=!i&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{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:ZX,onPointerDown:XX,children:r.jsx(Yn,{size:14})})}),r.jsxs(Yt,{align:"end",children:[o&&r.jsxs(et,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(Mv,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(et,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(on,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(et,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(Zs,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=o,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==u||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[u,f,m,p]}),e[15]=u,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function XX(t){return t.stopPropagation()}function ZX(t){return t.stopPropagation()}function eZ(t){const e=F.c(27),{entry:s,selected:n,canDelete:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:tZ},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:m,isDragging:p}=yf(d);let g;e[2]!==m?(g=Ni.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let y;e[7]!==o?(y=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=y):y=e[8];const L=p?"cursor-grabbing":"cursor-grab",_=n?dw:YX;let k;e[9]!==L||e[10]!==_?(k=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,_),e[9]=L,e[10]=_,e[11]=k):k=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=r.jsx(uw,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=S):S=e[17];let w;return e[18]!==h||e[19]!==u||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==y||e[24]!==k||e[25]!==S?(w=r.jsx("div",{ref:f,style:v,...h,...u,onClick:o,onKeyDown:y,className:k,children:S}),e[18]=h,e[19]=u,e[20]=o,e[21]=f,e[22]=v,e[23]=y,e[24]=k,e[25]=S,e[26]=w):w=e[26],w}function tZ(){return!1}function sZ(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=re(),m=n.length>1;let p;e[0]!==n?(p=()=>D4(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=E.useState(p),[b,v]=E.useState(null),[y,L]=E.useState(s),[_,k]=E.useState(n.length);let S;e[2]!==n?(S=()=>R4(n),e[2]=n,e[3]=S):S=e[3];const[w,j]=E.useState(S),N=E.useRef(!1),A=R4(n);y!==s?(L(s),k(n.length),j(A),x(D4(n))):(_!==n.length||w!==A)&&(k(n.length),j(A),x(fe=>QX(fe,n)));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:_f},e[5]=T):T=e[5];const V=fu(rr(Sl,C),rr(wl,T));let R;e[6]!==g?(R=g.map(nZ),e[6]=g,e[7]=R):R=e[7];const P=R;let M;e[8]!==g?(M=fe=>{const ue=String(fe.active.id);v(g.find(ge=>ge.id===ue)??null)},e[8]=g,e[9]=M):M=e[9];const D=M;let $;e[10]!==P||e[11]!==h?($=fe=>{v(null);const{active:ue,over:ge}=fe;if(!ge||ue.id===ge.id)return;const J=P.indexOf(String(ue.id)),me=P.indexOf(String(ge.id));J===-1||me===-1||(x(ye=>JX(ol([...ye],J,me))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),h(J,me))},e[10]=P,e[11]=h,e[12]=$):$=e[12];const z=$;let I;e[13]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{v(null)},e[13]=I):I=e[13];const O=I;let B,U,H,K,W,Y,Q,te,ee,oe,se,G,X;if(e[14]!==m||e[15]!==g||e[16]!==P||e[17]!==z||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==V||e[27]!==f){const fe=Ve=>{N.current||o(Ve)};se="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 ge;e[43]!==ue?(ge=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ue}),e[43]=ue,e[44]=ge):ge=e[44];let J;e[45]!==f?(J=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=J):J=e[46];let me;e[47]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx(Dt,{size:14}),e[47]=me):me=e[47];let ye;e[48]!==u||e[49]!==J?(ye=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":J,className:"size-6",onClick:u,children:me})}),e[48]=u,e[49]=J,e[50]=ye):ye=e[50];let Le;e[51]!==f?(Le=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=Le):Le=e[52];let ke;e[53]!==Le?(ke=r.jsx(He,{children:Le}),e[53]=Le,e[54]=ke):ke=e[54];let we;e[55]!==ye||e[56]!==ke?(we=r.jsxs(Ke,{children:[ye,ke]}),e[55]=ye,e[56]=ke,e[57]=we):we=e[57];let Ne;e[58]!==f?(Ne=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ne):Ne=e[59];let Ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ae=r.jsx(Zs,{size:14}),e[60]=Ae):Ae=e[60];let be;e[61]!==d||e[62]!==Ne?(be=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":Ne,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ae})}),e[61]=d,e[62]=Ne,e[63]=be):be=e[63];let Se;e[64]!==f?(Se=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Se):Se=e[65];let _e;e[66]!==Se?(_e=r.jsx(He,{children:Se}),e[66]=Se,e[67]=_e):_e=e[67];let Ee;e[68]!==be||e[69]!==_e?(Ee=r.jsxs(Ke,{children:[be,_e]}),e[68]=be,e[69]=_e,e[70]=Ee):Ee=e[70];let De;e[71]!==we||e[72]!==Ee?(De=r.jsxs("div",{className:"flex items-center gap-0.5",children:[we,Ee]}),e[71]=we,e[72]=Ee,e[73]=De):De=e[73],e[74]!==ge||e[75]!==De?(G=r.jsxs("div",{className:"flex items-center justify-between",children:[ge,De]}),e[74]=ge,e[75]=De,e[76]=G):G=e[76],U=pu,Y=V,Q=x2,te=D,ee=z,oe=O,B=vf,K=P,W=bf,X="space-y-0.5",H=g.map(Ve=>r.jsx(eZ,{entry:Ve,selected:Ve.index===i,canDelete:m,onSelect:()=>fe(Ve.index),onRename:l?()=>l(Ve.index):void 0,onDuplicate:()=>a(Ve.index),onDelete:()=>c(Ve.index)},Ve.id)),e[14]=m,e[15]=g,e[16]=P,e[17]=z,e[18]=D,e[19]=u,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=V,e[27]=f,e[28]=B,e[29]=U,e[30]=H,e[31]=K,e[32]=W,e[33]=Y,e[34]=Q,e[35]=te,e[36]=ee,e[37]=oe,e[38]=se,e[39]=G,e[40]=X}else B=e[28],U=e[29],H=e[30],K=e[31],W=e[32],Y=e[33],Q=e[34],te=e[35],ee=e[36],oe=e[37],se=e[38],G=e[39],X=e[40];let q;e[77]!==H||e[78]!==X?(q=r.jsx("div",{className:X,children:H}),e[77]=H,e[78]=X,e[79]=q):q=e[79];let Z;e[80]!==B||e[81]!==K||e[82]!==W||e[83]!==q?(Z=r.jsx(B,{items:K,strategy:W,children:q}),e[80]=B,e[81]=K,e[82]=W,e[83]=q,e[84]=Z):Z=e[84];let le;e[85]!==b||e[86]!==m?(le=b?r.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",dw),children:r.jsx(uw,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ne;e[88]!==le?(ne=En.createPortal(r.jsx(xf,{dropAnimation:TL,children:le}),document.body),e[88]=le,e[89]=ne):ne=e[89];let ae;e[90]!==U||e[91]!==Y||e[92]!==Q||e[93]!==te||e[94]!==ee||e[95]!==oe||e[96]!==Z||e[97]!==ne?(ae=r.jsxs(U,{sensors:Y,collisionDetection:Q,onDragStart:te,onDragEnd:ee,onDragCancel:oe,children:[Z,ne]}),e[90]=U,e[91]=Y,e[92]=Q,e[93]=te,e[94]=ee,e[95]=oe,e[96]=Z,e[97]=ne,e[98]=ae):ae=e[98];let de;return e[99]!==se||e[100]!==G||e[101]!==ae?(de=r.jsxs("div",{className:se,children:[G,ae]}),e[99]=se,e[100]=G,e[101]=ae,e[102]=de):de=e[102],de}function nZ(t){return t.id}const iZ=[[/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"]],rZ={"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 C9(t){return xl(t)!==void 0}function pg(t,e){if(e){if(C9(e))return e;const s=rZ[e];if(s&&C9(s))return s}for(const[s,n]of iZ)if(s.test(t)&&C9(n))return n;return"FilterLines"}function oZ(t){return xl(t)??Ip}function N9(t){const e=F.c(11),{iconName:s,size:n,className:i}=t,o=n===void 0?"md":n;let l;e[0]!==s?(l=oZ(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",d=o==="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=r.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=r.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}const lZ=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),aZ=5,cZ=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function I4(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const o=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:cZ.format(d)},l=o(n),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function fh(t,e=0){if(!t)return"Default";if(e>aZ)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:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(lZ).join(" & "):vs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return I4(t)??vs(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`:vs(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):vs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:vs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=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=o?.[0];if(c){const d=(o?.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:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>fh(a,e+1)).join(` ${l} `)}return vs(s)}default:{const i=I4(t);return i||vs(s)||"Default"}}}function nhe(t,e){return pG(t,e).map(s=>{const n=e[s.blockKey]??{},i=W_(bG(s.blockKey),e,t);return{blockKey:s.blockKey,title:rl(s.blockKey,n),description:fh(i),iconName:pg(s.matcherResolveType)}})}const hw="Users03";function dZ(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function uZ(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,o]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(o)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=Ao(l,t);s.push({resolveType:l,title:a.title??vs(l),description:a.description,iconName:pg(l,a.icon)})}return s}function hZ(t,e){if(!t)return hw;const s=e.find(n=>n.resolveType===t);return s?s.iconName:pg(t)}function fZ(t){const e=F.c(80),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[h,u]=E.useState(!1),f=re(),p=(i?d.find(ee=>ee.blockKey===i):void 0)?.iconName??hZ(s,o),g=xl(p);let x;e[0]!==a||e[1]!==u?(x=ee=>{a(ee),u(!1)},e[0]=a,e[1]=u,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==u?(v=ee=>{c?.(ee),u(!1)},e[3]=c,e[4]=u,e[5]=v):v=e[5];const y=v;let L;e[6]!==u?(L=()=>u(!0),e[6]=u,e[7]=L):L=e[7];let _;e[8]!==g?(_=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=_):_=e[9];let k;e[10]!==n?(k=r.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=k):k=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Jt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let w;e[13]!==L||e[14]!==_||e[15]!==k?(w=r.jsxs("button",{type:"button",onClick:L,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:[_,k,S]}),e[13]=L,e[14]=_,e[15]=k,e[16]=w):w=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let N;e[19]!==f?(N=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=N):N=e[20];let A;e[21]!==f?(A=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=A):A=e[22];let C;e[23]!==A?(C=r.jsx(hi,{placeholder:A}),e[23]=A,e[24]=C):C=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let V;e[27]!==T?(V=r.jsx(Jn,{children:T}),e[27]=T,e[28]=V):V=e[28];let R;e[29]!==b?(R=()=>b(""),e[29]=b,e[30]=R):R=e[30];const P=!s&&!i&&"bg-accent/60";let M;e[31]!==P?(M=ie("gap-2.5",P),e[31]=P,e[32]=M):M=e[32];let D;e[33]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(N9,{iconName:hw,size:"sm"}),e[33]=D):D=e[33];let $;e[34]!==f?($=f("sectionsEditor.matcherPicker.alwaysLabel"),e[34]=f,e[35]=$):$=e[35];let z;e[36]!==$?(z=r.jsx("span",{className:"text-sm",children:$}),e[36]=$,e[37]=z):z=e[37];let I;e[38]!==f?(I=f("sectionsEditor.matcherPicker.targetAllUsers"),e[38]=f,e[39]=I):I=e[39];let O;e[40]!==I?(O=r.jsx("span",{className:"text-xs text-muted-foreground",children:I}),e[40]=I,e[41]=O):O=e[41];let B;e[42]!==z||e[43]!==O?(B=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[z,O]}),e[42]=z,e[43]=O,e[44]=B):B=e[44];let U;e[45]!==R||e[46]!==M||e[47]!==B?(U=r.jsxs(Ut,{value:"always Target all users",onSelect:R,className:M,children:[D,B]}),e[45]=R,e[46]=M,e[47]=B,e[48]=U):U=e[48];let H;if(e[49]!==i||e[50]!==s||e[51]!==b||e[52]!==o){let ee;e[54]!==i||e[55]!==s||e[56]!==b?(ee=oe=>r.jsxs(Ut,{value:`${oe.title} ${oe.resolveType} ${oe.description??""}`,onSelect:()=>b(oe.resolveType),className:ie("gap-2.5",!i&&s===oe.resolveType&&"bg-accent/60"),children:[r.jsx(N9,{iconName:oe.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:oe.title}),oe.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:oe.description})]})]},oe.resolveType),e[54]=i,e[55]=s,e[56]=b,e[57]=ee):ee=e[57],H=o.map(ee),e[49]=i,e[50]=s,e[51]=b,e[52]=o,e[53]=H}else H=e[53];let K;e[58]!==U||e[59]!==H?(K=r.jsxs(fs,{children:[U,H]}),e[58]=U,e[59]=H,e[60]=K):K=e[60];let W;e[61]!==i||e[62]!==d||e[63]!==y||e[64]!==f?(W=d.length>0&&r.jsx(fs,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(ee=>r.jsxs(Ut,{value:`${ee.title} ${ee.blockKey} ${ee.description??""}`,onSelect:()=>y(ee.blockKey),className:ie("gap-2.5",i===ee.blockKey&&"bg-accent/60"),children:[r.jsx(N9,{iconName:ee.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:ee.title}),ee.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:ee.description})]})]},ee.blockKey))}),e[61]=i,e[62]=d,e[63]=y,e[64]=f,e[65]=W):W=e[65];let Y;e[66]!==V||e[67]!==K||e[68]!==W?(Y=r.jsxs(fi,{children:[V,K,W]}),e[66]=V,e[67]=K,e[68]=W,e[69]=Y):Y=e[69];let Q;e[70]!==h||e[71]!==u||e[72]!==N||e[73]!==C||e[74]!==Y||e[75]!==j?(Q=r.jsxs(AV,{open:h,onOpenChange:u,title:j,description:N,className:"sm:max-w-lg",filter:dZ,children:[C,Y]}),e[70]=h,e[71]=u,e[72]=N,e[73]=C,e[74]=Y,e[75]=j,e[76]=Q):Q=e[76];let te;return e[77]!==Q||e[78]!==w?(te=r.jsxs(r.Fragment,{children:[w,Q]}),e[77]=Q,e[78]=w,e[79]=te):te=e[79],te}const M4=new WeakMap;function mZ(t,e){let s=M4.get(e);s||(s=new Map,M4.set(e,s));let n=s.get(t);return n===void 0&&(n=ai(t,e),s.set(t,n)),n}function pZ(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function gZ(t,e){return{__resolveType:e,variants:[{rule:qa(),value:structuredClone(t)},{rule:qa(),value:structuredClone(t)}]}}function xZ(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>eg(n.rule));return s?s.value:e[e.length-1]?.value}function bZ(t){const e=[...t.variants],s=e[e.length-1],n={rule:qa(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function vZ(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function yZ(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function _Z(t,e,s){return e<t?t-1:Math.min(t,s-1)}function LZ(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 wZ(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function $4(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const O4=new WeakMap;function SZ(t){let e=O4.get(t);return e||(e=uZ(t),O4.set(t,e)),e}function fw(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=re(),{value:l,onChange:a,meta:c,path:d}=i,[h,u]=E.useState(0);if(!pZ(l)){let z;e[0]!==o?(z=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=z):z=e[1];let I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Hh,{size:14}),e[2]=I):I=e[2];let O;e[3]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=O):O=e[4];let B;return e[5]!==O?(B=r.jsx(He,{children:O}),e[5]=O,e[6]=B):B=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":z,onClick:()=>{a(gZ(l,s)),u(0)},children:I})}),B]}),n(i)]})}const f=l,m=f.variants,p=Math.min(h,m.length-1);let g;e[7]!==o?(g=(z,I)=>({index:I,label:fh(z.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(I+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},y=v.__resolveType??"",L=b?.value,_=c?SZ(c):[],k=y&&c?mZ(y,c):null,{__resolveType:S,...w}=v,j=()=>{a(xZ(f)),u(0)},N=()=>{const z=bZ(f);a(z),u(z.variants.length-1)},A=z=>{const I=vZ(f,z);I&&(a(I),u(_Z(p,z,I.variants.length)))},C=z=>{const I=yZ(f,z);a(I),u(z+1)},T=(z,I)=>{const O=LZ(f,z,I);a(O),p===z&&u(I)},V=z=>{const I=z?vG(z,c):{__resolveType:Q6};a($4(f,p,I))},R=z=>{const I=z,O=y?{...I,__resolveType:y}:{...I};a($4(f,p,O))},P=z=>{a(wZ(f,p,z))},M=`${d}-${f.__resolveType}`;let D;e[9]!==o?(D=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=D):D=e[10];let $;return e[11]!==D?($=r.jsx(Mt,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(sZ,{listKey:M,variants:x,selectedIndex:p,onSelect:u,onDuplicate:C,onDelete:A,onRemoveAll:j,onReorder:T,onAdd:N}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(fZ,{currentRt:y,currentLabel:fh(v),matchers:_,onSelect:V}),k&&r.jsx("div",{className:"pt-1",children:r.jsx($r,{schema:k,value:w,onChange:R,basePath:""})})]}),n({...i,value:L,onChange:P})]})]})}const kZ="website/loaders/secret.ts";function gd(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 jZ(){return{__resolveType:kZ,name:"",encrypted:""}}function CZ(t){const{value:e,...s}=t;return s}function V9(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!gd(n)){const N=typeof n=="string"?n:"",A=a?.virtualMcpId;let C;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==A?(C=r.jsx($s,{htmlFor:l,label:o,description:s.description,virtualMcpId:A}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=A,e[4]=C):C=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let V;e[7]!==i?(V=M=>i(M.target.value),e[7]=i,e[8]=V):V=e[8];let R;e[9]!==l||e[10]!==N||e[11]!==T||e[12]!==V?(R=r.jsx(pt,{id:l,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:V,className:"h-10"}),e[9]=l,e[10]=N,e[11]=T,e[12]=V,e[13]=R):R=e[13];let P;return e[14]!==C||e[15]!==R?(P=r.jsxs("div",{className:"space-y-2",children:[C,R]}),e[14]=C,e[15]=R,e[16]=P):P=e[16],P}let d;e[17]!==n?(d=gd(n)?n:jZ(),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,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx($s,{htmlFor:m,label:o,description:s.description,virtualMcpId:p}),e[19]=o,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==h||e[27]!==i?(v=N=>i({...h,name:N.target.value}),e[26]=h,e[27]=i,e[28]=v):v=e[28];let y;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==v?(y=r.jsx(pt,{id:x,value:u,placeholder:b,onChange:v,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=v,e[33]=y):y=e[33];const L=`${l}-value`;let _;e[34]!==f||e[35]!==c?(_=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=_):_=e[36];let k;e[37]!==h||e[38]!==f||e[39]!==i?(k=N=>{const A=N.target.value;if(!A){i(f?CZ(h):h);return}i({...h,value:A})},e[37]=h,e[38]=f,e[39]=i,e[40]=k):k=e[40];let S;e[41]!==_||e[42]!==k||e[43]!==L?(S=r.jsx(pt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:_,onChange:k,className:"h-10"}),e[41]=_,e[42]=k,e[43]=L,e[44]=S):S=e[44];let w;e[45]!==f||e[46]!==c?(w=f&&r.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=w):w=e[47];let j;return e[48]!==S||e[49]!==w||e[50]!==g||e[51]!==y?(j=r.jsxs("div",{className:"space-y-2",children:[g,y,S,w]}),e[48]=S,e[49]=w,e[50]=g,e[51]=y,e[52]=j):j=e[52],j}function NZ(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("__")):[],o=[],l=d=>{d?.type==="object"&&d.properties&&o.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(o.length===0)return;if(i.length===0)return o.length===1?o[0]:void 0;let a,c=-1;for(const d of o){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 VZ(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 TZ=new Set(["__resolveType","@type"]);function AZ(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 EZ(t){if(Vf(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 B4(t){if(t.type==="array"&&t.items)return t;const e=t.items??EZ(t);return e?{...t,type:"array",items:e}:null}function PZ(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 mw(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=ai(n,s);return i?r.jsx($r,{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 Ja(t){const{schema:e,value:s}=t;if(rh(s)){const l=KG(s),a=B4(e);if(l!==null&&a)return r.jsx(s0,{...t,schema:a,value:l,onChange:c=>t.onChange(WG(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&Vf(e)){const l=B4(e);if(l)return r.jsx(s0,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!rh(s)&&e.type==="block-ref"){const l=NZ(e,s)??VZ(s);if(l){const a={...e,type:"array",items:l};return r.jsx(s0,{...t,schema:a,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(AZ(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=h=>Ja({...h,schema:c});return r.jsx(fw,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(V4,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(FX,{...t},t.path);if(e.format==="image-uri")return r.jsx(VX,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(jX,{...t},t.path);if(e.format==="map")return r.jsx(qX,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(eX,{...t},t.path);if(e.format==="location")return r.jsx(cw,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(KQ,{...t},t.path);if(e.type==="anyOf")return r.jsx(V4,{...t},t.path);if(gd(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(V9,{...t},t.path);if(!e.format&&!e.enum){const l=mw(t);if(l)return l}const n=s??PZ(e.type,e.default);if(n==null)return gd(s)?r.jsx(V9,{...t},t.path):null;if(gd(n))return r.jsx(V9,{...t,value:n},t.path);const i={...t,value:n},o=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(o==="array"||Array.isArray(n))return r.jsx(s0,{...i},t.path);switch(o){case"boolean":return r.jsx(BQ,{...i},t.path);case"number":case"integer":return r.jsx(OQ,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(e0,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(e0,{...i},t.path):r.jsx(e0,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(IJ,{...i},t.path):null;default:return r.jsx(e0,{...i},t.path)}}function RZ(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ja({...t,schema:e});const s=mw(t);return s||Ja(e?{...t,schema:e}:t)}function $r({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const m=re(),p=t.properties;if(!p)return t.type==="inline-union"?Ja({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}):null;if(HG(e)&&p.variants){const C=p.variants.items?.properties?.value;return r.jsx(fw,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:T=>RZ(T,C)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(C=>!TZ.has(C)&&p[C]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const v=(C,T)=>{if(T===void 0){const{[C]:V,...R}=g;s(R);return}s({...g,[C]:T})},y=typeof g.__resolveType=="string"?g.__resolveType:void 0,L=x.filter(C=>{const T=p[C];return T!=null&&Ta(T,g[C])}).length>1,_=pJ(x,p,g),k=i.length>0?xJ(x,p,g,i,a,l):null,S=k?p[k]:null,w=k&&S?[k]:x,j=k&&S?mJ(k,S,i,Bd(k,x,p)):i,N=fJ(i,j),A=N.length>0&&o?C=>o([...N,...C]):o;return r.jsx("div",{className:"min-w-0 space-y-6",children:w.map(C=>{const T=p[C];if(!T)return null;const V=n?`${n}.${C}`:C,R=Bd(C,x,p),P=dl(C,T),$=(N.length===0&&x.some(z=>{const I=p[z];return z!==C&&I!=null&&dl(z,I)===P})||N.length===0&&_.has(C))&&A?z=>A(uJ(R,z)):A;return Ja({schema:T,value:g[C],onChange:z=>v(C,z),path:V,label:R,required:b.has(C),breadcrumbPath:j,onBreadcrumbChange:$,hasSiblingDrillDownFields:L,focused:k===C,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:y,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function DZ(t){const e=F.c(3),{isPending:s,isError:n}=t;if(n){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[r.jsx(pn,{size:13}),"Couldn't save"]}),e[0]=o):o=e[0],o}if(s){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(ut,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[r.jsx(Et,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const z4=3e4;function IZ(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 MZ(t,{resolveType:e,props:s}){let n;try{n=await fetch(F6(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(z4)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${z4/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let o=null,l=!1;try{o=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&o&&typeof o=="object"&&"error"in o&&typeof o.error=="string"?o.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?o:i}function $Z(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>MZ(t,n)},e[0]=t,e[1]=s):s=e[1],Xs(s)}function pw({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:m=!0}){const p=re(),g=zr(),x=g?.entity?.id===e?g.entity.metadata?.siteSlug??null:null,b=ai(a.resolveType,i),v=!b&&hI(a.resolveType,i),y=v?fI(c):null,L=b??y,[_,k]=E.useState(c),[S,w]=E.useState([]),[j,N]=E.useState(0),[A,C]=E.useState(!1),[T,V]=E.useState(null),[R,P]=E.useState(!1),[M,D]=E.useState(!1),[$,z]=E.useState(!1),I=T!==null,{save:O,flush:B,isPending:U}=Z_({orgSlug:t,virtualMcpId:e,branch:s}),H=$Z({orgSlug:t,virtualMcpId:e,branch:s});E.useEffect(()=>()=>{B()},[]);const K=xL(l),W=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:x},Q=Z=>{k(Z),a.mode==="saved"&&O(a.blockKey,{__resolveType:a.resolveType,...Z})},te=()=>{I?(V(null),C(!1),N(Z=>Z+1)):V(JSON.stringify(_,null,2))},ee=Z=>{const le=Z??"";try{const ne=JSON.parse(le);if(ne&&typeof ne=="object"&&!Array.isArray(ne)){C(!1),Q(ne);return}C(!0)}catch{C(!0)}},oe=async Z=>{const le=ug(Z,o);if(le){pe.error(le);return}await h(Z,{__resolveType:a.resolveType,..._}),P(!1)},se=()=>{D(!0),H.mutate({resolveType:a.resolveType,props:_})},G=()=>{n&&window.open(IZ(n,a.resolveType,_,Date.now()),"_blank","noopener")},X=[a.title,...S],q=Z=>{w(S.slice(0,Z)),N(le=>le+1)};return r.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":p("sandbox.runnableBlockEditor.backToList"),children:r.jsx(Mh,{size:14})}),r.jsx("nav",{"aria-label":p("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:X.map((Z,le)=>{const ne=le===X.length-1,ae=Pn(Z);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[le>0&&r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>q(le),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",ne?"font-medium text-foreground":"text-muted-foreground"),children:ae})]},`${ae}-${le}`)})}),a.mode==="saved"&&r.jsx(DZ,{isPending:U,isError:!1}),m&&r.jsxs(he,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:se,disabled:H.isPending,"aria-label":p("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[H.isPending?r.jsx(ut,{size:14,className:"animate-spin"}):r.jsx(tl,{size:14}),p("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>P(!0),"aria-label":p("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:r.jsx(np,{size:14})})}),r.jsx(He,{side:"bottom",children:p("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:I?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:te,"aria-label":p(I?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":I,children:I?r.jsx(_s,{size:14}):r.jsx(To,{size:14})})}),r.jsx(He,{side:"bottom",children:p(I?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?p("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):p("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:W,singular:K})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:ie("relative min-h-0 flex-1",M&&$&&"hidden"),children:[r.jsx(No,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[y&&L===y&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:p("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:K})}),L?r.jsx($r,{schema:L,value:_,onChange:Z=>Q(Z),basePath:"",breadcrumbPath:S,onBreadcrumbChange:w,meta:i,decofile:o,onSaveReferencedBlock:u,sandbox:Y},j):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v?p("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):p("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),T!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[A&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:p("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(iu,{language:"json",height:"100%",code:T,onChange:ee,onSave:Z=>{ee(Z),B()}})})]})]}),M&&r.jsx(OZ,{singular:K,result:{isPending:H.isPending,error:H.error,data:H.data,hasRun:H.status!=="idle"},expanded:$,onToggleExpand:()=>z(Z=>!Z),onOpenInNewTab:n?G:void 0,onClose:()=>{D(!1),z(!1)}})]}),r.jsx(hg,{open:R,onOpenChange:P,defaultBlockId:"",isPending:d,onSubmit:oe})]})}function OZ(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,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 m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(mn,{size:14})})}),r.jsx(He,{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?r.jsx(qC,{size:14}):r.jsx(Ev,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==o||e[19]!==x||e[20]!==b?(v=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:o,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=o,e[19]=x,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==i||e[23]!==c?(y=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=y):y=e[24];let L;e[25]!==y?(L=r.jsx(He,{side:"bottom",children:y}),e[25]=y,e[26]=L):L=e[26];let _;e[27]!==L||e[28]!==v?(_=r.jsxs(Ke,{children:[v,L]}),e[27]=L,e[28]=v,e[29]=_):_=e[29];let k;e[30]!==c?(k=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=k):k=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(_s,{size:14}),e[32]=S):S=e[32];let w;e[33]!==a||e[34]!==k?(w=r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":k,children:S}),e[33]=a,e[34]=k,e[35]=w):w=e[35];let j;e[36]!==_||e[37]!==w||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,_,w]}),e[36]=_,e[37]=w,e[38]=g,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==p?(N=r.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=N):N=e[42];let A;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(A=r.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?r.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ut,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?r.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[r.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?r.jsx(iu,{language:"json",height:"100%",code:h,readOnly:!0}):r.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]=A):A=e[49];let C;return e[50]!==N||e[51]!==A||e[52]!==f?(C=r.jsxs("div",{className:f,children:[N,A]}),e[50]=N,e[51]=A,e[52]=f,e[53]=C):C=e[53],C}function BZ(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,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=bu(h);let f;e[4]!==u?(f=rg((_,k)=>u.mutate({blockKey:_,data:k})),e[4]=u,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=_L(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let _;e[9]!==d?(_=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=_):_=e[10];let k;return e[11]!==_?(k=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:_}),e[11]=_,e[12]=k):k=e[12],k}const v=`loader:${c}`;let y;e[13]!==c||e[14]!==g||e[15]!==b?(y={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=y):y=e[16];let L;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==o||e[22]!==x||e[23]!==u.isPending||e[24]!==m||e[25]!==v||e[26]!==y||e[27]!==n?(L=r.jsx(pw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:"loaders",target:y,initialValue:x,isCreating:u.isPending,onCreate:zZ,onSaveReferencedBlock:m,showRun:!1},v),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=o,e[22]=x,e[23]=u.isPending,e[24]=m,e[25]=v,e[26]=y,e[27]=n,e[28]=L):L=e[28],L}async function zZ(){}const FZ="https://github.com/decocms/blocks";function UZ(){const t=F.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(GC,{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 o;t[5]!==e?(o=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=o):o=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(mn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(he,{size:"sm",asChild:!0,children:r.jsxs("a",{href:FZ,target:"_blank",rel:"noreferrer",children:[o,l]})}),t[8]=o,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=r.jsx(_o,{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 HZ(t){const e=F.c(15),{source:s,onRetry:n}=t,i=re();let o;e[0]!==s||e[1]!==i?(o=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(pn,{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=r.jsx(he,{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=r.jsx(_o,{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 ul(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const KZ=E.lazy(()=>In(()=>import("./sections-editor-DHi-y1Qr.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])).then(t=>({default:t.SectionsEditor})));function F4(t){const e=F.c(46),{virtualMcpId:s,externalSelection:n}=t,i=n===void 0?null:n,{org:o}=We(),{currentBranch:l}=en(),a=$n(),c=Ll(),d=SL(),h=a.lifecycle.phase==="running",u=c.previewUrl;let f;e[0]!==l||e[1]!==o||e[2]!==u||e[3]!==s?(f=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,previewUrl:u}:null,e[0]=l,e[1]=o,e[2]=u,e[3]=s,e[4]=f):f=e[4];const m=f;let p;e[5]!==h?(p={fetchEnabled:h},e[5]=h,e[6]=p):p=e[6];const g=rf(m,p);let x;e[7]!==h?(x={fetchEnabled:h},e[7]=h,e[8]=x):x=e[8];const b=of(m,x),v=G_({lifecyclePhase:a.lifecycle.phase,decofile:nh(g),meta:nh(b),hasEditableContent:cf(g.data,b.data),fastPreviewActive:yl(s).active});if(v.kind==="loading"){let P;return e[9]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(ul,{}),e[9]=P):P=e[9],P}if(v.kind==="empty"){let P;return e[10]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(UZ,{}),e[10]=P):P=e[10],P}if(v.kind==="error"){let P;e[11]!==g||e[12]!==c||e[13]!==b||e[14]!==v.source?(P=()=>{if(v.source==="sandbox"){c.retry();return}Promise.all([g.refetch(),b.refetch()])},e[11]=g,e[12]=c,e[13]=b,e[14]=v.source,e[15]=P):P=e[15];const M=P;let D;return e[16]!==M||e[17]!==v.source?(D=r.jsx(HZ,{source:v.source,onRetry:M}),e[16]=M,e[17]=v.source,e[18]=D):D=e[18],D}const y=d.state.target;if(y?.kind==="loader"&&g.data&&b.data){const P=l??"",M=u??null;let D;return e[19]!==g.data||e[20]!==b.data||e[21]!==o.slug||e[22]!==P||e[23]!==M||e[24]!==y.key||e[25]!==s?(D=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(BZ,{orgSlug:o.slug,virtualMcpId:s,branch:P,previewUrl:M,meta:b.data,decofile:g.data,blockKey:y.key})}),e[19]=g.data,e[20]=b.data,e[21]=o.slug,e[22]=P,e[23]=M,e[24]=y.key,e[25]=s,e[26]=D):D=e[26],D}let L;e[27]!==l||e[28]!==o.slug||e[29]!==y||e[30]!==s?(L=y||!l?null:sg(tg(o.slug,s,l)),e[27]=l,e[28]=o.slug,e[29]=y,e[30]=s,e[31]=L):L=e[31];const _=L;let k="/",S=null,w=null;y?.kind==="page"?(k=y.path,S=y.key):y?.kind==="section"?w=y.key:_&&(k=_.path,S=_.pageKey);const j=S?`page:${S}`:w?`section:${w}`:`path:${k}`;let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),e[32]=N):N=e[32];const A=l??"",C=u??void 0,T=w?null:i,V=!!S&&d.state.editSeoPageKey===S;let R;return e[33]!==w||e[34]!==S||e[35]!==k||e[36]!==j||e[37]!==o.slug||e[38]!==V||e[39]!==A||e[40]!==C||e[41]!==T||e[42]!==s||e[43]!==d.consumeEditSeo||e[44]!==d.setVariantOverride?(R=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(E.Suspense,{fallback:N,children:r.jsx(KZ,{orgSlug:o.slug,virtualMcpId:s,branch:A,previewReady:!0,previewUrl:C,currentPath:k,activePageBlockKey:S,activeGlobalBlockKey:w,externalSelection:T,initialEditSeo:V,onExitSeo:d.consumeEditSeo,onVariantPreviewOverride:d.setVariantOverride},j)})}),e[33]=w,e[34]=S,e[35]=k,e[36]=j,e[37]=o.slug,e[38]=V,e[39]=A,e[40]=C,e[41]=T,e[42]=s,e[43]=d.consumeEditSeo,e[44]=d.setVariantOverride,e[45]=R):R=e[45],R}function WZ(t,e){return t===e?"preview":e}function qZ(t){return t.cmsDefaultOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const GZ="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",YZ="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",QZ=500,JZ={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},U4=1,T9=["desktop","mobile","tablet"],H4={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function K4(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function XZ(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.href}catch{return t}}function i0(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function A9(t,e){try{return new URL(t,e).href}catch{return null}}function ZZ(t){const{onOpen:e}=t,[s,n]=E.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function eee(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function tee({virtualMcpId:t}){const e=re(),s=Fh(),n=So(),i=hG(),o=Ot(),{currentBranch:l}=en(),a=SL(),c=xe=>{o({to:".",search:Pe=>({...Pe,main:xe}),replace:!0})},[d,h]=E.useState("preview"),[u,f]=E.useState(!1),[m,p]=E.useState("desktop"),[g,x]=E.useState(null),[b,v]=E.useState(null),y=E.useRef(null),L=E.useRef(null),[_,k]=E.useState({width:0,height:0}),[S,w]=E.useState(null),[j,N]=E.useState(!1),[A,C]=E.useState(""),T=E.useRef(null),[V,R]=E.useState(!1),[P,M]=E.useState(),[D,$]=E.useState(null),[z,I]=E.useState(null),[O,B]=E.useState(null),[U,H]=E.useState("/"),[K,W]=E.useState(null),[Y,Q]=E.useState({}),[te,ee]=E.useState(!1),oe=E.useRef(null),se=()=>{ee(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>ee(!1),15e3)},G=()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),ee(!1)},{org:X}=We(),q=$n(),Z=Ll(),le=Z.vmEntry,ne=Z.previewUrl,ae=q.lifecycle.phase,de=ae==="running",fe=le?.sandboxProviderKind==="user-desktop",ue=LL({orgSlug:X.slug,virtualMcpId:t??"",branch:l??"",enabled:fe&&de&&!!t&&!!l}),ge=fe?ue:null,J=zr(),me=J?.entity?.id===t?Xm(J.entity.metadata):null,ye=ou(),Le=J?.entity?.id===t&&ji(J.entity.metadata,ye).active,ke=kG({sandboxUrl:ne,previewServerUrl:me,fastPreviewActive:Le}),we=t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l,previewUrl:ne}:null,Ne=rf(we,{fetchEnabled:de}),Ae=of(we,{fetchEnabled:de}),be=Ne.data,Se=Ae.data,_e=`${t}:${l??""}`,[Ee,De]=E.useState(null),Ve=G_({lifecyclePhase:ae,decofile:nh(Ne),meta:nh(Ae),hasEditableContent:cf(be,Se),fastPreviewActive:Le,frameworkKnownMissing:Ee===_e});Ve.kind==="empty"&&Ve.reason==="framework-missing"&&Ee!==_e&&De(_e);const Ge=Ve.kind==="content",$e=t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l}:null,Fe=VG($e),Je=be?z0(be).sort((xe,Pe)=>xe.name.localeCompare(Pe.name)):[],at=be&&Se?d2(be,Se):[],Be=be&&Se?yL(Se,be,"loaders"):[],lt=go,rt=Je.filter(xe=>{if(!A)return!0;const Pe=A.toLowerCase();return xe.name.toLowerCase().includes(Pe)||xe.path.toLowerCase().includes(Pe)}),ct=at.filter(xe=>{if(!A)return!0;const Pe=A.toLowerCase();return xe.name.toLowerCase().includes(Pe)||xe.key.toLowerCase().includes(Pe)||xe.resolveType.toLowerCase().includes(Pe)}),dt=Be.filter(xe=>{if(!A)return!0;const Pe=A.toLowerCase();return xe.title.toLowerCase().includes(Pe)||xe.key.toLowerCase().includes(Pe)||xe.resolveType.toLowerCase().includes(Pe)}),bt=z?Be.find(xe=>xe.key===z)??null:null,tt=D||z?null:v1(Je,U,K),ft=D?D.name:bt?.title??tt?.name,ze=tt?.key??null,ve=tt?.path??null,Oe=(ze?Y[ze]:void 0)??{},nt=_r(U,Oe),Ye={};if(de&&ne&&Se&&be){const xe=tQ(Se,"loaders"),Pe=ze?be[ze]:void 0,vt=kY(Pe,be,gs=>xe.has(gs)),Ct=yY(vt);for(const gs of O0(U)){if(gs.type!=="param")continue;const un=xY(U,gs.name,vt),Hs=wY(un,xe,Ct);Hs.length>0&&(Ye[gs.name]=Hs)}}const _t=t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l}:null,ce=be&&ze?oL(be,ze,0):[],je=be?tL(ce,be):[],Re=je.map(xe=>xe.isSavedBlock?xe.label:""),Ie=je.map(xe=>xe.isSavedBlock?"global":xe.isMultivariate?"variant":"normal"),Xe=ce.map(xe=>F1(xe,be??{})),ot=E.useRef(null),yt=E.useRef(null),Tt=q.status.state==="paused",Ze=q.phase,is=dL({claimPhase:Ze,lifecycle:q.lifecycle}),Ht=Z.previewState,ps=Z.userStopped,Vs=(J?.entity?.id===t?J.entity.metadata?.ui?.layout?.cmsDefaultOpen:null)??!1,sn=Qh({mutationKey:cu(X.slug,t??"",l??"")})>0,{url:rs}=J_(Le&&t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l,previewServerUrl:me??null,path:nt}:null),xn=ye?.runtime==="sandbox",gt=eG({previewState:Ht,progressStatus:is.status,previewServerUrl:xn?null:me,fastPreviewActive:Le,fastPreviewReady:!!rs}),Rs=gt.mode!=="none",an=gt.mode==="production"&&gt.iframeBase?i0(gt.iframeBase):null,bn=!s,On=gt.mode==="production"?an:i0(ne),Xt=XZ(gt.mode==="sandbox"?w9(K4(O??A9(nt,gt.iframeBase)??gt.iframeBase,m),a.state.variantOverride??[]):gt.mode==="production"&&bn?w9(K4(Q_(O??rs??A9(nt,gt.iframeBase)??gt.iframeBase,gt.showWakingPill?SG:null),m),a.state.variantOverride??[]):null);E.useEffect(()=>{},[s,an,S]);const cn="sandbox.preview.openInNewTab",Xn=rs??(gt.iframeBase?A9(nt,gt.iframeBase):null),vn=gt.mode==="production"?Xn?w9(Xn,a.state.variantOverride??[]):null:Xt??gt.iframeBase,yn=async()=>{const xe=vn;if(xe){window.open(xe,"_blank","noopener");return}},_n=t&&l?tg(X.slug,t,l):null,Us=xe=>{_n&&mY(_n,xe)},Bt=a.state.target;E.useEffect(()=>{if(!(!Bt||!ke||!Se))if(Bt.kind==="page"){const xe=Y[Bt.key]??{};yt.current=_r(Bt.path,xe),$(null),I(null),B(null),W(Bt.key),H(Bt.path),Us({path:Bt.path,pageKey:Bt.key,params:xe})}else if(Bt.kind==="loader")yt.current=null,$(null),I(Bt.key),B(null);else{const xe=at.find(Pe=>Pe.key===Bt.key);if(xe){yt.current=null;const Pe=x1(Se);I(null),$(xe),B(d4(ke,Pe,xe.key))}}},[Bt,ke,Se,Y]),E.useEffect(()=>{!ze||ve===null||Bt?.kind==="page"&&Bt.key===ze&&Bt.path===ve||a.selectTarget({kind:"page",key:ze,path:ve})},[ze,ve,Bt]);const[Te,ht]=E.useState(null);if(Ht.kind==="iframe"&&Te!==Ht.previewUrl){const xe=Te!==null;ht(Ht.previewUrl);const Pe=_n?sg(_n):null;if(Pe){if(yt.current=_r(Pe.path,Pe.params),H(Pe.path),W(Pe.pageKey),B(null),$(null),I(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const vt=Pe.pageKey;Q(Ct=>({...Ct,[vt]:Pe.params}))}}else xe&&(yt.current=null,H("/"),B(null),W(null),$(null),I(null))}ot.current=Xt;const jt=iG({iframeRef:y,src:gt.mode==="sandbox"?Xt:null,active:gt.mode==="sandbox"}),cs=E.useRef(null);E.useEffect(()=>{if(!rs||!Xt||cs.current===rs)return;cs.current=rs;const xe=y.current;xe&&xe.getAttribute("src")!==Xt&&(se(),xe.src=Xt)},[rs,Xt]);const dn=!!t&&!!l&&!q.notFound&&!ps&&!Tt&&(Ze?.kind==="ready"||ae!=="idle"),Ss=gt.mode!=="sandbox"&&d==="visual"?"preview":d;E.useEffect(()=>{const xe=On;if(!xe)return;const Pe=vt=>{if(vt.origin===xe){if(vt.data?.type==="visual-editor::element-clicked"){const Ct=EG.safeParse(vt.data.payload);Ct.success&&x(Ct.data)}else if(vt.data?.type==="cms-editor::section-clicked"){const Ct=DG.safeParse(vt.data.payload);Ct.success&&v({index:Ct.data.sectionIndex,seq:Ct.data.clickSeq})}}};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[On]),E.useEffect(()=>{if(!j)return;const xe=Pe=>{T.current?.contains(Pe.target)||(N(!1),C(""))};return document.addEventListener("pointerdown",xe),()=>document.removeEventListener("pointerdown",xe)},[j]);const cr=()=>{const xe=y.current?.contentWindow,Pe=i0(ne);!xe||!Pe||xe.postMessage({type:"visual-editor::activate",script:PG},Pe)},Ff=()=>{const xe=y.current?.contentWindow,Pe=i0(ne);!xe||!Pe||xe.postMessage({type:"visual-editor::deactivate"},Pe)},Ii=()=>{const xe=y.current?.contentWindow,Pe=On;!xe||!Pe||(xe.postMessage(gt.mode==="production"?{type:"editor::inject",args:{script:f4}}:{type:"visual-editor::activate",script:f4},Pe),xe.postMessage({type:"cms-editor::set-labels",labels:Re,kinds:Ie,keys:Xe},Pe))},Fr=()=>{const xe=y.current?.contentWindow,Pe=On;!xe||!Pe||xe.postMessage({type:"cms-editor::deactivate"},Pe)},Zn=xe=>{const Pe=d;!n&&xe!==Pe&&(xe==="blocks"?L.current?.resize("30%"):L.current?.collapse()),h(xe),x(null),v(null),xe!=="blocks"&&I(null),Pe==="visual"&&Ff(),xe==="visual"&&cr(),Pe==="blocks"&&xe!=="blocks"&&Fr(),xe==="blocks"&&Ii()},dr=xe=>{f(!0),Zn(WZ(d,xe))},kc=qZ({cmsDefaultOpen:Vs,blocksReady:Ge,autoOpenResolved:u,editingMode:d}),Ur=()=>{f(!0),Zn("blocks")},Hr=()=>{if(!y.current||!Xt)return;se();const xe=y.current;xe.src=Xt},Kr=()=>{const xe=y.current;if(!xe)return;se();const Pe=document.activeElement,vt=xe.tabIndex;xe.tabIndex=-1,xe.style.pointerEvents="none",xe.blur(),eee(xe,ot.current);let Ct;const gs=()=>{clearTimeout(Ct),xe.tabIndex=vt,xe.style.pointerEvents="";const un=document.activeElement;(!un||un===document.body||un===xe)&&Pe?.focus(),xe.removeEventListener("load",gs)};xe.addEventListener("load",gs),Ct=setTimeout(gs,3e3)};$I(()=>{rs||Kr()}),OI(()=>{se()});const Wr=()=>{const xe=T9.indexOf(m);p(T9[(xe+1)%T9.length])},qr=async()=>{let xe=null;try{xe=y.current?.contentWindow?.location?.href??null}catch{}const Pe=xe??Xt??ne;if(Pe)try{await navigator.clipboard.writeText(Pe),pe.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{pe.error(e("sandbox.preview.failedToCopyUrl"))}},Gr=rG({iframeBase:gt.iframeBase,resolvedPath:nt,activeGlobalSectionName:D?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Po=xe=>{const Pe=Y[xe.key]??{},vt=_r(xe.path,Pe);(D||lt(vt)!==lt(nt))&&se(),yt.current=vt,$(null),I(null),B(null),v(null),W(xe.key),H(xe.path),Us({path:xe.path,pageKey:xe.key,params:Pe}),a.selectTarget({kind:"page",key:xe.key,path:xe.path})},Ro=(xe,Pe)=>{if(!ze)return;const vt=ze,Ct={...Oe,[xe]:Pe};yt.current=_r(U,Ct),Q(gs=>({...gs,[vt]:Ct})),Us({path:U,pageKey:vt,params:Ct})},Yr=xe=>{if(!ke||!Se){pe.error(e("sandbox.preview.previewMetadataNotReady"));return}se(),yt.current=null;const Pe=x1(Se),vt=d4(ke,Pe,xe.key);$(xe),I(null),B(vt),v(null),a.selectTarget({kind:"section",key:xe.key})},Qr=xe=>{$(null),I(xe.key),B(null),Zn("blocks"),a.selectTarget({kind:"loader",key:xe.key})},Jr=async({name:xe,path:Pe,templateKey:vt})=>{if(!t||!l)return;const Ct=l2(Pe);if(Ct){M(Ct);return}const gs=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(Je.some(Hs=>lt(Hs.path)===lt(gs))){M(e("sandbox.preview.pageAlreadyExists",{path:gs}));return}let un;if(vt&&(un=be?.[vt],!un)){M(e("sandbox.preview.templateNoLongerExists"));return}M(void 0);try{const Hs=await Fe.mutateAsync({name:xe,path:gs,template:un});R(!1),pe.success(e("sandbox.preview.pageCreated",{name:xe})),await ac(QZ),Po({key:Hs.key,name:Hs.name,path:Hs.path}),Zn("blocks")}catch(Hs){M(Hs instanceof Error?Hs.message:e("sandbox.preview.failedToCreatePage"))}},Bn=Rs&&(dn||gt.mode==="production"),ur=d==="blocks",hr=IG({showPreviewToolbar:Bn,blocksState:Ve}),Do=hr?r.jsx(X2,{title:e("sandbox.preview.cms"),tooltip:e(ur?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:YC},active:ur,onClick:()=>dr("blocks"),testId:"preview-blocks-toggle",dataTour:xo.edit}):null,fr=Bn?r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{onClick:Hr,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(Rn,{size:16})})}),r.jsx(He,{side:"bottom",children:e("sandbox.preview.refresh")})]}),hr&&r.jsxs("div",{ref:T,className:"relative min-w-0 w-64 shrink",children:[r.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:[r.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>N(xe=>!xe),children:[D&&r.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:[r.jsx(Er,{size:11}),"Global"]}),bt&&r.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:[r.jsx(Da,{size:11}),e("sandbox.preview.loaderBadge")]}),r.jsx("span",{className:ie("text-[13px] font-medium text-foreground",ft==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ft??Gr}),!D&&!z&&ft!=null&&U&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:O0(U).map((xe,Pe)=>{if(xe.type==="text")return r.jsx("span",{className:ie(Pe===0?"min-w-0 truncate":"shrink-0"),children:xe.text},`text-${Pe}`);const vt=Ye[xe.name];return vt&&_t?r.jsx(BY,{sources:vt,template:U,paramName:xe.name,value:Oe[xe.name]??"",sandboxRef:_t,onCommit:Ct=>Ro(xe.name,Ct)},`${ze}:${xe.name}`):r.jsx(JY,{name:xe.name,value:Oe[xe.name]??"",onCommit:Ct=>Ro(xe.name,Ct)},`${ze}:${xe.name}`)})})]}),r.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>N(xe=>!xe),"aria-label":e("sandbox.preview.choosePage"),children:r.jsx(Jt,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",j&&"rotate-180")})})]}),j&&r.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:[r.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[r.jsx(Gh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:A,onChange:xe=>C(xe.target.value),onKeyDown:xe=>{if(xe.key!=="Enter")return;const Pe=A.trim();if(!Pe)return;const vt=rt.find(Ct=>lt(Ct.path)===lt(Pe));vt&&(xe.preventDefault(),N(!1),C(""),Po(vt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),r.jsx("div",{className:"p-1.5 border-b",children:r.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:xe=>{xe.preventDefault(),N(!1),C(""),M(void 0),R(!0)},children:[r.jsx(Dt,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),rt.length===0&&ct.length===0&&dt.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Je.length===0&&at.length===0&&Be.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[rt.length>0&&r.jsx("div",{className:"p-1.5",children:rt.map(xe=>r.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(),N(!1),C(""),Po(xe)},children:[r.jsx(Cr,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.path})]},xe.key))}),ct.length>0&&r.jsxs("div",{className:ie("p-1.5",rt.length>0&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ct.map(xe=>r.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(),N(!1),C(""),Yr(xe)},children:[r.jsx(Er,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]}),dt.length>0&&r.jsxs("div",{className:ie("p-1.5",(rt.length>0||ct.length>0)&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),dt.map(xe=>r.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(),N(!1),C(""),Qr(xe)},children:[r.jsx(Da,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.title}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]})]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{"aria-label":e(cn),onClick:()=>{yn()},children:r.jsx(mn,{size:16})})}),r.jsx(He,{side:"bottom",children:e(cn)})]})]}):null,Xr=Bn?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Do,Do&&r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),fr]}):null,Mi=Bn?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(Yn,{size:14})})}),r.jsxs(Yt,{align:"end",className:"w-44",children:[r.jsxs(et,{onClick:qr,children:[r.jsx(on,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),be&&Se&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),ze&&r.jsxs(et,{onClick:()=>{a.editSeo({kind:"page",key:ze,path:U}),Zn("blocks")},children:[r.jsx(lp,{size:14}),e("sandbox.preview.editSeo")]}),ze&&r.jsxs(et,{onClick:()=>{try{c(mC(HD(ze)))}catch{pe.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx(To,{size:14}),e("sandbox.preview.viewJson")]})]}),ge&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),r.jsxs(et,{onClick:()=>window.open(oh("vscode",ge)),children:[r.jsx("img",{src:GZ,alt:"VSCode",width:14,height:14}),e("sandbox.preview.openInVscode")]}),r.jsxs(et,{onClick:()=>window.open(oh("cursor",ge)),children:[r.jsx("img",{src:YZ,alt:"Cursor",width:14,height:14}),e("sandbox.preview.openInCursor")]})]}),r.jsx(er,{}),r.jsxs(et,{onClick:()=>Jq(e),children:[r.jsx(QC,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Zr=gt.mode==="sandbox",mi=JZ[m],pi=m==="desktop"&&(_.width===0||_.width>=mi.width+2*U4),mr=pi?1:Math.min(_.width>0?_.width/(mi.width+2*U4):1,1),eo=pi?{width:"100%",height:"100%"}:{width:`${mi.width}px`,height:_.height>0?`${_.height/mr}px`:`${mi.height}px`,transform:`scale(${mr})`,transformOrigin:"top center"},Tl=Rs?r.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:r.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[Zr&&r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{onClick:()=>dr("visual"),"aria-pressed":d==="visual","aria-label":e("sandbox.preview.visualEditor"),active:d==="visual",className:"rounded-full","data-tour":xo.visualEditor,children:r.jsx(Yg,{size:16})})}),r.jsx(He,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{onClick:Wr,"aria-label":e(H4[m]),className:"rounded-full","data-tour":xo.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[m==="mobile"&&r.jsx(JC,{size:16}),m==="tablet"&&r.jsx(XC,{size:16}),m==="desktop"&&r.jsx(ZC,{size:16})]},m)})}),r.jsx(He,{side:"top",children:e(H4[m])})]})]})}):null,to=(n||!!z)&&Ss==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[kc&&r.jsx(ZZ,{onOpen:Ur}),_t&&Object.entries(Ye).map(([xe,Pe])=>(Oe[xe]??"")===""?r.jsx(YY,{sources:Pe,template:U,paramName:xe,sandboxRef:_t,onFill:vt=>Ro(xe,vt)},`${ze}:${xe}`):null),i?r.jsxs(r.Fragment,{children:[Bn&&r.jsx(dG,{children:Xr}),r.jsx(uG,{children:Mi})]}):(Bn||Mi)&&r.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:[r.jsx("div",{className:"flex flex-1 items-center justify-start",children:Do}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:fr}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:Mi})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:to?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(F4,{virtualMcpId:t,externalSelection:b}),n&&Tl]}):r.jsxs(N6,{orientation:"horizontal",disabled:Ss!=="blocks",children:[r.jsx($0,{ref:L,id:"preview-blocks-editor",defaultSize:Ss==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Ss==="blocks"&&r.jsx(F4,{virtualMcpId:t,externalSelection:b})}),Ss==="blocks"&&r.jsx(V6,{withHandle:!0}),r.jsx($0,{id:"preview-canvas",defaultSize:Ss==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:xe=>{if(!xe)return;const Pe=()=>k(Ct=>Ct.width===xe.clientWidth&&Ct.height===xe.clientHeight?Ct:{width:xe.clientWidth,height:xe.clientHeight});Pe();const vt=new ResizeObserver(Pe);return vt.observe(xe),()=>vt.disconnect()},className:ie("h-full relative overflow-hidden flex justify-center",Rs&&!pi&&"bg-muted/30"),children:[(te||sn)&&Rs&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),gt.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Va,{kind:"starting",progress:is,claimPhase:Ze})}),Ht.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Va,{kind:"suspended",onResume:Z.resume})}),Ht.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Va,{kind:"errored",error:Ht.error,onRetry:Z.retry,connectionsHref:`/${X.slug}/settings/connections`})}),gt.showWakingPill&&r.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[r.jsx(ut,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Ss==="visual"&&!g&&r.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-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:[r.jsx(Yg,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Ss==="visual"&&g&&r.jsx(XG,{element:g,onDismiss:()=>x(null)}),Tl,Rs&&Xt&&r.jsx("div",{className:ie("shrink-0",!pi&&"border-x border-border bg-background shadow-sm"),style:eo,children:r.jsx("iframe",{ref:y,src:Xt,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:jt.handleError,onLoad:()=>{if(jt.handleLoad(),G(),gt.mode!=="sandbox"){gt.mode==="production"&&!gt.showWakingPill&&d==="blocks"&&Ii();return}if(st("vm_preview_loaded",{view_mode:d,vm_id:le?.sandboxHandle??null}),!D)try{const xe=y.current?.contentWindow?.location?.pathname;if(!xe)return;const Pe=yt.current;if(Pe!==null&&(yt.current=null,lt(xe)!==lt(Pe))||lt(xe)===lt(nt))return;H(xe),Us({path:xe,pageKey:K,params:Oe})}catch{}d==="visual"&&cr(),d==="blocks"&&Ii()}},gt.iframeBase)})]})})]})}),r.jsx(AG,{open:V,onOpenChange:R,isPending:Fe.isPending,error:P,templates:Je,onSubmit:Jr})]})}function see(t){const e=F.c(22),{virtualMcpId:s}=t,n=re(),i=Fs(s),{activeTask:o,taskId:l,currentBranch:a}=en(),c=y8(l),[d,h]=E.useState(!1);if(_8({threadId:l,sandboxBranch:o?.branch??a,agentHasRepo:Qs(i?.metadata),threadHasRepo:Qs(c)||Qs(o?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(kn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=r.jsx(kn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsxs(he,{onClick:x,children:[b,v]}),e[9]=v,e[10]=y):y=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==y?(L=r.jsx(_o,{className:"h-full",image:m,title:p,description:g,actions:y}),e[11]=p,e[12]=g,e[13]=y,e[14]=L):L=e[14];let _;e[15]!==d?(_=r.jsx(Ap,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=_):_=e[16];let k;return e[17]!==L||e[18]!==_?(k=r.jsxs(r.Fragment,{children:[L,_]}),e[17]=L,e[18]=_,e[19]=k):k=e[19],k}let f;return e[20]!==s?(f=r.jsx(tee,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const nee="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",iee="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",ree=E.lazy(()=>In(()=>import("./file-explorer-D_PGAi5e.js"),__vite__mapDeps([150,1,2,83,84,77,4,5,6,7,8,9,10,11,12,13,14,15,3,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,78,79,80,81,82,85,86,87,88,89,90,91,92,93,94,95,96,97,110,102,103,104,105,106,107,108,109,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,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.FileExplorer})));function oee(t){const e=F.c(21),{openPath:s}=t,n=re(),i=zr(),{org:o}=We(),{currentBranch:l}=en(),a=i?.entity?.id??null,c=Ll(),d=$n(),h=c.vmEntry,u=d.lifecycle.phase==="running",f=h?.sandboxProviderKind==="user-desktop",m=a??"",p=l??"",g=f&&u&&!!a&&!!l;let x;e[0]!==o.slug||e[1]!==m||e[2]!==p||e[3]!==g?(x={orgSlug:o.slug,virtualMcpId:m,branch:p,enabled:g},e[0]=o.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x):x=e[4];const b=LL(x),v=f?b:null;if(!a||!l){let S;e[5]!==n?(S=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[5]=n,e[6]=S):S=e[6];let w;return e[7]!==S?(w=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:S}),e[7]=S,e[8]=w):w=e[8],w}let y;e[9]!==v||e[10]!==n?(y=v&&r.jsx("div",{className:"relative flex h-12 shrink-0 items-center border-b border-border/60 px-3 md:px-4",children:r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInVscode"),onClick:()=>window.open(oh("vscode",v)),children:r.jsx("img",{src:nee,alt:"VSCode",width:14,height:14})})}),r.jsx(He,{side:"bottom",children:n("mainPanelTabs.codeTab.openInVscode")})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInCursor"),onClick:()=>window.open(oh("cursor",v)),children:r.jsx("img",{src:iee,alt:"Cursor",width:14,height:14})})}),r.jsx(He,{side:"bottom",children:n("mainPanelTabs.codeTab.openInCursor")})]})]})}),e[9]=v,e[10]=n,e[11]=y):y=e[11];let L;e[12]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),e[12]=L):L=e[12];let _;e[13]!==l||e[14]!==s||e[15]!==o.slug||e[16]!==a?(_=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(E.Suspense,{fallback:L,children:r.jsx(ree,{orgSlug:o.slug,virtualMcpId:a,branch:l,openPath:s})})}),e[13]=l,e[14]=s,e[15]=o.slug,e[16]=a,e[17]=_):_=e[17];let k;return e[18]!==y||e[19]!==_?(k=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[y,_]}),e[18]=y,e[19]=_,e[20]=k):k=e[20],k}function lee(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 aee(t,e,s){return typeof t!="string"?null:lee(ai(t,e),s)}function gw(t,e,s){if(!e||typeof t!="string")return!1;const n=aee(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function cee({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ls(),i=nf(e),o=yl(e).active;return Xs({mutationKey:cu(t,e,s),mutationFn:async({blockKey:l})=>{if(o){const d=await O6({orgSlug:t,virtualMcpId:e,branch:s},{delete:[l]});return e2(n,{orgSlug:t,virtualMcpId:e,branch:s},d),await n.invalidateQueries({queryKey:xu(t,e,s)}),{ok:!0,existed:!0}}const a=tf(i,t2(l)),c=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a})});return c.ok?c.json():Zp(c,"Delete")},onMutate:async({blockKey:l})=>{const a=`${t}/${e}/${s}`,c=it.decofile(a);await n.cancelQueries({queryKey:c});const d=n.getQueryData(c),h=!!d&&l in d,u=d?.[l];return n.setQueryData(c,f=>{if(!f)return f;const{[l]:m,...p}=f;return p}),{queryKey:c,blockKey:l,hadKey:h,previousValue:u}},onError:(l,a,c)=>{c&&n.setQueryData(c.queryKey,d=>c.hadKey?{...d??{},[c.blockKey]:c.previousValue}:d)},onSuccess:()=>{n.invalidateQueries({queryKey:it.liveMeta(t,e,s)})}})}function da(t){const e=F.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let o;e[0]!==i||e[1]!==n||e[2]!==s?(o=s?"No results match your search.":r.jsxs(r.Fragment,{children:[r.jsx("div",{children:n}),r.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==o?(l=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=l):l=e[5],l}function If(t,e){return`${t}-${e}`}function xw(t,e){return`site/apps/${t}/${e}.ts`}function bw(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 dee(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function uee(t){return t==="local"?"Custom":"Installed"}function vw(t,e,s){const n=new Set([If(t,e),e].map(o=>o.toLowerCase())),i=xw(t,e);for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(o.toLowerCase())||a.__resolveType===i)return o}return null}function hee(t,e){const s=t.vendor.alias,n=t.name,i=vw(s,n,e);return{id:If(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:xw(s,n),blockKey:i,installed:i!==null}}function fee(t,e,s){if(t===c2)return null;const n=bw(t);if(!n)return null;const{vendor:i,app:o}=n,l=vw(i,o,s),a=Ao(t,e);return{id:If(i,o),app:o,vendor:i,title:a.title??o,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function mee(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Ga(t,e)||!e8(n))return null;const i=bw(n)??dee(t);if(!i)return null;const o=Ao(n,s),{vendor:l,app:a}=i;return{id:If(l,a),app:a,vendor:l,title:o.title??F0(t,e,s),description:o.description??"",category:uee(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function pee(t,e,s){const n=new Map;for(const o of t){const l=hee(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=fee(o,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=mee(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(gee)}function gee(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function xee(){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 bee(t,e,s){const n=F.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=it.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:xee,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Vt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?pee(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 vee(t){const e=F.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=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=r.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:r.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]!==o||e[8]!==d||e[9]!==h?(u=r.jsx(ei,{id:"pages",icon:Cr,label:d,count:n.pages,active:h,onSelect:o}),e[6]=n.pages,e[7]=o,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 m=s==="sections";let p;e[13]!==n.sections||e[14]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(ei,{id:"sections",icon:Er,label:f,count:n.sections,active:m,onSelect:o}),e[13]=n.sections,e[14]=o,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==o||e[22]!==x||e[23]!==g?(b=r.jsx(ei,{id:"apps",icon:by,label:g,count:n.apps,active:x,onSelect:o}),e[20]=n.apps,e[21]=o,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const y=s==="redirects";let L;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==y?(L=r.jsx(ei,{id:"redirects",icon:$v,label:v,count:n.redirects,active:y,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=y,e[31]=L):L=e[31];let _;e[32]!==l?(_=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=_):_=e[33];const k=s==="loaders";let S;e[34]!==n.loaders||e[35]!==o||e[36]!==_||e[37]!==k?(S=r.jsx(ei,{id:"loaders",icon:Da,label:_,count:n.loaders,active:k,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=_,e[37]=k,e[38]=S):S=e[38];let w;e[39]!==l?(w=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=w):w=e[40];const j=s==="actions";let N;e[41]!==n.actions||e[42]!==o||e[43]!==w||e[44]!==j?(N=r.jsx(ei,{id:"actions",icon:Ir,label:w,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=w,e[44]=j,e[45]=N):N=e[45];let A;e[46]!==l?(A=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=A):A=e[47];const C=s==="site";let T;e[48]!==o||e[49]!==A||e[50]!==C?(T=r.jsx(ei,{id:"site",icon:tp,label:A,active:C,onSelect:o}),e[48]=o,e[49]=A,e[50]=C,e[51]=T):T=e[51];let V;e[52]!==l?(V=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=V):V=e[53];const R=s==="seo";let P;e[54]!==o||e[55]!==V||e[56]!==R?(P=r.jsx(ei,{id:"seo",icon:lp,label:V,active:R,onSelect:o}),e[54]=o,e[55]=V,e[56]=R,e[57]=P):P=e[57];let M;e[58]!==l?(M=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=M):M=e[59];const D=s==="calendar";let $;e[60]!==o||e[61]!==M||e[62]!==D?($=r.jsx(ei,{id:"calendar",icon:jr,label:M,active:D,onSelect:o}),e[60]=o,e[61]=M,e[62]=D,e[63]=$):$=e[63];let z;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(z=i&&r.jsxs(r.Fragment,{children:[r.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:[r.jsx(Ra,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(ei,{id:"posts",icon:Li,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(ei,{id:"authors",icon:Ep,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(ei,{id:"categories",icon:Rh,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=o,e[69]=i,e[70]=l,e[71]=z):z=e[71];let I;e[72]!==b||e[73]!==L||e[74]!==S||e[75]!==N||e[76]!==T||e[77]!==P||e[78]!==$||e[79]!==z||e[80]!==u||e[81]!==p?(I=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,p,b,L,S,N,T,P,$,z]}),e[72]=b,e[73]=L,e[74]=S,e[75]=N,e[76]=T,e[77]=P,e[78]=$,e[79]=z,e[80]=u,e[81]=p,e[82]=I):I=e[82];let O;return e[83]!==c||e[84]!==I?(O=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,I]}),e[83]=c,e[84]=I,e[85]=O):O=e[85],O}function ei(t){const e=F.c(18),{id:s,icon:n,label:i,count:o,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=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==i?(f=r.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==o?(m=o!==void 0&&r.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=l,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==h||e[14]!==u||e[15]!==f||e[16]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:h,children:[u,f,m]}),e[12]=c,e[13]=h,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function yee(t){const e=F.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:o,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=dL({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=r.jsx(Va,{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]!==o?(a=r.jsx(Va,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==o||e[10]!==s.error?(a=r.jsx(Va,{kind:"errored",error:s.error,onRetry:o,connectionsHref:l}),e[8]=l,e[9]=o,e[10]=s.error,e[11]=a):a=e[11],a}}}const _ee=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Lee(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&&!_ee.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function W4(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 o=`${s} (copy ${i})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function wee(t,e){const s=go,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let o=2;o<1e3;o++){const l=`${n}-copy-${o}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function See(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 o=`${s}_copy_${i}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function kee(t){const e=Z2(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function jee(t,e){return X_(t,e)}const Cee=1e3;function Nee(t,e){for(let s=0;s<Cee;s++){const n=Z2(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Vee={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Tee={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Aee={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Eee(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=l===void 0?!1:l,m=re(),[p,g]=E.useState(i),[x,b]=E.useState(o),[v,y]=E.useState(bo),[L,_]=E.useState(null),[k,S]=E.useState(s);s!==k&&(S(s),s&&(g(i),b(o),y(bo),_(null)));const w=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=de=>{!de&&!f&&(_(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const N=j;let A;e[3]!==f||e[4]!==p||e[5]!==h||e[6]!==x||e[7]!==w||e[8]!==v||e[9]!==d?(A=async de=>{de.preventDefault();const fe=p.trim(),ue=x.trim();if(!fe||!ue||f)return;const ge=l2(ue);if(ge){_(ge);return}const J=d?.({name:fe,path:ue});if(J){_(J);return}_(null),await h({name:fe,path:ue,templateKey:w&&v!==bo?v:null})},e[3]=f,e[4]=p,e[5]=h,e[6]=x,e[7]=w,e[8]=v,e[9]=d,e[10]=A):A=e[10];const C=A,T=L??a,V=Vee[n];let R;e[11]!==m||e[12]!==V?(R=m(V),e[11]=m,e[12]=V,e[13]=R):R=e[13];let P;e[14]!==R?(P=r.jsx(ms,{children:r.jsx($t,{children:R})}),e[14]=R,e[15]=P):P=e[15];let M;e[16]!==f||e[17]!==w||e[18]!==m||e[19]!==v||e[20]!==c?(M=w&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),r.jsx(eL,{id:"page-form-template",value:v,onChange:y,templates:c??[],disabled:f})]}),e[16]=f,e[17]=w,e[18]=m,e[19]=v,e[20]=c,e[21]=M):M=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=D):D=e[23];let $;e[24]!==D?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=$):$=e[25];let z;e[26]===Symbol.for("react.memo_cache_sentinel")?(z=de=>g(de.target.value),e[26]=z):z=e[26];let I;e[27]!==m?(I=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=I):I=e[28];let O;e[29]!==f||e[30]!==p||e[31]!==I?(O=r.jsx(pt,{id:"page-form-name",value:p,onChange:z,placeholder:I,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=I,e[32]=O):O=e[32];let B;e[33]!==O||e[34]!==$?(B=r.jsxs("div",{className:"space-y-1.5",children:[$,O]}),e[33]=O,e[34]=$,e[35]=B):B=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let H;e[38]!==U?(H=r.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 K;e[40]===Symbol.for("react.memo_cache_sentinel")?(K=de=>b(de.target.value),e[40]=K):K=e[40];let W;e[41]!==m?(W=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=W):W=e[42];let Y;e[43]!==f||e[44]!==x||e[45]!==W?(Y=r.jsx(pt,{id:"page-form-path",value:x,onChange:K,placeholder:W,disabled:f}),e[43]=f,e[44]=x,e[45]=W,e[46]=Y):Y=e[46];let Q;e[47]!==H||e[48]!==Y?(Q=r.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[47]=H,e[48]=Y,e[49]=Q):Q=e[49];let te;e[50]!==T?(te=T&&r.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=te):te=e[51];let ee;e[52]!==B||e[53]!==Q||e[54]!==te||e[55]!==M?(ee=r.jsxs("div",{className:"space-y-4 py-4",children:[M,B,Q,te]}),e[52]=B,e[53]=Q,e[54]=te,e[55]=M,e[56]=ee):ee=e[56];let oe;e[57]!==u?(oe=()=>u(!1),e[57]=u,e[58]=oe):oe=e[58];let se;e[59]!==m?(se=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=se):se=e[60];let G;e[61]!==f||e[62]!==oe||e[63]!==se?(G=r.jsx(he,{type:"button",variant:"outline",onClick:oe,disabled:f,children:se}),e[61]=f,e[62]=oe,e[63]=se,e[64]=G):G=e[64];let X;e[65]!==f||e[66]!==p||e[67]!==x?(X=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=X):X=e[68];let q;e[69]!==f||e[70]!==n||e[71]!==m?(q=f?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),m(Aee[n])]}):m(Tee[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=q):q=e[72];let Z;e[73]!==X||e[74]!==q?(Z=r.jsx(he,{type:"submit",disabled:X,children:q}),e[73]=X,e[74]=q,e[75]=Z):Z=e[75];let le;e[76]!==G||e[77]!==Z?(le=r.jsxs(Gn,{children:[G,Z]}),e[76]=G,e[77]=Z,e[78]=le):le=e[78];let ne;e[79]!==C||e[80]!==ee||e[81]!==le||e[82]!==P?(ne=r.jsx(Pt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:C,children:[P,ee,le]})}),e[79]=C,e[80]=ee,e[81]=le,e[82]=P,e[83]=ne):ne=e[83];let ae;return e[84]!==N||e[85]!==s||e[86]!==ne?(ae=r.jsx(Rt,{open:s,onOpenChange:N,children:ne}),e[84]=N,e[85]=s,e[86]=ne,e[87]=ae):ae=e[87],ae}function Pee(t){const e=F.c(70),{open:s,blockKey:n,initialName:i,isPending:o,onSubmit:l,onOpenChange:a}=t,c=o===void 0?!1:o,d=re(),[h,u]=E.useState(i),[f,m]=E.useState(s);s!==f&&(m(s),s&&u(i));let p;e[0]!==c||e[1]!==a?(p=K=>{!K&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==h||e[5]!==l?(x=async K=>{K.preventDefault();const W=h.trim();!W||c||await l(W)},e[3]=c,e[4]=h,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx($t,{children:v}),e[9]=v,e[10]=y):y=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let _;e[13]!==L?(_=r.jsx(Dn,{children:L}),e[13]=L,e[14]=_):_=e[14];let k;e[15]!==y||e[16]!==_?(k=r.jsxs(ms,{children:[y,_]}),e[15]=y,e[16]=_,e[17]=k):k=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let w;e[20]!==S?(w=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=w):w=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=K=>u(K.target.value),e[22]=j):j=e[22];let N;e[23]!==c||e[24]!==h?(N=r.jsx(pt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=N):N=e[25];let A;e[26]!==w||e[27]!==N?(A=r.jsxs("div",{className:"space-y-1.5",children:[w,N]}),e[26]=w,e[27]=N,e[28]=A):A=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let T;e[31]!==C?(T=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=T):T=e[32];let V;e[33]!==n?(V=r.jsx(pt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=V):V=e[34];let R;e[35]!==T||e[36]!==V?(R=r.jsxs("div",{className:"space-y-1.5",children:[T,V]}),e[35]=T,e[36]=V,e[37]=R):R=e[37];let P;e[38]!==A||e[39]!==R?(P=r.jsxs("div",{className:"space-y-4 py-4",children:[A,R]}),e[38]=A,e[39]=R,e[40]=P):P=e[40];let M;e[41]!==a?(M=()=>a(!1),e[41]=a,e[42]=M):M=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let $;e[45]!==c||e[46]!==M||e[47]!==D?($=r.jsx(he,{type:"button",variant:"outline",onClick:M,disabled:c,children:D}),e[45]=c,e[46]=M,e[47]=D,e[48]=$):$=e[48];let z;e[49]!==c||e[50]!==h?(z=!h.trim()||c,e[49]=c,e[50]=h,e[51]=z):z=e[51];let I;e[52]!==c||e[53]!==d?(I=c?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=I):I=e[54];let O;e[55]!==z||e[56]!==I?(O=r.jsx(he,{type:"submit",disabled:z,children:I}),e[55]=z,e[56]=I,e[57]=O):O=e[57];let B;e[58]!==$||e[59]!==O?(B=r.jsxs(Gn,{children:[$,O]}),e[58]=$,e[59]=O,e[60]=B):B=e[60];let U;e[61]!==b||e[62]!==P||e[63]!==B||e[64]!==k?(U=r.jsx(Pt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[k,P,B]})}),e[61]=b,e[62]=P,e[63]=B,e[64]=k,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=r.jsx(Rt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function Ree(t){const e=F.c(7),{type:s}=t,n=yI[s];let i;e[0]!==n?(i=r.jsx(Ue,{asChild:!0,children:r.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 o=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==o?(l=r.jsx(He,{side:"left",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs(Ke,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const E9={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},gg=["posts","authors","categories"],xd={posts:"post",authors:"author",categories:"category"};function bd(t){return gg.includes(t)}const xg={posts:"post",authors:"author",categories:"category"},yw={posts:E9.post,authors:E9.author,categories:E9.category},Dee=Object.fromEntries(Object.entries(yw).map(([t,e])=>[e,t]));function Iee(t){return typeof t=="string"?Dee[t]??null:null}function wo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ys(t){return typeof t=="string"?t:""}function Mee(t,e){switch(t){case"posts":return{label:ys(e.title)||"Untitled post",subtitle:ys(e.slug)};case"authors":return{label:ys(e.name)||"Unnamed author",subtitle:ys(e.email)};case"categories":return{label:ys(e.name)||"Unnamed category",subtitle:ys(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function _w(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=wo(n);if(!i)continue;const o=Iee(i.__resolveType);if(!o)continue;const l=wo(i[xg[o]])??{},{label:a,subtitle:c}=Mee(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of gg)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function $ee(t,e){return _w(t)[e]}function zd(t,e){return $ee(t,e).map(s=>({key:s.key,payload:L0(wo(t[s.key])??void 0,e)}))}const q4=Object.freeze({});function L0(t,e){return t?wo(t[xg[e]])??q4:q4}function r0(t,e,s){return{name:t,__resolveType:yw[e],[xg[e]]:s}}function ihe({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:ys(wo(f)?.[s]),l=f=>typeof f=="string"?f:ys(wo(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>ys(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>ys(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:ys(m.name)||ys(m[s])||f})),d=new Map,h=[];return i.forEach((f,m)=>{const p=a(f);if(p){h.includes(p.key)||h.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),h.push(g),c.push({value:g,label:l(f)||o(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function Lw(t){const e=ys(t.status);return e===""||e==="published"}function hl(t){return Array.isArray(t)?t:[]}function Vr(t){if(typeof t=="string")return t;const e=wo(t);return e?ys(e.slug):""}function Oee(t){if(typeof t=="string")return t;const e=wo(t);return e?ys(e.email):""}function ww(t){const e=[];return ys(t.title).trim()||e.push("Title"),ys(t.slug).trim()||e.push("Slug"),hl(t.categories).map(Vr).filter(Boolean).length===0&&e.push("Category"),ys(t.excerpt).trim()||e.push("Excerpt"),ys(t.image).trim()||e.push("Cover image"),e}function rhe(t){return!Lw(t)&&ww(t).length>0}function Sw(t){return zd(t,"posts").map(({key:e,payload:s})=>({key:e,title:ys(s.title)||"Untitled post",slug:ys(s.slug),date:ys(s.date),categorySlugs:hl(s.categories).map(Vr).filter(Boolean),authorEmails:hl(s.authors).map(Oee).filter(Boolean),missing:ww(s),published:Lw(s)}))}function Bee(t,e){const s=hl(t.categories);return s.some(n=>Vr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function zee(t,e){const s=hl(t.categories);return s.length===1&&Vr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function ohe(t,e,s){const n=hl(t.categories);if(!n.some(a=>Vr(a)===e))return t;const i=n.map(a=>{const c=Vr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=Vr(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function Fee(t,e){const s=hl(t.categories);return s.some(n=>Vr(n)===e)?{...t,categories:s.filter(n=>Vr(n)!==e)}:t}function G4(t){return{...t,dateModified:new Date().toISOString()}}function W1(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 Y4(t,e){const s=`collections/blog/${e}/${W1(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Uee(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${W1(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-${W1(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Hee={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"}},Q4="Box";function Kee(t){return t.startsWith("site/")?"site":"app"}function Wee(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Mc(...t){for(const e of t)if(e!==void 0)return e}function lhe(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const o of Object.keys(i)){if(!Yee(o)||e.has(o))continue;e.add(o);const l=Ao(o,t),a=qee(o),c=Hee[a],d=Kee(o),h=(d==="site"?Mc(l.title,c?.title):Mc(c?.title,l.title))??a,u=d==="site"?Mc(l.description,c?.description):Mc(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Wee(f)?f:void 0,p=m!==void 0?c?.iconName??Q4:Mc(f,c?.iconName)??Q4;s.push({resolveType:o,title:h,description:u,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function qee(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Gee=["blog/sections/blocks/","site/sections/Blog/Post/"];function Yee(t){return Gee.some(e=>t.startsWith(e))}function Qee({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,h]=E.useState(!1),[u,f]=E.useState(c),[m,p]=E.useState(!1),g=!i||a,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},v=async y=>{if(!i||m)return;let L;try{L=JSON.parse(y)}catch{pe.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(L),pe.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(_){pe.error(o("sectionsEditor.pageJsonDialog.saveError",{error:_ instanceof Error?_.message:String(_)}))}finally{p(!1)}};return r.jsx(Rt,{open:t,onOpenChange:e,children:r.jsxs(Pt,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(ms,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx($t,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(he,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(ui,{size:12}):r.jsx(on,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(he,{size:"sm",onClick:()=>v(u),disabled:!x||m,className:"h-7 text-xs",children:o(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",o("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"h-[70vh]",children:r.jsx(iu,{code:c,language:"json",readOnly:g,height:"100%",onChange:y=>f(y??""),onSave:y=>{v(y)}})})]})})}function xi(t){const e=F.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,active:l,accent:a,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let y;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(y=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(He,{side:"right",children:[c," variants"]})]})}):n?r.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):r.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",v?"bg-global-section/15":"bg-muted"),children:r.jsx(s,{size:16,className:ie("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:n2}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=y):y=e[5];const L=y,_=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let k;e[6]!==_?(k=ie("group relative flex min-w-0 items-center rounded-md transition-colors",_),e[6]=_,e[7]=k):k=e[7];let S;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==i?(S=h&&r.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:Jee,children:r.jsx(lc,{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]=S):S=e[13];const w=m&&!l&&"text-destructive";let j;e[14]!==w?(j=ie("block truncate text-sm font-medium",w),e[14]=w,e[15]=j):j=e[15];let N;e[16]!==j||e[17]!==i?(N=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=N):N=e[18];const A=l?"text-accent-foreground/70":"text-muted-foreground";let C;e[19]!==A?(C=ie("block truncate text-xs",A),e[19]=A,e[20]=C):C=e[20];let T;e[21]!==o||e[22]!==C?(T=r.jsx("span",{className:C,children:o}),e[21]=o,e[22]=C,e[23]=T):T=e[23];let V;e[24]!==T||e[25]!==N?(V=r.jsxs("span",{className:"min-w-0 flex-1",children:[N,T]}),e[24]=T,e[25]=N,e[26]=V):V=e[26];let R;e[27]!==l||e[28]!==m||e[29]!==p?(R=m&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(pn,{size:14})})}),p&&r.jsx(He,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=R):R=e[30];let P;e[31]!==x||e[32]!==L||e[33]!==V||e[34]!==R||e[35]!==d?(P=r.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:[L,V,R,d]}),e[31]=x,e[32]=L,e[33]=V,e[34]=R,e[35]=d,e[36]=P):P=e[36];let M;e[37]!==l||e[38]!==b?(M=b&&r.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]=M):M=e[39];let D;return e[40]!==P||e[41]!==M||e[42]!==k||e[43]!==S?(D=r.jsxs("div",{className:k,children:[S,P,M]}),e[40]=P,e[41]=M,e[42]=k,e[43]=S,e[44]=D):D=e[44],D}function Jee(t){return t.stopPropagation()}function ho(t){const e=F.c(10),{icon:s,title:n,description:i}=t;let o;e[0]!==s?(o=s&&r.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==n?(l=r.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&r.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]!==o||e[7]!==l||e[8]!==a?(c=r.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:[o,l,a]}),e[6]=o,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Xee={loaders:Da,actions:Ir},Zee={loaders:"Loaders",actions:"Actions"},ete={analytics:sV,blog:Ra,commerce:Vp,site:eN,website:Mn};function tte(t,e){return e===0?ete[t.toLowerCase()]??Pr:Pr}function o0(t,e){return e===0?iQ(t):t}function ste(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,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]=E.useState(h),[m,p]=E.useState(null),[g,x]=E.useState(""),[b,v]=E.useState(dte),[y,L]=E.useState(c);y!==c&&(L(c),f([]),p(null),x(""),v(new Set));let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=U=>{v(H=>{const K=new Set(H);return K.has(U)?K.delete(U):K.add(U),K})},e[1]=_):_=e[1];const k=_;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const w=bu(S);let j;e[6]!==w?(j=rg((U,H)=>w.mutate({blockKey:U,data:H})),e[6]=w,e[7]=j):j=e[7];const N=j;let A;e[8]!==c?(A=xL(c),e[8]=c,e[9]=A):A=e[9];const C=A,T=Xee[c];let V,R,P,M,D,$,z;if(e[10]!==T||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==o||e[19]!==w||e[20]!==N||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){P=Symbol.for("react.early_return_sentinel");e:{const U=[...yL(l,a,c).map(cte),...bL(l,c).map(ate)],H=g.trim().toLowerCase(),K=H.length>0,W=K?U.filter(be=>be.title.toLowerCase().includes(H)||be.resolveType.toLowerCase().includes(H)):[],Y=new Map,Q=[],te=new Map;if(!K){for(const be of U){const Se=be.folderPath;if(!(Se.length<u.length)&&u.every((_e,Ee)=>Se[Ee]===_e))if(Se.length===u.length)if(be.savedKey!==void 0){const _e=te.get(be.resolveType);_e?_e.push(be):te.set(be.resolveType,[be])}else Q.push(be);else{const _e=Se[u.length],Ee=Y.get(_e)??{count:0,savedCount:0};be.savedKey!==void 0?Ee.savedCount=Ee.savedCount+1:Ee.count=Ee.count+1,Y.set(_e,Ee)}}Q.sort(lte);for(const be of te.values())be.sort(ote)}const ee=[...te.entries()].filter(be=>{const[Se]=be;return!Q.some(_e=>_e.resolveType===Se)}).flatMap(rte).sort(ite);let oe;e[33]!==u?(oe=(be,Se)=>o0(be.name,u.length).localeCompare(o0(Se.name,u.length)),e[33]=u,e[34]=oe):oe=e[34];const se=[...Y.entries()].map(nte).sort(oe);let G;e[35]===Symbol.for("react.memo_cache_sentinel")?(G=be=>{p(be.savedKey!==void 0?{mode:"saved",key:be.savedKey}:{mode:"available",resolveType:be.resolveType,title:be.title})},e[35]=G):G=e[35];const X=G;let q;e[36]!==w||e[37]!==C||e[38]!==d?(q=async(be,Se)=>{await w.mutateAsync({blockKey:be,data:Se}),pe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:be})),p({mode:"saved",key:be})},e[36]=w,e[37]=C,e[38]=d,e[39]=q):q=e[39];const Z=q;let le;e[40]!==a||e[41]!==m?(le=ute(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ne=le;if(ne){const be=`${ne.mode}:${ne.mode==="saved"?ne.blockKey:ne.resolveType}`;let Se;e[43]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>p(null),e[43]=Se):Se=e[43];let _e;e[44]!==i||e[45]!==a||e[46]!==Z||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==w.isPending||e[52]!==N||e[53]!==be||e[54]!==ne.editorTarget||e[55]!==ne.initialValue||e[56]!==n?(_e=r.jsx(pw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:ne.editorTarget,initialValue:ne.initialValue,isCreating:w.isPending,onCreate:Z,onSaveReferencedBlock:N,onBack:Se},be),e[44]=i,e[45]=a,e[46]=Z,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=w.isPending,e[52]=N,e[53]=be,e[54]=ne.editorTarget,e[55]=ne.initialValue,e[56]=n,e[57]=_e):_e=e[57],P=_e;break e}z="flex h-full w-full min-w-0 flex-col";let ae;e[58]!==d?(ae=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ae):ae=e[59];let de;e[60]===Symbol.for("react.memo_cache_sentinel")?(de=()=>f([]),e[60]=de):de=e[60];const fe=u.length===0?"font-medium text-foreground":"text-muted-foreground";let ue;e[61]!==fe?(ue=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",fe),e[61]=fe,e[62]=ue):ue=e[62];const ge=Zee[c];let J;e[63]!==ue||e[64]!==ge?(J=r.jsx("button",{type:"button",onClick:de,className:ue,children:ge}),e[63]=ue,e[64]=ge,e[65]=J):J=e[65];let me;e[66]!==u?(me=u.map((be,Se)=>{const _e=Se===u.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(u.slice(0,Se+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:o0(be,Se)})]},`${be}-${Se}`)}),e[66]=u,e[67]=me):me=e[67];let ye;e[68]!==ae||e[69]!==J||e[70]!==me?(ye=r.jsxs("nav",{"aria-label":ae,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[J,me]}),e[68]=ae,e[69]=J,e[70]=me,e[71]=ye):ye=e[71];let Le;e[72]===Symbol.for("react.memo_cache_sentinel")?(Le=r.jsx(Gh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Le):Le=e[72];let ke;e[73]===Symbol.for("react.memo_cache_sentinel")?(ke=be=>x(be.target.value),e[73]=ke):ke=e[73];let we;e[74]!==c||e[75]!==d?(we=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=we):we=e[76];let Ne;e[77]!==c||e[78]!==d?(Ne=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ne):Ne=e[79];let Ae;e[80]!==g||e[81]!==we||e[82]!==Ne?(Ae=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Le,r.jsx("input",{type:"text",value:g,onChange:ke,placeholder:we,"aria-label":Ne,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=we,e[82]=Ne,e[83]=Ae):Ae=e[83],e[84]!==ye||e[85]!==Ae?(R=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ye,Ae]}),e[84]=ye,e[85]=Ae,e[86]=R):R=e[86],V=No,$="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",M="mx-auto w-full max-w-4xl px-6 py-5",D=K?W.length===0?r.jsx(ho,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):r.jsx("div",{className:"flex flex-col gap-1",children:W.map(be=>r.jsx(xi,{icon:T,accent:be.savedKey!==void 0?"global":void 0,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>X(be)},be.savedKey??be.resolveType))}):se.length===0&&Q.length===0&&ee.length===0?r.jsx(ho,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[se.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:se.map(be=>{const Se=tte(be.name,u.length);return r.jsxs("button",{type:"button",onClick:()=>f([...u,be.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:[r.jsx(Se,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:o0(be.name,u.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[be.count," ",be.count===1?C:c,be.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:be.savedCount})]})]})]})]},be.name)})}),(Q.length>0||ee.length>0)&&r.jsxs("div",{className:ie("flex flex-col gap-1",se.length>0&&"mt-4"),children:[Q.map(be=>{const Se=te.get(be.resolveType)??[],_e=b.has(be.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(xi,{icon:T,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>X(be)}),Se.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>k(be.resolveType),"aria-expanded":_e,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:n2},children:[_e?r.jsx(Jt,{size:12,className:"shrink-0"}):r.jsx(gn,{size:12,className:"shrink-0"}),d(_e?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Se.length,")"]}),_e&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Se.map(Ee=>r.jsx(xi,{icon:T,accent:"global",title:Ee.title,subtitle:Ee.resolveType,active:!1,onClick:()=>X(Ee)},Ee.savedKey))})]})]},be.resolveType)}),ee.map(be=>r.jsx(xi,{icon:T,accent:"global",title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>X(be)},be.savedKey))]})]})}e[10]=T,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=u,e[18]=o,e[19]=w,e[20]=N,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=V,e[27]=R,e[28]=P,e[29]=M,e[30]=D,e[31]=$,e[32]=z}else V=e[26],R=e[27],P=e[28],M=e[29],D=e[30],$=e[31],z=e[32];if(P!==Symbol.for("react.early_return_sentinel"))return P;let I;e[87]!==M||e[88]!==D?(I=r.jsx("div",{className:M,children:D}),e[87]=M,e[88]=D,e[89]=I):I=e[89];let O;e[90]!==V||e[91]!==I||e[92]!==$?(O=r.jsx(V,{className:$,children:I}),e[90]=V,e[91]=I,e[92]=$,e[93]=O):O=e[93];let B;return e[94]!==R||e[95]!==O||e[96]!==z?(B=r.jsxs("div",{className:z,children:[R,O]}),e[94]=R,e[95]=O,e[96]=z,e[97]=B):B=e[97],B}function nte(t){const[e,s]=t;return{name:e,...s}}function ite(t,e){return t.title.localeCompare(e.title)}function rte(t){const[,e]=t;return e}function ote(t,e){return t.title.localeCompare(e.title)}function lte(t,e){return t.title.localeCompare(e.title)}function ate(t){return{resolveType:t.resolveType,title:t.title,folderPath:vL(t.resolveType)}}function cte(t){return{resolveType:t.resolveType,title:t.title,folderPath:vL(t.resolveType),savedKey:t.key}}function dte(){return new Set}function ute(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}=_L(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function hte(t){const e=F.c(104),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:m}=t,p=re(),g=zr(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,y]=E.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[_,k]=E.useState(L),[S,w]=E.useState(0),[j,N]=E.useState(!1);let A;e[2]!==l||e[3]!==c?(A=ai(c,l),e[2]=l,e[3]=c,e[4]=A):A=e[4];const C=A;let T,V,R,P,M,D,$,z;if(e[5]!==x||e[6]!==i||e[7]!==a||e[8]!==_||e[9]!==v||e[10]!==u||e[11]!==f||e[12]!==s||e[13]!==o||e[14]!==c||e[15]!==p||e[16]!==d||e[17]!==n){const W=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,Y=o??void 0;let Q;e[26]!==x||e[27]!==i||e[28]!==s||e[29]!==Y||e[30]!==n?(Q={orgSlug:s,virtualMcpId:n,branch:i,previewUrl:Y,siteSlug:x},e[26]=x,e[27]=i,e[28]=s,e[29]=Y,e[30]=n,e[31]=Q):Q=e[31],V=Q;let te,ee,oe,se;if(e[32]!==a||e[33]!==_||e[34]!==v||e[35]!==f||e[36]!==p||e[37]!==d){const fe=[d,..._],ue=J=>{k(_.slice(0,J)),w(fte)};let ge;e[46]!==a||e[47]!==v||e[48]!==f?(ge=async J=>{const me=ug(J,a);if(me){pe.error(me);return}await f(J,v),N(!1)},e[46]=a,e[47]=v,e[48]=f,e[49]=ge):ge=e[49],T=ge,z="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",M="shrink-0 border-b px-3 py-2.5",se="flex min-w-0 items-center gap-2 overflow-hidden",e[50]!==p?(te=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[50]=p,e[51]=te):te=e[51],ee="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=fe.map((J,me)=>{const ye=me===fe.length-1,Le=Pn(J);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[me>0&&r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>ue(me),title:Le,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ye?"font-medium text-foreground":"text-muted-foreground"),children:Le})]},`${Le}-${me}`)}),e[32]=a,e[33]=_,e[34]=v,e[35]=f,e[36]=p,e[37]=d,e[38]=T,e[39]=te,e[40]=ee,e[41]=oe,e[42]=se,e[43]=M,e[44]=$,e[45]=z}else T=e[38],te=e[39],ee=e[40],oe=e[41],se=e[42],M=e[43],$=e[44],z=e[45];let G;e[52]!==te||e[53]!==ee||e[54]!==oe?(G=r.jsx("nav",{"aria-label":te,className:ee,children:oe}),e[52]=te,e[53]=ee,e[54]=oe,e[55]=G):G=e[55];let X;e[56]===Symbol.for("react.memo_cache_sentinel")?(X=()=>N(!0),e[56]=X):X=e[56];let q;e[57]!==p?(q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[57]=p,e[58]=q):q=e[58];let Z;e[59]===Symbol.for("react.memo_cache_sentinel")?(Z=r.jsx(np,{size:14}),e[59]=Z):Z=e[59];let le;e[60]!==u||e[61]!==q?(le=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:X,"aria-label":q,children:Z})}),e[60]=u,e[61]=q,e[62]=le):le=e[62];let ne;e[63]!==p?(ne=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[63]=p,e[64]=ne):ne=e[64];let ae;e[65]!==ne?(ae=r.jsx(He,{side:"bottom",children:ne}),e[65]=ne,e[66]=ae):ae=e[66];let de;e[67]!==le||e[68]!==ae?(de=r.jsxs(Ke,{children:[le,ae]}),e[67]=le,e[68]=ae,e[69]=de):de=e[69],e[70]!==se||e[71]!==G||e[72]!==de?(D=r.jsxs("div",{className:se,children:[G,de]}),e[70]=se,e[71]=G,e[72]=de,e[73]=D):D=e[73],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",P=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:W}),e[5]=x,e[6]=i,e[7]=a,e[8]=_,e[9]=v,e[10]=u,e[11]=f,e[12]=s,e[13]=o,e[14]=c,e[15]=p,e[16]=d,e[17]=n,e[18]=T,e[19]=V,e[20]=R,e[21]=P,e[22]=M,e[23]=D,e[24]=$,e[25]=z}else T=e[18],V=e[19],R=e[20],P=e[21],M=e[22],D=e[23],$=e[24],z=e[25];let I;e[74]!==R||e[75]!==P?(I=r.jsx("p",{className:R,children:P}),e[74]=R,e[75]=P,e[76]=I):I=e[76];let O;e[77]!==I||e[78]!==M||e[79]!==D?(O=r.jsxs("div",{className:M,children:[D,I]}),e[77]=I,e[78]=M,e[79]=D,e[80]=O):O=e[80];let B;e[81]!==a||e[82]!==_||e[83]!==S||e[84]!==v||e[85]!==l||e[86]!==m||e[87]!==V||e[88]!==C||e[89]!==p?(B=r.jsx(No,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:C?r.jsx($r,{schema:C,value:v,onChange:W=>y(W),basePath:"",breadcrumbPath:_,onBreadcrumbChange:k,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:V},S):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[81]=a,e[82]=_,e[83]=S,e[84]=v,e[85]=l,e[86]=m,e[87]=V,e[88]=C,e[89]=p,e[90]=B):B=e[90];let U;e[91]!==O||e[92]!==B||e[93]!==$?(U=r.jsxs("div",{className:$,children:[O,B]}),e[91]=O,e[92]=B,e[93]=$,e[94]=U):U=e[94];let H;e[95]!==h||e[96]!==T||e[97]!==u||e[98]!==j?(H=r.jsx(hg,{open:j,onOpenChange:N,defaultBlockId:h,isPending:u,onSubmit:T}),e[95]=h,e[96]=T,e[97]=u,e[98]=j,e[99]=H):H=e[99];let K;return e[100]!==U||e[101]!==H||e[102]!==z?(K=r.jsxs("div",{className:z,children:[U,H]}),e[100]=U,e[101]=H,e[102]=z,e[103]=K):K=e[103],K}function fte(t){return t+1}var mte=Object.prototype.toString,Lc=Array.isArray||function(e){return mte.call(e)==="[object Array]"};function bg(t){return typeof t=="function"}function pte(t){return Lc(t)?"array":typeof t}function P9(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function J4(t,e){return t!=null&&typeof t=="object"&&e in t}function gte(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var xte=RegExp.prototype.test;function bte(t,e){return xte.call(t,e)}var vte=/\S/;function yte(t){return!bte(vte,t)}var _te={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Lte(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return _te[s]})}var wte=/\s*/,Ste=/\s+/,X4=/\s*=/,kte=/\s*\}/,jte=/#|\^|\/|>|\{|&|=|!/;function Cte(t,e){if(!t)return[];var s=!1,n=[],i=[],o=[],l=!1,a=!1,c="",d=0;function h(){if(l&&!a)for(;o.length;)delete i[o.pop()];else o=[];l=!1,a=!1}var u,f,m;function p(w){if(typeof w=="string"&&(w=w.split(Ste,2)),!Lc(w)||w.length!==2)throw new Error("Invalid tags: "+w);u=new RegExp(P9(w[0])+"\\s*"),f=new RegExp("\\s*"+P9(w[1])),m=new RegExp("\\s*"+P9("}"+w[1]))}p(e||Ai.tags);for(var g=new vu(t),x,b,v,y,L,_;!g.eos();){if(x=g.pos,v=g.scanUntil(u),v)for(var k=0,S=v.length;k<S;++k)y=v.charAt(k),yte(y)?(o.push(i.length),c+=y):(a=!0,s=!0,c+=" "),i.push(["text",y,x,x+1]),x+=1,y===`
540
+ `)}function D4(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function QX(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 JX(t){return t.map((e,s)=>({...e,index:s}))}function uw(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:o,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=r.jsx(ic,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Cr,{className:"h-4 w-4 shrink-0",style:{color:GX}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==c?(p=!i&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{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:ZX,onPointerDown:XX,children:r.jsx(Yn,{size:14})})}),r.jsxs(Yt,{align:"end",children:[o&&r.jsxs(et,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(Mv,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(et,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(on,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(et,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(Zs,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=o,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==u||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[u,f,m,p]}),e[15]=u,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function XX(t){return t.stopPropagation()}function ZX(t){return t.stopPropagation()}function eZ(t){const e=F.c(27),{entry:s,selected:n,canDelete:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:tZ},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:m,isDragging:p}=yf(d);let g;e[2]!==m?(g=Ni.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let y;e[7]!==o?(y=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=y):y=e[8];const L=p?"cursor-grabbing":"cursor-grab",_=n?dw:YX;let k;e[9]!==L||e[10]!==_?(k=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,_),e[9]=L,e[10]=_,e[11]=k):k=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=r.jsx(uw,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=S):S=e[17];let w;return e[18]!==h||e[19]!==u||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==y||e[24]!==k||e[25]!==S?(w=r.jsx("div",{ref:f,style:v,...h,...u,onClick:o,onKeyDown:y,className:k,children:S}),e[18]=h,e[19]=u,e[20]=o,e[21]=f,e[22]=v,e[23]=y,e[24]=k,e[25]=S,e[26]=w):w=e[26],w}function tZ(){return!1}function sZ(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=re(),m=n.length>1;let p;e[0]!==n?(p=()=>D4(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=E.useState(p),[b,v]=E.useState(null),[y,L]=E.useState(s),[_,k]=E.useState(n.length);let S;e[2]!==n?(S=()=>R4(n),e[2]=n,e[3]=S):S=e[3];const[w,j]=E.useState(S),N=E.useRef(!1),A=R4(n);y!==s?(L(s),k(n.length),j(A),x(D4(n))):(_!==n.length||w!==A)&&(k(n.length),j(A),x(fe=>QX(fe,n)));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:_f},e[5]=T):T=e[5];const V=fu(rr(Sl,C),rr(wl,T));let R;e[6]!==g?(R=g.map(nZ),e[6]=g,e[7]=R):R=e[7];const P=R;let M;e[8]!==g?(M=fe=>{const ue=String(fe.active.id);v(g.find(ge=>ge.id===ue)??null)},e[8]=g,e[9]=M):M=e[9];const D=M;let $;e[10]!==P||e[11]!==h?($=fe=>{v(null);const{active:ue,over:ge}=fe;if(!ge||ue.id===ge.id)return;const J=P.indexOf(String(ue.id)),me=P.indexOf(String(ge.id));J===-1||me===-1||(x(ye=>JX(ol([...ye],J,me))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),h(J,me))},e[10]=P,e[11]=h,e[12]=$):$=e[12];const z=$;let I;e[13]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{v(null)},e[13]=I):I=e[13];const O=I;let B,U,H,K,W,Y,Q,te,ee,oe,se,G,X;if(e[14]!==m||e[15]!==g||e[16]!==P||e[17]!==z||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==V||e[27]!==f){const fe=Ve=>{N.current||o(Ve)};se="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 ge;e[43]!==ue?(ge=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ue}),e[43]=ue,e[44]=ge):ge=e[44];let J;e[45]!==f?(J=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=J):J=e[46];let me;e[47]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx(Dt,{size:14}),e[47]=me):me=e[47];let ye;e[48]!==u||e[49]!==J?(ye=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":J,className:"size-6",onClick:u,children:me})}),e[48]=u,e[49]=J,e[50]=ye):ye=e[50];let Le;e[51]!==f?(Le=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=Le):Le=e[52];let ke;e[53]!==Le?(ke=r.jsx(He,{children:Le}),e[53]=Le,e[54]=ke):ke=e[54];let we;e[55]!==ye||e[56]!==ke?(we=r.jsxs(Ke,{children:[ye,ke]}),e[55]=ye,e[56]=ke,e[57]=we):we=e[57];let Ne;e[58]!==f?(Ne=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ne):Ne=e[59];let Ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ae=r.jsx(Zs,{size:14}),e[60]=Ae):Ae=e[60];let be;e[61]!==d||e[62]!==Ne?(be=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":Ne,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ae})}),e[61]=d,e[62]=Ne,e[63]=be):be=e[63];let Se;e[64]!==f?(Se=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Se):Se=e[65];let _e;e[66]!==Se?(_e=r.jsx(He,{children:Se}),e[66]=Se,e[67]=_e):_e=e[67];let Ee;e[68]!==be||e[69]!==_e?(Ee=r.jsxs(Ke,{children:[be,_e]}),e[68]=be,e[69]=_e,e[70]=Ee):Ee=e[70];let De;e[71]!==we||e[72]!==Ee?(De=r.jsxs("div",{className:"flex items-center gap-0.5",children:[we,Ee]}),e[71]=we,e[72]=Ee,e[73]=De):De=e[73],e[74]!==ge||e[75]!==De?(G=r.jsxs("div",{className:"flex items-center justify-between",children:[ge,De]}),e[74]=ge,e[75]=De,e[76]=G):G=e[76],U=pu,Y=V,Q=x2,te=D,ee=z,oe=O,B=vf,K=P,W=bf,X="space-y-0.5",H=g.map(Ve=>r.jsx(eZ,{entry:Ve,selected:Ve.index===i,canDelete:m,onSelect:()=>fe(Ve.index),onRename:l?()=>l(Ve.index):void 0,onDuplicate:()=>a(Ve.index),onDelete:()=>c(Ve.index)},Ve.id)),e[14]=m,e[15]=g,e[16]=P,e[17]=z,e[18]=D,e[19]=u,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=V,e[27]=f,e[28]=B,e[29]=U,e[30]=H,e[31]=K,e[32]=W,e[33]=Y,e[34]=Q,e[35]=te,e[36]=ee,e[37]=oe,e[38]=se,e[39]=G,e[40]=X}else B=e[28],U=e[29],H=e[30],K=e[31],W=e[32],Y=e[33],Q=e[34],te=e[35],ee=e[36],oe=e[37],se=e[38],G=e[39],X=e[40];let q;e[77]!==H||e[78]!==X?(q=r.jsx("div",{className:X,children:H}),e[77]=H,e[78]=X,e[79]=q):q=e[79];let Z;e[80]!==B||e[81]!==K||e[82]!==W||e[83]!==q?(Z=r.jsx(B,{items:K,strategy:W,children:q}),e[80]=B,e[81]=K,e[82]=W,e[83]=q,e[84]=Z):Z=e[84];let le;e[85]!==b||e[86]!==m?(le=b?r.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",dw),children:r.jsx(uw,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ne;e[88]!==le?(ne=En.createPortal(r.jsx(xf,{dropAnimation:TL,children:le}),document.body),e[88]=le,e[89]=ne):ne=e[89];let ae;e[90]!==U||e[91]!==Y||e[92]!==Q||e[93]!==te||e[94]!==ee||e[95]!==oe||e[96]!==Z||e[97]!==ne?(ae=r.jsxs(U,{sensors:Y,collisionDetection:Q,onDragStart:te,onDragEnd:ee,onDragCancel:oe,children:[Z,ne]}),e[90]=U,e[91]=Y,e[92]=Q,e[93]=te,e[94]=ee,e[95]=oe,e[96]=Z,e[97]=ne,e[98]=ae):ae=e[98];let de;return e[99]!==se||e[100]!==G||e[101]!==ae?(de=r.jsxs("div",{className:se,children:[G,ae]}),e[99]=se,e[100]=G,e[101]=ae,e[102]=de):de=e[102],de}function nZ(t){return t.id}const iZ=[[/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"]],rZ={"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 C9(t){return xl(t)!==void 0}function pg(t,e){if(e){if(C9(e))return e;const s=rZ[e];if(s&&C9(s))return s}for(const[s,n]of iZ)if(s.test(t)&&C9(n))return n;return"FilterLines"}function oZ(t){return xl(t)??Ip}function N9(t){const e=F.c(11),{iconName:s,size:n,className:i}=t,o=n===void 0?"md":n;let l;e[0]!==s?(l=oZ(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",d=o==="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=r.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=r.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}const lZ=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),aZ=5,cZ=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function I4(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const o=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:cZ.format(d)},l=o(n),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function fh(t,e=0){if(!t)return"Default";if(e>aZ)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:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(lZ).join(" & "):vs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return I4(t)??vs(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`:vs(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):vs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:vs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=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=o?.[0];if(c){const d=(o?.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:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>fh(a,e+1)).join(` ${l} `)}return vs(s)}default:{const i=I4(t);return i||vs(s)||"Default"}}}function nhe(t,e){return pG(t,e).map(s=>{const n=e[s.blockKey]??{},i=W_(bG(s.blockKey),e,t);return{blockKey:s.blockKey,title:rl(s.blockKey,n),description:fh(i),iconName:pg(s.matcherResolveType)}})}const hw="Users03";function dZ(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function uZ(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,o]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(o)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=Ao(l,t);s.push({resolveType:l,title:a.title??vs(l),description:a.description,iconName:pg(l,a.icon)})}return s}function hZ(t,e){if(!t)return hw;const s=e.find(n=>n.resolveType===t);return s?s.iconName:pg(t)}function fZ(t){const e=F.c(80),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[h,u]=E.useState(!1),f=re(),p=(i?d.find(ee=>ee.blockKey===i):void 0)?.iconName??hZ(s,o),g=xl(p);let x;e[0]!==a||e[1]!==u?(x=ee=>{a(ee),u(!1)},e[0]=a,e[1]=u,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==u?(v=ee=>{c?.(ee),u(!1)},e[3]=c,e[4]=u,e[5]=v):v=e[5];const y=v;let L;e[6]!==u?(L=()=>u(!0),e[6]=u,e[7]=L):L=e[7];let _;e[8]!==g?(_=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=_):_=e[9];let k;e[10]!==n?(k=r.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=k):k=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Jt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let w;e[13]!==L||e[14]!==_||e[15]!==k?(w=r.jsxs("button",{type:"button",onClick:L,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:[_,k,S]}),e[13]=L,e[14]=_,e[15]=k,e[16]=w):w=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let N;e[19]!==f?(N=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=N):N=e[20];let A;e[21]!==f?(A=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=A):A=e[22];let C;e[23]!==A?(C=r.jsx(hi,{placeholder:A}),e[23]=A,e[24]=C):C=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let V;e[27]!==T?(V=r.jsx(Jn,{children:T}),e[27]=T,e[28]=V):V=e[28];let R;e[29]!==b?(R=()=>b(""),e[29]=b,e[30]=R):R=e[30];const P=!s&&!i&&"bg-accent/60";let M;e[31]!==P?(M=ie("gap-2.5",P),e[31]=P,e[32]=M):M=e[32];let D;e[33]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(N9,{iconName:hw,size:"sm"}),e[33]=D):D=e[33];let $;e[34]!==f?($=f("sectionsEditor.matcherPicker.alwaysLabel"),e[34]=f,e[35]=$):$=e[35];let z;e[36]!==$?(z=r.jsx("span",{className:"text-sm",children:$}),e[36]=$,e[37]=z):z=e[37];let I;e[38]!==f?(I=f("sectionsEditor.matcherPicker.targetAllUsers"),e[38]=f,e[39]=I):I=e[39];let O;e[40]!==I?(O=r.jsx("span",{className:"text-xs text-muted-foreground",children:I}),e[40]=I,e[41]=O):O=e[41];let B;e[42]!==z||e[43]!==O?(B=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[z,O]}),e[42]=z,e[43]=O,e[44]=B):B=e[44];let U;e[45]!==R||e[46]!==M||e[47]!==B?(U=r.jsxs(Ut,{value:"always Target all users",onSelect:R,className:M,children:[D,B]}),e[45]=R,e[46]=M,e[47]=B,e[48]=U):U=e[48];let H;if(e[49]!==i||e[50]!==s||e[51]!==b||e[52]!==o){let ee;e[54]!==i||e[55]!==s||e[56]!==b?(ee=oe=>r.jsxs(Ut,{value:`${oe.title} ${oe.resolveType} ${oe.description??""}`,onSelect:()=>b(oe.resolveType),className:ie("gap-2.5",!i&&s===oe.resolveType&&"bg-accent/60"),children:[r.jsx(N9,{iconName:oe.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:oe.title}),oe.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:oe.description})]})]},oe.resolveType),e[54]=i,e[55]=s,e[56]=b,e[57]=ee):ee=e[57],H=o.map(ee),e[49]=i,e[50]=s,e[51]=b,e[52]=o,e[53]=H}else H=e[53];let K;e[58]!==U||e[59]!==H?(K=r.jsxs(fs,{children:[U,H]}),e[58]=U,e[59]=H,e[60]=K):K=e[60];let W;e[61]!==i||e[62]!==d||e[63]!==y||e[64]!==f?(W=d.length>0&&r.jsx(fs,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(ee=>r.jsxs(Ut,{value:`${ee.title} ${ee.blockKey} ${ee.description??""}`,onSelect:()=>y(ee.blockKey),className:ie("gap-2.5",i===ee.blockKey&&"bg-accent/60"),children:[r.jsx(N9,{iconName:ee.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:ee.title}),ee.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:ee.description})]})]},ee.blockKey))}),e[61]=i,e[62]=d,e[63]=y,e[64]=f,e[65]=W):W=e[65];let Y;e[66]!==V||e[67]!==K||e[68]!==W?(Y=r.jsxs(fi,{children:[V,K,W]}),e[66]=V,e[67]=K,e[68]=W,e[69]=Y):Y=e[69];let Q;e[70]!==h||e[71]!==u||e[72]!==N||e[73]!==C||e[74]!==Y||e[75]!==j?(Q=r.jsxs(AV,{open:h,onOpenChange:u,title:j,description:N,className:"sm:max-w-lg",filter:dZ,children:[C,Y]}),e[70]=h,e[71]=u,e[72]=N,e[73]=C,e[74]=Y,e[75]=j,e[76]=Q):Q=e[76];let te;return e[77]!==Q||e[78]!==w?(te=r.jsxs(r.Fragment,{children:[w,Q]}),e[77]=Q,e[78]=w,e[79]=te):te=e[79],te}const M4=new WeakMap;function mZ(t,e){let s=M4.get(e);s||(s=new Map,M4.set(e,s));let n=s.get(t);return n===void 0&&(n=ai(t,e),s.set(t,n)),n}function pZ(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function gZ(t,e){return{__resolveType:e,variants:[{rule:qa(),value:structuredClone(t)},{rule:qa(),value:structuredClone(t)}]}}function xZ(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>eg(n.rule));return s?s.value:e[e.length-1]?.value}function bZ(t){const e=[...t.variants],s=e[e.length-1],n={rule:qa(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function vZ(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function yZ(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function _Z(t,e,s){return e<t?t-1:Math.min(t,s-1)}function LZ(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 wZ(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function $4(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const O4=new WeakMap;function SZ(t){let e=O4.get(t);return e||(e=uZ(t),O4.set(t,e)),e}function fw(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=re(),{value:l,onChange:a,meta:c,path:d}=i,[h,u]=E.useState(0);if(!pZ(l)){let z;e[0]!==o?(z=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=z):z=e[1];let I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Hh,{size:14}),e[2]=I):I=e[2];let O;e[3]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=O):O=e[4];let B;return e[5]!==O?(B=r.jsx(He,{children:O}),e[5]=O,e[6]=B):B=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":z,onClick:()=>{a(gZ(l,s)),u(0)},children:I})}),B]}),n(i)]})}const f=l,m=f.variants,p=Math.min(h,m.length-1);let g;e[7]!==o?(g=(z,I)=>({index:I,label:fh(z.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(I+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},y=v.__resolveType??"",L=b?.value,_=c?SZ(c):[],k=y&&c?mZ(y,c):null,{__resolveType:S,...w}=v,j=()=>{a(xZ(f)),u(0)},N=()=>{const z=bZ(f);a(z),u(z.variants.length-1)},A=z=>{const I=vZ(f,z);I&&(a(I),u(_Z(p,z,I.variants.length)))},C=z=>{const I=yZ(f,z);a(I),u(z+1)},T=(z,I)=>{const O=LZ(f,z,I);a(O),p===z&&u(I)},V=z=>{const I=z?vG(z,c):{__resolveType:Q6};a($4(f,p,I))},R=z=>{const I=z,O=y?{...I,__resolveType:y}:{...I};a($4(f,p,O))},P=z=>{a(wZ(f,p,z))},M=`${d}-${f.__resolveType}`;let D;e[9]!==o?(D=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=D):D=e[10];let $;return e[11]!==D?($=r.jsx(Mt,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(sZ,{listKey:M,variants:x,selectedIndex:p,onSelect:u,onDuplicate:C,onDelete:A,onRemoveAll:j,onReorder:T,onAdd:N}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(fZ,{currentRt:y,currentLabel:fh(v),matchers:_,onSelect:V}),k&&r.jsx("div",{className:"pt-1",children:r.jsx($r,{schema:k,value:w,onChange:R,basePath:""})})]}),n({...i,value:L,onChange:P})]})]})}const kZ="website/loaders/secret.ts";function gd(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 jZ(){return{__resolveType:kZ,name:"",encrypted:""}}function CZ(t){const{value:e,...s}=t;return s}function V9(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!gd(n)){const N=typeof n=="string"?n:"",A=a?.virtualMcpId;let C;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==A?(C=r.jsx($s,{htmlFor:l,label:o,description:s.description,virtualMcpId:A}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=A,e[4]=C):C=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let V;e[7]!==i?(V=M=>i(M.target.value),e[7]=i,e[8]=V):V=e[8];let R;e[9]!==l||e[10]!==N||e[11]!==T||e[12]!==V?(R=r.jsx(pt,{id:l,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:V,className:"h-10"}),e[9]=l,e[10]=N,e[11]=T,e[12]=V,e[13]=R):R=e[13];let P;return e[14]!==C||e[15]!==R?(P=r.jsxs("div",{className:"space-y-2",children:[C,R]}),e[14]=C,e[15]=R,e[16]=P):P=e[16],P}let d;e[17]!==n?(d=gd(n)?n:jZ(),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,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx($s,{htmlFor:m,label:o,description:s.description,virtualMcpId:p}),e[19]=o,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==h||e[27]!==i?(v=N=>i({...h,name:N.target.value}),e[26]=h,e[27]=i,e[28]=v):v=e[28];let y;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==v?(y=r.jsx(pt,{id:x,value:u,placeholder:b,onChange:v,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=v,e[33]=y):y=e[33];const L=`${l}-value`;let _;e[34]!==f||e[35]!==c?(_=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=_):_=e[36];let k;e[37]!==h||e[38]!==f||e[39]!==i?(k=N=>{const A=N.target.value;if(!A){i(f?CZ(h):h);return}i({...h,value:A})},e[37]=h,e[38]=f,e[39]=i,e[40]=k):k=e[40];let S;e[41]!==_||e[42]!==k||e[43]!==L?(S=r.jsx(pt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:_,onChange:k,className:"h-10"}),e[41]=_,e[42]=k,e[43]=L,e[44]=S):S=e[44];let w;e[45]!==f||e[46]!==c?(w=f&&r.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=w):w=e[47];let j;return e[48]!==S||e[49]!==w||e[50]!==g||e[51]!==y?(j=r.jsxs("div",{className:"space-y-2",children:[g,y,S,w]}),e[48]=S,e[49]=w,e[50]=g,e[51]=y,e[52]=j):j=e[52],j}function NZ(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("__")):[],o=[],l=d=>{d?.type==="object"&&d.properties&&o.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(o.length===0)return;if(i.length===0)return o.length===1?o[0]:void 0;let a,c=-1;for(const d of o){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 VZ(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 TZ=new Set(["__resolveType","@type"]);function AZ(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 EZ(t){if(Vf(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 B4(t){if(t.type==="array"&&t.items)return t;const e=t.items??EZ(t);return e?{...t,type:"array",items:e}:null}function PZ(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 mw(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=ai(n,s);return i?r.jsx($r,{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 Ja(t){const{schema:e,value:s}=t;if(rh(s)){const l=KG(s),a=B4(e);if(l!==null&&a)return r.jsx(s0,{...t,schema:a,value:l,onChange:c=>t.onChange(WG(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&Vf(e)){const l=B4(e);if(l)return r.jsx(s0,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!rh(s)&&e.type==="block-ref"){const l=NZ(e,s)??VZ(s);if(l){const a={...e,type:"array",items:l};return r.jsx(s0,{...t,schema:a,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(AZ(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=h=>Ja({...h,schema:c});return r.jsx(fw,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(V4,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(FX,{...t},t.path);if(e.format==="image-uri")return r.jsx(VX,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(jX,{...t},t.path);if(e.format==="map")return r.jsx(qX,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(eX,{...t},t.path);if(e.format==="location")return r.jsx(cw,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(KQ,{...t},t.path);if(e.type==="anyOf")return r.jsx(V4,{...t},t.path);if(gd(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(V9,{...t},t.path);if(!e.format&&!e.enum){const l=mw(t);if(l)return l}const n=s??PZ(e.type,e.default);if(n==null)return gd(s)?r.jsx(V9,{...t},t.path):null;if(gd(n))return r.jsx(V9,{...t,value:n},t.path);const i={...t,value:n},o=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(o==="array"||Array.isArray(n))return r.jsx(s0,{...i},t.path);switch(o){case"boolean":return r.jsx(BQ,{...i},t.path);case"number":case"integer":return r.jsx(OQ,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(e0,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(e0,{...i},t.path):r.jsx(e0,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(IJ,{...i},t.path):null;default:return r.jsx(e0,{...i},t.path)}}function RZ(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ja({...t,schema:e});const s=mw(t);return s||Ja(e?{...t,schema:e}:t)}function $r({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const m=re(),p=t.properties;if(!p)return t.type==="inline-union"?Ja({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}):null;if(HG(e)&&p.variants){const C=p.variants.items?.properties?.value;return r.jsx(fw,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:T=>RZ(T,C)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(C=>!TZ.has(C)&&p[C]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const v=(C,T)=>{if(T===void 0){const{[C]:V,...R}=g;s(R);return}s({...g,[C]:T})},y=typeof g.__resolveType=="string"?g.__resolveType:void 0,L=x.filter(C=>{const T=p[C];return T!=null&&Ta(T,g[C])}).length>1,_=pJ(x,p,g),k=i.length>0?xJ(x,p,g,i,a,l):null,S=k?p[k]:null,w=k&&S?[k]:x,j=k&&S?mJ(k,S,i,Bd(k,x,p)):i,N=fJ(i,j),A=N.length>0&&o?C=>o([...N,...C]):o;return r.jsx("div",{className:"min-w-0 space-y-6",children:w.map(C=>{const T=p[C];if(!T)return null;const V=n?`${n}.${C}`:C,R=Bd(C,x,p),P=dl(C,T),$=(N.length===0&&x.some(z=>{const I=p[z];return z!==C&&I!=null&&dl(z,I)===P})||N.length===0&&_.has(C))&&A?z=>A(uJ(R,z)):A;return Ja({schema:T,value:g[C],onChange:z=>v(C,z),path:V,label:R,required:b.has(C),breadcrumbPath:j,onBreadcrumbChange:$,hasSiblingDrillDownFields:L,focused:k===C,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:y,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function DZ(t){const e=F.c(3),{isPending:s,isError:n}=t;if(n){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[r.jsx(pn,{size:13}),"Couldn't save"]}),e[0]=o):o=e[0],o}if(s){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(ut,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[r.jsx(Et,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const z4=3e4;function IZ(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 MZ(t,{resolveType:e,props:s}){let n;try{n=await fetch(F6(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(z4)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${z4/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let o=null,l=!1;try{o=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&o&&typeof o=="object"&&"error"in o&&typeof o.error=="string"?o.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?o:i}function $Z(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>MZ(t,n)},e[0]=t,e[1]=s):s=e[1],Xs(s)}function pw({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:m=!0}){const p=re(),g=zr(),x=g?.entity?.id===e?g.entity.metadata?.siteSlug??null:null,b=ai(a.resolveType,i),v=!b&&hI(a.resolveType,i),y=v?fI(c):null,L=b??y,[_,k]=E.useState(c),[S,w]=E.useState([]),[j,N]=E.useState(0),[A,C]=E.useState(!1),[T,V]=E.useState(null),[R,P]=E.useState(!1),[M,D]=E.useState(!1),[$,z]=E.useState(!1),I=T!==null,{save:O,flush:B,isPending:U}=Z_({orgSlug:t,virtualMcpId:e,branch:s}),H=$Z({orgSlug:t,virtualMcpId:e,branch:s});E.useEffect(()=>()=>{B()},[]);const K=xL(l),W=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:x},Q=Z=>{k(Z),a.mode==="saved"&&O(a.blockKey,{__resolveType:a.resolveType,...Z})},te=()=>{I?(V(null),C(!1),N(Z=>Z+1)):V(JSON.stringify(_,null,2))},ee=Z=>{const le=Z??"";try{const ne=JSON.parse(le);if(ne&&typeof ne=="object"&&!Array.isArray(ne)){C(!1),Q(ne);return}C(!0)}catch{C(!0)}},oe=async Z=>{const le=ug(Z,o);if(le){pe.error(le);return}await h(Z,{__resolveType:a.resolveType,..._}),P(!1)},se=()=>{D(!0),H.mutate({resolveType:a.resolveType,props:_})},G=()=>{n&&window.open(IZ(n,a.resolveType,_,Date.now()),"_blank","noopener")},X=[a.title,...S],q=Z=>{w(S.slice(0,Z)),N(le=>le+1)};return r.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":p("sandbox.runnableBlockEditor.backToList"),children:r.jsx(Mh,{size:14})}),r.jsx("nav",{"aria-label":p("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:X.map((Z,le)=>{const ne=le===X.length-1,ae=Pn(Z);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[le>0&&r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>q(le),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",ne?"font-medium text-foreground":"text-muted-foreground"),children:ae})]},`${ae}-${le}`)})}),a.mode==="saved"&&r.jsx(DZ,{isPending:U,isError:!1}),m&&r.jsxs(he,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:se,disabled:H.isPending,"aria-label":p("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[H.isPending?r.jsx(ut,{size:14,className:"animate-spin"}):r.jsx(tl,{size:14}),p("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>P(!0),"aria-label":p("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:r.jsx(np,{size:14})})}),r.jsx(He,{side:"bottom",children:p("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:I?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:te,"aria-label":p(I?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":I,children:I?r.jsx(_s,{size:14}):r.jsx(To,{size:14})})}),r.jsx(He,{side:"bottom",children:p(I?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?p("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):p("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:W,singular:K})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:ie("relative min-h-0 flex-1",M&&$&&"hidden"),children:[r.jsx(No,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[y&&L===y&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:p("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:K})}),L?r.jsx($r,{schema:L,value:_,onChange:Z=>Q(Z),basePath:"",breadcrumbPath:S,onBreadcrumbChange:w,meta:i,decofile:o,onSaveReferencedBlock:u,sandbox:Y},j):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v?p("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):p("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),T!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[A&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:p("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(iu,{language:"json",height:"100%",code:T,onChange:ee,onSave:Z=>{ee(Z),B()}})})]})]}),M&&r.jsx(OZ,{singular:K,result:{isPending:H.isPending,error:H.error,data:H.data,hasRun:H.status!=="idle"},expanded:$,onToggleExpand:()=>z(Z=>!Z),onOpenInNewTab:n?G:void 0,onClose:()=>{D(!1),z(!1)}})]}),r.jsx(hg,{open:R,onOpenChange:P,defaultBlockId:"",isPending:d,onSubmit:oe})]})}function OZ(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,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 m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(mn,{size:14})})}),r.jsx(He,{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?r.jsx(qC,{size:14}):r.jsx(Ev,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==o||e[19]!==x||e[20]!==b?(v=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:o,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=o,e[19]=x,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==i||e[23]!==c?(y=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=y):y=e[24];let L;e[25]!==y?(L=r.jsx(He,{side:"bottom",children:y}),e[25]=y,e[26]=L):L=e[26];let _;e[27]!==L||e[28]!==v?(_=r.jsxs(Ke,{children:[v,L]}),e[27]=L,e[28]=v,e[29]=_):_=e[29];let k;e[30]!==c?(k=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=k):k=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(_s,{size:14}),e[32]=S):S=e[32];let w;e[33]!==a||e[34]!==k?(w=r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":k,children:S}),e[33]=a,e[34]=k,e[35]=w):w=e[35];let j;e[36]!==_||e[37]!==w||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,_,w]}),e[36]=_,e[37]=w,e[38]=g,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==p?(N=r.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=N):N=e[42];let A;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(A=r.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?r.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ut,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?r.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[r.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?r.jsx(iu,{language:"json",height:"100%",code:h,readOnly:!0}):r.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]=A):A=e[49];let C;return e[50]!==N||e[51]!==A||e[52]!==f?(C=r.jsxs("div",{className:f,children:[N,A]}),e[50]=N,e[51]=A,e[52]=f,e[53]=C):C=e[53],C}function BZ(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,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=bu(h);let f;e[4]!==u?(f=rg((_,k)=>u.mutate({blockKey:_,data:k})),e[4]=u,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=_L(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let _;e[9]!==d?(_=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=_):_=e[10];let k;return e[11]!==_?(k=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:_}),e[11]=_,e[12]=k):k=e[12],k}const v=`loader:${c}`;let y;e[13]!==c||e[14]!==g||e[15]!==b?(y={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=y):y=e[16];let L;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==o||e[22]!==x||e[23]!==u.isPending||e[24]!==m||e[25]!==v||e[26]!==y||e[27]!==n?(L=r.jsx(pw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:"loaders",target:y,initialValue:x,isCreating:u.isPending,onCreate:zZ,onSaveReferencedBlock:m,showRun:!1},v),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=o,e[22]=x,e[23]=u.isPending,e[24]=m,e[25]=v,e[26]=y,e[27]=n,e[28]=L):L=e[28],L}async function zZ(){}const FZ="https://github.com/decocms/blocks";function UZ(){const t=F.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(GC,{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 o;t[5]!==e?(o=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=o):o=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(mn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(he,{size:"sm",asChild:!0,children:r.jsxs("a",{href:FZ,target:"_blank",rel:"noreferrer",children:[o,l]})}),t[8]=o,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=r.jsx(_o,{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 HZ(t){const e=F.c(15),{source:s,onRetry:n}=t,i=re();let o;e[0]!==s||e[1]!==i?(o=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(pn,{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=r.jsx(he,{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=r.jsx(_o,{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 ul(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const KZ=E.lazy(()=>In(()=>import("./sections-editor-BKACmRBp.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])).then(t=>({default:t.SectionsEditor})));function F4(t){const e=F.c(46),{virtualMcpId:s,externalSelection:n}=t,i=n===void 0?null:n,{org:o}=We(),{currentBranch:l}=en(),a=$n(),c=Ll(),d=SL(),h=a.lifecycle.phase==="running",u=c.previewUrl;let f;e[0]!==l||e[1]!==o||e[2]!==u||e[3]!==s?(f=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,previewUrl:u}:null,e[0]=l,e[1]=o,e[2]=u,e[3]=s,e[4]=f):f=e[4];const m=f;let p;e[5]!==h?(p={fetchEnabled:h},e[5]=h,e[6]=p):p=e[6];const g=rf(m,p);let x;e[7]!==h?(x={fetchEnabled:h},e[7]=h,e[8]=x):x=e[8];const b=of(m,x),v=G_({lifecyclePhase:a.lifecycle.phase,decofile:nh(g),meta:nh(b),hasEditableContent:cf(g.data,b.data),fastPreviewActive:yl(s).active});if(v.kind==="loading"){let P;return e[9]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(ul,{}),e[9]=P):P=e[9],P}if(v.kind==="empty"){let P;return e[10]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(UZ,{}),e[10]=P):P=e[10],P}if(v.kind==="error"){let P;e[11]!==g||e[12]!==c||e[13]!==b||e[14]!==v.source?(P=()=>{if(v.source==="sandbox"){c.retry();return}Promise.all([g.refetch(),b.refetch()])},e[11]=g,e[12]=c,e[13]=b,e[14]=v.source,e[15]=P):P=e[15];const M=P;let D;return e[16]!==M||e[17]!==v.source?(D=r.jsx(HZ,{source:v.source,onRetry:M}),e[16]=M,e[17]=v.source,e[18]=D):D=e[18],D}const y=d.state.target;if(y?.kind==="loader"&&g.data&&b.data){const P=l??"",M=u??null;let D;return e[19]!==g.data||e[20]!==b.data||e[21]!==o.slug||e[22]!==P||e[23]!==M||e[24]!==y.key||e[25]!==s?(D=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(BZ,{orgSlug:o.slug,virtualMcpId:s,branch:P,previewUrl:M,meta:b.data,decofile:g.data,blockKey:y.key})}),e[19]=g.data,e[20]=b.data,e[21]=o.slug,e[22]=P,e[23]=M,e[24]=y.key,e[25]=s,e[26]=D):D=e[26],D}let L;e[27]!==l||e[28]!==o.slug||e[29]!==y||e[30]!==s?(L=y||!l?null:sg(tg(o.slug,s,l)),e[27]=l,e[28]=o.slug,e[29]=y,e[30]=s,e[31]=L):L=e[31];const _=L;let k="/",S=null,w=null;y?.kind==="page"?(k=y.path,S=y.key):y?.kind==="section"?w=y.key:_&&(k=_.path,S=_.pageKey);const j=S?`page:${S}`:w?`section:${w}`:`path:${k}`;let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),e[32]=N):N=e[32];const A=l??"",C=u??void 0,T=w?null:i,V=!!S&&d.state.editSeoPageKey===S;let R;return e[33]!==w||e[34]!==S||e[35]!==k||e[36]!==j||e[37]!==o.slug||e[38]!==V||e[39]!==A||e[40]!==C||e[41]!==T||e[42]!==s||e[43]!==d.consumeEditSeo||e[44]!==d.setVariantOverride?(R=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(E.Suspense,{fallback:N,children:r.jsx(KZ,{orgSlug:o.slug,virtualMcpId:s,branch:A,previewReady:!0,previewUrl:C,currentPath:k,activePageBlockKey:S,activeGlobalBlockKey:w,externalSelection:T,initialEditSeo:V,onExitSeo:d.consumeEditSeo,onVariantPreviewOverride:d.setVariantOverride},j)})}),e[33]=w,e[34]=S,e[35]=k,e[36]=j,e[37]=o.slug,e[38]=V,e[39]=A,e[40]=C,e[41]=T,e[42]=s,e[43]=d.consumeEditSeo,e[44]=d.setVariantOverride,e[45]=R):R=e[45],R}function WZ(t,e){return t===e?"preview":e}function qZ(t){return t.cmsDefaultOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const GZ="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",YZ="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",QZ=500,JZ={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},U4=1,T9=["desktop","mobile","tablet"],H4={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function K4(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function XZ(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.href}catch{return t}}function i0(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function A9(t,e){try{return new URL(t,e).href}catch{return null}}function ZZ(t){const{onOpen:e}=t,[s,n]=E.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function eee(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function tee({virtualMcpId:t}){const e=re(),s=Fh(),n=So(),i=hG(),o=Ot(),{currentBranch:l}=en(),a=SL(),c=xe=>{o({to:".",search:Pe=>({...Pe,main:xe}),replace:!0})},[d,h]=E.useState("preview"),[u,f]=E.useState(!1),[m,p]=E.useState("desktop"),[g,x]=E.useState(null),[b,v]=E.useState(null),y=E.useRef(null),L=E.useRef(null),[_,k]=E.useState({width:0,height:0}),[S,w]=E.useState(null),[j,N]=E.useState(!1),[A,C]=E.useState(""),T=E.useRef(null),[V,R]=E.useState(!1),[P,M]=E.useState(),[D,$]=E.useState(null),[z,I]=E.useState(null),[O,B]=E.useState(null),[U,H]=E.useState("/"),[K,W]=E.useState(null),[Y,Q]=E.useState({}),[te,ee]=E.useState(!1),oe=E.useRef(null),se=()=>{ee(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>ee(!1),15e3)},G=()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),ee(!1)},{org:X}=We(),q=$n(),Z=Ll(),le=Z.vmEntry,ne=Z.previewUrl,ae=q.lifecycle.phase,de=ae==="running",fe=le?.sandboxProviderKind==="user-desktop",ue=LL({orgSlug:X.slug,virtualMcpId:t??"",branch:l??"",enabled:fe&&de&&!!t&&!!l}),ge=fe?ue:null,J=zr(),me=J?.entity?.id===t?Xm(J.entity.metadata):null,ye=ou(),Le=J?.entity?.id===t&&ji(J.entity.metadata,ye).active,ke=kG({sandboxUrl:ne,previewServerUrl:me,fastPreviewActive:Le}),we=t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l,previewUrl:ne}:null,Ne=rf(we,{fetchEnabled:de}),Ae=of(we,{fetchEnabled:de}),be=Ne.data,Se=Ae.data,_e=`${t}:${l??""}`,[Ee,De]=E.useState(null),Ve=G_({lifecyclePhase:ae,decofile:nh(Ne),meta:nh(Ae),hasEditableContent:cf(be,Se),fastPreviewActive:Le,frameworkKnownMissing:Ee===_e});Ve.kind==="empty"&&Ve.reason==="framework-missing"&&Ee!==_e&&De(_e);const Ge=Ve.kind==="content",$e=t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l}:null,Fe=VG($e),Je=be?z0(be).sort((xe,Pe)=>xe.name.localeCompare(Pe.name)):[],at=be&&Se?d2(be,Se):[],Be=be&&Se?yL(Se,be,"loaders"):[],lt=go,rt=Je.filter(xe=>{if(!A)return!0;const Pe=A.toLowerCase();return xe.name.toLowerCase().includes(Pe)||xe.path.toLowerCase().includes(Pe)}),ct=at.filter(xe=>{if(!A)return!0;const Pe=A.toLowerCase();return xe.name.toLowerCase().includes(Pe)||xe.key.toLowerCase().includes(Pe)||xe.resolveType.toLowerCase().includes(Pe)}),dt=Be.filter(xe=>{if(!A)return!0;const Pe=A.toLowerCase();return xe.title.toLowerCase().includes(Pe)||xe.key.toLowerCase().includes(Pe)||xe.resolveType.toLowerCase().includes(Pe)}),bt=z?Be.find(xe=>xe.key===z)??null:null,tt=D||z?null:v1(Je,U,K),ft=D?D.name:bt?.title??tt?.name,ze=tt?.key??null,ve=tt?.path??null,Oe=(ze?Y[ze]:void 0)??{},nt=_r(U,Oe),Ye={};if(de&&ne&&Se&&be){const xe=tQ(Se,"loaders"),Pe=ze?be[ze]:void 0,vt=kY(Pe,be,gs=>xe.has(gs)),Ct=yY(vt);for(const gs of O0(U)){if(gs.type!=="param")continue;const un=xY(U,gs.name,vt),Hs=wY(un,xe,Ct);Hs.length>0&&(Ye[gs.name]=Hs)}}const _t=t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l}:null,ce=be&&ze?oL(be,ze,0):[],je=be?tL(ce,be):[],Re=je.map(xe=>xe.isSavedBlock?xe.label:""),Ie=je.map(xe=>xe.isSavedBlock?"global":xe.isMultivariate?"variant":"normal"),Xe=ce.map(xe=>F1(xe,be??{})),ot=E.useRef(null),yt=E.useRef(null),Tt=q.status.state==="paused",Ze=q.phase,is=dL({claimPhase:Ze,lifecycle:q.lifecycle}),Ht=Z.previewState,ps=Z.userStopped,Vs=(J?.entity?.id===t?J.entity.metadata?.ui?.layout?.cmsDefaultOpen:null)??!1,sn=Qh({mutationKey:cu(X.slug,t??"",l??"")})>0,{url:rs}=J_(Le&&t&&l?{orgSlug:X.slug,virtualMcpId:t,branch:l,previewServerUrl:me??null,path:nt}:null),xn=ye?.runtime==="sandbox",gt=eG({previewState:Ht,progressStatus:is.status,previewServerUrl:xn?null:me,fastPreviewActive:Le,fastPreviewReady:!!rs}),Rs=gt.mode!=="none",an=gt.mode==="production"&&gt.iframeBase?i0(gt.iframeBase):null,bn=!s,On=gt.mode==="production"?an:i0(ne),Xt=XZ(gt.mode==="sandbox"?w9(K4(O??A9(nt,gt.iframeBase)??gt.iframeBase,m),a.state.variantOverride??[]):gt.mode==="production"&&bn?w9(K4(Q_(O??rs??A9(nt,gt.iframeBase)??gt.iframeBase,gt.showWakingPill?SG:null),m),a.state.variantOverride??[]):null);E.useEffect(()=>{},[s,an,S]);const cn="sandbox.preview.openInNewTab",Xn=rs??(gt.iframeBase?A9(nt,gt.iframeBase):null),vn=gt.mode==="production"?Xn?w9(Xn,a.state.variantOverride??[]):null:Xt??gt.iframeBase,yn=async()=>{const xe=vn;if(xe){window.open(xe,"_blank","noopener");return}},_n=t&&l?tg(X.slug,t,l):null,Us=xe=>{_n&&mY(_n,xe)},Bt=a.state.target;E.useEffect(()=>{if(!(!Bt||!ke||!Se))if(Bt.kind==="page"){const xe=Y[Bt.key]??{};yt.current=_r(Bt.path,xe),$(null),I(null),B(null),W(Bt.key),H(Bt.path),Us({path:Bt.path,pageKey:Bt.key,params:xe})}else if(Bt.kind==="loader")yt.current=null,$(null),I(Bt.key),B(null);else{const xe=at.find(Pe=>Pe.key===Bt.key);if(xe){yt.current=null;const Pe=x1(Se);I(null),$(xe),B(d4(ke,Pe,xe.key))}}},[Bt,ke,Se,Y]),E.useEffect(()=>{!ze||ve===null||Bt?.kind==="page"&&Bt.key===ze&&Bt.path===ve||a.selectTarget({kind:"page",key:ze,path:ve})},[ze,ve,Bt]);const[Te,ht]=E.useState(null);if(Ht.kind==="iframe"&&Te!==Ht.previewUrl){const xe=Te!==null;ht(Ht.previewUrl);const Pe=_n?sg(_n):null;if(Pe){if(yt.current=_r(Pe.path,Pe.params),H(Pe.path),W(Pe.pageKey),B(null),$(null),I(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const vt=Pe.pageKey;Q(Ct=>({...Ct,[vt]:Pe.params}))}}else xe&&(yt.current=null,H("/"),B(null),W(null),$(null),I(null))}ot.current=Xt;const jt=iG({iframeRef:y,src:gt.mode==="sandbox"?Xt:null,active:gt.mode==="sandbox"}),cs=E.useRef(null);E.useEffect(()=>{if(!rs||!Xt||cs.current===rs)return;cs.current=rs;const xe=y.current;xe&&xe.getAttribute("src")!==Xt&&(se(),xe.src=Xt)},[rs,Xt]);const dn=!!t&&!!l&&!q.notFound&&!ps&&!Tt&&(Ze?.kind==="ready"||ae!=="idle"),Ss=gt.mode!=="sandbox"&&d==="visual"?"preview":d;E.useEffect(()=>{const xe=On;if(!xe)return;const Pe=vt=>{if(vt.origin===xe){if(vt.data?.type==="visual-editor::element-clicked"){const Ct=EG.safeParse(vt.data.payload);Ct.success&&x(Ct.data)}else if(vt.data?.type==="cms-editor::section-clicked"){const Ct=DG.safeParse(vt.data.payload);Ct.success&&v({index:Ct.data.sectionIndex,seq:Ct.data.clickSeq})}}};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[On]),E.useEffect(()=>{if(!j)return;const xe=Pe=>{T.current?.contains(Pe.target)||(N(!1),C(""))};return document.addEventListener("pointerdown",xe),()=>document.removeEventListener("pointerdown",xe)},[j]);const cr=()=>{const xe=y.current?.contentWindow,Pe=i0(ne);!xe||!Pe||xe.postMessage({type:"visual-editor::activate",script:PG},Pe)},Ff=()=>{const xe=y.current?.contentWindow,Pe=i0(ne);!xe||!Pe||xe.postMessage({type:"visual-editor::deactivate"},Pe)},Ii=()=>{const xe=y.current?.contentWindow,Pe=On;!xe||!Pe||(xe.postMessage(gt.mode==="production"?{type:"editor::inject",args:{script:f4}}:{type:"visual-editor::activate",script:f4},Pe),xe.postMessage({type:"cms-editor::set-labels",labels:Re,kinds:Ie,keys:Xe},Pe))},Fr=()=>{const xe=y.current?.contentWindow,Pe=On;!xe||!Pe||xe.postMessage({type:"cms-editor::deactivate"},Pe)},Zn=xe=>{const Pe=d;!n&&xe!==Pe&&(xe==="blocks"?L.current?.resize("30%"):L.current?.collapse()),h(xe),x(null),v(null),xe!=="blocks"&&I(null),Pe==="visual"&&Ff(),xe==="visual"&&cr(),Pe==="blocks"&&xe!=="blocks"&&Fr(),xe==="blocks"&&Ii()},dr=xe=>{f(!0),Zn(WZ(d,xe))},kc=qZ({cmsDefaultOpen:Vs,blocksReady:Ge,autoOpenResolved:u,editingMode:d}),Ur=()=>{f(!0),Zn("blocks")},Hr=()=>{if(!y.current||!Xt)return;se();const xe=y.current;xe.src=Xt},Kr=()=>{const xe=y.current;if(!xe)return;se();const Pe=document.activeElement,vt=xe.tabIndex;xe.tabIndex=-1,xe.style.pointerEvents="none",xe.blur(),eee(xe,ot.current);let Ct;const gs=()=>{clearTimeout(Ct),xe.tabIndex=vt,xe.style.pointerEvents="";const un=document.activeElement;(!un||un===document.body||un===xe)&&Pe?.focus(),xe.removeEventListener("load",gs)};xe.addEventListener("load",gs),Ct=setTimeout(gs,3e3)};$I(()=>{rs||Kr()}),OI(()=>{se()});const Wr=()=>{const xe=T9.indexOf(m);p(T9[(xe+1)%T9.length])},qr=async()=>{let xe=null;try{xe=y.current?.contentWindow?.location?.href??null}catch{}const Pe=xe??Xt??ne;if(Pe)try{await navigator.clipboard.writeText(Pe),pe.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{pe.error(e("sandbox.preview.failedToCopyUrl"))}},Gr=rG({iframeBase:gt.iframeBase,resolvedPath:nt,activeGlobalSectionName:D?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Po=xe=>{const Pe=Y[xe.key]??{},vt=_r(xe.path,Pe);(D||lt(vt)!==lt(nt))&&se(),yt.current=vt,$(null),I(null),B(null),v(null),W(xe.key),H(xe.path),Us({path:xe.path,pageKey:xe.key,params:Pe}),a.selectTarget({kind:"page",key:xe.key,path:xe.path})},Ro=(xe,Pe)=>{if(!ze)return;const vt=ze,Ct={...Oe,[xe]:Pe};yt.current=_r(U,Ct),Q(gs=>({...gs,[vt]:Ct})),Us({path:U,pageKey:vt,params:Ct})},Yr=xe=>{if(!ke||!Se){pe.error(e("sandbox.preview.previewMetadataNotReady"));return}se(),yt.current=null;const Pe=x1(Se),vt=d4(ke,Pe,xe.key);$(xe),I(null),B(vt),v(null),a.selectTarget({kind:"section",key:xe.key})},Qr=xe=>{$(null),I(xe.key),B(null),Zn("blocks"),a.selectTarget({kind:"loader",key:xe.key})},Jr=async({name:xe,path:Pe,templateKey:vt})=>{if(!t||!l)return;const Ct=l2(Pe);if(Ct){M(Ct);return}const gs=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(Je.some(Hs=>lt(Hs.path)===lt(gs))){M(e("sandbox.preview.pageAlreadyExists",{path:gs}));return}let un;if(vt&&(un=be?.[vt],!un)){M(e("sandbox.preview.templateNoLongerExists"));return}M(void 0);try{const Hs=await Fe.mutateAsync({name:xe,path:gs,template:un});R(!1),pe.success(e("sandbox.preview.pageCreated",{name:xe})),await ac(QZ),Po({key:Hs.key,name:Hs.name,path:Hs.path}),Zn("blocks")}catch(Hs){M(Hs instanceof Error?Hs.message:e("sandbox.preview.failedToCreatePage"))}},Bn=Rs&&(dn||gt.mode==="production"),ur=d==="blocks",hr=IG({showPreviewToolbar:Bn,blocksState:Ve}),Do=hr?r.jsx(X2,{title:e("sandbox.preview.cms"),tooltip:e(ur?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:YC},active:ur,onClick:()=>dr("blocks"),testId:"preview-blocks-toggle",dataTour:xo.edit}):null,fr=Bn?r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{onClick:Hr,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(Rn,{size:16})})}),r.jsx(He,{side:"bottom",children:e("sandbox.preview.refresh")})]}),hr&&r.jsxs("div",{ref:T,className:"relative min-w-0 w-64 shrink",children:[r.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:[r.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>N(xe=>!xe),children:[D&&r.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:[r.jsx(Er,{size:11}),"Global"]}),bt&&r.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:[r.jsx(Da,{size:11}),e("sandbox.preview.loaderBadge")]}),r.jsx("span",{className:ie("text-[13px] font-medium text-foreground",ft==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ft??Gr}),!D&&!z&&ft!=null&&U&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:O0(U).map((xe,Pe)=>{if(xe.type==="text")return r.jsx("span",{className:ie(Pe===0?"min-w-0 truncate":"shrink-0"),children:xe.text},`text-${Pe}`);const vt=Ye[xe.name];return vt&&_t?r.jsx(BY,{sources:vt,template:U,paramName:xe.name,value:Oe[xe.name]??"",sandboxRef:_t,onCommit:Ct=>Ro(xe.name,Ct)},`${ze}:${xe.name}`):r.jsx(JY,{name:xe.name,value:Oe[xe.name]??"",onCommit:Ct=>Ro(xe.name,Ct)},`${ze}:${xe.name}`)})})]}),r.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>N(xe=>!xe),"aria-label":e("sandbox.preview.choosePage"),children:r.jsx(Jt,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",j&&"rotate-180")})})]}),j&&r.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:[r.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[r.jsx(Gh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:A,onChange:xe=>C(xe.target.value),onKeyDown:xe=>{if(xe.key!=="Enter")return;const Pe=A.trim();if(!Pe)return;const vt=rt.find(Ct=>lt(Ct.path)===lt(Pe));vt&&(xe.preventDefault(),N(!1),C(""),Po(vt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),r.jsx("div",{className:"p-1.5 border-b",children:r.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:xe=>{xe.preventDefault(),N(!1),C(""),M(void 0),R(!0)},children:[r.jsx(Dt,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),rt.length===0&&ct.length===0&&dt.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Je.length===0&&at.length===0&&Be.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[rt.length>0&&r.jsx("div",{className:"p-1.5",children:rt.map(xe=>r.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(),N(!1),C(""),Po(xe)},children:[r.jsx(Cr,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.path})]},xe.key))}),ct.length>0&&r.jsxs("div",{className:ie("p-1.5",rt.length>0&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ct.map(xe=>r.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(),N(!1),C(""),Yr(xe)},children:[r.jsx(Er,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]}),dt.length>0&&r.jsxs("div",{className:ie("p-1.5",(rt.length>0||ct.length>0)&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),dt.map(xe=>r.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(),N(!1),C(""),Qr(xe)},children:[r.jsx(Da,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.title}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]})]})]})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{"aria-label":e(cn),onClick:()=>{yn()},children:r.jsx(mn,{size:16})})}),r.jsx(He,{side:"bottom",children:e(cn)})]})]}):null,Xr=Bn?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Do,Do&&r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),fr]}):null,Mi=Bn?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(Yn,{size:14})})}),r.jsxs(Yt,{align:"end",className:"w-44",children:[r.jsxs(et,{onClick:qr,children:[r.jsx(on,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),be&&Se&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),ze&&r.jsxs(et,{onClick:()=>{a.editSeo({kind:"page",key:ze,path:U}),Zn("blocks")},children:[r.jsx(lp,{size:14}),e("sandbox.preview.editSeo")]}),ze&&r.jsxs(et,{onClick:()=>{try{c(mC(HD(ze)))}catch{pe.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx(To,{size:14}),e("sandbox.preview.viewJson")]})]}),ge&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),r.jsxs(et,{onClick:()=>window.open(oh("vscode",ge)),children:[r.jsx("img",{src:GZ,alt:"VSCode",width:14,height:14}),e("sandbox.preview.openInVscode")]}),r.jsxs(et,{onClick:()=>window.open(oh("cursor",ge)),children:[r.jsx("img",{src:YZ,alt:"Cursor",width:14,height:14}),e("sandbox.preview.openInCursor")]})]}),r.jsx(er,{}),r.jsxs(et,{onClick:()=>Jq(e),children:[r.jsx(QC,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Zr=gt.mode==="sandbox",mi=JZ[m],pi=m==="desktop"&&(_.width===0||_.width>=mi.width+2*U4),mr=pi?1:Math.min(_.width>0?_.width/(mi.width+2*U4):1,1),eo=pi?{width:"100%",height:"100%"}:{width:`${mi.width}px`,height:_.height>0?`${_.height/mr}px`:`${mi.height}px`,transform:`scale(${mr})`,transformOrigin:"top center"},Tl=Rs?r.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:r.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[Zr&&r.jsxs(r.Fragment,{children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{onClick:()=>dr("visual"),"aria-pressed":d==="visual","aria-label":e("sandbox.preview.visualEditor"),active:d==="visual",className:"rounded-full","data-tour":xo.visualEditor,children:r.jsx(Yg,{size:16})})}),r.jsx(He,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(uo,{onClick:Wr,"aria-label":e(H4[m]),className:"rounded-full","data-tour":xo.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[m==="mobile"&&r.jsx(JC,{size:16}),m==="tablet"&&r.jsx(XC,{size:16}),m==="desktop"&&r.jsx(ZC,{size:16})]},m)})}),r.jsx(He,{side:"top",children:e(H4[m])})]})]})}):null,to=(n||!!z)&&Ss==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[kc&&r.jsx(ZZ,{onOpen:Ur}),_t&&Object.entries(Ye).map(([xe,Pe])=>(Oe[xe]??"")===""?r.jsx(YY,{sources:Pe,template:U,paramName:xe,sandboxRef:_t,onFill:vt=>Ro(xe,vt)},`${ze}:${xe}`):null),i?r.jsxs(r.Fragment,{children:[Bn&&r.jsx(dG,{children:Xr}),r.jsx(uG,{children:Mi})]}):(Bn||Mi)&&r.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:[r.jsx("div",{className:"flex flex-1 items-center justify-start",children:Do}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:fr}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:Mi})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:to?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(F4,{virtualMcpId:t,externalSelection:b}),n&&Tl]}):r.jsxs(N6,{orientation:"horizontal",disabled:Ss!=="blocks",children:[r.jsx($0,{ref:L,id:"preview-blocks-editor",defaultSize:Ss==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Ss==="blocks"&&r.jsx(F4,{virtualMcpId:t,externalSelection:b})}),Ss==="blocks"&&r.jsx(V6,{withHandle:!0}),r.jsx($0,{id:"preview-canvas",defaultSize:Ss==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:xe=>{if(!xe)return;const Pe=()=>k(Ct=>Ct.width===xe.clientWidth&&Ct.height===xe.clientHeight?Ct:{width:xe.clientWidth,height:xe.clientHeight});Pe();const vt=new ResizeObserver(Pe);return vt.observe(xe),()=>vt.disconnect()},className:ie("h-full relative overflow-hidden flex justify-center",Rs&&!pi&&"bg-muted/30"),children:[(te||sn)&&Rs&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),gt.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Va,{kind:"starting",progress:is,claimPhase:Ze})}),Ht.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Va,{kind:"suspended",onResume:Z.resume})}),Ht.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Va,{kind:"errored",error:Ht.error,onRetry:Z.retry,connectionsHref:`/${X.slug}/settings/connections`})}),gt.showWakingPill&&r.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[r.jsx(ut,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Ss==="visual"&&!g&&r.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-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:[r.jsx(Yg,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Ss==="visual"&&g&&r.jsx(XG,{element:g,onDismiss:()=>x(null)}),Tl,Rs&&Xt&&r.jsx("div",{className:ie("shrink-0",!pi&&"border-x border-border bg-background shadow-sm"),style:eo,children:r.jsx("iframe",{ref:y,src:Xt,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:jt.handleError,onLoad:()=>{if(jt.handleLoad(),G(),gt.mode!=="sandbox"){gt.mode==="production"&&!gt.showWakingPill&&d==="blocks"&&Ii();return}if(st("vm_preview_loaded",{view_mode:d,vm_id:le?.sandboxHandle??null}),!D)try{const xe=y.current?.contentWindow?.location?.pathname;if(!xe)return;const Pe=yt.current;if(Pe!==null&&(yt.current=null,lt(xe)!==lt(Pe))||lt(xe)===lt(nt))return;H(xe),Us({path:xe,pageKey:K,params:Oe})}catch{}d==="visual"&&cr(),d==="blocks"&&Ii()}},gt.iframeBase)})]})})]})}),r.jsx(AG,{open:V,onOpenChange:R,isPending:Fe.isPending,error:P,templates:Je,onSubmit:Jr})]})}function see(t){const e=F.c(22),{virtualMcpId:s}=t,n=re(),i=Fs(s),{activeTask:o,taskId:l,currentBranch:a}=en(),c=y8(l),[d,h]=E.useState(!1);if(_8({threadId:l,sandboxBranch:o?.branch??a,agentHasRepo:Qs(i?.metadata),threadHasRepo:Qs(c)||Qs(o?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(kn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=r.jsx(kn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsxs(he,{onClick:x,children:[b,v]}),e[9]=v,e[10]=y):y=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==y?(L=r.jsx(_o,{className:"h-full",image:m,title:p,description:g,actions:y}),e[11]=p,e[12]=g,e[13]=y,e[14]=L):L=e[14];let _;e[15]!==d?(_=r.jsx(Ap,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=_):_=e[16];let k;return e[17]!==L||e[18]!==_?(k=r.jsxs(r.Fragment,{children:[L,_]}),e[17]=L,e[18]=_,e[19]=k):k=e[19],k}let f;return e[20]!==s?(f=r.jsx(tee,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const nee="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",iee="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",ree=E.lazy(()=>In(()=>import("./file-explorer-DLJoQEI1.js"),__vite__mapDeps([150,1,2,83,84,77,4,5,6,7,8,9,10,11,12,13,14,15,3,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,78,79,80,81,82,85,86,87,88,89,90,91,92,93,94,95,96,97,110,102,103,104,105,106,107,108,109,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,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.FileExplorer})));function oee(t){const e=F.c(21),{openPath:s}=t,n=re(),i=zr(),{org:o}=We(),{currentBranch:l}=en(),a=i?.entity?.id??null,c=Ll(),d=$n(),h=c.vmEntry,u=d.lifecycle.phase==="running",f=h?.sandboxProviderKind==="user-desktop",m=a??"",p=l??"",g=f&&u&&!!a&&!!l;let x;e[0]!==o.slug||e[1]!==m||e[2]!==p||e[3]!==g?(x={orgSlug:o.slug,virtualMcpId:m,branch:p,enabled:g},e[0]=o.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x):x=e[4];const b=LL(x),v=f?b:null;if(!a||!l){let S;e[5]!==n?(S=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[5]=n,e[6]=S):S=e[6];let w;return e[7]!==S?(w=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:S}),e[7]=S,e[8]=w):w=e[8],w}let y;e[9]!==v||e[10]!==n?(y=v&&r.jsx("div",{className:"relative flex h-12 shrink-0 items-center border-b border-border/60 px-3 md:px-4",children:r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInVscode"),onClick:()=>window.open(oh("vscode",v)),children:r.jsx("img",{src:nee,alt:"VSCode",width:14,height:14})})}),r.jsx(He,{side:"bottom",children:n("mainPanelTabs.codeTab.openInVscode")})]}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInCursor"),onClick:()=>window.open(oh("cursor",v)),children:r.jsx("img",{src:iee,alt:"Cursor",width:14,height:14})})}),r.jsx(He,{side:"bottom",children:n("mainPanelTabs.codeTab.openInCursor")})]})]})}),e[9]=v,e[10]=n,e[11]=y):y=e[11];let L;e[12]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),e[12]=L):L=e[12];let _;e[13]!==l||e[14]!==s||e[15]!==o.slug||e[16]!==a?(_=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(E.Suspense,{fallback:L,children:r.jsx(ree,{orgSlug:o.slug,virtualMcpId:a,branch:l,openPath:s})})}),e[13]=l,e[14]=s,e[15]=o.slug,e[16]=a,e[17]=_):_=e[17];let k;return e[18]!==y||e[19]!==_?(k=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[y,_]}),e[18]=y,e[19]=_,e[20]=k):k=e[20],k}function lee(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 aee(t,e,s){return typeof t!="string"?null:lee(ai(t,e),s)}function gw(t,e,s){if(!e||typeof t!="string")return!1;const n=aee(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function cee({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ls(),i=nf(e),o=yl(e).active;return Xs({mutationKey:cu(t,e,s),mutationFn:async({blockKey:l})=>{if(o){const d=await O6({orgSlug:t,virtualMcpId:e,branch:s},{delete:[l]});return e2(n,{orgSlug:t,virtualMcpId:e,branch:s},d),await n.invalidateQueries({queryKey:xu(t,e,s)}),{ok:!0,existed:!0}}const a=tf(i,t2(l)),c=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a})});return c.ok?c.json():Zp(c,"Delete")},onMutate:async({blockKey:l})=>{const a=`${t}/${e}/${s}`,c=it.decofile(a);await n.cancelQueries({queryKey:c});const d=n.getQueryData(c),h=!!d&&l in d,u=d?.[l];return n.setQueryData(c,f=>{if(!f)return f;const{[l]:m,...p}=f;return p}),{queryKey:c,blockKey:l,hadKey:h,previousValue:u}},onError:(l,a,c)=>{c&&n.setQueryData(c.queryKey,d=>c.hadKey?{...d??{},[c.blockKey]:c.previousValue}:d)},onSuccess:()=>{n.invalidateQueries({queryKey:it.liveMeta(t,e,s)})}})}function da(t){const e=F.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let o;e[0]!==i||e[1]!==n||e[2]!==s?(o=s?"No results match your search.":r.jsxs(r.Fragment,{children:[r.jsx("div",{children:n}),r.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==o?(l=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=l):l=e[5],l}function If(t,e){return`${t}-${e}`}function xw(t,e){return`site/apps/${t}/${e}.ts`}function bw(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 dee(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function uee(t){return t==="local"?"Custom":"Installed"}function vw(t,e,s){const n=new Set([If(t,e),e].map(o=>o.toLowerCase())),i=xw(t,e);for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(o.toLowerCase())||a.__resolveType===i)return o}return null}function hee(t,e){const s=t.vendor.alias,n=t.name,i=vw(s,n,e);return{id:If(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:xw(s,n),blockKey:i,installed:i!==null}}function fee(t,e,s){if(t===c2)return null;const n=bw(t);if(!n)return null;const{vendor:i,app:o}=n,l=vw(i,o,s),a=Ao(t,e);return{id:If(i,o),app:o,vendor:i,title:a.title??o,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function mee(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Ga(t,e)||!e8(n))return null;const i=bw(n)??dee(t);if(!i)return null;const o=Ao(n,s),{vendor:l,app:a}=i;return{id:If(l,a),app:a,vendor:l,title:o.title??F0(t,e,s),description:o.description??"",category:uee(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function pee(t,e,s){const n=new Map;for(const o of t){const l=hee(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=fee(o,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=mee(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(gee)}function gee(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function xee(){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 bee(t,e,s){const n=F.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=it.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:xee,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Vt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?pee(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 vee(t){const e=F.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=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=r.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:r.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]!==o||e[8]!==d||e[9]!==h?(u=r.jsx(ei,{id:"pages",icon:Cr,label:d,count:n.pages,active:h,onSelect:o}),e[6]=n.pages,e[7]=o,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 m=s==="sections";let p;e[13]!==n.sections||e[14]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(ei,{id:"sections",icon:Er,label:f,count:n.sections,active:m,onSelect:o}),e[13]=n.sections,e[14]=o,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==o||e[22]!==x||e[23]!==g?(b=r.jsx(ei,{id:"apps",icon:by,label:g,count:n.apps,active:x,onSelect:o}),e[20]=n.apps,e[21]=o,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const y=s==="redirects";let L;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==y?(L=r.jsx(ei,{id:"redirects",icon:$v,label:v,count:n.redirects,active:y,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=y,e[31]=L):L=e[31];let _;e[32]!==l?(_=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=_):_=e[33];const k=s==="loaders";let S;e[34]!==n.loaders||e[35]!==o||e[36]!==_||e[37]!==k?(S=r.jsx(ei,{id:"loaders",icon:Da,label:_,count:n.loaders,active:k,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=_,e[37]=k,e[38]=S):S=e[38];let w;e[39]!==l?(w=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=w):w=e[40];const j=s==="actions";let N;e[41]!==n.actions||e[42]!==o||e[43]!==w||e[44]!==j?(N=r.jsx(ei,{id:"actions",icon:Ir,label:w,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=w,e[44]=j,e[45]=N):N=e[45];let A;e[46]!==l?(A=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=A):A=e[47];const C=s==="site";let T;e[48]!==o||e[49]!==A||e[50]!==C?(T=r.jsx(ei,{id:"site",icon:tp,label:A,active:C,onSelect:o}),e[48]=o,e[49]=A,e[50]=C,e[51]=T):T=e[51];let V;e[52]!==l?(V=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=V):V=e[53];const R=s==="seo";let P;e[54]!==o||e[55]!==V||e[56]!==R?(P=r.jsx(ei,{id:"seo",icon:lp,label:V,active:R,onSelect:o}),e[54]=o,e[55]=V,e[56]=R,e[57]=P):P=e[57];let M;e[58]!==l?(M=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=M):M=e[59];const D=s==="calendar";let $;e[60]!==o||e[61]!==M||e[62]!==D?($=r.jsx(ei,{id:"calendar",icon:jr,label:M,active:D,onSelect:o}),e[60]=o,e[61]=M,e[62]=D,e[63]=$):$=e[63];let z;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(z=i&&r.jsxs(r.Fragment,{children:[r.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:[r.jsx(Ra,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(ei,{id:"posts",icon:Li,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(ei,{id:"authors",icon:Ep,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(ei,{id:"categories",icon:Rh,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=o,e[69]=i,e[70]=l,e[71]=z):z=e[71];let I;e[72]!==b||e[73]!==L||e[74]!==S||e[75]!==N||e[76]!==T||e[77]!==P||e[78]!==$||e[79]!==z||e[80]!==u||e[81]!==p?(I=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,p,b,L,S,N,T,P,$,z]}),e[72]=b,e[73]=L,e[74]=S,e[75]=N,e[76]=T,e[77]=P,e[78]=$,e[79]=z,e[80]=u,e[81]=p,e[82]=I):I=e[82];let O;return e[83]!==c||e[84]!==I?(O=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,I]}),e[83]=c,e[84]=I,e[85]=O):O=e[85],O}function ei(t){const e=F.c(18),{id:s,icon:n,label:i,count:o,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=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==i?(f=r.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==o?(m=o!==void 0&&r.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=l,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==h||e[14]!==u||e[15]!==f||e[16]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:h,children:[u,f,m]}),e[12]=c,e[13]=h,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function yee(t){const e=F.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:o,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=dL({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=r.jsx(Va,{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]!==o?(a=r.jsx(Va,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==o||e[10]!==s.error?(a=r.jsx(Va,{kind:"errored",error:s.error,onRetry:o,connectionsHref:l}),e[8]=l,e[9]=o,e[10]=s.error,e[11]=a):a=e[11],a}}}const _ee=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Lee(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&&!_ee.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function W4(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 o=`${s} (copy ${i})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function wee(t,e){const s=go,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let o=2;o<1e3;o++){const l=`${n}-copy-${o}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function See(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 o=`${s}_copy_${i}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function kee(t){const e=Z2(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function jee(t,e){return X_(t,e)}const Cee=1e3;function Nee(t,e){for(let s=0;s<Cee;s++){const n=Z2(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Vee={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Tee={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Aee={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Eee(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=l===void 0?!1:l,m=re(),[p,g]=E.useState(i),[x,b]=E.useState(o),[v,y]=E.useState(bo),[L,_]=E.useState(null),[k,S]=E.useState(s);s!==k&&(S(s),s&&(g(i),b(o),y(bo),_(null)));const w=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=de=>{!de&&!f&&(_(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const N=j;let A;e[3]!==f||e[4]!==p||e[5]!==h||e[6]!==x||e[7]!==w||e[8]!==v||e[9]!==d?(A=async de=>{de.preventDefault();const fe=p.trim(),ue=x.trim();if(!fe||!ue||f)return;const ge=l2(ue);if(ge){_(ge);return}const J=d?.({name:fe,path:ue});if(J){_(J);return}_(null),await h({name:fe,path:ue,templateKey:w&&v!==bo?v:null})},e[3]=f,e[4]=p,e[5]=h,e[6]=x,e[7]=w,e[8]=v,e[9]=d,e[10]=A):A=e[10];const C=A,T=L??a,V=Vee[n];let R;e[11]!==m||e[12]!==V?(R=m(V),e[11]=m,e[12]=V,e[13]=R):R=e[13];let P;e[14]!==R?(P=r.jsx(ms,{children:r.jsx($t,{children:R})}),e[14]=R,e[15]=P):P=e[15];let M;e[16]!==f||e[17]!==w||e[18]!==m||e[19]!==v||e[20]!==c?(M=w&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),r.jsx(eL,{id:"page-form-template",value:v,onChange:y,templates:c??[],disabled:f})]}),e[16]=f,e[17]=w,e[18]=m,e[19]=v,e[20]=c,e[21]=M):M=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=D):D=e[23];let $;e[24]!==D?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=$):$=e[25];let z;e[26]===Symbol.for("react.memo_cache_sentinel")?(z=de=>g(de.target.value),e[26]=z):z=e[26];let I;e[27]!==m?(I=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=I):I=e[28];let O;e[29]!==f||e[30]!==p||e[31]!==I?(O=r.jsx(pt,{id:"page-form-name",value:p,onChange:z,placeholder:I,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=I,e[32]=O):O=e[32];let B;e[33]!==O||e[34]!==$?(B=r.jsxs("div",{className:"space-y-1.5",children:[$,O]}),e[33]=O,e[34]=$,e[35]=B):B=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let H;e[38]!==U?(H=r.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 K;e[40]===Symbol.for("react.memo_cache_sentinel")?(K=de=>b(de.target.value),e[40]=K):K=e[40];let W;e[41]!==m?(W=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=W):W=e[42];let Y;e[43]!==f||e[44]!==x||e[45]!==W?(Y=r.jsx(pt,{id:"page-form-path",value:x,onChange:K,placeholder:W,disabled:f}),e[43]=f,e[44]=x,e[45]=W,e[46]=Y):Y=e[46];let Q;e[47]!==H||e[48]!==Y?(Q=r.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[47]=H,e[48]=Y,e[49]=Q):Q=e[49];let te;e[50]!==T?(te=T&&r.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=te):te=e[51];let ee;e[52]!==B||e[53]!==Q||e[54]!==te||e[55]!==M?(ee=r.jsxs("div",{className:"space-y-4 py-4",children:[M,B,Q,te]}),e[52]=B,e[53]=Q,e[54]=te,e[55]=M,e[56]=ee):ee=e[56];let oe;e[57]!==u?(oe=()=>u(!1),e[57]=u,e[58]=oe):oe=e[58];let se;e[59]!==m?(se=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=se):se=e[60];let G;e[61]!==f||e[62]!==oe||e[63]!==se?(G=r.jsx(he,{type:"button",variant:"outline",onClick:oe,disabled:f,children:se}),e[61]=f,e[62]=oe,e[63]=se,e[64]=G):G=e[64];let X;e[65]!==f||e[66]!==p||e[67]!==x?(X=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=X):X=e[68];let q;e[69]!==f||e[70]!==n||e[71]!==m?(q=f?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),m(Aee[n])]}):m(Tee[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=q):q=e[72];let Z;e[73]!==X||e[74]!==q?(Z=r.jsx(he,{type:"submit",disabled:X,children:q}),e[73]=X,e[74]=q,e[75]=Z):Z=e[75];let le;e[76]!==G||e[77]!==Z?(le=r.jsxs(Gn,{children:[G,Z]}),e[76]=G,e[77]=Z,e[78]=le):le=e[78];let ne;e[79]!==C||e[80]!==ee||e[81]!==le||e[82]!==P?(ne=r.jsx(Pt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:C,children:[P,ee,le]})}),e[79]=C,e[80]=ee,e[81]=le,e[82]=P,e[83]=ne):ne=e[83];let ae;return e[84]!==N||e[85]!==s||e[86]!==ne?(ae=r.jsx(Rt,{open:s,onOpenChange:N,children:ne}),e[84]=N,e[85]=s,e[86]=ne,e[87]=ae):ae=e[87],ae}function Pee(t){const e=F.c(70),{open:s,blockKey:n,initialName:i,isPending:o,onSubmit:l,onOpenChange:a}=t,c=o===void 0?!1:o,d=re(),[h,u]=E.useState(i),[f,m]=E.useState(s);s!==f&&(m(s),s&&u(i));let p;e[0]!==c||e[1]!==a?(p=K=>{!K&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==h||e[5]!==l?(x=async K=>{K.preventDefault();const W=h.trim();!W||c||await l(W)},e[3]=c,e[4]=h,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx($t,{children:v}),e[9]=v,e[10]=y):y=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let _;e[13]!==L?(_=r.jsx(Dn,{children:L}),e[13]=L,e[14]=_):_=e[14];let k;e[15]!==y||e[16]!==_?(k=r.jsxs(ms,{children:[y,_]}),e[15]=y,e[16]=_,e[17]=k):k=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let w;e[20]!==S?(w=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=w):w=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=K=>u(K.target.value),e[22]=j):j=e[22];let N;e[23]!==c||e[24]!==h?(N=r.jsx(pt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=N):N=e[25];let A;e[26]!==w||e[27]!==N?(A=r.jsxs("div",{className:"space-y-1.5",children:[w,N]}),e[26]=w,e[27]=N,e[28]=A):A=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let T;e[31]!==C?(T=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=T):T=e[32];let V;e[33]!==n?(V=r.jsx(pt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=V):V=e[34];let R;e[35]!==T||e[36]!==V?(R=r.jsxs("div",{className:"space-y-1.5",children:[T,V]}),e[35]=T,e[36]=V,e[37]=R):R=e[37];let P;e[38]!==A||e[39]!==R?(P=r.jsxs("div",{className:"space-y-4 py-4",children:[A,R]}),e[38]=A,e[39]=R,e[40]=P):P=e[40];let M;e[41]!==a?(M=()=>a(!1),e[41]=a,e[42]=M):M=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let $;e[45]!==c||e[46]!==M||e[47]!==D?($=r.jsx(he,{type:"button",variant:"outline",onClick:M,disabled:c,children:D}),e[45]=c,e[46]=M,e[47]=D,e[48]=$):$=e[48];let z;e[49]!==c||e[50]!==h?(z=!h.trim()||c,e[49]=c,e[50]=h,e[51]=z):z=e[51];let I;e[52]!==c||e[53]!==d?(I=c?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=I):I=e[54];let O;e[55]!==z||e[56]!==I?(O=r.jsx(he,{type:"submit",disabled:z,children:I}),e[55]=z,e[56]=I,e[57]=O):O=e[57];let B;e[58]!==$||e[59]!==O?(B=r.jsxs(Gn,{children:[$,O]}),e[58]=$,e[59]=O,e[60]=B):B=e[60];let U;e[61]!==b||e[62]!==P||e[63]!==B||e[64]!==k?(U=r.jsx(Pt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[k,P,B]})}),e[61]=b,e[62]=P,e[63]=B,e[64]=k,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=r.jsx(Rt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function Ree(t){const e=F.c(7),{type:s}=t,n=yI[s];let i;e[0]!==n?(i=r.jsx(Ue,{asChild:!0,children:r.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 o=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==o?(l=r.jsx(He,{side:"left",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs(Ke,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const E9={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},gg=["posts","authors","categories"],xd={posts:"post",authors:"author",categories:"category"};function bd(t){return gg.includes(t)}const xg={posts:"post",authors:"author",categories:"category"},yw={posts:E9.post,authors:E9.author,categories:E9.category},Dee=Object.fromEntries(Object.entries(yw).map(([t,e])=>[e,t]));function Iee(t){return typeof t=="string"?Dee[t]??null:null}function wo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ys(t){return typeof t=="string"?t:""}function Mee(t,e){switch(t){case"posts":return{label:ys(e.title)||"Untitled post",subtitle:ys(e.slug)};case"authors":return{label:ys(e.name)||"Unnamed author",subtitle:ys(e.email)};case"categories":return{label:ys(e.name)||"Unnamed category",subtitle:ys(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function _w(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=wo(n);if(!i)continue;const o=Iee(i.__resolveType);if(!o)continue;const l=wo(i[xg[o]])??{},{label:a,subtitle:c}=Mee(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of gg)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function $ee(t,e){return _w(t)[e]}function zd(t,e){return $ee(t,e).map(s=>({key:s.key,payload:L0(wo(t[s.key])??void 0,e)}))}const q4=Object.freeze({});function L0(t,e){return t?wo(t[xg[e]])??q4:q4}function r0(t,e,s){return{name:t,__resolveType:yw[e],[xg[e]]:s}}function ihe({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:ys(wo(f)?.[s]),l=f=>typeof f=="string"?f:ys(wo(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>ys(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>ys(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:ys(m.name)||ys(m[s])||f})),d=new Map,h=[];return i.forEach((f,m)=>{const p=a(f);if(p){h.includes(p.key)||h.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),h.push(g),c.push({value:g,label:l(f)||o(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function Lw(t){const e=ys(t.status);return e===""||e==="published"}function hl(t){return Array.isArray(t)?t:[]}function Vr(t){if(typeof t=="string")return t;const e=wo(t);return e?ys(e.slug):""}function Oee(t){if(typeof t=="string")return t;const e=wo(t);return e?ys(e.email):""}function ww(t){const e=[];return ys(t.title).trim()||e.push("Title"),ys(t.slug).trim()||e.push("Slug"),hl(t.categories).map(Vr).filter(Boolean).length===0&&e.push("Category"),ys(t.excerpt).trim()||e.push("Excerpt"),ys(t.image).trim()||e.push("Cover image"),e}function rhe(t){return!Lw(t)&&ww(t).length>0}function Sw(t){return zd(t,"posts").map(({key:e,payload:s})=>({key:e,title:ys(s.title)||"Untitled post",slug:ys(s.slug),date:ys(s.date),categorySlugs:hl(s.categories).map(Vr).filter(Boolean),authorEmails:hl(s.authors).map(Oee).filter(Boolean),missing:ww(s),published:Lw(s)}))}function Bee(t,e){const s=hl(t.categories);return s.some(n=>Vr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function zee(t,e){const s=hl(t.categories);return s.length===1&&Vr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function ohe(t,e,s){const n=hl(t.categories);if(!n.some(a=>Vr(a)===e))return t;const i=n.map(a=>{const c=Vr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=Vr(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function Fee(t,e){const s=hl(t.categories);return s.some(n=>Vr(n)===e)?{...t,categories:s.filter(n=>Vr(n)!==e)}:t}function G4(t){return{...t,dateModified:new Date().toISOString()}}function W1(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 Y4(t,e){const s=`collections/blog/${e}/${W1(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Uee(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${W1(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-${W1(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Hee={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"}},Q4="Box";function Kee(t){return t.startsWith("site/")?"site":"app"}function Wee(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Mc(...t){for(const e of t)if(e!==void 0)return e}function lhe(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const o of Object.keys(i)){if(!Yee(o)||e.has(o))continue;e.add(o);const l=Ao(o,t),a=qee(o),c=Hee[a],d=Kee(o),h=(d==="site"?Mc(l.title,c?.title):Mc(c?.title,l.title))??a,u=d==="site"?Mc(l.description,c?.description):Mc(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Wee(f)?f:void 0,p=m!==void 0?c?.iconName??Q4:Mc(f,c?.iconName)??Q4;s.push({resolveType:o,title:h,description:u,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function qee(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Gee=["blog/sections/blocks/","site/sections/Blog/Post/"];function Yee(t){return Gee.some(e=>t.startsWith(e))}function Qee({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,h]=E.useState(!1),[u,f]=E.useState(c),[m,p]=E.useState(!1),g=!i||a,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},v=async y=>{if(!i||m)return;let L;try{L=JSON.parse(y)}catch{pe.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(L),pe.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(_){pe.error(o("sectionsEditor.pageJsonDialog.saveError",{error:_ instanceof Error?_.message:String(_)}))}finally{p(!1)}};return r.jsx(Rt,{open:t,onOpenChange:e,children:r.jsxs(Pt,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(ms,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx($t,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(he,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(ui,{size:12}):r.jsx(on,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(he,{size:"sm",onClick:()=>v(u),disabled:!x||m,className:"h-7 text-xs",children:o(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",o("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"h-[70vh]",children:r.jsx(iu,{code:c,language:"json",readOnly:g,height:"100%",onChange:y=>f(y??""),onSave:y=>{v(y)}})})]})})}function xi(t){const e=F.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,active:l,accent:a,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let y;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(y=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(He,{side:"right",children:[c," variants"]})]})}):n?r.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):r.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",v?"bg-global-section/15":"bg-muted"),children:r.jsx(s,{size:16,className:ie("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:n2}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=y):y=e[5];const L=y,_=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let k;e[6]!==_?(k=ie("group relative flex min-w-0 items-center rounded-md transition-colors",_),e[6]=_,e[7]=k):k=e[7];let S;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==i?(S=h&&r.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:Jee,children:r.jsx(lc,{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]=S):S=e[13];const w=m&&!l&&"text-destructive";let j;e[14]!==w?(j=ie("block truncate text-sm font-medium",w),e[14]=w,e[15]=j):j=e[15];let N;e[16]!==j||e[17]!==i?(N=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=N):N=e[18];const A=l?"text-accent-foreground/70":"text-muted-foreground";let C;e[19]!==A?(C=ie("block truncate text-xs",A),e[19]=A,e[20]=C):C=e[20];let T;e[21]!==o||e[22]!==C?(T=r.jsx("span",{className:C,children:o}),e[21]=o,e[22]=C,e[23]=T):T=e[23];let V;e[24]!==T||e[25]!==N?(V=r.jsxs("span",{className:"min-w-0 flex-1",children:[N,T]}),e[24]=T,e[25]=N,e[26]=V):V=e[26];let R;e[27]!==l||e[28]!==m||e[29]!==p?(R=m&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(pn,{size:14})})}),p&&r.jsx(He,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=R):R=e[30];let P;e[31]!==x||e[32]!==L||e[33]!==V||e[34]!==R||e[35]!==d?(P=r.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:[L,V,R,d]}),e[31]=x,e[32]=L,e[33]=V,e[34]=R,e[35]=d,e[36]=P):P=e[36];let M;e[37]!==l||e[38]!==b?(M=b&&r.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]=M):M=e[39];let D;return e[40]!==P||e[41]!==M||e[42]!==k||e[43]!==S?(D=r.jsxs("div",{className:k,children:[S,P,M]}),e[40]=P,e[41]=M,e[42]=k,e[43]=S,e[44]=D):D=e[44],D}function Jee(t){return t.stopPropagation()}function ho(t){const e=F.c(10),{icon:s,title:n,description:i}=t;let o;e[0]!==s?(o=s&&r.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==n?(l=r.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&r.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]!==o||e[7]!==l||e[8]!==a?(c=r.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:[o,l,a]}),e[6]=o,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Xee={loaders:Da,actions:Ir},Zee={loaders:"Loaders",actions:"Actions"},ete={analytics:sV,blog:Ra,commerce:Vp,site:eN,website:Mn};function tte(t,e){return e===0?ete[t.toLowerCase()]??Pr:Pr}function o0(t,e){return e===0?iQ(t):t}function ste(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,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]=E.useState(h),[m,p]=E.useState(null),[g,x]=E.useState(""),[b,v]=E.useState(dte),[y,L]=E.useState(c);y!==c&&(L(c),f([]),p(null),x(""),v(new Set));let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=U=>{v(H=>{const K=new Set(H);return K.has(U)?K.delete(U):K.add(U),K})},e[1]=_):_=e[1];const k=_;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const w=bu(S);let j;e[6]!==w?(j=rg((U,H)=>w.mutate({blockKey:U,data:H})),e[6]=w,e[7]=j):j=e[7];const N=j;let A;e[8]!==c?(A=xL(c),e[8]=c,e[9]=A):A=e[9];const C=A,T=Xee[c];let V,R,P,M,D,$,z;if(e[10]!==T||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==o||e[19]!==w||e[20]!==N||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){P=Symbol.for("react.early_return_sentinel");e:{const U=[...yL(l,a,c).map(cte),...bL(l,c).map(ate)],H=g.trim().toLowerCase(),K=H.length>0,W=K?U.filter(be=>be.title.toLowerCase().includes(H)||be.resolveType.toLowerCase().includes(H)):[],Y=new Map,Q=[],te=new Map;if(!K){for(const be of U){const Se=be.folderPath;if(!(Se.length<u.length)&&u.every((_e,Ee)=>Se[Ee]===_e))if(Se.length===u.length)if(be.savedKey!==void 0){const _e=te.get(be.resolveType);_e?_e.push(be):te.set(be.resolveType,[be])}else Q.push(be);else{const _e=Se[u.length],Ee=Y.get(_e)??{count:0,savedCount:0};be.savedKey!==void 0?Ee.savedCount=Ee.savedCount+1:Ee.count=Ee.count+1,Y.set(_e,Ee)}}Q.sort(lte);for(const be of te.values())be.sort(ote)}const ee=[...te.entries()].filter(be=>{const[Se]=be;return!Q.some(_e=>_e.resolveType===Se)}).flatMap(rte).sort(ite);let oe;e[33]!==u?(oe=(be,Se)=>o0(be.name,u.length).localeCompare(o0(Se.name,u.length)),e[33]=u,e[34]=oe):oe=e[34];const se=[...Y.entries()].map(nte).sort(oe);let G;e[35]===Symbol.for("react.memo_cache_sentinel")?(G=be=>{p(be.savedKey!==void 0?{mode:"saved",key:be.savedKey}:{mode:"available",resolveType:be.resolveType,title:be.title})},e[35]=G):G=e[35];const X=G;let q;e[36]!==w||e[37]!==C||e[38]!==d?(q=async(be,Se)=>{await w.mutateAsync({blockKey:be,data:Se}),pe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:be})),p({mode:"saved",key:be})},e[36]=w,e[37]=C,e[38]=d,e[39]=q):q=e[39];const Z=q;let le;e[40]!==a||e[41]!==m?(le=ute(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ne=le;if(ne){const be=`${ne.mode}:${ne.mode==="saved"?ne.blockKey:ne.resolveType}`;let Se;e[43]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>p(null),e[43]=Se):Se=e[43];let _e;e[44]!==i||e[45]!==a||e[46]!==Z||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==w.isPending||e[52]!==N||e[53]!==be||e[54]!==ne.editorTarget||e[55]!==ne.initialValue||e[56]!==n?(_e=r.jsx(pw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:ne.editorTarget,initialValue:ne.initialValue,isCreating:w.isPending,onCreate:Z,onSaveReferencedBlock:N,onBack:Se},be),e[44]=i,e[45]=a,e[46]=Z,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=w.isPending,e[52]=N,e[53]=be,e[54]=ne.editorTarget,e[55]=ne.initialValue,e[56]=n,e[57]=_e):_e=e[57],P=_e;break e}z="flex h-full w-full min-w-0 flex-col";let ae;e[58]!==d?(ae=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ae):ae=e[59];let de;e[60]===Symbol.for("react.memo_cache_sentinel")?(de=()=>f([]),e[60]=de):de=e[60];const fe=u.length===0?"font-medium text-foreground":"text-muted-foreground";let ue;e[61]!==fe?(ue=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",fe),e[61]=fe,e[62]=ue):ue=e[62];const ge=Zee[c];let J;e[63]!==ue||e[64]!==ge?(J=r.jsx("button",{type:"button",onClick:de,className:ue,children:ge}),e[63]=ue,e[64]=ge,e[65]=J):J=e[65];let me;e[66]!==u?(me=u.map((be,Se)=>{const _e=Se===u.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(u.slice(0,Se+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:o0(be,Se)})]},`${be}-${Se}`)}),e[66]=u,e[67]=me):me=e[67];let ye;e[68]!==ae||e[69]!==J||e[70]!==me?(ye=r.jsxs("nav",{"aria-label":ae,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[J,me]}),e[68]=ae,e[69]=J,e[70]=me,e[71]=ye):ye=e[71];let Le;e[72]===Symbol.for("react.memo_cache_sentinel")?(Le=r.jsx(Gh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Le):Le=e[72];let ke;e[73]===Symbol.for("react.memo_cache_sentinel")?(ke=be=>x(be.target.value),e[73]=ke):ke=e[73];let we;e[74]!==c||e[75]!==d?(we=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=we):we=e[76];let Ne;e[77]!==c||e[78]!==d?(Ne=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ne):Ne=e[79];let Ae;e[80]!==g||e[81]!==we||e[82]!==Ne?(Ae=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Le,r.jsx("input",{type:"text",value:g,onChange:ke,placeholder:we,"aria-label":Ne,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=we,e[82]=Ne,e[83]=Ae):Ae=e[83],e[84]!==ye||e[85]!==Ae?(R=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ye,Ae]}),e[84]=ye,e[85]=Ae,e[86]=R):R=e[86],V=No,$="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",M="mx-auto w-full max-w-4xl px-6 py-5",D=K?W.length===0?r.jsx(ho,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):r.jsx("div",{className:"flex flex-col gap-1",children:W.map(be=>r.jsx(xi,{icon:T,accent:be.savedKey!==void 0?"global":void 0,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>X(be)},be.savedKey??be.resolveType))}):se.length===0&&Q.length===0&&ee.length===0?r.jsx(ho,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[se.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:se.map(be=>{const Se=tte(be.name,u.length);return r.jsxs("button",{type:"button",onClick:()=>f([...u,be.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:[r.jsx(Se,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:o0(be.name,u.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[be.count," ",be.count===1?C:c,be.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:be.savedCount})]})]})]})]},be.name)})}),(Q.length>0||ee.length>0)&&r.jsxs("div",{className:ie("flex flex-col gap-1",se.length>0&&"mt-4"),children:[Q.map(be=>{const Se=te.get(be.resolveType)??[],_e=b.has(be.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(xi,{icon:T,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>X(be)}),Se.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>k(be.resolveType),"aria-expanded":_e,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:n2},children:[_e?r.jsx(Jt,{size:12,className:"shrink-0"}):r.jsx(gn,{size:12,className:"shrink-0"}),d(_e?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Se.length,")"]}),_e&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Se.map(Ee=>r.jsx(xi,{icon:T,accent:"global",title:Ee.title,subtitle:Ee.resolveType,active:!1,onClick:()=>X(Ee)},Ee.savedKey))})]})]},be.resolveType)}),ee.map(be=>r.jsx(xi,{icon:T,accent:"global",title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>X(be)},be.savedKey))]})]})}e[10]=T,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=u,e[18]=o,e[19]=w,e[20]=N,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=V,e[27]=R,e[28]=P,e[29]=M,e[30]=D,e[31]=$,e[32]=z}else V=e[26],R=e[27],P=e[28],M=e[29],D=e[30],$=e[31],z=e[32];if(P!==Symbol.for("react.early_return_sentinel"))return P;let I;e[87]!==M||e[88]!==D?(I=r.jsx("div",{className:M,children:D}),e[87]=M,e[88]=D,e[89]=I):I=e[89];let O;e[90]!==V||e[91]!==I||e[92]!==$?(O=r.jsx(V,{className:$,children:I}),e[90]=V,e[91]=I,e[92]=$,e[93]=O):O=e[93];let B;return e[94]!==R||e[95]!==O||e[96]!==z?(B=r.jsxs("div",{className:z,children:[R,O]}),e[94]=R,e[95]=O,e[96]=z,e[97]=B):B=e[97],B}function nte(t){const[e,s]=t;return{name:e,...s}}function ite(t,e){return t.title.localeCompare(e.title)}function rte(t){const[,e]=t;return e}function ote(t,e){return t.title.localeCompare(e.title)}function lte(t,e){return t.title.localeCompare(e.title)}function ate(t){return{resolveType:t.resolveType,title:t.title,folderPath:vL(t.resolveType)}}function cte(t){return{resolveType:t.resolveType,title:t.title,folderPath:vL(t.resolveType),savedKey:t.key}}function dte(){return new Set}function ute(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}=_L(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function hte(t){const e=F.c(104),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:m}=t,p=re(),g=zr(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,y]=E.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[_,k]=E.useState(L),[S,w]=E.useState(0),[j,N]=E.useState(!1);let A;e[2]!==l||e[3]!==c?(A=ai(c,l),e[2]=l,e[3]=c,e[4]=A):A=e[4];const C=A;let T,V,R,P,M,D,$,z;if(e[5]!==x||e[6]!==i||e[7]!==a||e[8]!==_||e[9]!==v||e[10]!==u||e[11]!==f||e[12]!==s||e[13]!==o||e[14]!==c||e[15]!==p||e[16]!==d||e[17]!==n){const W=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,Y=o??void 0;let Q;e[26]!==x||e[27]!==i||e[28]!==s||e[29]!==Y||e[30]!==n?(Q={orgSlug:s,virtualMcpId:n,branch:i,previewUrl:Y,siteSlug:x},e[26]=x,e[27]=i,e[28]=s,e[29]=Y,e[30]=n,e[31]=Q):Q=e[31],V=Q;let te,ee,oe,se;if(e[32]!==a||e[33]!==_||e[34]!==v||e[35]!==f||e[36]!==p||e[37]!==d){const fe=[d,..._],ue=J=>{k(_.slice(0,J)),w(fte)};let ge;e[46]!==a||e[47]!==v||e[48]!==f?(ge=async J=>{const me=ug(J,a);if(me){pe.error(me);return}await f(J,v),N(!1)},e[46]=a,e[47]=v,e[48]=f,e[49]=ge):ge=e[49],T=ge,z="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",M="shrink-0 border-b px-3 py-2.5",se="flex min-w-0 items-center gap-2 overflow-hidden",e[50]!==p?(te=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[50]=p,e[51]=te):te=e[51],ee="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=fe.map((J,me)=>{const ye=me===fe.length-1,Le=Pn(J);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[me>0&&r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>ue(me),title:Le,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ye?"font-medium text-foreground":"text-muted-foreground"),children:Le})]},`${Le}-${me}`)}),e[32]=a,e[33]=_,e[34]=v,e[35]=f,e[36]=p,e[37]=d,e[38]=T,e[39]=te,e[40]=ee,e[41]=oe,e[42]=se,e[43]=M,e[44]=$,e[45]=z}else T=e[38],te=e[39],ee=e[40],oe=e[41],se=e[42],M=e[43],$=e[44],z=e[45];let G;e[52]!==te||e[53]!==ee||e[54]!==oe?(G=r.jsx("nav",{"aria-label":te,className:ee,children:oe}),e[52]=te,e[53]=ee,e[54]=oe,e[55]=G):G=e[55];let X;e[56]===Symbol.for("react.memo_cache_sentinel")?(X=()=>N(!0),e[56]=X):X=e[56];let q;e[57]!==p?(q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[57]=p,e[58]=q):q=e[58];let Z;e[59]===Symbol.for("react.memo_cache_sentinel")?(Z=r.jsx(np,{size:14}),e[59]=Z):Z=e[59];let le;e[60]!==u||e[61]!==q?(le=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:X,"aria-label":q,children:Z})}),e[60]=u,e[61]=q,e[62]=le):le=e[62];let ne;e[63]!==p?(ne=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[63]=p,e[64]=ne):ne=e[64];let ae;e[65]!==ne?(ae=r.jsx(He,{side:"bottom",children:ne}),e[65]=ne,e[66]=ae):ae=e[66];let de;e[67]!==le||e[68]!==ae?(de=r.jsxs(Ke,{children:[le,ae]}),e[67]=le,e[68]=ae,e[69]=de):de=e[69],e[70]!==se||e[71]!==G||e[72]!==de?(D=r.jsxs("div",{className:se,children:[G,de]}),e[70]=se,e[71]=G,e[72]=de,e[73]=D):D=e[73],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",P=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:W}),e[5]=x,e[6]=i,e[7]=a,e[8]=_,e[9]=v,e[10]=u,e[11]=f,e[12]=s,e[13]=o,e[14]=c,e[15]=p,e[16]=d,e[17]=n,e[18]=T,e[19]=V,e[20]=R,e[21]=P,e[22]=M,e[23]=D,e[24]=$,e[25]=z}else T=e[18],V=e[19],R=e[20],P=e[21],M=e[22],D=e[23],$=e[24],z=e[25];let I;e[74]!==R||e[75]!==P?(I=r.jsx("p",{className:R,children:P}),e[74]=R,e[75]=P,e[76]=I):I=e[76];let O;e[77]!==I||e[78]!==M||e[79]!==D?(O=r.jsxs("div",{className:M,children:[D,I]}),e[77]=I,e[78]=M,e[79]=D,e[80]=O):O=e[80];let B;e[81]!==a||e[82]!==_||e[83]!==S||e[84]!==v||e[85]!==l||e[86]!==m||e[87]!==V||e[88]!==C||e[89]!==p?(B=r.jsx(No,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:C?r.jsx($r,{schema:C,value:v,onChange:W=>y(W),basePath:"",breadcrumbPath:_,onBreadcrumbChange:k,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:V},S):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[81]=a,e[82]=_,e[83]=S,e[84]=v,e[85]=l,e[86]=m,e[87]=V,e[88]=C,e[89]=p,e[90]=B):B=e[90];let U;e[91]!==O||e[92]!==B||e[93]!==$?(U=r.jsxs("div",{className:$,children:[O,B]}),e[91]=O,e[92]=B,e[93]=$,e[94]=U):U=e[94];let H;e[95]!==h||e[96]!==T||e[97]!==u||e[98]!==j?(H=r.jsx(hg,{open:j,onOpenChange:N,defaultBlockId:h,isPending:u,onSubmit:T}),e[95]=h,e[96]=T,e[97]=u,e[98]=j,e[99]=H):H=e[99];let K;return e[100]!==U||e[101]!==H||e[102]!==z?(K=r.jsxs("div",{className:z,children:[U,H]}),e[100]=U,e[101]=H,e[102]=z,e[103]=K):K=e[103],K}function fte(t){return t+1}var mte=Object.prototype.toString,Lc=Array.isArray||function(e){return mte.call(e)==="[object Array]"};function bg(t){return typeof t=="function"}function pte(t){return Lc(t)?"array":typeof t}function P9(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function J4(t,e){return t!=null&&typeof t=="object"&&e in t}function gte(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var xte=RegExp.prototype.test;function bte(t,e){return xte.call(t,e)}var vte=/\S/;function yte(t){return!bte(vte,t)}var _te={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Lte(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return _te[s]})}var wte=/\s*/,Ste=/\s+/,X4=/\s*=/,kte=/\s*\}/,jte=/#|\^|\/|>|\{|&|=|!/;function Cte(t,e){if(!t)return[];var s=!1,n=[],i=[],o=[],l=!1,a=!1,c="",d=0;function h(){if(l&&!a)for(;o.length;)delete i[o.pop()];else o=[];l=!1,a=!1}var u,f,m;function p(w){if(typeof w=="string"&&(w=w.split(Ste,2)),!Lc(w)||w.length!==2)throw new Error("Invalid tags: "+w);u=new RegExp(P9(w[0])+"\\s*"),f=new RegExp("\\s*"+P9(w[1])),m=new RegExp("\\s*"+P9("}"+w[1]))}p(e||Ai.tags);for(var g=new vu(t),x,b,v,y,L,_;!g.eos();){if(x=g.pos,v=g.scanUntil(u),v)for(var k=0,S=v.length;k<S;++k)y=v.charAt(k),yte(y)?(o.push(i.length),c+=y):(a=!0,s=!0,c+=" "),i.push(["text",y,x,x+1]),x+=1,y===`
541
541
  `&&(h(),c="",d=0,s=!1);if(!g.scan(u))break;if(l=!0,b=g.scan(jte)||"name",g.scan(wte),b==="="?(v=g.scanUntil(X4),g.scan(X4),g.scanUntil(f)):b==="{"?(v=g.scanUntil(m),g.scan(kte),g.scanUntil(f),b="&"):v=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?L=[b,v,x,g.pos,c,d,s]:L=[b,v,x,g.pos],d++,i.push(L),b==="#"||b==="^")n.push(L);else if(b==="/"){if(_=n.pop(),!_)throw new Error('Unopened section "'+v+'" at '+x);if(_[1]!==v)throw new Error('Unclosed section "'+_[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&p(v)}if(h(),_=n.pop(),_)throw new Error('Unclosed section "'+_[1]+'" at '+g.pos);return Vte(Nte(i))}function Nte(t){for(var e=[],s,n,i=0,o=t.length;i<o;++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 Vte(t){for(var e=[],s=e,n=[],i,o,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"/":o=n.pop(),o[5]=i[2],s=n.length>0?n[n.length-1][4]:e;break;default:s.push(i)}return e}function vu(t){this.string=t,this.tail=t,this.pos=0}vu.prototype.eos=function(){return this.tail===""};vu.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};vu.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 Xa(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Xa.prototype.push=function(e){return new Xa(e,this)};Xa.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var i=this,o,l,a,c=!1;i;){if(e.indexOf(".")>0)for(o=i.view,l=e.split("."),a=0;o!=null&&a<l.length;)a===l.length-1&&(c=J4(o,l[a])||gte(o,l[a])),o=o[l[a++]];else o=i.view[e],c=J4(i.view,e);if(c){n=o;break}i=i.parent}s[e]=n}return bg(n)&&(n=n.call(this.view)),n};function Cn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Cn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Cn.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Ai.tags).join(":"),o=typeof n<"u",l=o?n.get(i):void 0;return l==null&&(l=Cte(e,s),o&&n.set(i,l)),l};Cn.prototype.render=function(e,s,n,i){var o=this.getConfigTags(i),l=this.parse(e,o),a=s instanceof Xa?s:new Xa(s,void 0);return this.renderTokens(l,a,n,e,i)};Cn.prototype.renderTokens=function(e,s,n,i,o){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,o):c==="^"?d=this.renderInverted(a,s,n,i,o):c===">"?d=this.renderPartial(a,s,n,o):c==="&"?d=this.unescapedValue(a,s):c==="name"?d=this.escapedValue(a,s,o):c==="text"&&(d=this.rawValue(a)),d!==void 0&&(l+=d);return l};Cn.prototype.renderSection=function(e,s,n,i,o){var l=this,a="",c=s.lookup(e[1]);function d(f){return l.render(f,s,n,o)}if(c){if(Lc(c))for(var h=0,u=c.length;h<u;++h)a+=this.renderTokens(e[4],s.push(c[h]),n,i,o);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],s.push(c),n,i,o);else if(bg(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,o);return a}};Cn.prototype.renderInverted=function(e,s,n,i,o){var l=s.lookup(e[1]);if(!l||Lc(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,o)};Cn.prototype.indentPartial=function(e,s,n){for(var i=s.replace(/[^ \t]/g,""),o=e.split(`
542
542
  `),l=0;l<o.length;l++)o[l].length&&(l>0||!n)&&(o[l]=i+o[l]);return o.join(`
543
- `)};Cn.prototype.renderPartial=function(e,s,n,i){if(n){var o=this.getConfigTags(i),l=bg(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,o);return this.renderTokens(u,s,n,h,i)}}};Cn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Cn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ai.escape,o=s.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===Ai.escape?String(o):i(o)};Cn.prototype.rawValue=function(e){return e[1]};Cn.prototype.getConfigTags=function(e){return Lc(e)?e:e&&typeof e=="object"?e.tags:void 0};Cn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Lc(e))return e.escape};var Ai={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){Fd.templateCache=t},get templateCache(){return Fd.templateCache}},Fd=new Cn;Ai.clearCache=function(){return Fd.clearCache()};Ai.parse=function(e,s){return Fd.parse(e,s)};Ai.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+pte(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Fd.render(e,s,n,i)};Ai.escape=Lte;Ai.Scanner=vu;Ai.Context=Xa;Ai.Writer=Cn;function Tte(t,e){const s={__resolveType:t},n=tL([s],e)[0];return n?cJ(s,n,e):null}function Ate({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=zr(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=E.useState(()=>Tte(l,o)),[f,m]=E.useState(u?.data??{}),[p,g]=E.useState([]),[x,b]=E.useState(0),[v,y]=E.useState(!1),[L,_]=E.useState(null),k=L!==null,{save:S,flush:w}=Z_({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?ai(u.resolveType,i):null,N=o[l],A=N?rl(l,N):l,C={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:h},T=D=>{m(D),S(l,D)},V=()=>{k?(_(null),y(!1),b(D=>D+1)):_(JSON.stringify(f,null,2))},R=D=>{const $=D??"";try{const z=JSON.parse($);if(z&&typeof z=="object"&&!Array.isArray(z)){y(!1),T(z);return}y(!0)}catch{y(!0)}},P=[A,...p],M=D=>{g(p.slice(0,D)),b($=>$+1)};return r.jsx("div",{className:"flex h-full w-full min-w-0",children:r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:n2},"aria-hidden":!0}),r.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:P.map((D,$)=>{const z=$===P.length-1,I=Pn(D);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>M($),title:I,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",z?"font-medium text-foreground":"text-muted-foreground"),children:I})]},`${I}-${$}`)})}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:V,"aria-label":c(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?r.jsx(_s,{size:14}):r.jsx(To,{size:14})})}),r.jsx(He,{side:"bottom",children:c(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),r.jsxs("div",{className:"relative min-h-0 flex-1",children:[r.jsx(No,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:j?r.jsx($r,{schema:j,value:f,onChange:D=>T(D),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:C},x):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),L!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(iu,{language:"json",height:"100%",code:L,onChange:R,onSave:D=>{R(D),w()}})})]})]})]})})}function Ete(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,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=r.jsx(ho,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=GL(s.title),e[7]=s.title,e[8]=v):v=e[8];let y;e[9]!==h||e[10]!==s.resolveType?(y=(_,k)=>h(s.resolveType,_,k),e[9]=h,e[10]=s.resolveType,e[11]=y):y=e[11];let L;return e[12]!==o||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]!==v||e[23]!==y||e[24]!==i?(L=r.jsx(hte,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:y,onSaveReferencedBlock:u},g),e[12]=o,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]=v,e[23]=y,e[24]=i,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==o||e[27]!==c||e[28]!==a||e[29]!==u||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=r.jsx(Ate,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},m),e[26]=o,e[27]=c,e[28]=a,e[29]=u,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Z4="__all__",e5={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Pte={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},R9={published:"sandbox.postToolbar.statusPublished",draft:"sandbox.postToolbar.statusDraft"},t5=E.forwardRef(function(e,s){const n=F.c(20);let i,o,l,a,c;n[0]!==e?({icon:i,active:o,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=l,n[4]=a,n[5]=c):(i=n[1],o=n[2],l=n[3],a=n[4],c=n[5]);const d=o?"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=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&r.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Jt,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(p=r.jsxs(he,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...a,children:[u,f,m]}),n[14]=a,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=p):p=n[19],p});function vg(t){const e=F.c(2),{count:s}=t;let n;return e[0]!==s?(n=r.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 Rte(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:o,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,m=re();let p;if(e[0]!==s||e[1]!==o){let ne;e[3]!==o?(ne=ae=>ae.slug===o,e[3]=o,e[4]=ne):ne=e[4],p=s.find(ne),e[0]=s,e[1]=o,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let ne;e[8]!==l?(ne=ae=>ae.email===l,e[8]=l,e[9]=ne):ne=e[9],x=n.find(ne),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(o||l||a);let y;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(y=g?.name??b?.name??m(a?R9[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=y):y=e[14];const L=y,_=o?`cat:${o}`:l?`author:${l}`:a?`status:${a}`:Z4;let k;e[15]!==h||e[16]!==d||e[17]!==u?(k=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=k):k=e[18];const S=k;let w;e[19]!==S||e[20]!==h||e[21]!==d||e[22]!==u?(w=ne=>{ne.startsWith("cat:")?(h(null),u(null),d(ne.slice(4))):ne.startsWith("author:")?(d(null),u(null),h(ne.slice(7))):ne==="status:published"||ne==="status:draft"?(d(null),h(null),u(ne==="status:published"?"published":"draft")):S()},e[19]=S,e[20]=h,e[21]=d,e[22]=u,e[23]=w):w=e[23];const j=w;let N;e[24]!==L||e[25]!==v?(N=r.jsx(Gt,{asChild:!0,children:r.jsx(t5,{icon:tN,active:v,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=v,e[26]=N):N=e[26];let A;e[27]!==m?(A=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=A):A=e[28];let C;e[29]!==A?(C=r.jsx(Cc,{children:A}),e[29]=A,e[30]=C):C=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let V;e[33]!==T?(V=r.jsx(Zi,{value:Z4,children:T}),e[33]=T,e[34]=V):V=e[34];let R;e[35]!==m?(R=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=R):R=e[36];let P;e[37]!==R?(P=r.jsx(Cc,{className:"text-muted-foreground/70",children:R}),e[37]=R,e[38]=P):P=e[38];let M;e[39]===Symbol.for("react.memo_cache_sentinel")?(M=Object.keys(R9),e[39]=M):M=e[39];let D;e[40]!==i||e[41]!==m?(D=M.map(ne=>r.jsxs(Zi,{value:`status:${ne}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(R9[ne])}),r.jsx(vg,{count:i[ne]})]},`status:${ne}`)),e[40]=i,e[41]=m,e[42]=D):D=e[42];let $;e[43]!==s.length||e[44]!==m?($=s.length>0&&r.jsx(Cc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=$):$=e[45];let z;e[46]!==s?(z=s.map(Ite),e[46]=s,e[47]=z):z=e[47];let I;e[48]!==n.length||e[49]!==m?(I=n.length>0&&r.jsx(Cc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=I):I=e[50];let O;e[51]!==n?(O=n.map(Dte),e[51]=n,e[52]=O):O=e[52];let B;e[53]!==_||e[54]!==j||e[55]!==V||e[56]!==P||e[57]!==D||e[58]!==$||e[59]!==z||e[60]!==I||e[61]!==O?(B=r.jsxs(Td,{value:_,onValueChange:j,children:[V,P,D,$,z,I,O]}),e[53]=_,e[54]=j,e[55]=V,e[56]=P,e[57]=D,e[58]=$,e[59]=z,e[60]=I,e[61]=O,e[62]=B):B=e[62];let U;e[63]!==B||e[64]!==C?(U=r.jsxs(Yt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[C,B]}),e[63]=B,e[64]=C,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==N?(H=r.jsxs(qt,{children:[N,U]}),e[66]=U,e[67]=N,e[68]=H):H=e[68];let K;e[69]!==S||e[70]!==v||e[71]!==m?(K=v&&r.jsx(Mte,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=m,e[72]=K):K=e[72];const W=Pte[c];let Y;e[73]!==m||e[74]!==W?(Y=m(W),e[73]=m,e[74]=W,e[75]=Y):Y=e[75];let Q;e[76]!==Y?(Q=r.jsx(Gt,{asChild:!0,children:r.jsx(t5,{icon:sN,active:!0,value:Y})}),e[76]=Y,e[77]=Q):Q=e[77];let te;e[78]!==m?(te=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=te):te=e[79];let ee;e[80]!==te?(ee=r.jsx(Cc,{children:te}),e[80]=te,e[81]=ee):ee=e[81];let oe;e[82]!==f?(oe=ne=>f(ne),e[82]=f,e[83]=oe):oe=e[83];let se;e[84]===Symbol.for("react.memo_cache_sentinel")?(se=Object.keys(e5),e[84]=se):se=e[84];let G;e[85]!==m?(G=se.map(ne=>r.jsx(Zi,{value:ne,children:m(e5[ne])},ne)),e[85]=m,e[86]=G):G=e[86];let X;e[87]!==c||e[88]!==oe||e[89]!==G?(X=r.jsx(Td,{value:c,onValueChange:oe,children:G}),e[87]=c,e[88]=oe,e[89]=G,e[90]=X):X=e[90];let q;e[91]!==ee||e[92]!==X?(q=r.jsxs(Yt,{align:"end",className:"w-44",children:[ee,X]}),e[91]=ee,e[92]=X,e[93]=q):q=e[93];let Z;e[94]!==Q||e[95]!==q?(Z=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(qt,{children:[Q,q]})}),e[94]=Q,e[95]=q,e[96]=Z):Z=e[96];let le;return e[97]!==H||e[98]!==K||e[99]!==Z?(le=r.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,K,Z]}),e[97]=H,e[98]=K,e[99]=Z,e[100]=le):le=e[100],le}function Dte(t){return r.jsxs(Zi,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(vg,{count:t.count})]},`author:${t.email}`)}function Ite(t){return r.jsxs(Zi,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(vg,{count:t.count})]},`cat:${t.slug}`)}function Mte(t){const e=F.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(_s,{size:12}),e[0]=i):i=e[0];let o;return e[1]!==s||e[2]!==n?(o=r.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]=o):o=e[3],o}function $te(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,o=re();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o?(a=o(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=r.jsx(Ue,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Ote,children:r.jsx(lc,{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]!==o?(d=o(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=o,e[12]=d):d=e[12];let h;e[13]!==d?(h=r.jsx(He,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=r.jsxs(Ke,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Ote(t){return t.stopPropagation()}function Bte(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=r.jsx($te,{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=r.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 m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Zs,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==u||e[13]!==f?(p=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:o,"aria-label":f,children:m})}),e[11]=o,e[12]=u,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=r.jsx(He,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(Ke,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(_s,{size:14}),e[24]=y):y=e[24];let L;e[25]!==l||e[26]!==v?(L=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:y})}),e[25]=l,e[26]=v,e[27]=L):L=e[27];let _;e[28]!==a?(_=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=_):_=e[29];let k;e[30]!==_?(k=r.jsx(He,{side:"bottom",children:_}),e[30]=_,e[31]=k):k=e[31];let S;e[32]!==L||e[33]!==k?(S=r.jsxs(Ke,{children:[L,k]}),e[32]=L,e[33]=k,e[34]=S):S=e[34];let w;e[35]!==b||e[36]!==S?(w=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=w):w=e[37];let j;return e[38]!==c||e[39]!==w||e[40]!==h?(j=r.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,w]}),e[38]=c,e[39]=w,e[40]=h,e[41]=j):j=e[41],j}function $c(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,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=r.jsx(Yn,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=r.jsx(Gt,{asChild:!0,children:r.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:zte,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(et,{onClick:n,children:[r.jsx(cp,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&r.jsxs(et,{onClick:s,children:[r.jsx(on,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),r.jsxs(et,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(Hh,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==o||e[15]!==l||e[16]!==c?(g=(o||l)&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),o&&r.jsxs(et,{onClick:o,children:[r.jsx(lp,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(et,{onClick:l,children:[r.jsx(To,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=o,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(er,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Zs,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let y;e[22]!==a||e[23]!==v?(y=r.jsxs(et,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=y):y=e[24];let L;e[25]!==y||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=r.jsxs(Yt,{align:"end",className:"w-44",children:[f,m,p,g,x,y]}),e[25]=y,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let _;return e[31]!==L||e[32]!==u?(_=r.jsxs(qt,{children:[u,L]}),e[31]=L,e[32]=u,e[33]=_):_=e[33],_}function zte(t){return t.stopPropagation()}function Fte(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Ute(t){const e=new Map;for(const s of t){const n=Fte(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 s5(t){const e=F.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=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]=o):o=e[1];let l;e[2]!==s?(l=r.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:o,children:[l,n]}),e[4]=n,e[5]=o,e[6]=l,e[7]=a):a=e[7],a}const n5=E.lazy(()=>In(()=>import("./app-editor-CClK5ocS.js"),__vite__mapDeps([151,1,2,16,52,53,15,3,18,4,5,6,7,8,9,10,11,12,13,14,17,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,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,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,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.AppEditor}))),Hte=E.lazy(()=>In(()=>import("./post-editor-DXF_bdFs.js"),__vite__mapDeps([152,1,2,5,34,4,6,7,8,9,10,11,12,13,14,15,3,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,96,95,153,129,133,130,131,72,108,105,100,126,154,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,97,155,156,102,103,104,106,107,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,132,134,135,98,136,137,138,139,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.PostEditor}))),Kte=E.lazy(()=>In(()=>import("./record-editor-SauBdytI.js"),__vite__mapDeps([157,1,2,96,95,53,15,3,18,126,155,4,5,6,7,8,9,10,11,12,13,14,16,17,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,156,78,73,72,74,57,58,59,75,76,77,79,60,80,81,82,52,54,55,56,61,62,63,64,65,66,67,68,69,70,71,83,84,85,86,87,88,89,90,91,92,93,94,97,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,129,130,131,132,133,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.RecordEditor}))),Wte=E.lazy(()=>In(()=>import("./category-editor-DCes96yT.js"),__vite__mapDeps([158,1,2,10,4,5,6,7,8,9,11,12,13,14,15,3,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,110,96,95,154,130,131,72,108,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,97,155,156,102,103,104,105,106,107,109,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,132,133,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.CategoryEditor}))),qte=E.lazy(()=>In(()=>import("./bulk-category-panel-BLk77HCA.js"),__vite__mapDeps([159,1,2,4,5,6,7,8,9,10,11,12,13,14,15,3,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,95,53,78,73,72,74,57,58,59,75,76,77,79,60,80,81,82,52,54,55,56,61,62,63,64,65,66,67,68,69,70,71,83,84,85,86,87,88,89,90,91,92,93,94,96,97,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,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.BulkCategoryPanel}))),Gte=E.lazy(()=>In(()=>import("./sections-editor-DHi-y1Qr.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])).then(t=>({default:t.SectionsEditor}))),Yte=E.lazy(()=>In(()=>import("./seo-editor-C0yrgVaA.js"),__vite__mapDeps([160,1,2,16,4,5,6,7,8,9,10,11,12,13,14,15,3,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,99,100,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,98,136,137,138,139,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.SeoEditor}))),Qte=E.lazy(()=>In(()=>import("./variant-calendar-D8gSD-Zc.js"),__vite__mapDeps([161,1,2,4,5,6,7,8,9,10,11,12,13,14,15,3,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,95,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,96,97,100,162])).then(t=>({default:t.VariantCalendar}))),Jte=E.lazy(()=>In(()=>import("./redirect-editor-DOZ_6ItM.js"),__vite__mapDeps([163,1,2,133,15,96,95,53,3,18,156,7,78,73,72,22,24,74,57,58,59,75,76,77,79,60,80,81,82,52,4,5,6,8,9,10,11,12,13,14,16,17,19,20,21,23,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,54,55,56,61,62,63,64,65,66,67,68,69,70,71,83,84,85,86,87,88,89,90,91,92,93,94,97,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,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.RedirectEditor})));function Xte(t){const e=F.c(20),{deepLinkPage:s}=t,n=zr(),{currentBranch:i}=en(),{org:o}=We(),l=n?.entity?.id??null,a=$n(),c=Ll(),{active:d,previewServerUrl:h}=yl(l);let u;e[0]!==d||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(u=Lee({fastPreviewActive:d,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=d,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=u):u=e[3];const f=u;if(f.kind==="sandbox-card"){const g=`/${o.slug}/settings/connections`;let x;return e[4]!==f.state||e[5]!==c.start||e[6]!==g||e[7]!==a.lifecycle||e[8]!==a.phase?(x=r.jsx(yee,{state:f.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:g}),e[4]=f.state,e[5]=c.start,e[6]=g,e[7]=a.lifecycle,e[8]=a.phase,e[9]=x):x=e[9],x}if(!l||!i){let g;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(ho,{title:"Waiting for sandbox context…"}),e[10]=g):g=e[10],g}const m=d?h:c.previewUrl;let p;return e[11]!==i||e[12]!==s||e[13]!==f.devServerReady||e[14]!==f.sandboxWarming||e[15]!==c.previewUrl||e[16]!==o.slug||e[17]!==m||e[18]!==l?(p=r.jsx(ese,{orgSlug:o.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:m,deepLinkPage:s,devServerReady:f.devServerReady,sandboxWarming:f.sandboxWarming}),e[11]=i,e[12]=s,e[13]=f.devServerReady,e[14]=f.sandboxWarming,e[15]=c.previewUrl,e[16]=o.slug,e[17]=m,e[18]=l,e[19]=p):p=e[19],p}const i5=2e3,Zte=15;function r5(t,e,s,n){return typeof e!="string"||s&&(gw(e,s,n)||t.state.dataUpdateCount>=Zte)?!1:i5}function ese({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:o,devServerReady:l,sandboxWarming:a}){const c={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n},{data:d,isLoading:h}=rf(c,{fetchEnabled:l}),[u,f]=E.useState("pages"),[m,p]=E.useState(null),[g,x]=E.useState(null),b=!!(o?.pageId||o?.path||o?.pathTemplate),[v,y]=E.useState(!1);if(b&&!v&&m===null&&d){y(!0);const ce=jI(z0(d),o??{});ce&&(f("pages"),p({collection:"pages",key:ce.key,path:ce.path}))}const[L,_]=E.useState(""),[k,S]=E.useState(null),[w,j]=E.useState(null),[N,A]=E.useState(null),[C,T]=E.useState("date-desc"),[V,R]=E.useState(()=>new Set),[P,M]=E.useState(null),D=()=>{R(new Set),M(null)},$=ce=>{p(ce),x(null)},[z,I]=E.useState(u);z!==u&&(I(u),_(""),S(null),j(null),A(null),T("date-desc"),R(new Set),M(null));const{data:O,isLoading:B,isFetching:U}=of(c,{fetchEnabled:l,refetchInterval:ce=>{const je=ce.state.data;if(u==="apps"&&m&&m.collection==="apps"){const Re=d?.[m.key];return r5(ce,typeof Re?.__resolveType=="string"?Re.__resolveType:void 0,je)}if(u==="site"&&d){const Re=je?y1(d,je):null,Ie=d.site,Xe=Re?.resolveType??(typeof Ie?.__resolveType=="string"?Ie.__resolveType:void 0);return r5(ce,Xe,je,["seo"])}return!1}}),H=(ce,je)=>!gw(ce,O,je)&&(B||U),{catalog:K,isLoading:W}=bee(O??void 0,d??void 0,{enabled:u==="apps"}),Y=bu(c),Q=cee(c),[te,ee]=E.useState(null),[oe,se]=E.useState(),[G,X]=E.useState(null),[q,Z]=E.useState(null),[le,ne]=E.useState(null),ae=!d||!O;if(h||B||ae&&a)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})});if(ae)return r.jsx(ho,{title:"Could not load site data."});const de=z0(d).sort((ce,je)=>ce.name.localeCompare(je.name)),fe=c8(d).sort((ce,je)=>ce.from.localeCompare(je.from)),ue=d2(d,O),ge=u==="sections"?bI(O):[],J=y1(d,O),me=_w(d),ye=gg.some(ce=>me[ce].length>0),Le=bd(u)?me[u]:[],ke=(ye?zd(d,"categories"):[]).map(({key:ce,payload:je})=>{const Re=typeof je.slug=="string"?je.slug:"",Ie=typeof je.name=="string"?je.name:"";return{slug:Re||ce,name:Ie||Re||ce}}).filter(ce=>ce.slug).sort((ce,je)=>ce.name.localeCompare(je.name)),we=u==="posts"&&(V.size>0||P!==null),Ne=we?Sw(d).filter(ce=>V.has(ce.key)):[],Ae=b4(O,"loaders"),be=b4(O,"actions");if(!cf(d,O)&&!ye&&Ae===0&&be===0)return r.jsx(ho,{icon:pn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Se={pages:de.length,sections:ue.length,apps:K.length,loaders:Ae,actions:be,redirects:fe.length,posts:me.posts.length,authors:me.authors.length,categories:me.categories.length},_e=new Set(de.map(ce=>go(ce.path))),Ee=new Set(de.map(ce=>ce.name)),De=new Set(ue.map(ce=>ce.name)),Ve=async ce=>{const je=d[ce.key];if(!je)return;const Re=rL(d,ce.key),Ie=oL(d,ce.key,Math.max(0,Re-1)),Xe=GG(je.sections,Ie);if(Xe)try{await Y.mutateAsync({blockKey:ce.key,data:{...je,sections:Xe}}),pe.success(`Variant added to "${ce.name}"`),p({collection:"pages",key:ce.key,path:ce.path})}catch(ot){pe.error(ot instanceof Error?ot.message:"Could not add variant")}},Ge=()=>{se(void 0),ee({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},$e=ce=>{se(void 0),ee({mode:"duplicate",sourceKey:ce.key,initialName:W4(Ee,ce.name),initialPath:wee(_e,ce.path)})},Fe=ce=>{se(void 0),ee({mode:"rename",sourceKey:ce.key,initialName:ce.name,initialPath:ce.path})},Je=async ce=>{if(!te)return;const{mode:je,sourceKey:Re}=te;try{if(je==="create"){let Ie;if(ce.templateKey){const ot=d[ce.templateKey];if(!ot)throw new Error("Selected template no longer exists.");Ie={...ot,name:ce.name,path:ce.path}}else Ie=jee(ce.name,ce.path);const Xe=Nee(d,ce.name);await Y.mutateAsync({blockKey:Xe,data:Ie}),pe.success(`Created "${ce.name}"`),p({collection:"pages",key:Xe,path:ce.path})}else if(je==="duplicate"&&Re){const Ie=d[Re];if(!Ie)throw new Error("Source page not found");const{key:Xe,data:ot}=kee({source:Ie,pages:de,newName:ce.name,newPath:ce.path});await Y.mutateAsync({blockKey:Xe,data:ot}),pe.success(`Duplicated as "${ce.name}"`),p({collection:"pages",key:Xe,path:ce.path})}else if(je==="rename"&&Re){const Ie=d[Re];if(!Ie)throw new Error("Page not found");const Xe={...Ie,name:ce.name,path:ce.path};await Y.mutateAsync({blockKey:Re,data:Xe}),pe.success("Page updated"),m?.collection==="pages"&&m.key===Re&&p({collection:"pages",key:Re,path:ce.path})}ee(null)}catch(Ie){se(Ie instanceof Error?Ie.message:"Save failed")}},at=({path:ce})=>{if(!te)return null;const je=go(ce);return(te.mode==="rename"?go(te.initialPath):null)!==je&&_e.has(je)?`A page with path "${ce}" already exists.`:null},Be=async(ce,je,Re)=>{await Y.mutateAsync({blockKey:je,data:{...Re,name:je,__resolveType:ce}}),pe.success(`Created section "${je}"`),p({collection:"sections",key:je})},lt=rg((ce,je)=>Y.mutate({blockKey:ce,data:je})),rt=async ce=>{const je=d[ce.key];if(!je){pe.error("Section not found.");return}const Re=See(d,ce.key),Ie=W4(De,ce.name),Xe={...je,name:Ie};try{await Y.mutateAsync({blockKey:Re,data:Xe}),pe.success(`Duplicated "${ce.name}"`),p({collection:"sections",key:Re})}catch(ot){pe.error(ot instanceof Error?ot.message:"Duplicate failed")}},ct=async ce=>{if(!G)return;const je=d[G];if(!je){pe.error("Section not found.");return}try{await Y.mutateAsync({blockKey:G,data:{...je,name:ce}}),pe.success("Section renamed"),X(null)}catch(Re){pe.error(Re instanceof Error?Re.message:"Rename failed")}},dt=async()=>{const ce="/redirect-from",je=kI(d,ce),Re=LI({from:ce,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await Y.mutateAsync({blockKey:je,data:Re}),pe.success("Created redirect"),p({collection:"redirects",key:je})}catch(Ie){pe.error(Ie instanceof Error?Ie.message:"Could not create redirect")}},bt=async ce=>{const je=Y4(d,ce),Re=r0(je,ce,Uee(ce));try{await Y.mutateAsync({blockKey:je,data:Re}),pe.success(`Created ${xd[ce]}`),p({collection:ce,key:je})}catch(Ie){pe.error(Ie instanceof Error?Ie.message:"Could not create")}},tt=async ce=>{const je=d[ce.key];if(!je){pe.error("Record not found.");return}const Re=Y4(d,ce.kind),Ie=ce.kind==="posts"?"title":"name",Xe={...structuredClone(L0(je,ce.kind)),[Ie]:`${ce.label} (copy)`};try{await Y.mutateAsync({blockKey:Re,data:r0(Re,ce.kind,Xe)}),pe.success(`Duplicated "${ce.label}"`),p({collection:ce.kind,key:Re})}catch(ot){pe.error(ot instanceof Error?ot.message:"Duplicate failed")}},ft=ce=>{R(je=>{const Re=new Set(je);return Re.has(ce)?Re.delete(ce):Re.add(ce),Re})},ze=ce=>{f("posts"),I("posts"),p(null),x(null),_(""),S(null),j(null),A(null),T("date-desc"),R(new Set),M(ce||null)},ve=async(ce,je)=>{const Re=[...V];let Ie=0;for(const Xe of Re){const ot=d[Xe],yt=L0(ot,"posts"),Tt=ce==="add"?Bee(yt,je):zee(yt,je);Tt!==yt&&(await Y.mutateAsync({blockKey:Xe,data:r0(Xe,"posts",G4(Tt))}),Ie+=1)}return Ie},Oe=async(ce,je)=>{const Re=V.size;try{const Ie=await ve(ce,je),Xe=ce==="add"?"Added to":"Moved",ot=Re-Ie;pe.success(`${Xe} ${Ie} ${Ie===1?"post":"posts"}`+(ot>0?` (${ot} already set)`:"")),D()}catch(Ie){pe.error(Ie instanceof Error?Ie.message:"Bulk update failed")}},nt=async()=>{if(q)try{if(q.kind==="blog-bulk"){for(const Ie of q.keys)await Q.mutateAsync({blockKey:Ie});pe.success(`Deleted ${q.count} ${q.count===1?"post":"posts"}`),m&&m.collection!=="available-section"&&q.keys.includes(m.key)&&p(null),D(),Z(null);return}const{kind:ce,key:je,label:Re}=q;if(ce==="blog"){if(q.blogKind==="categories"){const Ie=L0(d[je],"categories").slug,Xe=typeof Ie=="string"?Ie:"";if(Xe)for(const{key:ot,payload:yt}of zd(d,"posts")){const Tt=Fee(yt,Xe);Tt!==yt&&await Y.mutateAsync({blockKey:ot,data:r0(ot,"posts",G4(Tt))})}}await Q.mutateAsync({blockKey:je})}else await Q.mutateAsync({blockKey:je});pe.success(`Deleted "${Re}"`),m&&m.collection!=="available-section"&&m.key===je&&p(null),Z(null)}catch(ce){pe.error(ce instanceof Error?ce.message:"Delete failed")}},Ye=Q.isPending||Y.isPending,_t=q?.kind==="blog"?xd[q.blogKind]:q?.kind==="blog-bulk"?`${q.count} ${q.count===1?"post":"posts"}`:q?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[r.jsx(vee,{active:u,counts:Se,showBlog:ye,onSelect:ce=>{f(ce),p(null),x(null)}}),u!=="seo"&&u!=="site"&&u!=="calendar"&&u!=="loaders"&&u!=="actions"&&r.jsx(tse,{activeCollection:u,pages:de,redirects:fe,sections:ue,availableSections:ge,appCatalog:K,appCatalogLoading:W,blogEntries:Le,decofile:d,searchQuery:L,onSearchChange:_,postCategoryFilter:k,postAuthorFilter:w,postStatusFilter:N,postSort:C,onPostCategoryFilterChange:ce=>{S(ce),R(new Set)},onPostAuthorFilterChange:ce=>{j(ce),R(new Set)},onPostStatusFilterChange:ce=>{A(ce),R(new Set)},onPostSortChange:T,selectedPostKeys:V,postBulkPanelOpen:we,onTogglePostSelect:ft,onSelectAllPosts:ce=>R(new Set(ce)),onClearPostSelection:()=>R(new Set),onExitPostSelection:D,onBulkDeletePosts:()=>Z({kind:"blog-bulk",keys:[...V],count:V.size}),selection:m,onSelect:$,onCreate:()=>{u==="pages"?Ge():u==="redirects"?dt():bd(u)&&bt(u)},onDuplicatePage:$e,onRenamePage:Fe,onAddPageVariant:Ve,onDeletePage:ce=>Z({kind:"page",key:ce.key,label:ce.name}),onEditPageSeo:ce=>{const je={collection:"pages",key:ce.key,path:ce.path};p(je),x(ce.key)},onViewPageJson:ce=>ne(ce.key),onDuplicateSection:rt,onRenameSection:ce=>X(ce.key),onDeleteSection:ce=>Z({kind:"section",key:ce.key,label:ce.name}),onDeleteRedirect:ce=>Z({kind:"redirect",key:ce.key,label:ce.from||ce.key}),onDuplicateBlog:tt,onDeleteBlog:ce=>Z({kind:"blog",blogKind:ce.kind,key:ce.key,label:ce.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:u==="loaders"||u==="actions"?r.jsx(ste,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:O,decofile:d,kind:u}):r.jsx(E.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),children:u==="calendar"?r.jsx(Qte,{decofile:d}):u==="site"?J?r.jsx(n5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:J.key,block:d[J.key],decofile:d,meta:O,title:"Site",excludeFields:["seo"],schemaPending:H(J.resolveType,["seo"]),previewBaseUrl:n},`site:${J.key}`):r.jsx(ho,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):u==="seo"?r.jsx(Yte,{orgSlug:t,virtualMcpId:e,branch:s,decofile:d,meta:O,target:{kind:"site"},previewBaseUrl:i}):u==="sections"?r.jsx(Ete,{selection:m?.collection==="sections"||m?.collection==="available-section"?m:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:O,decofile:d,isCreating:Y.isPending,onCreateAvailable:Be,onSaveReferencedBlock:lt}):we?r.jsx(qte,{posts:Ne,categories:ke,initialSlug:P,isPending:Y.isPending,onApply:(ce,je)=>{Oe(ce,je)},onClose:D},P??"selection"):m&&m.collection!=="available-section"?m.collection==="apps"?r.jsx(n5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key],decofile:d,meta:O,previewBaseUrl:n,schemaPending:H(typeof d[m.key]?.__resolveType=="string"?String(d[m.key].__resolveType):void 0)},`app:${m.key}`):m.collection==="posts"?r.jsx(Hte,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key],decofile:d,meta:O,previewBaseUrl:i},`post:${m.key}`):m.collection==="categories"?r.jsx(Wte,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key],decofile:d,meta:O,onManagePosts:ze,onOpenPost:ce=>{f("posts"),I("posts"),p({collection:"posts",key:ce}),x(null)},previewBaseUrl:i},`category:${m.key}`):m.collection==="authors"?r.jsx(Kte,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:m.key,block:d[m.key]},`authors:${m.key}`):m.collection==="redirects"?r.jsx(Jte,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key]},`redirect:${m.key}`):r.jsx(Gte,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:m.collection==="pages"?m.path:"/",activePageBlockKey:m.collection==="pages"?m.key:null,activeGlobalBlockKey:m.collection==="sections"?m.key:null,initialEditSeo:m.collection==="pages"&&g===m.key,onExitSeo:()=>x(null)},m.collection==="pages"?`page:${m.key}`:`section:${m.key}`):r.jsx(ho,{title:`Select ${bd(u)?`a ${xd[u]}`:u==="pages"?"a page":u==="apps"?"an app":u==="redirects"?"a redirect":"a section"} to edit`,description:u==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),te&&r.jsx(Eee,{open:!!te,mode:te.mode,initialName:te.initialName,initialPath:te.initialPath,isPending:Y.isPending,error:oe,templates:de,validate:at,onSubmit:Je,onOpenChange:ce=>{ce||(ee(null),se(void 0))}}),G&&r.jsx(Pee,{open:!!G,blockKey:G,initialName:ue.find(ce=>ce.key===G)?.name??G,isPending:Y.isPending,onSubmit:ct,onOpenChange:ce=>{ce||X(null)}}),le&&r.jsx(Qee,{open:!!le,onOpenChange:ce=>{ce||ne(null)},pageKey:le,decofile:d,onSave:ce=>Y.mutateAsync({blockKey:le,data:ce})}),r.jsx(Ma,{open:!!q,onOpenChange:ce=>{!ce&&!Ye&&Z(null)},children:r.jsxs($a,{children:[r.jsxs(Oa,{children:[r.jsx(Ba,{children:`Delete ${_t}?`}),r.jsx(za,{children:q?.kind==="section"?`"${q.label}" will be removed. Pages that still reference it will lose this section.`:q?.kind==="blog-bulk"?`${q.count} ${q.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:q?`"${q.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(Fa,{children:[r.jsx(Ua,{disabled:Ye,children:"Cancel"}),r.jsx(Ha,{onClick:ce=>{ce.preventDefault(),nt()},disabled:Ye,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ye?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function tse(t){const e=F.c(85),{activeCollection:s,pages:n,redirects:i,sections:o,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:y,onPostSortChange:L,selectedPostKeys:_,postBulkPanelOpen:k,onTogglePostSelect:S,onSelectAllPosts:w,onClearPostSelection:j,onExitPostSelection:N,onBulkDeletePosts:A,selection:C,onSelect:T,onCreate:V,onDuplicatePage:R,onRenamePage:P,onAddPageVariant:M,onDeletePage:D,onEditPageSeo:$,onViewPageJson:z,onDuplicateSection:I,onRenameSection:O,onDeleteSection:B,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:K}=t;let W,Y,Q,te,ee,oe,se;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==h||e[6]!==M||e[7]!==A||e[8]!==j||e[9]!==V||e[10]!==K||e[11]!==D||e[12]!==U||e[13]!==B||e[14]!==H||e[15]!==R||e[16]!==I||e[17]!==$||e[18]!==N||e[19]!==v||e[20]!==b||e[21]!==L||e[22]!==y||e[23]!==P||e[24]!==O||e[25]!==f||e[26]!==T||e[27]!==w||e[28]!==S||e[29]!==z||e[30]!==n||e[31]!==p||e[32]!==k||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==o||e[39]!==_||e[40]!==C){const Z=u.toLowerCase(),le=n.filter(ve=>!Z||ve.name.toLowerCase().includes(Z)||ve.path.toLowerCase().includes(Z)),ne=i.filter(ve=>!Z||ve.from.toLowerCase().includes(Z)||ve.to.toLowerCase().includes(Z)),ae=o.filter(ve=>!Z||ve.name.toLowerCase().includes(Z)||ve.key.toLowerCase().includes(Z)||ve.resolveType.toLowerCase().includes(Z)),de=l.filter(ve=>!Z||ve.title.toLowerCase().includes(Z)||ve.resolveType.toLowerCase().includes(Z)||(ve.description?.toLowerCase().includes(Z)??!1)),fe=Ute(ae),ue=a.filter(ve=>!Z||ve.title.toLowerCase().includes(Z)||ve.app.toLowerCase().includes(Z)||ve.vendor.toLowerCase().includes(Z)||ve.category.toLowerCase().includes(Z)),ge=d.filter(ve=>!Z||ve.label.toLowerCase().includes(Z)||ve.subtitle.toLowerCase().includes(Z)),J=s==="posts",me=ose,ye=J?Sw(h):[],Le=new Map,ke=new Map,we=ye.filter(rse).length,Ne=ye.length-we;let Ae;e[48]!==we||e[49]!==Ne?(Ae={published:we,draft:Ne},e[48]=we,e[49]=Ne,e[50]=Ae):Ae=e[50];const be=Ae;for(const ve of ye){for(const Oe of ve.categorySlugs)Le.set(Oe,(Le.get(Oe)??0)+1);for(const Oe of ve.authorEmails)ke.set(Oe,(ke.get(Oe)??0)+1)}const Se=(J?zd(h,"categories"):[]).map(ve=>{const{key:Oe,payload:nt}=ve,Ye=me(nt.slug)||Oe;return{slug:Ye,name:me(nt.name)||me(nt.slug)||Oe,count:Le.get(Ye)??0}}).filter(ise),_e=(J?zd(h,"authors"):[]).map(ve=>{const{key:Oe,payload:nt}=ve,Ye=me(nt.email);return{email:Ye,name:me(nt.name)||me(nt.email)||Oe,count:ke.get(Ye)??0}}).filter(nse);let Ee;e[51]!==m?(Ee=ve=>!m||ve.categorySlugs.includes(m),e[51]=m,e[52]=Ee):Ee=e[52];let De;e[53]!==p?(De=ve=>!p||ve.authorEmails.includes(p),e[53]=p,e[54]=De):De=e[54];let Ve;e[55]!==g?(Ve=ve=>!g||ve.published===(g==="published"),e[55]=g,e[56]=Ve):Ve=e[56];let Ge;e[57]!==x?(Ge=(ve,Oe)=>{if(x==="az")return ve.title.localeCompare(Oe.title);if(x==="za")return Oe.title.localeCompare(ve.title);const nt=ve.date.localeCompare(Oe.date);return x==="date-asc"?nt:-nt},e[57]=x,e[58]=Ge):Ge=e[58];const $e=ye.filter(ve=>!Z||ve.title.toLowerCase().includes(Z)||ve.slug.toLowerCase().includes(Z)).filter(Ee).filter(De).filter(Ve).sort(Ge),Fe=_.size,Je=$e.map(sse),at=Je.length>0&&Je.every(ve=>_.has(ve)),Be=Fe>0||k,lt=()=>{at?j():w(Je)},rt=`Search ${s}…`,ct=bd(s)?`Create new ${xd[s]}`:s==="redirects"?"Create new redirect":"Create new page",dt=s!=="apps"&&s!=="sections";ee="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let bt;e[59]===Symbol.for("react.memo_cache_sentinel")?(bt=r.jsx(Gh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[59]=bt):bt=e[59];let tt;e[60]!==f?(tt=ve=>f(ve.target.value),e[60]=f,e[61]=tt):tt=e[61];let ft;e[62]!==rt||e[63]!==u||e[64]!==tt?(ft=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[bt,r.jsx("input",{type:"text",value:u,onChange:tt,placeholder:rt,"aria-label":rt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[62]=rt,e[63]=u,e[64]=tt,e[65]=ft):ft=e[65];let ze;e[66]!==ct||e[67]!==V||e[68]!==dt?(ze=dt&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",onClick:V,"aria-label":ct,children:r.jsx(Dt,{size:14})})}),r.jsx(He,{side:"bottom",children:ct})]}),e[66]=ct,e[67]=V,e[68]=dt,e[69]=ze):ze=e[69],e[70]!==ft||e[71]!==ze?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[ft,ze]}),e[70]=ft,e[71]=ze,e[72]=oe):oe=e[72],se=J&&(Be?r.jsx(Bte,{count:Fe,allSelected:at,onToggleSelectAll:lt,onDelete:A,onExit:N}):r.jsx(Rte,{categories:Se,authors:_e,categoryFilter:m,statusCounts:be,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:y,onSortChange:L})),W=No,te="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",Y="flex flex-col gap-1 p-1.5",Q=s==="pages"?le.length===0?r.jsx(da,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(ve=>{const Oe=C?.collection==="pages"&&C.key===ve.key,nt=rL(h,ve.key);return r.jsx(xi,{icon:Cr,title:ve.name,subtitle:ve.path,active:Oe,variantCount:nt,onClick:()=>T({collection:"pages",key:ve.key,path:ve.path}),menu:r.jsx($c,{onDuplicate:()=>R(ve),onRename:()=>P(ve),onAddVariant:()=>M(ve),onEditSeo:()=>$(ve),onViewJson:()=>z(ve),onDelete:()=>D(ve)})},ve.key)}):s==="sections"?ae.length===0&&de.length===0?r.jsx(da,{hasItems:o.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):r.jsxs(r.Fragment,{children:[fe.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(s5,{icon:Er,label:"Saved sections"}),fe.map(ve=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ve.label}),ve.sections.map(Oe=>{const nt=C?.collection==="sections"&&C.key===Oe.key;return r.jsx(xi,{icon:Er,accent:"global",title:Oe.name,subtitle:ve.label,active:nt,onClick:()=>T({collection:"sections",key:Oe.key}),menu:r.jsx($c,{onDuplicate:()=>I(Oe),onRename:()=>O(Oe),onDelete:()=>B(Oe)})},Oe.key)})]},ve.label))]}),de.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(s5,{icon:Cr,label:"Available sections",className:ie(fe.length>0&&"mt-3")}),de.map(ve=>{const Oe=C?.collection==="available-section"&&C.resolveType===ve.resolveType,nt=ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(xi,{icon:Cr,title:ve.title,subtitle:nt??ve.resolveType,active:Oe,onClick:()=>T({collection:"available-section",resolveType:ve.resolveType,title:ve.title})},ve.resolveType)})]})]}):s==="apps"?c?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ut,{size:18,className:"animate-spin text-muted-foreground"})}):ue.length===0?r.jsx(da,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ue.map(ve=>{const Oe=C?.collection==="apps"&&ve.blockKey!==null&&C.key===ve.blockKey;return r.jsx(xi,{icon:by,logoUrl:ve.logo,title:ve.title,subtitle:ve.category,active:Oe,trailing:ve.installed?r.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(!ve.installed||!ve.blockKey){pe.message(`${ve.title} is not installed on this site.`);return}T({collection:"apps",key:ve.blockKey})}},ve.id)}):s==="redirects"?ne.length===0?r.jsx(da,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ne.map(ve=>r.jsx(xi,{icon:$v,title:ve.from||"(no source)",subtitle:`→ ${ve.to||"(no target)"}`,active:C?.collection==="redirects"&&C.key===ve.key,trailing:r.jsx(Ree,{type:ve.type}),onClick:()=>T({collection:"redirects",key:ve.key}),menu:r.jsx($c,{onDelete:()=>U(ve)})},ve.key)):J?$e.length===0?r.jsx(da,{hasItems:ye.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):$e.map(ve=>{const Oe={key:ve.key,kind:"posts",label:ve.title,subtitle:ve.slug};return r.jsx(xi,{icon:Li,title:ve.title,subtitle:ve.slug||"no slug",invalid:ve.missing.length>0,invalidReason:`Missing: ${ve.missing.join(", ")}`,active:C?.collection==="posts"&&C.key===ve.key,selectable:!0,selectionActive:Be,selected:_.has(ve.key),onToggleSelect:()=>S(ve.key),onClick:()=>Be?S(ve.key):T({collection:"posts",key:ve.key}),menu:r.jsx($c,{onDuplicate:()=>H(Oe),onDelete:()=>K(Oe)})},ve.key)}):ge.length===0?r.jsx(da,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${bd(s)?xd[s]:"item"}.`}):ge.map(ve=>{const Oe=C?.collection===ve.kind&&C.key===ve.key;return r.jsx(xi,{icon:ve.kind==="posts"?Li:ve.kind==="authors"?Ep:Rh,title:ve.label,subtitle:ve.subtitle,active:Oe,onClick:()=>T({collection:ve.kind,key:ve.key}),menu:r.jsx($c,{onDuplicate:()=>H(ve),onDelete:()=>K(ve)})},ve.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=h,e[6]=M,e[7]=A,e[8]=j,e[9]=V,e[10]=K,e[11]=D,e[12]=U,e[13]=B,e[14]=H,e[15]=R,e[16]=I,e[17]=$,e[18]=N,e[19]=v,e[20]=b,e[21]=L,e[22]=y,e[23]=P,e[24]=O,e[25]=f,e[26]=T,e[27]=w,e[28]=S,e[29]=z,e[30]=n,e[31]=p,e[32]=k,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=o,e[39]=_,e[40]=C,e[41]=W,e[42]=Y,e[43]=Q,e[44]=te,e[45]=ee,e[46]=oe,e[47]=se}else W=e[41],Y=e[42],Q=e[43],te=e[44],ee=e[45],oe=e[46],se=e[47];let G;e[73]!==Y||e[74]!==Q?(G=r.jsx("div",{className:Y,children:Q}),e[73]=Y,e[74]=Q,e[75]=G):G=e[75];let X;e[76]!==W||e[77]!==te||e[78]!==G?(X=r.jsx(W,{className:te,children:G}),e[76]=W,e[77]=te,e[78]=G,e[79]=X):X=e[79];let q;return e[80]!==ee||e[81]!==oe||e[82]!==se||e[83]!==X?(q=r.jsxs("div",{className:ee,children:[oe,se,X]}),e[80]=ee,e[81]=oe,e[82]=se,e[83]=X,e[84]=q):q=e[84],q}function sse(t){return t.key}function nse(t){return t.email}function ise(t){return t.slug}function rse(t){return t.published}function ose(t){return typeof t=="string"?t:""}function lse(t){const e=F.c(17),{virtualMcpId:s}=t,n=re(),i=Fs(s),{activeTask:o}=en();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=lr(l);if(!(Qs(i?.metadata)||Qs(o?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(pn,{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=r.jsx("div",{children:u}),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=m):m=e[7];let p;e[8]!==m?(p=r.jsx("div",{className:"text-xs text-muted-foreground/80",children:m}),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==f||e[11]!==p?(g=r.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,p]}),e[10]=f,e[11]=p,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=r.jsx(Xte,{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 ase(t){const e=F.c(6),{virtualMcpId:s}=t,n=Fs(s),i=iy();let o;e[0]!==i||e[1]!==n?(o=df(i,w8(n)),e[0]=i,e[1]=n,e[2]=o):o=e[2];const l=o;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(cse,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=r.jsx(hse,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function cse(){const t=F.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:r.jsx(Np,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function dse(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function use(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function hse(t){const e=F.c(99),{config:s}=t,n=re(),[i,o]=E.useState(""),l=Yh(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=QL(a),d=Rf(),[h,u]=E.useState(!1),[f,m]=E.useState(null),p=E.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(I){if(!I)return;const O=Array.from(I);if(O.length===0)return;const B=[];for(const U of O)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const K=H;B.push(`${U.name} (${K instanceof Error?K.message:"upload failed"})`)}await c.refetch(),B.length>0&&pe.error(B.length===O.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(I){I.preventDefault(),u(!0)},e[8]=b):b=e[8];const v=b;let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=function(){u(!1)},e[9]=y):y=e[9];const L=y;let _;e[10]!==x?(_=function(I){I.preventDefault(),I.stopPropagation(),u(!1),x(I.dataTransfer.files)},e[10]=x,e[11]=_):_=e[11];const k=_,[S,w]=m1();let j,N,A,C,T,V;if(e[12]!==s.name||e[13]!==l||e[14]!==w||e[15]!==S||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==k||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const I=(c.data?.pages??[]).flatMap(fse),O=use(I,dse(S)),B=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;T="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 K;e[33]!==H?(K=r.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=K):K=e[34];let W;e[35]!==s.name||e[36]!==n?(W=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=W):W=e[37];let Y;e[38]!==W?(Y=r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:W}),e[38]=W,e[39]=Y):Y=e[39];let Q;e[40]!==K||e[41]!==Y?(Q=r.jsxs("div",{className:"min-w-0",children:[K,Y]}),e[40]=K,e[41]=Y,e[42]=Q):Q=e[42];let te;e[43]===Symbol.for("react.memo_cache_sentinel")?(te=()=>p.current?.click(),e[43]=te):te=e[43];let ee;e[44]!==d.isPending?(ee=d.isPending?r.jsx(ut,{size:14,className:"animate-spin"}):r.jsx(Qn,{size:14}),e[44]=d.isPending,e[45]=ee):ee=e[45];let oe;e[46]!==n||e[47]!==d.isPending?(oe=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=oe):oe=e[48];let se;e[49]!==ee||e[50]!==oe||e[51]!==d.isPending?(se=r.jsxs(he,{type:"button",size:"sm",disabled:d.isPending,onClick:te,children:[ee,oe]}),e[49]=ee,e[50]=oe,e[51]=d.isPending,e[52]=se):se=e[52];let G;e[53]!==x?(G=r.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ge=>{const J=Array.from(ge.target.files??[]);ge.target.value="",x(J)}}),e[53]=x,e[54]=G):G=e[54],e[55]!==Q||e[56]!==se||e[57]!==G?(V=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Q,se,G]}),e[55]=Q,e[56]=se,e[57]=G,e[58]=V):V=e[58];let X;e[59]!==n?(X=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=X):X=e[60],e[61]!==U||e[62]!==i||e[63]!==X?(j=r.jsx(Wh,{value:i,onChange:o,isSearching:U,placeholder:X,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=X,e[64]=j):j=e[64];let q;e[65]===Symbol.for("react.memo_cache_sentinel")?(q=()=>p.current?.click(),e[65]=q):q=e[65];const Z=h&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ne;e[66]!==Z||e[67]!==le?(ne=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",Z,le),e[66]=Z,e[67]=le,e[68]=ne):ne=e[68];let ae;e[69]===Symbol.for("react.memo_cache_sentinel")?(ae=r.jsx(Qn,{size:16,className:"text-muted-foreground"}),e[69]=ae):ae=e[69];let de;e[70]!==n?(de=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=de):de=e[71];let fe;e[72]!==n?(fe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=fe):fe=e[73];let ue;e[74]!==de||e[75]!==fe?(ue=r.jsxs("p",{className:"text-xs text-muted-foreground",children:[de," ",fe]}),e[74]=de,e[75]=fe,e[76]=ue):ue=e[76],e[77]!==k||e[78]!==ne||e[79]!==ue?(N=r.jsxs("button",{type:"button",onClick:q,onDragOver:v,onDragLeave:L,onDrop:k,className:ne,children:[ae,ue]}),e[77]=k,e[78]=ne,e[79]=ue,e[80]=N):N=e[80],A="min-h-0 flex-1 overflow-y-auto pr-1",C=I.length===0?B?r.jsx(o5,{title:n("filePicker.filePickerDialog.noMatches",{query:B}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):r.jsx(o5,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):r.jsx("div",{ref:w,className:"flex items-start gap-3",children:O.map((ge,J)=>r.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ge.map(me=>r.jsx(mse,{item:me,onDelete:()=>m(me)},me.key))},J))}),e[12]=s.name,e[13]=l,e[14]=w,e[15]=S,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=k,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=N,e[27]=A,e[28]=C,e[29]=T,e[30]=V}else j=e[25],N=e[26],A=e[27],C=e[28],T=e[29],V=e[30];let R;e[81]!==c||e[82]!==n?(R=c.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=R):R=e[83];let P;e[84]!==R||e[85]!==A||e[86]!==C?(P=r.jsxs("div",{className:A,children:[C,R]}),e[84]=R,e[85]=A,e[86]=C,e[87]=P):P=e[87];let M;e[88]===Symbol.for("react.memo_cache_sentinel")?(M=()=>m(null),e[88]=M):M=e[88];let D;e[89]!==s.id||e[90]!==f?(D=r.jsx(xse,{configId:s.id,item:f,onClose:M}),e[89]=s.id,e[90]=f,e[91]=D):D=e[91];let $;return e[92]!==j||e[93]!==N||e[94]!==P||e[95]!==D||e[96]!==T||e[97]!==V?($=r.jsxs("div",{className:T,children:[V,j,N,P,D]}),e[92]=j,e[93]=N,e[94]=P,e[95]=D,e[96]=T,e[97]=V,e[98]=$):$=e[98],$}function fse(t){return t.items}function o5(t){const e=F.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(wi,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s?(o=r.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=o):o=e[2];let l;e[3]!==n?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function mse(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=JL(s.key),e[0]=s.key,e[1]=i):i=e[1];const o=i;let l;e[2]!==s.key?(l=fg(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?r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:pse}):r.jsx("div",{className:"flex aspect-square items-center justify-center",children:r.jsx(Li,{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=r.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=hh(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=r.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 m;e[17]!==s.size?(m=XL(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==o||e[20]!==m?(p=r.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[o," · ",m]}),e[19]=o,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=r.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=r.jsx(gse,{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=r.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=r.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function pse(t){t.target.style.display="none"}function gse(t){const e=F.c(36),{item:s,onDelete:n}=t,i=re(),[o,l]=E.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{pe.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=r.jsx(Pp,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=r.jsx(Gt,{asChild:!0,children:r.jsx(he,{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]!==o?(f=o?r.jsx(Et,{size:14}):r.jsx(on,{size:14}),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==o||e[11]!==i?(m=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=o,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs(et,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(mn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=r.jsx(et,{asChild:!0,children:r.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Zs,{size:14}),e[23]=y):y=e[23];let L;e[24]!==i?(L=i("assets.browser.deleteAction"),e[24]=i,e[25]=L):L=e[25];let _;e[26]!==n||e[27]!==L?(_=r.jsxs(et,{variant:"destructive",onClick:n,children:[y,L]}),e[26]=n,e[27]=L,e[28]=_):_=e[28];let k;e[29]!==v||e[30]!==_||e[31]!==p?(k=r.jsxs(Yt,{align:"end",children:[p,v,_]}),e[29]=v,e[30]=_,e[31]=p,e[32]=k):k=e[32];let S;return e[33]!==k||e[34]!==u?(S=r.jsxs(qt,{children:[u,k]}),e[33]=k,e[34]=u,e[35]=S):S=e[35],S}function xse(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,o=re(),l=iX();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==o?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),pe.success(o("assets.browser.deleted")),i()}catch{pe.error(o("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=o,e[5]=a):a=e[5];const c=a,d=!!n;let h;e[6]!==i?(h=C=>!C&&i(),e[6]=i,e[7]=h):h=e[7];let u;e[8]!==o?(u=o("assets.browser.deleteConfirmTitle"),e[8]=o,e[9]=u):u=e[9];let f;e[10]!==u?(f=r.jsx(Ba,{children:u}),e[10]=u,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==o?(m=o("assets.browser.deleteConfirmDescription",{name:n?hh(n.key):""}),e[12]=n,e[13]=o,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx(za,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=r.jsxs(Oa,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==o?(b=o("assets.browser.deleteCancel"),e[20]=o,e[21]=b):b=e[21];let v;e[22]!==l.isPending||e[23]!==b?(v=r.jsx(Ua,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let y;e[25]===Symbol.for("react.memo_cache_sentinel")?(y=ie(Ok({variant:"destructive"})),e[25]=y):y=e[25];const L=l.isPending;let _;e[26]!==c?(_=C=>{C.preventDefault(),c()},e[26]=c,e[27]=_):_=e[27];let k;e[28]!==l.isPending?(k=l.isPending?r.jsx(ut,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=k):k=e[29];let S;e[30]!==o?(S=o("assets.browser.deleteConfirm"),e[30]=o,e[31]=S):S=e[31];let w;e[32]!==l.isPending||e[33]!==_||e[34]!==k||e[35]!==S?(w=r.jsxs(Ha,{className:y,disabled:L,onClick:_,children:[k,S]}),e[32]=l.isPending,e[33]=_,e[34]=k,e[35]=S,e[36]=w):w=e[36];let j;e[37]!==v||e[38]!==w?(j=r.jsxs(Fa,{children:[v,w]}),e[37]=v,e[38]=w,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==g?(N=r.jsxs($a,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=N):N=e[42];let A;return e[43]!==N||e[44]!==d||e[45]!==h?(A=r.jsx(Ma,{open:d,onOpenChange:h,children:N}),e[43]=N,e[44]=d,e[45]=h,e[46]=A):A=e[46],A}const D9={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:gl},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Nr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:Sv}},bse=["fast","smart","thinking"];function vse(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=re(),[o,l]=E.useState(!1),a=D9[s].icon;let c;e[0]!==a?(c=r.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=D9[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=r.jsx(Jt,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=r.jsx(ts,{asChild:!0,children:r.jsxs(he,{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 m;e[9]!==n||e[10]!==i||e[11]!==s?(m=bse.map(x=>{const b=D9[x],v=b.icon;return r.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:[r.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm",children:i(b.labelKey)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&r.jsx(Et,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=r.jsx(ss,{align:"start",className:"p-1 w-64",children:r.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==o||e[16]!==f||e[17]!==p?(g=r.jsxs(ns,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function yse(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=re(),[a,c]=E.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=r.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]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(u=a?r.jsx(E.Suspense,{fallback:r.jsx(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(_se,{override:i,onOverrideChange:o})}):r.jsx(vse,{tier:s,onSelect:n}),e[4]=o,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]!==o?(f=v=>{c(v),v||o(null)},e[11]=o,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=r.jsx(Rr,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=r.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=r.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 _se(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=re(),o=Bh(),l=o[0]?.id??null;let a;e[0]!==l||e[1]!==o||e[2]!==s?.credentialId?(a=o.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=o,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=E.useState(a);let h;e[4]!==c||e[5]!==l||e[6]!==o?(h=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=h):h=e[7];const u=h;let f;e[8]!==o||e[9]!==s?(f=s&&o.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]=o,e[9]=s,e[10]=f):f=e[10];const m=f;if(o.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=r.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const v=b.keyId??u??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==m||e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(VN,{variant:"bordered",placeholder:p,model:m,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const kw=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:dp,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Mn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:wi},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:oi},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Zd}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Pr,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Dh},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:cp},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:ep},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Ad},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Pr},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:nN}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Da,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Da},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Ra},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Ra}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Er,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:ty},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Er},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:To}]}],Lse=kw.flatMap(t=>t.tools.map(e=>e.name));function wse(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Sse(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,o=re();let l;e[0]!==o?(l=o("automations.automationConfig.toolsLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.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]!==o||e[7]!==n?(c=s?r.jsx(E.Suspense,{fallback:r.jsxs(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(dp,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(kse,{agentId:s,value:n,onChange:i})}):r.jsx("span",{className:"text-xs text-muted-foreground italic",children:o("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=o,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=r.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 l5(t){const e=F.c(17),{value:s,checked:n,onToggle:i,title:o,description:l,leading:a}=t;let c;e[0]!==n?(c=r.jsx(lc,{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&&r.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let h;e[4]!==o?(h=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=h):h=e[5];let u;e[6]!==l?(u=l&&r.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=r.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 m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=r.jsxs(Ut,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function a5(t){const e=F.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=re(),d=o===l;let h;e[0]!==i||e[1]!==s?(h=s?r.jsx(Pi,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(iN,{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=r.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==l?(m=r.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",l]}),e[9]=o,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=y=>{y.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=r.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==h||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function kse(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,o=re(),{org:l}=We(),[a,c]=E.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:m}=Cp(u),p=ki();let g,x,b,v,y,L,_,k,S,w,j,N,A;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const P=new Map(p.map(Tse)),M=new Map;for(const fe of f?.tools??[]){const ue=Ji(fe._meta)??"__other__",ge=ec(fe.name,ue==="__other__"?void 0:ue),J=fe.title,me=J&&J!==fe.name?J:wse(ge);M.has(ue)||M.set(ue,{clientId:ue,conn:P.get(ue),tools:[]}),M.get(ue).tools.push({name:fe.name,display:me,description:fe.description})}const D=[...M.values()].sort(Vse),$=(f?.tools??[]).map(Nse),z=[...Lse,...$],I=n===null?new Set(z):new Set(n),O=z.every(fe=>I.has(fe)),B=fe=>i(z.every(ue=>fe.has(ue))?null:[...fe]),U=fe=>{const ue=new Set(I);ue.has(fe)?ue.delete(fe):ue.add(fe),B(ue)},H=(fe,ue)=>{const ge=new Set(I);for(const J of fe)ue?ge.add(J):ge.delete(J);B(ge)};v=ns,A=a,y=c;let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(dp,{size:14,className:"text-muted-foreground"}),e[26]=K):K=e[26];let W;e[27]!==O||e[28]!==o?(W=o(O?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=O,e[28]=o,e[29]=W):W=e[29];const Y=!O&&r.jsxs(IV,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[I.size,"/",z.length]});let Q;e[30]===Symbol.for("react.memo_cache_sentinel")?(Q=r.jsx(Jt,{size:14,className:"text-muted-foreground"}),e[30]=Q):Q=e[30],e[31]!==W||e[32]!==Y?(L=r.jsx(ts,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[K,W,Y,Q]})}),e[31]=W,e[32]=Y,e[33]=L):L=e[33],b=ss,j="p-0 w-80",N="start",x=Ri;let te;e[34]!==o?(te=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=te):te=e[35],e[36]!==te?(S=r.jsx(hi,{placeholder:te}),e[36]=te,e[37]=S):S=e[37];const ee=O?o("automations.automationConfig.allToolsEnabled",{count:z.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:I.size,total:z.length});let oe;e[38]!==ee?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:ee}),e[38]=ee,e[39]=oe):oe=e[39];let se;e[40]!==i?(se=()=>i(null),e[40]=i,e[41]=se):se=e[41];let G;e[42]!==o?(G=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=G):G=e[43];let X;e[44]!==O||e[45]!==se||e[46]!==G?(X=r.jsx("button",{type:"button",onClick:se,disabled:O,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:G}),e[44]=O,e[45]=se,e[46]=G,e[47]=X):X=e[47];let q;e[48]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=q):q=e[48];let Z;e[49]!==i?(Z=()=>i([]),e[49]=i,e[50]=Z):Z=e[50];const le=I.size===0;let ne;e[51]!==o?(ne=o("automations.automationConfig.clear"),e[51]=o,e[52]=ne):ne=e[52];let ae;e[53]!==Z||e[54]!==le||e[55]!==ne?(ae=r.jsx("button",{type:"button",onClick:Z,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ne}),e[53]=Z,e[54]=le,e[55]=ne,e[56]=ae):ae=e[56];let de;e[57]!==X||e[58]!==ae?(de=r.jsxs("div",{className:"flex items-center gap-2",children:[X,q,ae]}),e[57]=X,e[58]=ae,e[59]=de):de=e[59],e[60]!==oe||e[61]!==de?(w=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,de]}),e[60]=oe,e[61]=de,e[62]=w):w=e[62],g=fi,_="max-h-80",k=m?r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("automations.automationConfig.loadingTools")}):r.jsxs(r.Fragment,{children:[r.jsx(Jn,{children:o("automations.automationConfig.noToolsFound")}),kw.map(fe=>{const ue=fe.tools.map(Cse),ge=ue.filter(J=>I.has(J)).length;return r.jsx(fs,{heading:r.jsx(a5,{label:o(fe.headingKey),icon:fe.icon,on:ge,total:ue.length,onToggle:()=>H(ue,ge!==ue.length)}),children:fe.tools.map(J=>r.jsx(l5,{value:`${o(J.titleKey)} ${J.name}`,checked:I.has(J.name),onToggle:()=>U(J.name),title:o(J.titleKey),description:o(J.descriptionKey),leading:r.jsx(J.icon,{size:16,className:"text-muted-foreground"})},J.name))},fe.key)}),D.map(fe=>{const ue=fe.tools.map(jse),ge=ue.filter(J=>I.has(J)).length;return r.jsx(fs,{heading:r.jsx(a5,{conn:fe.conn,on:ge,total:ue.length,onToggle:()=>H(ue,ge!==ue.length)}),children:fe.tools.map(J=>r.jsx(l5,{value:`${J.display} ${J.name} ${fe.conn?.title??""}`,checked:I.has(J.name),onToggle:()=>U(J.name),title:J.display,description:J.description},J.name))},fe.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=o,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=y,e[18]=L,e[19]=_,e[20]=k,e[21]=S,e[22]=w,e[23]=j,e[24]=N,e[25]=A}else g=e[13],x=e[14],b=e[15],v=e[16],y=e[17],L=e[18],_=e[19],k=e[20],S=e[21],w=e[22],j=e[23],N=e[24],A=e[25];let C;e[63]!==g||e[64]!==_||e[65]!==k?(C=r.jsx(g,{className:_,children:k}),e[63]=g,e[64]=_,e[65]=k,e[66]=C):C=e[66];let T;e[67]!==x||e[68]!==C||e[69]!==S||e[70]!==w?(T=r.jsxs(x,{children:[S,w,C]}),e[67]=x,e[68]=C,e[69]=S,e[70]=w,e[71]=T):T=e[71];let V;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==N?(V=r.jsx(b,{className:j,align:N,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=N,e[76]=V):V=e[76];let R;return e[77]!==v||e[78]!==y||e[79]!==L||e[80]!==V||e[81]!==A?(R=r.jsxs(v,{open:A,onOpenChange:y,children:[L,V]}),e[77]=v,e[78]=y,e[79]=L,e[80]=V,e[81]=A,e[82]=R):R=e[82],R}function jse(t){return t.name}function Cse(t){return t.name}function Nse(t){return t.name}function Vse(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Tse(t){return[t.id,t]}function vd(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Ase(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 o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const a=(o[2]??"0").padStart(2,"0"),c=(o[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 Ese(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 Pse(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 Rse(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Dse=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Ise({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=re(),{triggerAdd:a}=ru(),[c,d]=E.useState(!1),h=e??c,u=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),pe.success(l("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");pe.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});u(!1),p.webhook?o?.(p.webhook):pe.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");pe.error(g)}};return r.jsxs(qt,{open:h,onOpenChange:u,children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",children:[r.jsx(Dt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(Yt,{align:"end",className:"w-[200px]",children:[r.jsxs(Wi,{children:[r.jsxs(qi,{className:"gap-2.5",children:[r.jsx(ad,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(Gi,{className:"w-[160px]",children:Dse.map(p=>r.jsxs(et,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(ad,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[r.jsx(ad,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[r.jsx(Ir,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(et,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function jw(t){const e=F.c(39),{open:s,onOpenChange:n,url:i,token:o,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]=E.useState(null),[m,p]=E.useState("curl"),[g,x]=E.useState("header"),b=E.useId();let v;e[0]!==h?(v=async(D,$)=>{try{await navigator.clipboard.writeText(D),f($),pe.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{pe.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=v):v=e[1];const y=v;let L;e[2]!==g||e[3]!==o||e[4]!==i?(L=i&&o&&g==="url"?`${i.replace(/\/$/,"")}/${o}`:i??"",e[2]=g,e[3]=o,e[4]=i,e[5]=L):L=e[5];const _=L,k=i&&o?g==="header"?`curl -X POST "${_}" \\
543
+ `)};Cn.prototype.renderPartial=function(e,s,n,i){if(n){var o=this.getConfigTags(i),l=bg(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,o);return this.renderTokens(u,s,n,h,i)}}};Cn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Cn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ai.escape,o=s.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===Ai.escape?String(o):i(o)};Cn.prototype.rawValue=function(e){return e[1]};Cn.prototype.getConfigTags=function(e){return Lc(e)?e:e&&typeof e=="object"?e.tags:void 0};Cn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Lc(e))return e.escape};var Ai={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){Fd.templateCache=t},get templateCache(){return Fd.templateCache}},Fd=new Cn;Ai.clearCache=function(){return Fd.clearCache()};Ai.parse=function(e,s){return Fd.parse(e,s)};Ai.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+pte(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Fd.render(e,s,n,i)};Ai.escape=Lte;Ai.Scanner=vu;Ai.Context=Xa;Ai.Writer=Cn;function Tte(t,e){const s={__resolveType:t},n=tL([s],e)[0];return n?cJ(s,n,e):null}function Ate({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=zr(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=E.useState(()=>Tte(l,o)),[f,m]=E.useState(u?.data??{}),[p,g]=E.useState([]),[x,b]=E.useState(0),[v,y]=E.useState(!1),[L,_]=E.useState(null),k=L!==null,{save:S,flush:w}=Z_({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?ai(u.resolveType,i):null,N=o[l],A=N?rl(l,N):l,C={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:h},T=D=>{m(D),S(l,D)},V=()=>{k?(_(null),y(!1),b(D=>D+1)):_(JSON.stringify(f,null,2))},R=D=>{const $=D??"";try{const z=JSON.parse($);if(z&&typeof z=="object"&&!Array.isArray(z)){y(!1),T(z);return}y(!0)}catch{y(!0)}},P=[A,...p],M=D=>{g(p.slice(0,D)),b($=>$+1)};return r.jsx("div",{className:"flex h-full w-full min-w-0",children:r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:n2},"aria-hidden":!0}),r.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:P.map((D,$)=>{const z=$===P.length-1,I=Pn(D);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&r.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>M($),title:I,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",z?"font-medium text-foreground":"text-muted-foreground"),children:I})]},`${I}-${$}`)})}),r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:V,"aria-label":c(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?r.jsx(_s,{size:14}):r.jsx(To,{size:14})})}),r.jsx(He,{side:"bottom",children:c(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),r.jsxs("div",{className:"relative min-h-0 flex-1",children:[r.jsx(No,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:j?r.jsx($r,{schema:j,value:f,onChange:D=>T(D),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:C},x):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),L!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(iu,{language:"json",height:"100%",code:L,onChange:R,onSave:D=>{R(D),w()}})})]})]})]})})}function Ete(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,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=r.jsx(ho,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=GL(s.title),e[7]=s.title,e[8]=v):v=e[8];let y;e[9]!==h||e[10]!==s.resolveType?(y=(_,k)=>h(s.resolveType,_,k),e[9]=h,e[10]=s.resolveType,e[11]=y):y=e[11];let L;return e[12]!==o||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]!==v||e[23]!==y||e[24]!==i?(L=r.jsx(hte,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:y,onSaveReferencedBlock:u},g),e[12]=o,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]=v,e[23]=y,e[24]=i,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==o||e[27]!==c||e[28]!==a||e[29]!==u||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=r.jsx(Ate,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},m),e[26]=o,e[27]=c,e[28]=a,e[29]=u,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Z4="__all__",e5={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Pte={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},R9={published:"sandbox.postToolbar.statusPublished",draft:"sandbox.postToolbar.statusDraft"},t5=E.forwardRef(function(e,s){const n=F.c(20);let i,o,l,a,c;n[0]!==e?({icon:i,active:o,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=l,n[4]=a,n[5]=c):(i=n[1],o=n[2],l=n[3],a=n[4],c=n[5]);const d=o?"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=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&r.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Jt,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(p=r.jsxs(he,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...a,children:[u,f,m]}),n[14]=a,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=p):p=n[19],p});function vg(t){const e=F.c(2),{count:s}=t;let n;return e[0]!==s?(n=r.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 Rte(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:o,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,m=re();let p;if(e[0]!==s||e[1]!==o){let ne;e[3]!==o?(ne=ae=>ae.slug===o,e[3]=o,e[4]=ne):ne=e[4],p=s.find(ne),e[0]=s,e[1]=o,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let ne;e[8]!==l?(ne=ae=>ae.email===l,e[8]=l,e[9]=ne):ne=e[9],x=n.find(ne),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(o||l||a);let y;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(y=g?.name??b?.name??m(a?R9[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=y):y=e[14];const L=y,_=o?`cat:${o}`:l?`author:${l}`:a?`status:${a}`:Z4;let k;e[15]!==h||e[16]!==d||e[17]!==u?(k=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=k):k=e[18];const S=k;let w;e[19]!==S||e[20]!==h||e[21]!==d||e[22]!==u?(w=ne=>{ne.startsWith("cat:")?(h(null),u(null),d(ne.slice(4))):ne.startsWith("author:")?(d(null),u(null),h(ne.slice(7))):ne==="status:published"||ne==="status:draft"?(d(null),h(null),u(ne==="status:published"?"published":"draft")):S()},e[19]=S,e[20]=h,e[21]=d,e[22]=u,e[23]=w):w=e[23];const j=w;let N;e[24]!==L||e[25]!==v?(N=r.jsx(Gt,{asChild:!0,children:r.jsx(t5,{icon:tN,active:v,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=v,e[26]=N):N=e[26];let A;e[27]!==m?(A=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=A):A=e[28];let C;e[29]!==A?(C=r.jsx(Cc,{children:A}),e[29]=A,e[30]=C):C=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let V;e[33]!==T?(V=r.jsx(Zi,{value:Z4,children:T}),e[33]=T,e[34]=V):V=e[34];let R;e[35]!==m?(R=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=R):R=e[36];let P;e[37]!==R?(P=r.jsx(Cc,{className:"text-muted-foreground/70",children:R}),e[37]=R,e[38]=P):P=e[38];let M;e[39]===Symbol.for("react.memo_cache_sentinel")?(M=Object.keys(R9),e[39]=M):M=e[39];let D;e[40]!==i||e[41]!==m?(D=M.map(ne=>r.jsxs(Zi,{value:`status:${ne}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(R9[ne])}),r.jsx(vg,{count:i[ne]})]},`status:${ne}`)),e[40]=i,e[41]=m,e[42]=D):D=e[42];let $;e[43]!==s.length||e[44]!==m?($=s.length>0&&r.jsx(Cc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=$):$=e[45];let z;e[46]!==s?(z=s.map(Ite),e[46]=s,e[47]=z):z=e[47];let I;e[48]!==n.length||e[49]!==m?(I=n.length>0&&r.jsx(Cc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=I):I=e[50];let O;e[51]!==n?(O=n.map(Dte),e[51]=n,e[52]=O):O=e[52];let B;e[53]!==_||e[54]!==j||e[55]!==V||e[56]!==P||e[57]!==D||e[58]!==$||e[59]!==z||e[60]!==I||e[61]!==O?(B=r.jsxs(Td,{value:_,onValueChange:j,children:[V,P,D,$,z,I,O]}),e[53]=_,e[54]=j,e[55]=V,e[56]=P,e[57]=D,e[58]=$,e[59]=z,e[60]=I,e[61]=O,e[62]=B):B=e[62];let U;e[63]!==B||e[64]!==C?(U=r.jsxs(Yt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[C,B]}),e[63]=B,e[64]=C,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==N?(H=r.jsxs(qt,{children:[N,U]}),e[66]=U,e[67]=N,e[68]=H):H=e[68];let K;e[69]!==S||e[70]!==v||e[71]!==m?(K=v&&r.jsx(Mte,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=m,e[72]=K):K=e[72];const W=Pte[c];let Y;e[73]!==m||e[74]!==W?(Y=m(W),e[73]=m,e[74]=W,e[75]=Y):Y=e[75];let Q;e[76]!==Y?(Q=r.jsx(Gt,{asChild:!0,children:r.jsx(t5,{icon:sN,active:!0,value:Y})}),e[76]=Y,e[77]=Q):Q=e[77];let te;e[78]!==m?(te=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=te):te=e[79];let ee;e[80]!==te?(ee=r.jsx(Cc,{children:te}),e[80]=te,e[81]=ee):ee=e[81];let oe;e[82]!==f?(oe=ne=>f(ne),e[82]=f,e[83]=oe):oe=e[83];let se;e[84]===Symbol.for("react.memo_cache_sentinel")?(se=Object.keys(e5),e[84]=se):se=e[84];let G;e[85]!==m?(G=se.map(ne=>r.jsx(Zi,{value:ne,children:m(e5[ne])},ne)),e[85]=m,e[86]=G):G=e[86];let X;e[87]!==c||e[88]!==oe||e[89]!==G?(X=r.jsx(Td,{value:c,onValueChange:oe,children:G}),e[87]=c,e[88]=oe,e[89]=G,e[90]=X):X=e[90];let q;e[91]!==ee||e[92]!==X?(q=r.jsxs(Yt,{align:"end",className:"w-44",children:[ee,X]}),e[91]=ee,e[92]=X,e[93]=q):q=e[93];let Z;e[94]!==Q||e[95]!==q?(Z=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(qt,{children:[Q,q]})}),e[94]=Q,e[95]=q,e[96]=Z):Z=e[96];let le;return e[97]!==H||e[98]!==K||e[99]!==Z?(le=r.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,K,Z]}),e[97]=H,e[98]=K,e[99]=Z,e[100]=le):le=e[100],le}function Dte(t){return r.jsxs(Zi,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(vg,{count:t.count})]},`author:${t.email}`)}function Ite(t){return r.jsxs(Zi,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(vg,{count:t.count})]},`cat:${t.slug}`)}function Mte(t){const e=F.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(_s,{size:12}),e[0]=i):i=e[0];let o;return e[1]!==s||e[2]!==n?(o=r.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]=o):o=e[3],o}function $te(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,o=re();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o?(a=o(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=r.jsx(Ue,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Ote,children:r.jsx(lc,{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]!==o?(d=o(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=o,e[12]=d):d=e[12];let h;e[13]!==d?(h=r.jsx(He,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=r.jsxs(Ke,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Ote(t){return t.stopPropagation()}function Bte(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=r.jsx($te,{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=r.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 m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Zs,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==u||e[13]!==f?(p=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:o,"aria-label":f,children:m})}),e[11]=o,e[12]=u,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=r.jsx(He,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(Ke,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(_s,{size:14}),e[24]=y):y=e[24];let L;e[25]!==l||e[26]!==v?(L=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:y})}),e[25]=l,e[26]=v,e[27]=L):L=e[27];let _;e[28]!==a?(_=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=_):_=e[29];let k;e[30]!==_?(k=r.jsx(He,{side:"bottom",children:_}),e[30]=_,e[31]=k):k=e[31];let S;e[32]!==L||e[33]!==k?(S=r.jsxs(Ke,{children:[L,k]}),e[32]=L,e[33]=k,e[34]=S):S=e[34];let w;e[35]!==b||e[36]!==S?(w=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=w):w=e[37];let j;return e[38]!==c||e[39]!==w||e[40]!==h?(j=r.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,w]}),e[38]=c,e[39]=w,e[40]=h,e[41]=j):j=e[41],j}function $c(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,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=r.jsx(Yn,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=r.jsx(Gt,{asChild:!0,children:r.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:zte,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(et,{onClick:n,children:[r.jsx(cp,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&r.jsxs(et,{onClick:s,children:[r.jsx(on,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),r.jsxs(et,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(Hh,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==o||e[15]!==l||e[16]!==c?(g=(o||l)&&r.jsxs(r.Fragment,{children:[r.jsx(er,{}),o&&r.jsxs(et,{onClick:o,children:[r.jsx(lp,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(et,{onClick:l,children:[r.jsx(To,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=o,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(er,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Zs,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let y;e[22]!==a||e[23]!==v?(y=r.jsxs(et,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=y):y=e[24];let L;e[25]!==y||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=r.jsxs(Yt,{align:"end",className:"w-44",children:[f,m,p,g,x,y]}),e[25]=y,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let _;return e[31]!==L||e[32]!==u?(_=r.jsxs(qt,{children:[u,L]}),e[31]=L,e[32]=u,e[33]=_):_=e[33],_}function zte(t){return t.stopPropagation()}function Fte(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Ute(t){const e=new Map;for(const s of t){const n=Fte(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 s5(t){const e=F.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=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]=o):o=e[1];let l;e[2]!==s?(l=r.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:o,children:[l,n]}),e[4]=n,e[5]=o,e[6]=l,e[7]=a):a=e[7],a}const n5=E.lazy(()=>In(()=>import("./app-editor-C4t39sNr.js"),__vite__mapDeps([151,1,2,16,52,53,15,3,18,4,5,6,7,8,9,10,11,12,13,14,17,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,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,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,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.AppEditor}))),Hte=E.lazy(()=>In(()=>import("./post-editor-CdIOS9Pq.js"),__vite__mapDeps([152,1,2,5,34,4,6,7,8,9,10,11,12,13,14,15,3,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,96,95,153,129,133,130,131,72,108,105,100,126,154,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,97,155,156,102,103,104,106,107,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,132,134,135,98,136,137,138,139,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.PostEditor}))),Kte=E.lazy(()=>In(()=>import("./record-editor-DwWObGXS.js"),__vite__mapDeps([157,1,2,96,95,53,15,3,18,126,155,4,5,6,7,8,9,10,11,12,13,14,16,17,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,156,78,73,72,74,57,58,59,75,76,77,79,60,80,81,82,52,54,55,56,61,62,63,64,65,66,67,68,69,70,71,83,84,85,86,87,88,89,90,91,92,93,94,97,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,129,130,131,132,133,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.RecordEditor}))),Wte=E.lazy(()=>In(()=>import("./category-editor-jfBtBcjQ.js"),__vite__mapDeps([158,1,2,10,4,5,6,7,8,9,11,12,13,14,15,3,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,110,96,95,154,130,131,72,108,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,97,155,156,102,103,104,105,106,107,109,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,132,133,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.CategoryEditor}))),qte=E.lazy(()=>In(()=>import("./bulk-category-panel-CPeSnbUk.js"),__vite__mapDeps([159,1,2,4,5,6,7,8,9,10,11,12,13,14,15,3,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,95,53,78,73,72,74,57,58,59,75,76,77,79,60,80,81,82,52,54,55,56,61,62,63,64,65,66,67,68,69,70,71,83,84,85,86,87,88,89,90,91,92,93,94,96,97,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,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.BulkCategoryPanel}))),Gte=E.lazy(()=>In(()=>import("./sections-editor-BKACmRBp.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])).then(t=>({default:t.SectionsEditor}))),Yte=E.lazy(()=>In(()=>import("./seo-editor-NeW6LrgW.js"),__vite__mapDeps([160,1,2,16,4,5,6,7,8,9,10,11,12,13,14,15,3,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,99,100,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,98,136,137,138,139,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.SeoEditor}))),Qte=E.lazy(()=>In(()=>import("./variant-calendar-3TFN0yrj.js"),__vite__mapDeps([161,1,2,4,5,6,7,8,9,10,11,12,13,14,15,3,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,95,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,96,97,100,162])).then(t=>({default:t.VariantCalendar}))),Jte=E.lazy(()=>In(()=>import("./redirect-editor-Cbkccd6C.js"),__vite__mapDeps([163,1,2,133,15,96,95,53,3,18,156,7,78,73,72,22,24,74,57,58,59,75,76,77,79,60,80,81,82,52,4,5,6,8,9,10,11,12,13,14,16,17,19,20,21,23,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,54,55,56,61,62,63,64,65,66,67,68,69,70,71,83,84,85,86,87,88,89,90,91,92,93,94,97,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,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.RedirectEditor})));function Xte(t){const e=F.c(20),{deepLinkPage:s}=t,n=zr(),{currentBranch:i}=en(),{org:o}=We(),l=n?.entity?.id??null,a=$n(),c=Ll(),{active:d,previewServerUrl:h}=yl(l);let u;e[0]!==d||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(u=Lee({fastPreviewActive:d,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=d,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=u):u=e[3];const f=u;if(f.kind==="sandbox-card"){const g=`/${o.slug}/settings/connections`;let x;return e[4]!==f.state||e[5]!==c.start||e[6]!==g||e[7]!==a.lifecycle||e[8]!==a.phase?(x=r.jsx(yee,{state:f.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:g}),e[4]=f.state,e[5]=c.start,e[6]=g,e[7]=a.lifecycle,e[8]=a.phase,e[9]=x):x=e[9],x}if(!l||!i){let g;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(ho,{title:"Waiting for sandbox context…"}),e[10]=g):g=e[10],g}const m=d?h:c.previewUrl;let p;return e[11]!==i||e[12]!==s||e[13]!==f.devServerReady||e[14]!==f.sandboxWarming||e[15]!==c.previewUrl||e[16]!==o.slug||e[17]!==m||e[18]!==l?(p=r.jsx(ese,{orgSlug:o.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:m,deepLinkPage:s,devServerReady:f.devServerReady,sandboxWarming:f.sandboxWarming}),e[11]=i,e[12]=s,e[13]=f.devServerReady,e[14]=f.sandboxWarming,e[15]=c.previewUrl,e[16]=o.slug,e[17]=m,e[18]=l,e[19]=p):p=e[19],p}const i5=2e3,Zte=15;function r5(t,e,s,n){return typeof e!="string"||s&&(gw(e,s,n)||t.state.dataUpdateCount>=Zte)?!1:i5}function ese({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:o,devServerReady:l,sandboxWarming:a}){const c={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n},{data:d,isLoading:h}=rf(c,{fetchEnabled:l}),[u,f]=E.useState("pages"),[m,p]=E.useState(null),[g,x]=E.useState(null),b=!!(o?.pageId||o?.path||o?.pathTemplate),[v,y]=E.useState(!1);if(b&&!v&&m===null&&d){y(!0);const ce=jI(z0(d),o??{});ce&&(f("pages"),p({collection:"pages",key:ce.key,path:ce.path}))}const[L,_]=E.useState(""),[k,S]=E.useState(null),[w,j]=E.useState(null),[N,A]=E.useState(null),[C,T]=E.useState("date-desc"),[V,R]=E.useState(()=>new Set),[P,M]=E.useState(null),D=()=>{R(new Set),M(null)},$=ce=>{p(ce),x(null)},[z,I]=E.useState(u);z!==u&&(I(u),_(""),S(null),j(null),A(null),T("date-desc"),R(new Set),M(null));const{data:O,isLoading:B,isFetching:U}=of(c,{fetchEnabled:l,refetchInterval:ce=>{const je=ce.state.data;if(u==="apps"&&m&&m.collection==="apps"){const Re=d?.[m.key];return r5(ce,typeof Re?.__resolveType=="string"?Re.__resolveType:void 0,je)}if(u==="site"&&d){const Re=je?y1(d,je):null,Ie=d.site,Xe=Re?.resolveType??(typeof Ie?.__resolveType=="string"?Ie.__resolveType:void 0);return r5(ce,Xe,je,["seo"])}return!1}}),H=(ce,je)=>!gw(ce,O,je)&&(B||U),{catalog:K,isLoading:W}=bee(O??void 0,d??void 0,{enabled:u==="apps"}),Y=bu(c),Q=cee(c),[te,ee]=E.useState(null),[oe,se]=E.useState(),[G,X]=E.useState(null),[q,Z]=E.useState(null),[le,ne]=E.useState(null),ae=!d||!O;if(h||B||ae&&a)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})});if(ae)return r.jsx(ho,{title:"Could not load site data."});const de=z0(d).sort((ce,je)=>ce.name.localeCompare(je.name)),fe=c8(d).sort((ce,je)=>ce.from.localeCompare(je.from)),ue=d2(d,O),ge=u==="sections"?bI(O):[],J=y1(d,O),me=_w(d),ye=gg.some(ce=>me[ce].length>0),Le=bd(u)?me[u]:[],ke=(ye?zd(d,"categories"):[]).map(({key:ce,payload:je})=>{const Re=typeof je.slug=="string"?je.slug:"",Ie=typeof je.name=="string"?je.name:"";return{slug:Re||ce,name:Ie||Re||ce}}).filter(ce=>ce.slug).sort((ce,je)=>ce.name.localeCompare(je.name)),we=u==="posts"&&(V.size>0||P!==null),Ne=we?Sw(d).filter(ce=>V.has(ce.key)):[],Ae=b4(O,"loaders"),be=b4(O,"actions");if(!cf(d,O)&&!ye&&Ae===0&&be===0)return r.jsx(ho,{icon:pn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Se={pages:de.length,sections:ue.length,apps:K.length,loaders:Ae,actions:be,redirects:fe.length,posts:me.posts.length,authors:me.authors.length,categories:me.categories.length},_e=new Set(de.map(ce=>go(ce.path))),Ee=new Set(de.map(ce=>ce.name)),De=new Set(ue.map(ce=>ce.name)),Ve=async ce=>{const je=d[ce.key];if(!je)return;const Re=rL(d,ce.key),Ie=oL(d,ce.key,Math.max(0,Re-1)),Xe=GG(je.sections,Ie);if(Xe)try{await Y.mutateAsync({blockKey:ce.key,data:{...je,sections:Xe}}),pe.success(`Variant added to "${ce.name}"`),p({collection:"pages",key:ce.key,path:ce.path})}catch(ot){pe.error(ot instanceof Error?ot.message:"Could not add variant")}},Ge=()=>{se(void 0),ee({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},$e=ce=>{se(void 0),ee({mode:"duplicate",sourceKey:ce.key,initialName:W4(Ee,ce.name),initialPath:wee(_e,ce.path)})},Fe=ce=>{se(void 0),ee({mode:"rename",sourceKey:ce.key,initialName:ce.name,initialPath:ce.path})},Je=async ce=>{if(!te)return;const{mode:je,sourceKey:Re}=te;try{if(je==="create"){let Ie;if(ce.templateKey){const ot=d[ce.templateKey];if(!ot)throw new Error("Selected template no longer exists.");Ie={...ot,name:ce.name,path:ce.path}}else Ie=jee(ce.name,ce.path);const Xe=Nee(d,ce.name);await Y.mutateAsync({blockKey:Xe,data:Ie}),pe.success(`Created "${ce.name}"`),p({collection:"pages",key:Xe,path:ce.path})}else if(je==="duplicate"&&Re){const Ie=d[Re];if(!Ie)throw new Error("Source page not found");const{key:Xe,data:ot}=kee({source:Ie,pages:de,newName:ce.name,newPath:ce.path});await Y.mutateAsync({blockKey:Xe,data:ot}),pe.success(`Duplicated as "${ce.name}"`),p({collection:"pages",key:Xe,path:ce.path})}else if(je==="rename"&&Re){const Ie=d[Re];if(!Ie)throw new Error("Page not found");const Xe={...Ie,name:ce.name,path:ce.path};await Y.mutateAsync({blockKey:Re,data:Xe}),pe.success("Page updated"),m?.collection==="pages"&&m.key===Re&&p({collection:"pages",key:Re,path:ce.path})}ee(null)}catch(Ie){se(Ie instanceof Error?Ie.message:"Save failed")}},at=({path:ce})=>{if(!te)return null;const je=go(ce);return(te.mode==="rename"?go(te.initialPath):null)!==je&&_e.has(je)?`A page with path "${ce}" already exists.`:null},Be=async(ce,je,Re)=>{await Y.mutateAsync({blockKey:je,data:{...Re,name:je,__resolveType:ce}}),pe.success(`Created section "${je}"`),p({collection:"sections",key:je})},lt=rg((ce,je)=>Y.mutate({blockKey:ce,data:je})),rt=async ce=>{const je=d[ce.key];if(!je){pe.error("Section not found.");return}const Re=See(d,ce.key),Ie=W4(De,ce.name),Xe={...je,name:Ie};try{await Y.mutateAsync({blockKey:Re,data:Xe}),pe.success(`Duplicated "${ce.name}"`),p({collection:"sections",key:Re})}catch(ot){pe.error(ot instanceof Error?ot.message:"Duplicate failed")}},ct=async ce=>{if(!G)return;const je=d[G];if(!je){pe.error("Section not found.");return}try{await Y.mutateAsync({blockKey:G,data:{...je,name:ce}}),pe.success("Section renamed"),X(null)}catch(Re){pe.error(Re instanceof Error?Re.message:"Rename failed")}},dt=async()=>{const ce="/redirect-from",je=kI(d,ce),Re=LI({from:ce,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await Y.mutateAsync({blockKey:je,data:Re}),pe.success("Created redirect"),p({collection:"redirects",key:je})}catch(Ie){pe.error(Ie instanceof Error?Ie.message:"Could not create redirect")}},bt=async ce=>{const je=Y4(d,ce),Re=r0(je,ce,Uee(ce));try{await Y.mutateAsync({blockKey:je,data:Re}),pe.success(`Created ${xd[ce]}`),p({collection:ce,key:je})}catch(Ie){pe.error(Ie instanceof Error?Ie.message:"Could not create")}},tt=async ce=>{const je=d[ce.key];if(!je){pe.error("Record not found.");return}const Re=Y4(d,ce.kind),Ie=ce.kind==="posts"?"title":"name",Xe={...structuredClone(L0(je,ce.kind)),[Ie]:`${ce.label} (copy)`};try{await Y.mutateAsync({blockKey:Re,data:r0(Re,ce.kind,Xe)}),pe.success(`Duplicated "${ce.label}"`),p({collection:ce.kind,key:Re})}catch(ot){pe.error(ot instanceof Error?ot.message:"Duplicate failed")}},ft=ce=>{R(je=>{const Re=new Set(je);return Re.has(ce)?Re.delete(ce):Re.add(ce),Re})},ze=ce=>{f("posts"),I("posts"),p(null),x(null),_(""),S(null),j(null),A(null),T("date-desc"),R(new Set),M(ce||null)},ve=async(ce,je)=>{const Re=[...V];let Ie=0;for(const Xe of Re){const ot=d[Xe],yt=L0(ot,"posts"),Tt=ce==="add"?Bee(yt,je):zee(yt,je);Tt!==yt&&(await Y.mutateAsync({blockKey:Xe,data:r0(Xe,"posts",G4(Tt))}),Ie+=1)}return Ie},Oe=async(ce,je)=>{const Re=V.size;try{const Ie=await ve(ce,je),Xe=ce==="add"?"Added to":"Moved",ot=Re-Ie;pe.success(`${Xe} ${Ie} ${Ie===1?"post":"posts"}`+(ot>0?` (${ot} already set)`:"")),D()}catch(Ie){pe.error(Ie instanceof Error?Ie.message:"Bulk update failed")}},nt=async()=>{if(q)try{if(q.kind==="blog-bulk"){for(const Ie of q.keys)await Q.mutateAsync({blockKey:Ie});pe.success(`Deleted ${q.count} ${q.count===1?"post":"posts"}`),m&&m.collection!=="available-section"&&q.keys.includes(m.key)&&p(null),D(),Z(null);return}const{kind:ce,key:je,label:Re}=q;if(ce==="blog"){if(q.blogKind==="categories"){const Ie=L0(d[je],"categories").slug,Xe=typeof Ie=="string"?Ie:"";if(Xe)for(const{key:ot,payload:yt}of zd(d,"posts")){const Tt=Fee(yt,Xe);Tt!==yt&&await Y.mutateAsync({blockKey:ot,data:r0(ot,"posts",G4(Tt))})}}await Q.mutateAsync({blockKey:je})}else await Q.mutateAsync({blockKey:je});pe.success(`Deleted "${Re}"`),m&&m.collection!=="available-section"&&m.key===je&&p(null),Z(null)}catch(ce){pe.error(ce instanceof Error?ce.message:"Delete failed")}},Ye=Q.isPending||Y.isPending,_t=q?.kind==="blog"?xd[q.blogKind]:q?.kind==="blog-bulk"?`${q.count} ${q.count===1?"post":"posts"}`:q?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[r.jsx(vee,{active:u,counts:Se,showBlog:ye,onSelect:ce=>{f(ce),p(null),x(null)}}),u!=="seo"&&u!=="site"&&u!=="calendar"&&u!=="loaders"&&u!=="actions"&&r.jsx(tse,{activeCollection:u,pages:de,redirects:fe,sections:ue,availableSections:ge,appCatalog:K,appCatalogLoading:W,blogEntries:Le,decofile:d,searchQuery:L,onSearchChange:_,postCategoryFilter:k,postAuthorFilter:w,postStatusFilter:N,postSort:C,onPostCategoryFilterChange:ce=>{S(ce),R(new Set)},onPostAuthorFilterChange:ce=>{j(ce),R(new Set)},onPostStatusFilterChange:ce=>{A(ce),R(new Set)},onPostSortChange:T,selectedPostKeys:V,postBulkPanelOpen:we,onTogglePostSelect:ft,onSelectAllPosts:ce=>R(new Set(ce)),onClearPostSelection:()=>R(new Set),onExitPostSelection:D,onBulkDeletePosts:()=>Z({kind:"blog-bulk",keys:[...V],count:V.size}),selection:m,onSelect:$,onCreate:()=>{u==="pages"?Ge():u==="redirects"?dt():bd(u)&&bt(u)},onDuplicatePage:$e,onRenamePage:Fe,onAddPageVariant:Ve,onDeletePage:ce=>Z({kind:"page",key:ce.key,label:ce.name}),onEditPageSeo:ce=>{const je={collection:"pages",key:ce.key,path:ce.path};p(je),x(ce.key)},onViewPageJson:ce=>ne(ce.key),onDuplicateSection:rt,onRenameSection:ce=>X(ce.key),onDeleteSection:ce=>Z({kind:"section",key:ce.key,label:ce.name}),onDeleteRedirect:ce=>Z({kind:"redirect",key:ce.key,label:ce.from||ce.key}),onDuplicateBlog:tt,onDeleteBlog:ce=>Z({kind:"blog",blogKind:ce.kind,key:ce.key,label:ce.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:u==="loaders"||u==="actions"?r.jsx(ste,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:O,decofile:d,kind:u}):r.jsx(E.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ut,{size:20,className:"animate-spin text-muted-foreground"})}),children:u==="calendar"?r.jsx(Qte,{decofile:d}):u==="site"?J?r.jsx(n5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:J.key,block:d[J.key],decofile:d,meta:O,title:"Site",excludeFields:["seo"],schemaPending:H(J.resolveType,["seo"]),previewBaseUrl:n},`site:${J.key}`):r.jsx(ho,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):u==="seo"?r.jsx(Yte,{orgSlug:t,virtualMcpId:e,branch:s,decofile:d,meta:O,target:{kind:"site"},previewBaseUrl:i}):u==="sections"?r.jsx(Ete,{selection:m?.collection==="sections"||m?.collection==="available-section"?m:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:O,decofile:d,isCreating:Y.isPending,onCreateAvailable:Be,onSaveReferencedBlock:lt}):we?r.jsx(qte,{posts:Ne,categories:ke,initialSlug:P,isPending:Y.isPending,onApply:(ce,je)=>{Oe(ce,je)},onClose:D},P??"selection"):m&&m.collection!=="available-section"?m.collection==="apps"?r.jsx(n5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key],decofile:d,meta:O,previewBaseUrl:n,schemaPending:H(typeof d[m.key]?.__resolveType=="string"?String(d[m.key].__resolveType):void 0)},`app:${m.key}`):m.collection==="posts"?r.jsx(Hte,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key],decofile:d,meta:O,previewBaseUrl:i},`post:${m.key}`):m.collection==="categories"?r.jsx(Wte,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key],decofile:d,meta:O,onManagePosts:ze,onOpenPost:ce=>{f("posts"),I("posts"),p({collection:"posts",key:ce}),x(null)},previewBaseUrl:i},`category:${m.key}`):m.collection==="authors"?r.jsx(Kte,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:m.key,block:d[m.key]},`authors:${m.key}`):m.collection==="redirects"?r.jsx(Jte,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:m.key,block:d[m.key]},`redirect:${m.key}`):r.jsx(Gte,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:m.collection==="pages"?m.path:"/",activePageBlockKey:m.collection==="pages"?m.key:null,activeGlobalBlockKey:m.collection==="sections"?m.key:null,initialEditSeo:m.collection==="pages"&&g===m.key,onExitSeo:()=>x(null)},m.collection==="pages"?`page:${m.key}`:`section:${m.key}`):r.jsx(ho,{title:`Select ${bd(u)?`a ${xd[u]}`:u==="pages"?"a page":u==="apps"?"an app":u==="redirects"?"a redirect":"a section"} to edit`,description:u==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),te&&r.jsx(Eee,{open:!!te,mode:te.mode,initialName:te.initialName,initialPath:te.initialPath,isPending:Y.isPending,error:oe,templates:de,validate:at,onSubmit:Je,onOpenChange:ce=>{ce||(ee(null),se(void 0))}}),G&&r.jsx(Pee,{open:!!G,blockKey:G,initialName:ue.find(ce=>ce.key===G)?.name??G,isPending:Y.isPending,onSubmit:ct,onOpenChange:ce=>{ce||X(null)}}),le&&r.jsx(Qee,{open:!!le,onOpenChange:ce=>{ce||ne(null)},pageKey:le,decofile:d,onSave:ce=>Y.mutateAsync({blockKey:le,data:ce})}),r.jsx(Ma,{open:!!q,onOpenChange:ce=>{!ce&&!Ye&&Z(null)},children:r.jsxs($a,{children:[r.jsxs(Oa,{children:[r.jsx(Ba,{children:`Delete ${_t}?`}),r.jsx(za,{children:q?.kind==="section"?`"${q.label}" will be removed. Pages that still reference it will lose this section.`:q?.kind==="blog-bulk"?`${q.count} ${q.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:q?`"${q.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(Fa,{children:[r.jsx(Ua,{disabled:Ye,children:"Cancel"}),r.jsx(Ha,{onClick:ce=>{ce.preventDefault(),nt()},disabled:Ye,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ye?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function tse(t){const e=F.c(85),{activeCollection:s,pages:n,redirects:i,sections:o,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:y,onPostSortChange:L,selectedPostKeys:_,postBulkPanelOpen:k,onTogglePostSelect:S,onSelectAllPosts:w,onClearPostSelection:j,onExitPostSelection:N,onBulkDeletePosts:A,selection:C,onSelect:T,onCreate:V,onDuplicatePage:R,onRenamePage:P,onAddPageVariant:M,onDeletePage:D,onEditPageSeo:$,onViewPageJson:z,onDuplicateSection:I,onRenameSection:O,onDeleteSection:B,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:K}=t;let W,Y,Q,te,ee,oe,se;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==h||e[6]!==M||e[7]!==A||e[8]!==j||e[9]!==V||e[10]!==K||e[11]!==D||e[12]!==U||e[13]!==B||e[14]!==H||e[15]!==R||e[16]!==I||e[17]!==$||e[18]!==N||e[19]!==v||e[20]!==b||e[21]!==L||e[22]!==y||e[23]!==P||e[24]!==O||e[25]!==f||e[26]!==T||e[27]!==w||e[28]!==S||e[29]!==z||e[30]!==n||e[31]!==p||e[32]!==k||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==o||e[39]!==_||e[40]!==C){const Z=u.toLowerCase(),le=n.filter(ve=>!Z||ve.name.toLowerCase().includes(Z)||ve.path.toLowerCase().includes(Z)),ne=i.filter(ve=>!Z||ve.from.toLowerCase().includes(Z)||ve.to.toLowerCase().includes(Z)),ae=o.filter(ve=>!Z||ve.name.toLowerCase().includes(Z)||ve.key.toLowerCase().includes(Z)||ve.resolveType.toLowerCase().includes(Z)),de=l.filter(ve=>!Z||ve.title.toLowerCase().includes(Z)||ve.resolveType.toLowerCase().includes(Z)||(ve.description?.toLowerCase().includes(Z)??!1)),fe=Ute(ae),ue=a.filter(ve=>!Z||ve.title.toLowerCase().includes(Z)||ve.app.toLowerCase().includes(Z)||ve.vendor.toLowerCase().includes(Z)||ve.category.toLowerCase().includes(Z)),ge=d.filter(ve=>!Z||ve.label.toLowerCase().includes(Z)||ve.subtitle.toLowerCase().includes(Z)),J=s==="posts",me=ose,ye=J?Sw(h):[],Le=new Map,ke=new Map,we=ye.filter(rse).length,Ne=ye.length-we;let Ae;e[48]!==we||e[49]!==Ne?(Ae={published:we,draft:Ne},e[48]=we,e[49]=Ne,e[50]=Ae):Ae=e[50];const be=Ae;for(const ve of ye){for(const Oe of ve.categorySlugs)Le.set(Oe,(Le.get(Oe)??0)+1);for(const Oe of ve.authorEmails)ke.set(Oe,(ke.get(Oe)??0)+1)}const Se=(J?zd(h,"categories"):[]).map(ve=>{const{key:Oe,payload:nt}=ve,Ye=me(nt.slug)||Oe;return{slug:Ye,name:me(nt.name)||me(nt.slug)||Oe,count:Le.get(Ye)??0}}).filter(ise),_e=(J?zd(h,"authors"):[]).map(ve=>{const{key:Oe,payload:nt}=ve,Ye=me(nt.email);return{email:Ye,name:me(nt.name)||me(nt.email)||Oe,count:ke.get(Ye)??0}}).filter(nse);let Ee;e[51]!==m?(Ee=ve=>!m||ve.categorySlugs.includes(m),e[51]=m,e[52]=Ee):Ee=e[52];let De;e[53]!==p?(De=ve=>!p||ve.authorEmails.includes(p),e[53]=p,e[54]=De):De=e[54];let Ve;e[55]!==g?(Ve=ve=>!g||ve.published===(g==="published"),e[55]=g,e[56]=Ve):Ve=e[56];let Ge;e[57]!==x?(Ge=(ve,Oe)=>{if(x==="az")return ve.title.localeCompare(Oe.title);if(x==="za")return Oe.title.localeCompare(ve.title);const nt=ve.date.localeCompare(Oe.date);return x==="date-asc"?nt:-nt},e[57]=x,e[58]=Ge):Ge=e[58];const $e=ye.filter(ve=>!Z||ve.title.toLowerCase().includes(Z)||ve.slug.toLowerCase().includes(Z)).filter(Ee).filter(De).filter(Ve).sort(Ge),Fe=_.size,Je=$e.map(sse),at=Je.length>0&&Je.every(ve=>_.has(ve)),Be=Fe>0||k,lt=()=>{at?j():w(Je)},rt=`Search ${s}…`,ct=bd(s)?`Create new ${xd[s]}`:s==="redirects"?"Create new redirect":"Create new page",dt=s!=="apps"&&s!=="sections";ee="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let bt;e[59]===Symbol.for("react.memo_cache_sentinel")?(bt=r.jsx(Gh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[59]=bt):bt=e[59];let tt;e[60]!==f?(tt=ve=>f(ve.target.value),e[60]=f,e[61]=tt):tt=e[61];let ft;e[62]!==rt||e[63]!==u||e[64]!==tt?(ft=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[bt,r.jsx("input",{type:"text",value:u,onChange:tt,placeholder:rt,"aria-label":rt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[62]=rt,e[63]=u,e[64]=tt,e[65]=ft):ft=e[65];let ze;e[66]!==ct||e[67]!==V||e[68]!==dt?(ze=dt&&r.jsxs(Ke,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",onClick:V,"aria-label":ct,children:r.jsx(Dt,{size:14})})}),r.jsx(He,{side:"bottom",children:ct})]}),e[66]=ct,e[67]=V,e[68]=dt,e[69]=ze):ze=e[69],e[70]!==ft||e[71]!==ze?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[ft,ze]}),e[70]=ft,e[71]=ze,e[72]=oe):oe=e[72],se=J&&(Be?r.jsx(Bte,{count:Fe,allSelected:at,onToggleSelectAll:lt,onDelete:A,onExit:N}):r.jsx(Rte,{categories:Se,authors:_e,categoryFilter:m,statusCounts:be,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:y,onSortChange:L})),W=No,te="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",Y="flex flex-col gap-1 p-1.5",Q=s==="pages"?le.length===0?r.jsx(da,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(ve=>{const Oe=C?.collection==="pages"&&C.key===ve.key,nt=rL(h,ve.key);return r.jsx(xi,{icon:Cr,title:ve.name,subtitle:ve.path,active:Oe,variantCount:nt,onClick:()=>T({collection:"pages",key:ve.key,path:ve.path}),menu:r.jsx($c,{onDuplicate:()=>R(ve),onRename:()=>P(ve),onAddVariant:()=>M(ve),onEditSeo:()=>$(ve),onViewJson:()=>z(ve),onDelete:()=>D(ve)})},ve.key)}):s==="sections"?ae.length===0&&de.length===0?r.jsx(da,{hasItems:o.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):r.jsxs(r.Fragment,{children:[fe.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(s5,{icon:Er,label:"Saved sections"}),fe.map(ve=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ve.label}),ve.sections.map(Oe=>{const nt=C?.collection==="sections"&&C.key===Oe.key;return r.jsx(xi,{icon:Er,accent:"global",title:Oe.name,subtitle:ve.label,active:nt,onClick:()=>T({collection:"sections",key:Oe.key}),menu:r.jsx($c,{onDuplicate:()=>I(Oe),onRename:()=>O(Oe),onDelete:()=>B(Oe)})},Oe.key)})]},ve.label))]}),de.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(s5,{icon:Cr,label:"Available sections",className:ie(fe.length>0&&"mt-3")}),de.map(ve=>{const Oe=C?.collection==="available-section"&&C.resolveType===ve.resolveType,nt=ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(xi,{icon:Cr,title:ve.title,subtitle:nt??ve.resolveType,active:Oe,onClick:()=>T({collection:"available-section",resolveType:ve.resolveType,title:ve.title})},ve.resolveType)})]})]}):s==="apps"?c?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ut,{size:18,className:"animate-spin text-muted-foreground"})}):ue.length===0?r.jsx(da,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ue.map(ve=>{const Oe=C?.collection==="apps"&&ve.blockKey!==null&&C.key===ve.blockKey;return r.jsx(xi,{icon:by,logoUrl:ve.logo,title:ve.title,subtitle:ve.category,active:Oe,trailing:ve.installed?r.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(!ve.installed||!ve.blockKey){pe.message(`${ve.title} is not installed on this site.`);return}T({collection:"apps",key:ve.blockKey})}},ve.id)}):s==="redirects"?ne.length===0?r.jsx(da,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ne.map(ve=>r.jsx(xi,{icon:$v,title:ve.from||"(no source)",subtitle:`→ ${ve.to||"(no target)"}`,active:C?.collection==="redirects"&&C.key===ve.key,trailing:r.jsx(Ree,{type:ve.type}),onClick:()=>T({collection:"redirects",key:ve.key}),menu:r.jsx($c,{onDelete:()=>U(ve)})},ve.key)):J?$e.length===0?r.jsx(da,{hasItems:ye.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):$e.map(ve=>{const Oe={key:ve.key,kind:"posts",label:ve.title,subtitle:ve.slug};return r.jsx(xi,{icon:Li,title:ve.title,subtitle:ve.slug||"no slug",invalid:ve.missing.length>0,invalidReason:`Missing: ${ve.missing.join(", ")}`,active:C?.collection==="posts"&&C.key===ve.key,selectable:!0,selectionActive:Be,selected:_.has(ve.key),onToggleSelect:()=>S(ve.key),onClick:()=>Be?S(ve.key):T({collection:"posts",key:ve.key}),menu:r.jsx($c,{onDuplicate:()=>H(Oe),onDelete:()=>K(Oe)})},ve.key)}):ge.length===0?r.jsx(da,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${bd(s)?xd[s]:"item"}.`}):ge.map(ve=>{const Oe=C?.collection===ve.kind&&C.key===ve.key;return r.jsx(xi,{icon:ve.kind==="posts"?Li:ve.kind==="authors"?Ep:Rh,title:ve.label,subtitle:ve.subtitle,active:Oe,onClick:()=>T({collection:ve.kind,key:ve.key}),menu:r.jsx($c,{onDuplicate:()=>H(ve),onDelete:()=>K(ve)})},ve.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=h,e[6]=M,e[7]=A,e[8]=j,e[9]=V,e[10]=K,e[11]=D,e[12]=U,e[13]=B,e[14]=H,e[15]=R,e[16]=I,e[17]=$,e[18]=N,e[19]=v,e[20]=b,e[21]=L,e[22]=y,e[23]=P,e[24]=O,e[25]=f,e[26]=T,e[27]=w,e[28]=S,e[29]=z,e[30]=n,e[31]=p,e[32]=k,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=o,e[39]=_,e[40]=C,e[41]=W,e[42]=Y,e[43]=Q,e[44]=te,e[45]=ee,e[46]=oe,e[47]=se}else W=e[41],Y=e[42],Q=e[43],te=e[44],ee=e[45],oe=e[46],se=e[47];let G;e[73]!==Y||e[74]!==Q?(G=r.jsx("div",{className:Y,children:Q}),e[73]=Y,e[74]=Q,e[75]=G):G=e[75];let X;e[76]!==W||e[77]!==te||e[78]!==G?(X=r.jsx(W,{className:te,children:G}),e[76]=W,e[77]=te,e[78]=G,e[79]=X):X=e[79];let q;return e[80]!==ee||e[81]!==oe||e[82]!==se||e[83]!==X?(q=r.jsxs("div",{className:ee,children:[oe,se,X]}),e[80]=ee,e[81]=oe,e[82]=se,e[83]=X,e[84]=q):q=e[84],q}function sse(t){return t.key}function nse(t){return t.email}function ise(t){return t.slug}function rse(t){return t.published}function ose(t){return typeof t=="string"?t:""}function lse(t){const e=F.c(17),{virtualMcpId:s}=t,n=re(),i=Fs(s),{activeTask:o}=en();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=lr(l);if(!(Qs(i?.metadata)||Qs(o?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(pn,{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=r.jsx("div",{children:u}),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=m):m=e[7];let p;e[8]!==m?(p=r.jsx("div",{className:"text-xs text-muted-foreground/80",children:m}),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==f||e[11]!==p?(g=r.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,p]}),e[10]=f,e[11]=p,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=r.jsx(Xte,{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 ase(t){const e=F.c(6),{virtualMcpId:s}=t,n=Fs(s),i=iy();let o;e[0]!==i||e[1]!==n?(o=df(i,w8(n)),e[0]=i,e[1]=n,e[2]=o):o=e[2];const l=o;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(cse,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=r.jsx(hse,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function cse(){const t=F.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:r.jsx(Np,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function dse(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function use(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function hse(t){const e=F.c(99),{config:s}=t,n=re(),[i,o]=E.useState(""),l=Yh(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=QL(a),d=Rf(),[h,u]=E.useState(!1),[f,m]=E.useState(null),p=E.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(I){if(!I)return;const O=Array.from(I);if(O.length===0)return;const B=[];for(const U of O)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const K=H;B.push(`${U.name} (${K instanceof Error?K.message:"upload failed"})`)}await c.refetch(),B.length>0&&pe.error(B.length===O.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(I){I.preventDefault(),u(!0)},e[8]=b):b=e[8];const v=b;let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=function(){u(!1)},e[9]=y):y=e[9];const L=y;let _;e[10]!==x?(_=function(I){I.preventDefault(),I.stopPropagation(),u(!1),x(I.dataTransfer.files)},e[10]=x,e[11]=_):_=e[11];const k=_,[S,w]=m1();let j,N,A,C,T,V;if(e[12]!==s.name||e[13]!==l||e[14]!==w||e[15]!==S||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==k||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const I=(c.data?.pages??[]).flatMap(fse),O=use(I,dse(S)),B=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;T="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 K;e[33]!==H?(K=r.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=K):K=e[34];let W;e[35]!==s.name||e[36]!==n?(W=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=W):W=e[37];let Y;e[38]!==W?(Y=r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:W}),e[38]=W,e[39]=Y):Y=e[39];let Q;e[40]!==K||e[41]!==Y?(Q=r.jsxs("div",{className:"min-w-0",children:[K,Y]}),e[40]=K,e[41]=Y,e[42]=Q):Q=e[42];let te;e[43]===Symbol.for("react.memo_cache_sentinel")?(te=()=>p.current?.click(),e[43]=te):te=e[43];let ee;e[44]!==d.isPending?(ee=d.isPending?r.jsx(ut,{size:14,className:"animate-spin"}):r.jsx(Qn,{size:14}),e[44]=d.isPending,e[45]=ee):ee=e[45];let oe;e[46]!==n||e[47]!==d.isPending?(oe=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=oe):oe=e[48];let se;e[49]!==ee||e[50]!==oe||e[51]!==d.isPending?(se=r.jsxs(he,{type:"button",size:"sm",disabled:d.isPending,onClick:te,children:[ee,oe]}),e[49]=ee,e[50]=oe,e[51]=d.isPending,e[52]=se):se=e[52];let G;e[53]!==x?(G=r.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ge=>{const J=Array.from(ge.target.files??[]);ge.target.value="",x(J)}}),e[53]=x,e[54]=G):G=e[54],e[55]!==Q||e[56]!==se||e[57]!==G?(V=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Q,se,G]}),e[55]=Q,e[56]=se,e[57]=G,e[58]=V):V=e[58];let X;e[59]!==n?(X=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=X):X=e[60],e[61]!==U||e[62]!==i||e[63]!==X?(j=r.jsx(Wh,{value:i,onChange:o,isSearching:U,placeholder:X,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=X,e[64]=j):j=e[64];let q;e[65]===Symbol.for("react.memo_cache_sentinel")?(q=()=>p.current?.click(),e[65]=q):q=e[65];const Z=h&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ne;e[66]!==Z||e[67]!==le?(ne=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",Z,le),e[66]=Z,e[67]=le,e[68]=ne):ne=e[68];let ae;e[69]===Symbol.for("react.memo_cache_sentinel")?(ae=r.jsx(Qn,{size:16,className:"text-muted-foreground"}),e[69]=ae):ae=e[69];let de;e[70]!==n?(de=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=de):de=e[71];let fe;e[72]!==n?(fe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=fe):fe=e[73];let ue;e[74]!==de||e[75]!==fe?(ue=r.jsxs("p",{className:"text-xs text-muted-foreground",children:[de," ",fe]}),e[74]=de,e[75]=fe,e[76]=ue):ue=e[76],e[77]!==k||e[78]!==ne||e[79]!==ue?(N=r.jsxs("button",{type:"button",onClick:q,onDragOver:v,onDragLeave:L,onDrop:k,className:ne,children:[ae,ue]}),e[77]=k,e[78]=ne,e[79]=ue,e[80]=N):N=e[80],A="min-h-0 flex-1 overflow-y-auto pr-1",C=I.length===0?B?r.jsx(o5,{title:n("filePicker.filePickerDialog.noMatches",{query:B}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):r.jsx(o5,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):r.jsx("div",{ref:w,className:"flex items-start gap-3",children:O.map((ge,J)=>r.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ge.map(me=>r.jsx(mse,{item:me,onDelete:()=>m(me)},me.key))},J))}),e[12]=s.name,e[13]=l,e[14]=w,e[15]=S,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=k,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=N,e[27]=A,e[28]=C,e[29]=T,e[30]=V}else j=e[25],N=e[26],A=e[27],C=e[28],T=e[29],V=e[30];let R;e[81]!==c||e[82]!==n?(R=c.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(ut,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=R):R=e[83];let P;e[84]!==R||e[85]!==A||e[86]!==C?(P=r.jsxs("div",{className:A,children:[C,R]}),e[84]=R,e[85]=A,e[86]=C,e[87]=P):P=e[87];let M;e[88]===Symbol.for("react.memo_cache_sentinel")?(M=()=>m(null),e[88]=M):M=e[88];let D;e[89]!==s.id||e[90]!==f?(D=r.jsx(xse,{configId:s.id,item:f,onClose:M}),e[89]=s.id,e[90]=f,e[91]=D):D=e[91];let $;return e[92]!==j||e[93]!==N||e[94]!==P||e[95]!==D||e[96]!==T||e[97]!==V?($=r.jsxs("div",{className:T,children:[V,j,N,P,D]}),e[92]=j,e[93]=N,e[94]=P,e[95]=D,e[96]=T,e[97]=V,e[98]=$):$=e[98],$}function fse(t){return t.items}function o5(t){const e=F.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(wi,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s?(o=r.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=o):o=e[2];let l;e[3]!==n?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function mse(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=JL(s.key),e[0]=s.key,e[1]=i):i=e[1];const o=i;let l;e[2]!==s.key?(l=fg(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?r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:pse}):r.jsx("div",{className:"flex aspect-square items-center justify-center",children:r.jsx(Li,{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=r.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=hh(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=r.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 m;e[17]!==s.size?(m=XL(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==o||e[20]!==m?(p=r.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[o," · ",m]}),e[19]=o,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=r.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=r.jsx(gse,{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=r.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=r.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function pse(t){t.target.style.display="none"}function gse(t){const e=F.c(36),{item:s,onDelete:n}=t,i=re(),[o,l]=E.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{pe.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=r.jsx(Pp,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=r.jsx(Gt,{asChild:!0,children:r.jsx(he,{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]!==o?(f=o?r.jsx(Et,{size:14}):r.jsx(on,{size:14}),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==o||e[11]!==i?(m=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=o,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs(et,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(mn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=r.jsx(et,{asChild:!0,children:r.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Zs,{size:14}),e[23]=y):y=e[23];let L;e[24]!==i?(L=i("assets.browser.deleteAction"),e[24]=i,e[25]=L):L=e[25];let _;e[26]!==n||e[27]!==L?(_=r.jsxs(et,{variant:"destructive",onClick:n,children:[y,L]}),e[26]=n,e[27]=L,e[28]=_):_=e[28];let k;e[29]!==v||e[30]!==_||e[31]!==p?(k=r.jsxs(Yt,{align:"end",children:[p,v,_]}),e[29]=v,e[30]=_,e[31]=p,e[32]=k):k=e[32];let S;return e[33]!==k||e[34]!==u?(S=r.jsxs(qt,{children:[u,k]}),e[33]=k,e[34]=u,e[35]=S):S=e[35],S}function xse(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,o=re(),l=iX();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==o?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),pe.success(o("assets.browser.deleted")),i()}catch{pe.error(o("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=o,e[5]=a):a=e[5];const c=a,d=!!n;let h;e[6]!==i?(h=C=>!C&&i(),e[6]=i,e[7]=h):h=e[7];let u;e[8]!==o?(u=o("assets.browser.deleteConfirmTitle"),e[8]=o,e[9]=u):u=e[9];let f;e[10]!==u?(f=r.jsx(Ba,{children:u}),e[10]=u,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==o?(m=o("assets.browser.deleteConfirmDescription",{name:n?hh(n.key):""}),e[12]=n,e[13]=o,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx(za,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=r.jsxs(Oa,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==o?(b=o("assets.browser.deleteCancel"),e[20]=o,e[21]=b):b=e[21];let v;e[22]!==l.isPending||e[23]!==b?(v=r.jsx(Ua,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let y;e[25]===Symbol.for("react.memo_cache_sentinel")?(y=ie(Ok({variant:"destructive"})),e[25]=y):y=e[25];const L=l.isPending;let _;e[26]!==c?(_=C=>{C.preventDefault(),c()},e[26]=c,e[27]=_):_=e[27];let k;e[28]!==l.isPending?(k=l.isPending?r.jsx(ut,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=k):k=e[29];let S;e[30]!==o?(S=o("assets.browser.deleteConfirm"),e[30]=o,e[31]=S):S=e[31];let w;e[32]!==l.isPending||e[33]!==_||e[34]!==k||e[35]!==S?(w=r.jsxs(Ha,{className:y,disabled:L,onClick:_,children:[k,S]}),e[32]=l.isPending,e[33]=_,e[34]=k,e[35]=S,e[36]=w):w=e[36];let j;e[37]!==v||e[38]!==w?(j=r.jsxs(Fa,{children:[v,w]}),e[37]=v,e[38]=w,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==g?(N=r.jsxs($a,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=N):N=e[42];let A;return e[43]!==N||e[44]!==d||e[45]!==h?(A=r.jsx(Ma,{open:d,onOpenChange:h,children:N}),e[43]=N,e[44]=d,e[45]=h,e[46]=A):A=e[46],A}const D9={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:gl},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Nr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:Sv}},bse=["fast","smart","thinking"];function vse(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=re(),[o,l]=E.useState(!1),a=D9[s].icon;let c;e[0]!==a?(c=r.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=D9[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=r.jsx(Jt,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=r.jsx(ts,{asChild:!0,children:r.jsxs(he,{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 m;e[9]!==n||e[10]!==i||e[11]!==s?(m=bse.map(x=>{const b=D9[x],v=b.icon;return r.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:[r.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm",children:i(b.labelKey)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&r.jsx(Et,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=r.jsx(ss,{align:"start",className:"p-1 w-64",children:r.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==o||e[16]!==f||e[17]!==p?(g=r.jsxs(ns,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function yse(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=re(),[a,c]=E.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=r.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]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(u=a?r.jsx(E.Suspense,{fallback:r.jsx(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(_se,{override:i,onOverrideChange:o})}):r.jsx(vse,{tier:s,onSelect:n}),e[4]=o,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]!==o?(f=v=>{c(v),v||o(null)},e[11]=o,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=r.jsx(Rr,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=r.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=r.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 _se(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=re(),o=Bh(),l=o[0]?.id??null;let a;e[0]!==l||e[1]!==o||e[2]!==s?.credentialId?(a=o.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=o,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=E.useState(a);let h;e[4]!==c||e[5]!==l||e[6]!==o?(h=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=h):h=e[7];const u=h;let f;e[8]!==o||e[9]!==s?(f=s&&o.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]=o,e[9]=s,e[10]=f):f=e[10];const m=f;if(o.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=r.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const v=b.keyId??u??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==m||e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(VN,{variant:"bordered",placeholder:p,model:m,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const kw=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:dp,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Mn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:wi},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:oi},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Zd}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Pr,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Dh},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:cp},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:ep},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Ad},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Pr},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:nN}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Da,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Da},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Ra},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Ra}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Er,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:ty},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Er},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:To}]}],Lse=kw.flatMap(t=>t.tools.map(e=>e.name));function wse(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Sse(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,o=re();let l;e[0]!==o?(l=o("automations.automationConfig.toolsLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.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]!==o||e[7]!==n?(c=s?r.jsx(E.Suspense,{fallback:r.jsxs(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(dp,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(kse,{agentId:s,value:n,onChange:i})}):r.jsx("span",{className:"text-xs text-muted-foreground italic",children:o("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=o,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=r.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 l5(t){const e=F.c(17),{value:s,checked:n,onToggle:i,title:o,description:l,leading:a}=t;let c;e[0]!==n?(c=r.jsx(lc,{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&&r.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let h;e[4]!==o?(h=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=h):h=e[5];let u;e[6]!==l?(u=l&&r.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=r.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 m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=r.jsxs(Ut,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function a5(t){const e=F.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=re(),d=o===l;let h;e[0]!==i||e[1]!==s?(h=s?r.jsx(Pi,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(iN,{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=r.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==l?(m=r.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",l]}),e[9]=o,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=y=>{y.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=r.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==h||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function kse(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,o=re(),{org:l}=We(),[a,c]=E.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:m}=Cp(u),p=ki();let g,x,b,v,y,L,_,k,S,w,j,N,A;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const P=new Map(p.map(Tse)),M=new Map;for(const fe of f?.tools??[]){const ue=Ji(fe._meta)??"__other__",ge=ec(fe.name,ue==="__other__"?void 0:ue),J=fe.title,me=J&&J!==fe.name?J:wse(ge);M.has(ue)||M.set(ue,{clientId:ue,conn:P.get(ue),tools:[]}),M.get(ue).tools.push({name:fe.name,display:me,description:fe.description})}const D=[...M.values()].sort(Vse),$=(f?.tools??[]).map(Nse),z=[...Lse,...$],I=n===null?new Set(z):new Set(n),O=z.every(fe=>I.has(fe)),B=fe=>i(z.every(ue=>fe.has(ue))?null:[...fe]),U=fe=>{const ue=new Set(I);ue.has(fe)?ue.delete(fe):ue.add(fe),B(ue)},H=(fe,ue)=>{const ge=new Set(I);for(const J of fe)ue?ge.add(J):ge.delete(J);B(ge)};v=ns,A=a,y=c;let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(dp,{size:14,className:"text-muted-foreground"}),e[26]=K):K=e[26];let W;e[27]!==O||e[28]!==o?(W=o(O?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=O,e[28]=o,e[29]=W):W=e[29];const Y=!O&&r.jsxs(IV,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[I.size,"/",z.length]});let Q;e[30]===Symbol.for("react.memo_cache_sentinel")?(Q=r.jsx(Jt,{size:14,className:"text-muted-foreground"}),e[30]=Q):Q=e[30],e[31]!==W||e[32]!==Y?(L=r.jsx(ts,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[K,W,Y,Q]})}),e[31]=W,e[32]=Y,e[33]=L):L=e[33],b=ss,j="p-0 w-80",N="start",x=Ri;let te;e[34]!==o?(te=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=te):te=e[35],e[36]!==te?(S=r.jsx(hi,{placeholder:te}),e[36]=te,e[37]=S):S=e[37];const ee=O?o("automations.automationConfig.allToolsEnabled",{count:z.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:I.size,total:z.length});let oe;e[38]!==ee?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:ee}),e[38]=ee,e[39]=oe):oe=e[39];let se;e[40]!==i?(se=()=>i(null),e[40]=i,e[41]=se):se=e[41];let G;e[42]!==o?(G=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=G):G=e[43];let X;e[44]!==O||e[45]!==se||e[46]!==G?(X=r.jsx("button",{type:"button",onClick:se,disabled:O,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:G}),e[44]=O,e[45]=se,e[46]=G,e[47]=X):X=e[47];let q;e[48]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=q):q=e[48];let Z;e[49]!==i?(Z=()=>i([]),e[49]=i,e[50]=Z):Z=e[50];const le=I.size===0;let ne;e[51]!==o?(ne=o("automations.automationConfig.clear"),e[51]=o,e[52]=ne):ne=e[52];let ae;e[53]!==Z||e[54]!==le||e[55]!==ne?(ae=r.jsx("button",{type:"button",onClick:Z,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ne}),e[53]=Z,e[54]=le,e[55]=ne,e[56]=ae):ae=e[56];let de;e[57]!==X||e[58]!==ae?(de=r.jsxs("div",{className:"flex items-center gap-2",children:[X,q,ae]}),e[57]=X,e[58]=ae,e[59]=de):de=e[59],e[60]!==oe||e[61]!==de?(w=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,de]}),e[60]=oe,e[61]=de,e[62]=w):w=e[62],g=fi,_="max-h-80",k=m?r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("automations.automationConfig.loadingTools")}):r.jsxs(r.Fragment,{children:[r.jsx(Jn,{children:o("automations.automationConfig.noToolsFound")}),kw.map(fe=>{const ue=fe.tools.map(Cse),ge=ue.filter(J=>I.has(J)).length;return r.jsx(fs,{heading:r.jsx(a5,{label:o(fe.headingKey),icon:fe.icon,on:ge,total:ue.length,onToggle:()=>H(ue,ge!==ue.length)}),children:fe.tools.map(J=>r.jsx(l5,{value:`${o(J.titleKey)} ${J.name}`,checked:I.has(J.name),onToggle:()=>U(J.name),title:o(J.titleKey),description:o(J.descriptionKey),leading:r.jsx(J.icon,{size:16,className:"text-muted-foreground"})},J.name))},fe.key)}),D.map(fe=>{const ue=fe.tools.map(jse),ge=ue.filter(J=>I.has(J)).length;return r.jsx(fs,{heading:r.jsx(a5,{conn:fe.conn,on:ge,total:ue.length,onToggle:()=>H(ue,ge!==ue.length)}),children:fe.tools.map(J=>r.jsx(l5,{value:`${J.display} ${J.name} ${fe.conn?.title??""}`,checked:I.has(J.name),onToggle:()=>U(J.name),title:J.display,description:J.description},J.name))},fe.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=o,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=y,e[18]=L,e[19]=_,e[20]=k,e[21]=S,e[22]=w,e[23]=j,e[24]=N,e[25]=A}else g=e[13],x=e[14],b=e[15],v=e[16],y=e[17],L=e[18],_=e[19],k=e[20],S=e[21],w=e[22],j=e[23],N=e[24],A=e[25];let C;e[63]!==g||e[64]!==_||e[65]!==k?(C=r.jsx(g,{className:_,children:k}),e[63]=g,e[64]=_,e[65]=k,e[66]=C):C=e[66];let T;e[67]!==x||e[68]!==C||e[69]!==S||e[70]!==w?(T=r.jsxs(x,{children:[S,w,C]}),e[67]=x,e[68]=C,e[69]=S,e[70]=w,e[71]=T):T=e[71];let V;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==N?(V=r.jsx(b,{className:j,align:N,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=N,e[76]=V):V=e[76];let R;return e[77]!==v||e[78]!==y||e[79]!==L||e[80]!==V||e[81]!==A?(R=r.jsxs(v,{open:A,onOpenChange:y,children:[L,V]}),e[77]=v,e[78]=y,e[79]=L,e[80]=V,e[81]=A,e[82]=R):R=e[82],R}function jse(t){return t.name}function Cse(t){return t.name}function Nse(t){return t.name}function Vse(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Tse(t){return[t.id,t]}function vd(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Ase(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 o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const a=(o[2]??"0").padStart(2,"0"),c=(o[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 Ese(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 Pse(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 Rse(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Dse=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Ise({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=re(),{triggerAdd:a}=ru(),[c,d]=E.useState(!1),h=e??c,u=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),pe.success(l("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");pe.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});u(!1),p.webhook?o?.(p.webhook):pe.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");pe.error(g)}};return r.jsxs(qt,{open:h,onOpenChange:u,children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",children:[r.jsx(Dt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(Yt,{align:"end",className:"w-[200px]",children:[r.jsxs(Wi,{children:[r.jsxs(qi,{className:"gap-2.5",children:[r.jsx(ad,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(Gi,{className:"w-[160px]",children:Dse.map(p=>r.jsxs(et,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(ad,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[r.jsx(ad,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[r.jsx(Ir,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(et,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function jw(t){const e=F.c(39),{open:s,onOpenChange:n,url:i,token:o,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]=E.useState(null),[m,p]=E.useState("curl"),[g,x]=E.useState("header"),b=E.useId();let v;e[0]!==h?(v=async(D,$)=>{try{await navigator.clipboard.writeText(D),f($),pe.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{pe.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=v):v=e[1];const y=v;let L;e[2]!==g||e[3]!==o||e[4]!==i?(L=i&&o&&g==="url"?`${i.replace(/\/$/,"")}/${o}`:i??"",e[2]=g,e[3]=o,e[4]=i,e[5]=L):L=e[5];const _=L,k=i&&o?g==="header"?`curl -X POST "${_}" \\
544
544
  -H "Authorization: Bearer ${o}" \\
545
545
  -H "Content-Type: application/json" \\
546
546
  -d '{"hello":"world"}'`:`curl -X POST "${_}" \\
@@ -721,7 +721,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
721
721
  <p class="cta">slides-create --theme &hellip;</p>
722
722
  </section>`].join(`
723
723
 
724
- `);function Rne(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Pne).replaceAll("{{title}}",Ene).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Dne(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=el(s),l=el(i??"");if(o.isPending||i&&l.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(xt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(o.isError||!o.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=r.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]!==o.data?(c=Rne(o.data,a),e[2]=a,e[3]=o.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=r.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 td(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ine(t){const e=F.c(16),{family:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;let a;e[0]!==s?(a=r.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]!==o){let u;e[7]!==i||e[8]!==l||e[9]!==o?(u=f=>{const m=o(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":f.name,title:p,value:UN(m),onChange:g=>l(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):r.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=o,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.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=r.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 Mne(t){const e=F.c(9),{token:s,value:n}=t;if(s.kind==="space"){let o;return e[0]!==n?(o=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="radius"){let o;return e[2]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=o):o=e[3],o}if(s.kind==="shadow"){let o;return e[4]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=o):o=e[5],o}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const o=`min(${n}, 22px)`;let l;return e[6]!==o?(l=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:o},children:"Ag"}),e[6]=o,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Rw(t){const e=F.c(17),{token:s,value:n,editing:i,onEdit:o}=t;let l;e[0]!==s||e[1]!==n?(l=r.jsx(Mne,{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=r.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]!==o||e[10]!==s.name||e[11]!==n?(d=i?r.jsx(pt,{value:n,onChange:u=>o(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=o,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=r.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 Oc(t){const e=F.c(16),{label:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=r.jsx(td,{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]!==o){let u;e[7]!==i||e[8]!==l||e[9]!==o?(u=f=>r.jsx(Rw,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.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=r.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 $ne({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=We(),o=jh(t),l=o.volume??"",a=o.dirPath,c=ls(a),d=o.readOnly,h=Ls(),u=oc(),f=Yv(l),{upload:m,remove:p}=Vd(l),g=E.useRef(null),x=wp(l,a),b=x.data??[],v=J=>b.some(me=>me.kind==="file"&&ls(me.path)===J),y=v("tokens.css"),L=v("brand.md"),_=v("slides-theme.html"),k=ON(b),S=u(l,`${a}/tokens.css`),w=u(l,`${a}/brand.md`),j=u(l,`${a}/slides-theme.html`),N=el(S,{enabled:y}),A=el(w,{enabled:L}),[C,T]=E.useState(!1),[V,R]=E.useState({}),[P,M]=E.useState(null),[D,$]=E.useState(!1),[z,I]=E.useState(!1),[O,B]=E.useState("deck"),U=N.data?BN(N.data):[],H=J=>U.find(me=>me.name===J)?.value,K=J=>V[J.name]??J.value,W=zN(U),Y=U.filter(J=>J.kind==="font"),Q=U.filter(J=>J.kind==="type"),te=U.filter(J=>J.kind==="space"),ee=U.filter(J=>J.kind==="radius"),oe=U.filter(J=>J.kind==="shadow"),se=U.filter(J=>J.kind==="motion"),G=U.filter(J=>J.kind==="other"),X=(J,me)=>R(ye=>({...ye,[J]:me})),q=_&&O==="deck",Z=P??A.data??"",le=Object.entries(V).filter(([J,me])=>H(J)!==me),ne=P!==null&&P!==(A.data??""),ae=le.length>0||ne;function de(){R({}),M(null),T(!1)}async function fe(){$(!0);try{if(le.length>0){let J=N.data??"";for(const[me,ye]of le)J=FN(J,me,ye);await f.mutateAsync({path:`${a}/tokens.css`,body:J,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:it.fileText(S)})}ne&&P!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:P,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:it.fileText(w)})),h.invalidateQueries({queryKey:it.orgFsVolume(i.id,l)}),h.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),R({}),M(null),T(!1),pe.success(n("library.brandPreview.brandSaved"))}catch(J){pe.error(J instanceof Error?J.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function ue(J){const me=J?.[0];if(!me)return;const Le=`logo.${(me.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([me],Le,{type:me.type})]}),k&&ls(k)!==Le&&await p.mutateAsync(k),pe.success(n("library.brandPreview.logoUpdated"))}catch(ke){pe.error(ke instanceof Error?ke.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ge=!x.isPending&&!y&&!L&&!k;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(l1,{size:18})}),s==="dialog"?r.jsx($t,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?r.jsxs(r.Fragment,{children:[r.jsx(he,{variant:"ghost",size:"sm",onClick:de,disabled:D,children:n("library.brandPreview.cancel")}),r.jsx(he,{size:"sm",disabled:!ae||D,onClick:()=>{fe()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[r.jsx(oN,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(cv,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(_s,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(xt,{className:"h-40 w-full rounded-xl"}),r.jsx(xt,{className:"h-4 w-1/3"}),r.jsx(xt,{className:"h-4 w-2/3"})]}):ge?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):r.jsxs(r.Fragment,{children:[(_||y)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(z?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>I(J=>!J),onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),I(me=>!me))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:J=>J.stopPropagation(),children:[_&&r.jsx("button",{type:"button",onClick:()=>{B("deck"),I(!1)},className:ie("rounded-md px-2.5 py-1",q?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{B("components"),I(!1)},className:ie("rounded-md px-2.5 py-1",q?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),z?r.jsx(Jt,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(yy,{size:16,className:"shrink-0 text-muted-foreground"})]}),!z&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",q?"aspect-[16/9]":"h-96"),children:q?r.jsx(Dne,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):r.jsx(Ane,{tokensUrl:S})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.logo")}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:k?r.jsx("img",{src:u(l,k),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(l1,{size:28,className:"text-muted-foreground/50"})}),C&&r.jsxs("div",{children:[r.jsxs(he,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(Qn,{size:14}),n(k?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:J=>{ue(J.target.files)}})]})]})]}),W.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.colors")}),W.map(J=>r.jsx(Ine,{family:J.family,tokens:J.tokens,editing:C,valueOf:K,onEdit:X},J.family))]}),(Y.length>0||Q.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.typography")}),Y.map(J=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:J.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?r.jsx(pt,{value:K(J),onChange:me=>X(J.name,me.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:K(J)},children:K(J)})]},J.name)),Q.map(J=>r.jsx(Rw,{token:J,value:K(J),editing:C,onEdit:X},J.name))]}),r.jsx(Oc,{label:n("library.brandPreview.spacing"),tokens:te,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.radius"),tokens:ee,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.shadows"),tokens:oe,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.motion"),tokens:se,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.tokens"),tokens:G,editing:C,valueOf:K,onEdit:X}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.voiceGuidelines")}),C?r.jsx(Dr,{value:Z,onChange:J=>M(J.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):A.isPending&&L?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(xt,{className:"h-3 w-full"}),r.jsx(xt,{className:"h-3 w-5/6"})]}):Z.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Vo,{id:`brand-preview-${t}`,text:Z})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Dw(t){const e=F.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==s||e[3]!==n?(o=r.jsx(Pt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx($ne,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(Rt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Iw(t){const e=F.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,o=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]!==o?(a=r.jsx(Pt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(Pw,{previewPath:s,onClose:n,showSeeInLibrary:o,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsx(Rt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function One(t){const e=F.c(18),{skillPath:s,onClose:n,variant:i}=t,o=jh(s),{volume:l,dirPath:a}=o,c=oc(),d=c(l??"",`${a}/SKILL.md`),h=el(d),u=wp(l??"",a);let f;e[0]!==a?(f=ls(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==h.data?(p=h.data?HN(h.data):null,e[2]=h.data,e[3]=p):p=e[3];const g=p,x=zne;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(R,P)=>x(R.path)?-1:x(P.path)?1:ls(R.path).localeCompare(ls(P.path)),e[4]=b):b=e[4];const v=(u.data??[]).filter(Bne).sort(b),[y,L]=E.useState(null),_=y===null?null:v.find(R=>R.path===y)??null,k=g?.name??m;let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(Ir,{size:18})}),e[5]=S):S=e[5];let w;e[6]!==k||e[7]!==i?(w=i==="dialog"?r.jsx($t,{className:"flex-1 truncate text-base font-medium text-foreground",children:k}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:k}),e[6]=k,e[7]=i,e[8]=w):w=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(cv,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:n,children:r.jsx(_s,{size:16})}),e[9]=n,e[10]=i,e[11]=j):j=e[11];let N;e[12]!==w||e[13]!==j?(N=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[S,w,j]}),e[12]=w,e[13]=j,e[14]=N):N=e[14];let A;e[15]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=A):A=e[15];const C="relative flex min-w-0 flex-1 flex-col overflow-y-auto",T=_?r.jsx(Lg,{file:{key:_.path,filename:ls(_.path),size:_.size,downloadUrl:c(l??"",_.path)}}):h.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(xt,{className:"h-4 w-1/3"}),r.jsx(xt,{className:"h-3 w-full"}),r.jsx(xt,{className:"h-3 w-5/6"}),r.jsx(xt,{className:"h-3 w-2/3"})]}):h.isError||!g?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:g.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(Vo,{id:`skill-preview-${s}`,text:g.body})})]});let V;return e[16]!==T?(V=r.jsx("div",{className:C,children:T}),e[16]=T,e[17]=V):V=e[17],r.jsxs(r.Fragment,{children:[N,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[A,u.isPending?r.jsx(xt,{className:"mx-2 h-4 w-24"}):v.map(R=>{const P=x(R.path)?_===null:y===R.path;return r.jsxs("button",{type:"button",onClick:()=>L(x(R.path)?null:R.path),className:ie("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",P?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(nr,{filename:ls(R.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ie("truncate text-sm",P?"text-foreground":"text-muted-foreground"),children:ls(R.path)})]},R.path)})]}),V]})]})}function Bne(t){return t.kind==="file"}function zne(t){return ls(t)==="SKILL.md"}function Mw(t){const e=F.c(8),{skillPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==n||e[3]!==s?(o=r.jsx(Pt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(One,{skillPath:s,onClose:n,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(Rt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Fne(t){const e=F.c(11),{onOpenDir:s}=t,n=re(),i=FV();let o;e[0]!==i.data?(o=i.data??[],e[0]=i.data,e[1]=o):o=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==o){let c;e[6]!==s||e[7]!==n?(c=d=>r.jsx(su,{name:d.volume,glyph:kn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:Qv(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=o.map(c),e[2]=s,e[3]=n,e[4]=o,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=r.jsx(r.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function wg(t){return`${window.location.origin}${t}`}function yd(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Une=[Sd,"uploads","outputs"],$w=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Qn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Nr}],G1=new Set([...$w.map(t=>t.volume),Ea("public")]),Hne=6;function Ow(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Yb(t),o=i?`public/${i}`:t==="home"?kd(s):t;return n?`${o}/${n}`:o}function l0(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 co(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function wr(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"@container",children:r.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 Mf(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(wr,{children:Array.from({length:n*3},Kne)}),e[0]=n,e[1]=i):i=e[1],i}function Kne(t,e){return r.jsx(xt,{className:"h-16 rounded-2xl"},e)}function Sg(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Wne(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=re(),a=GN(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]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(h=r.jsx(su,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:o}),e[6]=i,e[7]=o,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function qne(t){const e=F.c(12),{onOpenDir:s}=t,n=re(),o=Jv().data?.length??0;let l;e[0]!==s?(l=$w.map(h=>r.jsx(Wne,{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]!==o||e[4]!==n?(a=o>0&&r.jsx(su,{name:Ea("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:Ir,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=o,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=r.jsx(Fne,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=r.jsxs(r.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Gne(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=We();let o;e[0]!==s?(o=s[0]===Sd?s.slice(1):s,e[0]=s,e[1]=o):o=e[1];const l=o,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?r.jsx("span",{className:"truncate font-medium text-foreground",children:kd(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Sd),children:kd(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=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(gn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:Ea(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Ea(m)})]},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=r.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 Yne(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=re(),{org:d}=We(),h=oc(),u=KN(s,n);let f;e[0]!==h||e[1]!==l?(f=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:wg(h(S.volume,S.path))}),e[0]=h,e[1]=l,e[2]=f):f=e[2];const m=f;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Mf,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let w;e[14]!==s||e[15]!==c?(w=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=w):w=e[16];let j;e[17]!==w?(j=r.jsx(Sg,{children:w}),e[17]=w,e[18]=j):j=e[18],v=j;break e}const S=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=ie("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=co,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]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let y;e[21]!==p||e[22]!==x?(y=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=y):y=e[23];let L;if(e[24]!==h||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==h||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(S=w=>{const j=Yb(w.volume)!==null;return r.jsx(Xv,{filename:ls(w.path),updatedAt:w.updatedAt,downloadUrl:h(w.volume,w.path),subtitle:Ow(w.volume,w.path,d.slug),publicState:yd(w),onOpen:()=>o(Qb(w.volume,w.path)),onShare:j?void 0:()=>m(w),onDelete:j?void 0:()=>a({volume:w.volume,path:w.path,kind:"file"})},`${w.volume}/${w.path}`)},e[31]=h,e[32]=a,e[33]=o,e[34]=d,e[35]=m,e[36]=S):S=e[36],L=g.map(S),e[24]=h,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let _;e[37]!==L?(_=r.jsx(wr,{children:L}),e[37]=L,e[38]=_):_=e[38];let k;return e[39]!==b||e[40]!==y||e[41]!==_?(k=r.jsxs("div",{className:b,children:[y,_]}),e[39]=b,e[40]=y,e[41]=_,e[42]=k):k=e[42],k}function Qne(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=re(),{org:l}=We(),a=Gv(),c=oc();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:wg(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let y;e[5]!==v?(y=r.jsx(co,{children:v}),e[5]=v,e[6]=y):y=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Mf,{}),e[7]=L):L=e[7];let _;return e[8]!==y?(_=r.jsxs("div",{className:"flex flex-col gap-3",children:[y,L]}),e[8]=y,e[9]=_):_=e[9],_}let u,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==h||e[16]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,Hne);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let y;e[22]!==o?(y=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=y):y=e[23],e[24]!==y?(p=r.jsx(co,{children:y}),e[24]=y,e[25]=p):p=e[25],u=wr;let L;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==h?(L=_=>r.jsx(YN,{filename:ls(_.path),updatedAt:_.updatedAt,size:_.size,downloadUrl:c(_.volume,_.path),subtitle:Ow(_.volume,_.path,l.slug),publicState:yd(_),onOpen:()=>s(Qb(_.volume,_.path)),onShare:()=>h(_),onDelete:()=>i({volume:_.volume,path:_.path,kind:"file"})},`${_.volume}/${_.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=h,e[31]=L):L=e[31],f=v.map(L)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=h,e[16]=o,e[17]=u,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else u=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=r.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=r.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Jne(t){const e=F.c(16),{onOpenDir:s}=t,n=re(),i=Jv();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Mf,{}),e[0]=d):d=e[0],d}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const l=o;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=r.jsx(Sg,{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=>r.jsx(su,{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=r.jsx(wr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Xne(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=re(),{org:m}=We(),p=s.volume??"",g=wp(p,s.dirPath),x=oc();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&G1.has(C.toLowerCase())?`${kd(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let y;e[3]!==s.isHomeRoot||e[4]!==n?(y=s.isHomeRoot?r.jsx(qne,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=y):y=e[5];const L=y;if(g.isPending){let C;e[6]!==L||e[7]!==f?(C=L&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.folders")}),r.jsx(wr,{children:L})]}),e[6]=L,e[7]=f,e[8]=C):C=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(Mf,{rows:2}),e[9]=T):T=e[9];let V;return e[10]!==C?(V=r.jsxs(r.Fragment,{children:[C,T]}),e[10]=C,e[11]=V):V=e[11],V}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let T;return e[15]!==C?(T=r.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=T):T=e[16],T}let _,k,S,w,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],T=C.filter(sie),V=C.filter(tie),R=C.filter(eie),P=C.filter(Zne);if(C.length===0&&!s.isHomeRoot){let I;e[38]!==s.readOnly||e[39]!==f?(I=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=I):I=e[40];let O;e[41]!==I?(O=r.jsx(Sg,{children:I}),e[41]=I,e[42]=O):O=e[42],j=O;break e}let M;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(M=I=>s.readOnly?void 0:()=>c({volume:p,path:I.path,kind:I.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=M):M=e[46];const D=M;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=I=>s.readOnly?void 0:()=>a({volume:p,path:I.path,kind:I.kind,shareMode:I.shareMode??"private",effectivePublic:I.effectivePublic??!1,url:I.kind==="file"?wg(x(p,I.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const z=$;_=T.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.skills")}),r.jsx(wr,{children:T.map(I=>r.jsx(WN,{dirName:ls(I.path),updatedAt:I.updatedAt,skillMdUrl:x(p,`${I.path}/SKILL.md`),publicState:yd(I),onOpen:()=>o(ra(s,I.path)),onBrowse:()=>n(ra(s,I.path)),onShare:z(I),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"dir",{onDragStart:d,onContextMenu:h})},I.path))})]}),k=V.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.brands")}),r.jsx(wr,{children:V.map(I=>r.jsx(qN,{dirName:ls(I.path),updatedAt:I.updatedAt,tokensUrl:x(p,`${I.path}/tokens.css`),onOpen:()=>l(ra(s,I.path)),onBrowse:()=>n(ra(s,I.path)),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"dir",{onDragStart:d,onContextMenu:h})},I.path))})]}),S=(R.length>0||L)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.folders")}),r.jsxs(wr,{children:[L,R.map(I=>r.jsx(su,{name:ls(I.path),meta:Qv(I.updatedAt),subtitle:v(ls(I.path)),readOnly:s.readOnly,publicState:yd(I),onOpen:()=>n(ra(s,I.path)),onShare:z(I),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},I.path))]})]}),w=P.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.files")}),r.jsx(wr,{children:P.map(I=>r.jsx(Xv,{filename:ls(I.path),updatedAt:I.updatedAt,downloadUrl:x(p,I.path),publicState:yd(I),onOpen:()=>i(ra(s,I.path)),onShare:z(I),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"file",{onDragStart:d,onContextMenu:h})},I.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=l,e[26]=n,e[27]=i,e[28]=o,e[29]=a,e[30]=L,e[31]=f,e[32]=p,e[33]=_,e[34]=k,e[35]=S,e[36]=w,e[37]=j}else _=e[33],k=e[34],S=e[35],w=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let N;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(N=s.isHomeRoot&&r.jsx(Qne,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=N):N=e[56];let A;return e[57]!==_||e[58]!==k||e[59]!==S||e[60]!==w||e[61]!==N?(A=r.jsxs(r.Fragment,{children:[_,k,S,w,N]}),e[57]=_,e[58]=k,e[59]=S,e[60]=w,e[61]=N,e[62]=A):A=e[62],A}function Zne(t){return t.kind==="file"}function eie(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function tie(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function sie(t){return t.kind==="dir"&&t.hasSkill}function nie({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=We(),o=Ls(),l=Ot(),a=So(),c=lr({strict:!1}),d=c.path||Sd,h=jh(d),u=UV(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,m=(J,me)=>l({to:".",search:ye=>({...ye,[J]:me||void 0})}),p=J=>m("path",J),g=(J,me)=>l({to:".",search:ye=>({...ye,preview:void 0,skill:void 0,brand:void 0,[J]:me})}),x=t??(J=>g("preview",J)),b=e??(J=>g("skill",J)),v=s??(J=>g("brand",J)),[y,L]=E.useState(""),_=Yh(y.trim(),300),k=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=k?n("library.library.searchInPlaceholder",{folder:Ea(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),w=f.isHomeRoot?kd(i.slug):Ea(f.segments.at(-1)??""),[j,N]=E.useState(null),[A,C]=E.useState(null),[T,V]=E.useState(!1),[R,P]=E.useState(""),[M,D]=E.useState(!1),[$,z]=E.useState(null),[I,O]=E.useState(""),B=E.useRef(null),[U,H]=E.useState(!1),K=E.useRef(0),W=f.readOnly?null:f.volume,{upload:Y,mkdir:Q,move:te}=Vd(W??Sd),{remove:ee}=Vd(j?.volume??"uploads");async function oe(J){if(!(!W||!J||J.length===0))try{await Y.mutateAsync({dir:f.dirPath,files:[...J]}),pe.success(J.length===1?n("library.library.uploadedSingle",{filename:J[0]?.name??""}):n("library.library.uploadedMultiple",{count:J.length}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.uploadFailed"))}finally{B.current&&(B.current.value="")}}const se=W!==null;function G(J){return J.dataTransfer.types.includes("Files")}function X(J){!se||!G(J)||(J.preventDefault(),K.current+=1,H(!0))}function q(J){!se||!G(J)||J.preventDefault()}function Z(){se&&(K.current=Math.max(0,K.current-1),K.current===0&&H(!1))}function le(J){se&&(J.preventDefault(),J.stopPropagation(),K.current=0,H(!1),J.dataTransfer.files.length>0&&oe(J.dataTransfer.files))}async function ne(){const J=R.trim();if(!(!W||!J)){if(f.isHomeRoot&&G1.has(J.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:J}));return}try{const me=f.dirPath;await Q.mutateAsync(me?`${me}/${J}`:J),pe.success(n("library.library.folderCreated",{name:J})),V(!1),P("")}catch(me){pe.error(me instanceof Error?me.message:n("library.library.folderCreateFailed"))}}}async function ae(){if(!j)return;const J=j;try{await ee.mutateAsync(J.path),pe.success(n("library.library.deleted",{name:ls(J.path)}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.deleteFailed"))}finally{N(null)}}async function de(){if(!$)return;const J=I.trim();if(!J||J.includes("/")||J.includes("..")||J===ls($.path)){D(!1),z(null),O("");return}if($.kind==="dir"&&f.isHomeRoot&&G1.has(J.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:J}));return}try{const me=$.path.includes("/")?$.path.slice(0,$.path.lastIndexOf("/")):"",ye=me?`${me}/${J}`:J;await te.mutateAsync({from:$.path,to:ye});const Le=J.replace(/[<>]/g,"");pe.success(n("library.library.renamed",{name:Le}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.renameFailed"))}finally{D(!1),z(null),O("")}}async function fe(J,me){try{const ye=ls(J),Le=me?`${me}/${ye}`:ye;await te.mutateAsync({from:J,to:Le}),pe.success(n("library.library.moved",{name:ye,destination:me||n("library.library.theLibrary")}))}catch(ye){pe.error(ye instanceof Error?ye.message:n("library.library.moveFailed"))}}function ue(){for(const J of Une)o.invalidateQueries({queryKey:it.orgFsVolume(i.id,J)});f.volume&&o.invalidateQueries({queryKey:it.orgFsVolume(i.id,f.volume)}),o.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:it.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:it.orgFsPublicSets(i.id)})}function ge(J){J.defaultPrevented||!W||J.target.closest("input, textarea, button, a, [role='button']")||(J.preventDefault(),V(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:X,onDragOver:q,onDragLeave:Z,onDrop:le,onContextMenu:ge,children:[U&&r.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:r.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:[r.jsx(Qn,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:w})})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:r.jsx(Gne,{segments:f.segments,onNavigate:p})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(Gh,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(pt,{value:y,onChange:J=>L(J.target.value),onKeyDown:J=>{J.key==="Escape"&&L("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),y&&r.jsx(he,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>L(""),"aria-label":n("library.library.clearSearch"),children:r.jsx(Si,{size:14})})]}),r.jsx(he,{variant:"ghost",size:"icon",onClick:ue,"aria-label":n("library.library.refresh"),children:r.jsx(Rn,{size:14})}),W&&r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[r.jsx(Dt,{size:14}),n("library.library.newFolder")]}),f.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(dc,{size:12}),n("library.library.readOnly")]}):r.jsxs(he,{size:"sm",disabled:Y.isPending,onClick:()=>B.current?.click(),children:[r.jsx(Qn,{size:14}),Y.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:J=>{oe(J.target.files)}})]}),_?r.jsx(Yne,{query:_,scope:k,stale:y.trim()!==_,onOpenFile:x,onShare:C,onDelete:N}):f.volume===null?r.jsx(Jne,{onOpenDir:p}):r.jsx(Xne,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:C,onDelete:N,onContextMenu:(J,me)=>{z({path:J,kind:me}),O(ls(J)),D(!0)},onMove:fe},f.volume)]})}),a&&(c.preview?r.jsx(Iw,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?r.jsx(Mw,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?r.jsx(Dw,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),r.jsx(Rt,{open:T,onOpenChange:V,children:r.jsxs(Pt,{children:[r.jsxs(ms,{children:[r.jsx($t,{children:n("library.library.newFolderTitle")}),r.jsx(Dn,{children:n("library.library.newFolderDescription",{path:w||n("library.library.theLibrary")})})]}),r.jsx(pt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:R,onChange:J=>P(J.target.value),onKeyDown:J=>{J.key==="Enter"&&ne()}}),r.jsxs(Gn,{children:[r.jsx(he,{variant:"outline",onClick:()=>V(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!R.trim()||Q.isPending,onClick:()=>{ne()},children:n("library.library.create")})]})]})}),r.jsx(Rt,{open:M,onOpenChange:J=>{D(J),J||(z(null),O(""))},children:r.jsxs(Pt,{children:[r.jsxs(ms,{children:[r.jsx($t,{children:$&&n("library.library.renameTitle",{name:ls($.path)})}),r.jsx(Dn,{children:n("library.library.renameDescription")})]}),r.jsx(pt,{autoFocus:!0,value:I,onChange:J=>O(J.target.value),onKeyDown:J=>{J.key==="Enter"&&de()}}),r.jsxs(Gn,{children:[r.jsx(he,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!I.trim()||te.isPending,onClick:()=>{de()},children:n("library.library.rename")})]})]})}),r.jsx(yne,{target:A,onOpenChange:J=>{J||C(null)}}),r.jsx(Ma,{open:j!==null,onOpenChange:J=>{J||N(null)},children:r.jsxs($a,{children:[r.jsxs(Oa,{children:[r.jsx(Ba,{children:n("library.library.deleteTitle",{name:j?ls(j.path):""})}),r.jsx(za,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(Fa,{children:[r.jsx(Ua,{children:n("library.library.cancel")}),r.jsx(Ha,{onClick:()=>{ae()},children:n("library.library.delete")})]})]})})]})}function iie(){const t=F.c(12),e=Ot(),[s,n]=E.useState(null),[i,o]=E.useState(null);let l;t[0]!==e?(l=f=>e({to:".",search:m=>({...m,main:f}),replace:!0}),t[0]=e,t[1]=l):l=t[1];const a=l;let c;t[2]!==a?(c=r.jsx(nie,{onOpenFile:f=>a(pC(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(Mw,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let h;t[6]!==i?(h=i&&r.jsx(Dw,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=h):h=t[7];let u;return t[8]!==c||t[9]!==d||t[10]!==h?(u=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,h]}),t[8]=c,t[9]=d,t[10]=h,t[11]=u):u=t[11],u}const f5=E.lazy(()=>In(()=>import("./project-app-view-BmDjcK09.js"),__vite__mapDeps([164,1,2,52,53,15,3,18,4,5,6,7,8,9,10,11,12,13,14,16,17,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,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,120,109,110,111,112,113,114,115,116,117,102,103,104,105,106,107,108,118,119,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.AppViewContent})));function rie(t){const e=F.c(63),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let _;return e[0]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(wK,{}),e[0]=_):_=e[0],_}if(s==="board"){let _;return e[1]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(sW,{})}),e[1]=_):_=e[1],_}if(gC(s)){let _;return e[2]!==n?(_=r.jsx(lx,{virtualMcpId:n}),e[2]=n,e[3]=_):_=e[3],_}if(s==="git"){let _;return e[4]!==n?(_=r.jsx(Fq,{virtualMcpId:n}),e[4]=n,e[5]=_):_=e[5],_}if(s==="automations"){let _;return e[6]!==n?(_=r.jsx(Zse,{virtualMcpId:n}),e[6]=n,e[7]=_):_=e[7],_}if(s==="preview"){let _;return e[8]!==n?(_=r.jsx(see,{virtualMcpId:n}),e[8]=n,e[9]=_):_=e[9],_}let c;e[10]!==s?(c=xC(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let _;return e[12]!==d.path?(_=r.jsx(oee,{openPath:d.path}),e[12]=d.path,e[13]=_):_=e[13],_}if(s==="content"){let _;return e[14]!==n?(_=r.jsx(lse,{virtualMcpId:n}),e[14]=n,e[15]=_):_=e[15],_}if(s==="assets"){let _;return e[16]!==n?(_=r.jsx(ase,{virtualMcpId:n}),e[16]=n,e[17]=_):_=e[17],_}if(s==="files"){let _;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(iie,{}),e[18]=_):_=e[18],_}if(s==="connect-sources"){let _;return e[19]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(ane,{}),e[19]=_):_=e[19],_}if(a){let _;return e[20]!==s?(_=r.jsx(Gse,{tabId:s}),e[20]=s,e[21]=_):_=e[21],_}let h;e[22]!==s?(h=_v(s),e[22]=s,e[23]=h):h=e[23];const u=h;if(u){let _;return e[24]!==u.path?(_=r.jsx(Lne,{path:u.path},u.path),e[24]=u.path,e[25]=_):_=e[25],_}let f;e[26]!==s?(f=yv(s),e[26]=s,e[27]=f):f=e[27];const m=f;if(m){let _;return e[28]!==m.key||e[29]!==i?(_=r.jsx(rne,{fileKey:m.key,taskId:i}),e[28]=m.key,e[29]=i,e[30]=_):_=e[30],_}let p;e[31]!==s?(p=Lv(s),e[31]=s,e[32]=p):p=e[32];const g=p;if(g){let _;return e[33]!==g.path?(_=r.jsx(jne,{path:g.path},g.path),e[33]=g.path,e[34]=_):_=e[34],_}let x;e[35]!==s?(x=bC(s),e[35]=s,e[36]=x):x=e[36];const b=x;if(b){let _;if(e[37]!==l||e[38]!==b.connectionId||e[39]!==b.toolName){let N;e[41]!==b.connectionId||e[42]!==b.toolName?(N=A=>A.appId===b.connectionId&&A.toolName===b.toolName,e[41]=b.connectionId,e[42]=b.toolName,e[43]=N):N=e[43],_=l.find(N),e[37]=l,e[38]=b.connectionId,e[39]=b.toolName,e[40]=_}else _=e[40];const k=_;let S;e[44]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(ul,{}),e[44]=S):S=e[44];const w=k?.args;let j;return e[45]!==s||e[46]!==b.connectionId||e[47]!==b.toolName||e[48]!==w?(j=r.jsx(E.Suspense,{fallback:S,children:r.jsx(f5,{connectionId:b.connectionId,toolName:b.toolName,args:w},s)}),e[45]=s,e[46]=b.connectionId,e[47]=b.toolName,e[48]=w,e[49]=j):j=e[49],j}let v;if(e[50]!==s||e[51]!==o){let _;e[53]!==s?(_=k=>k.id===s,e[53]=s,e[54]=_):_=e[54],v=o.find(_),e[50]=s,e[51]=o,e[52]=v}else v=e[52];const y=v;if(y){let _;e[55]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(ul,{}),e[55]=_):_=e[55];let k;return e[56]!==s||e[57]!==y.id||e[58]!==y.view.appId||e[59]!==y.view.args?(k=r.jsx(E.Suspense,{fallback:_,children:r.jsx(f5,{connectionId:y.view.appId,toolName:y.id,args:y.view.args},s)}),e[56]=s,e[57]=y.id,e[58]=y.view.appId,e[59]=y.view.args,e[60]=k):k=e[60],k}let L;return e[61]!==n?(L=r.jsx(lx,{virtualMcpId:n}),e[61]=n,e[62]=L):L=e[62],L}function oie(t){const e=F.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:o,layoutTabs:l,expandedTools:a,automationTabParsed:c}=u2(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(ul,{}),e[3]=d):d=e[3];let h;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(h=r.jsx(E.Suspense,{fallback:d,children:r.jsx(rie,{activeTab:o,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=o,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]!==o||e[12]!==h?(u=r.jsx(Js,{children:h},o),e[11]=o,e[12]=h,e[13]=u):u=e[13],u}function lie(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&vC.has(t.mainTab))}const Jo="setup";function aie(t){const e=F.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=_=>!t.scriptTabs.includes(_),e[3]=t.scriptTabs,e[4]=L):L=e[4],n=t.scripts.filter(L),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let o;e[5]!==t?(o=()=>{t.active===Jo?t.onToggle():t.onSelectTab(Jo)},e[5]=t,e[6]=o):o=e[6];const l=o;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?r.jsx(Jt,{className:"size-4"}):r.jsx(yy,{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=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{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=r.jsx(He,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=r.jsxs(Ke,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const m=t.active===Jo;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(cie,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(L=>r.jsx(uie,{active:t.active===L,onClick:()=>{t.active===L?t.onToggle():t.onSelectTab(L)},onClose:()=>t.onCloseScript(L),t:s,children:L},L)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=r.jsx(hie,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?r.jsx(fie,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(die,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let y;return e[53]!==b||e[54]!==v||e[55]!==f?(y=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=y):y=e[56],y}function cie(t){const e=F.c(11),{active:s,open:n,onClick:i,t:o}=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=r.jsx(lN,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==o?(u=o("sandbox.toolbar.setupTab"),e[3]=o,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=r.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 die(t){const e=F.c(40),{status:s,onStart:n,onStop:i,onRestart:o,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(tl,{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=r.jsxs(he,{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=r.jsx(tl,{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=r.jsxs(he,{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=r.jsx(Rn,{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=r.jsxs(he,{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"&&!!o,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 m;e[22]!==i||e[23]!==u||e[24]!==f?(m=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:i,className:u,children:f})}),e[22]=i,e[23]=u,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=r.jsx(He,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(Ke,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==o||e[34]!==d||e[35]!==c?(b=d&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(Jt,{className:"size-3"})})}),r.jsx(Yt,{align:"end",children:r.jsxs(et,{onClick:o,children:[r.jsx(Rn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=o,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=r.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function uie(t){const e=F.c(17),{active:s,onClick:n,onClose:i,children:o,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]!==o||e[6]!==n||e[7]!==u?(f=r.jsx("button",{type:"button",onClick:n,className:u,children:o}),e[5]=o,e[6]=n,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i||e[11]!==l?(m=i&&r.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(o)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:r.jsx(_s,{className:"size-3.5"})}),e[9]=o,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function hie(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=re(),[o,l]=E.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=r.jsx(Dt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(Ue,{asChild:!0,children:r.jsx(ts,{asChild:!0,children:r.jsx(he,{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=r.jsx(He,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=r.jsxs(Ke,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=r.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>r.jsxs("button",{type:"button",onClick:()=>{l(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=r.jsxs(ss,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==o||e[24]!==x||e[25]!==f?(b=r.jsxs(ns,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function fie(t){const e=F.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:o,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(ut,{className:"size-3.5 animate-spin"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=r.jsxs(he,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(tl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=r.jsx(Ue,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=r.jsx(He,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(Ke,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==o||e[21]!==a?(c=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:o,children:a})}),e[20]=o,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=r.jsx(He,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=r.jsxs(Ke,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var Bw=Object.defineProperty,mie=Object.getOwnPropertyDescriptor,pie=(t,e)=>{for(var s in e)Bw(t,s,{get:e[s],enumerable:!0})},ws=(t,e,s,n)=>{for(var i=n>1?void 0:n?mie(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&Bw(e,s,i),i},qe=(t,e)=>(s,n)=>e(s,n,t),m5="Terminal input",Y1={get:()=>m5,set:t=>m5=t},p5="Too much output to announce, navigate to rows manually to read",Q1={get:()=>p5,set:t=>p5=t};function gie(t){return t.replace(/\r?\n/g,"\r")}function xie(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function bie(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function vie(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");zw(i,e,s,n)}}function zw(t,e,s,n){t=gie(t),t=xie(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Fw(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,o=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function g5(t,e,s,n,i){Fw(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function ao(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function $f(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let o=t[i];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var yie=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 o=t.charCodeAt(i++);56320<=o&&o<=57343?e[n++]=(this._interim-55296)*1024+o-56320+65536:(e[n++]=this._interim,e[n++]=o),this._interim=0}for(let o=i;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,n;let a=t.charCodeAt(o);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}},_ie=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,o,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((i=t[u])&128)&&!((o=t[u+1])&128)&&!((l=t[u+2])&128)&&!((a=t[u+3])&128);)e[n++]=i,e[n++]=o,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(o=t[u++],(o&192)!==128){u--;continue}if(c=(i&31)<<6|o&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(i&15)<<12|(o&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(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Uw="",fo=" ",yu=class Hw{constructor(){this.fg=0,this.bg=0,this.extended=new mh}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 Hw;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}},mh=class Kw{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 Kw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},li=class Ww extends yu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mh,this.combinedData=""}static fromCharData(e){let s=new Ww;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?ao(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()]}},x5="di$target",J1="di$dependencies",M9=new Map;function Lie(t){return t[J1]||[]}function tn(t){if(M9.has(t))return M9.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");wie(e,s,i)};return e._id=t,M9.set(t,e),e}function wie(t,e,s){e[x5]===e?e[J1].push({id:t,index:s}):(e[J1]=[{id:t,index:s}],e[x5]=e)}var Nn=tn("BufferService"),qw=tn("CoreMouseService"),Vl=tn("CoreService"),Sie=tn("CharsetService"),kg=tn("InstantiationService"),Gw=tn("LogService"),Vn=tn("OptionsService"),Yw=tn("OscLinkService"),kie=tn("UnicodeService"),_u=tn("DecorationService"),X1=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,o=new li,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,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=h,a=o.extended.urlId;continue}else d=o.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}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:u,range:f,activate:(p,g)=>i?i.activate(p,g,f):jie(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=h,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};X1=ws([qe(0,Nn),qe(1,Vn),qe(2,Yw)],X1);function jie(t,e){if(confirm(`Do you want to navigate to ${e}?
724
+ `);function Rne(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Pne).replaceAll("{{title}}",Ene).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Dne(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=el(s),l=el(i??"");if(o.isPending||i&&l.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(xt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(o.isError||!o.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=r.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]!==o.data?(c=Rne(o.data,a),e[2]=a,e[3]=o.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=r.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 td(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ine(t){const e=F.c(16),{family:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;let a;e[0]!==s?(a=r.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]!==o){let u;e[7]!==i||e[8]!==l||e[9]!==o?(u=f=>{const m=o(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":f.name,title:p,value:UN(m),onChange:g=>l(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):r.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=o,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.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=r.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 Mne(t){const e=F.c(9),{token:s,value:n}=t;if(s.kind==="space"){let o;return e[0]!==n?(o=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="radius"){let o;return e[2]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=o):o=e[3],o}if(s.kind==="shadow"){let o;return e[4]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=o):o=e[5],o}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const o=`min(${n}, 22px)`;let l;return e[6]!==o?(l=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:o},children:"Ag"}),e[6]=o,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Rw(t){const e=F.c(17),{token:s,value:n,editing:i,onEdit:o}=t;let l;e[0]!==s||e[1]!==n?(l=r.jsx(Mne,{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=r.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]!==o||e[10]!==s.name||e[11]!==n?(d=i?r.jsx(pt,{value:n,onChange:u=>o(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=o,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=r.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 Oc(t){const e=F.c(16),{label:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=r.jsx(td,{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]!==o){let u;e[7]!==i||e[8]!==l||e[9]!==o?(u=f=>r.jsx(Rw,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.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=r.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 $ne({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=We(),o=jh(t),l=o.volume??"",a=o.dirPath,c=ls(a),d=o.readOnly,h=Ls(),u=oc(),f=Yv(l),{upload:m,remove:p}=Vd(l),g=E.useRef(null),x=wp(l,a),b=x.data??[],v=J=>b.some(me=>me.kind==="file"&&ls(me.path)===J),y=v("tokens.css"),L=v("brand.md"),_=v("slides-theme.html"),k=ON(b),S=u(l,`${a}/tokens.css`),w=u(l,`${a}/brand.md`),j=u(l,`${a}/slides-theme.html`),N=el(S,{enabled:y}),A=el(w,{enabled:L}),[C,T]=E.useState(!1),[V,R]=E.useState({}),[P,M]=E.useState(null),[D,$]=E.useState(!1),[z,I]=E.useState(!1),[O,B]=E.useState("deck"),U=N.data?BN(N.data):[],H=J=>U.find(me=>me.name===J)?.value,K=J=>V[J.name]??J.value,W=zN(U),Y=U.filter(J=>J.kind==="font"),Q=U.filter(J=>J.kind==="type"),te=U.filter(J=>J.kind==="space"),ee=U.filter(J=>J.kind==="radius"),oe=U.filter(J=>J.kind==="shadow"),se=U.filter(J=>J.kind==="motion"),G=U.filter(J=>J.kind==="other"),X=(J,me)=>R(ye=>({...ye,[J]:me})),q=_&&O==="deck",Z=P??A.data??"",le=Object.entries(V).filter(([J,me])=>H(J)!==me),ne=P!==null&&P!==(A.data??""),ae=le.length>0||ne;function de(){R({}),M(null),T(!1)}async function fe(){$(!0);try{if(le.length>0){let J=N.data??"";for(const[me,ye]of le)J=FN(J,me,ye);await f.mutateAsync({path:`${a}/tokens.css`,body:J,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:it.fileText(S)})}ne&&P!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:P,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:it.fileText(w)})),h.invalidateQueries({queryKey:it.orgFsVolume(i.id,l)}),h.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),R({}),M(null),T(!1),pe.success(n("library.brandPreview.brandSaved"))}catch(J){pe.error(J instanceof Error?J.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function ue(J){const me=J?.[0];if(!me)return;const Le=`logo.${(me.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([me],Le,{type:me.type})]}),k&&ls(k)!==Le&&await p.mutateAsync(k),pe.success(n("library.brandPreview.logoUpdated"))}catch(ke){pe.error(ke instanceof Error?ke.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ge=!x.isPending&&!y&&!L&&!k;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(l1,{size:18})}),s==="dialog"?r.jsx($t,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?r.jsxs(r.Fragment,{children:[r.jsx(he,{variant:"ghost",size:"sm",onClick:de,disabled:D,children:n("library.brandPreview.cancel")}),r.jsx(he,{size:"sm",disabled:!ae||D,onClick:()=>{fe()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[r.jsx(oN,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(cv,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(_s,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(xt,{className:"h-40 w-full rounded-xl"}),r.jsx(xt,{className:"h-4 w-1/3"}),r.jsx(xt,{className:"h-4 w-2/3"})]}):ge?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):r.jsxs(r.Fragment,{children:[(_||y)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(z?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>I(J=>!J),onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),I(me=>!me))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:J=>J.stopPropagation(),children:[_&&r.jsx("button",{type:"button",onClick:()=>{B("deck"),I(!1)},className:ie("rounded-md px-2.5 py-1",q?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{B("components"),I(!1)},className:ie("rounded-md px-2.5 py-1",q?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),z?r.jsx(Jt,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(yy,{size:16,className:"shrink-0 text-muted-foreground"})]}),!z&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",q?"aspect-[16/9]":"h-96"),children:q?r.jsx(Dne,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):r.jsx(Ane,{tokensUrl:S})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.logo")}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:k?r.jsx("img",{src:u(l,k),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(l1,{size:28,className:"text-muted-foreground/50"})}),C&&r.jsxs("div",{children:[r.jsxs(he,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(Qn,{size:14}),n(k?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:J=>{ue(J.target.files)}})]})]})]}),W.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.colors")}),W.map(J=>r.jsx(Ine,{family:J.family,tokens:J.tokens,editing:C,valueOf:K,onEdit:X},J.family))]}),(Y.length>0||Q.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.typography")}),Y.map(J=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:J.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?r.jsx(pt,{value:K(J),onChange:me=>X(J.name,me.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:K(J)},children:K(J)})]},J.name)),Q.map(J=>r.jsx(Rw,{token:J,value:K(J),editing:C,onEdit:X},J.name))]}),r.jsx(Oc,{label:n("library.brandPreview.spacing"),tokens:te,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.radius"),tokens:ee,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.shadows"),tokens:oe,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.motion"),tokens:se,editing:C,valueOf:K,onEdit:X}),r.jsx(Oc,{label:n("library.brandPreview.tokens"),tokens:G,editing:C,valueOf:K,onEdit:X}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(td,{children:n("library.brandPreview.voiceGuidelines")}),C?r.jsx(Dr,{value:Z,onChange:J=>M(J.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):A.isPending&&L?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(xt,{className:"h-3 w-full"}),r.jsx(xt,{className:"h-3 w-5/6"})]}):Z.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Vo,{id:`brand-preview-${t}`,text:Z})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Dw(t){const e=F.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==s||e[3]!==n?(o=r.jsx(Pt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx($ne,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(Rt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Iw(t){const e=F.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,o=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]!==o?(a=r.jsx(Pt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(Pw,{previewPath:s,onClose:n,showSeeInLibrary:o,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsx(Rt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function One(t){const e=F.c(18),{skillPath:s,onClose:n,variant:i}=t,o=jh(s),{volume:l,dirPath:a}=o,c=oc(),d=c(l??"",`${a}/SKILL.md`),h=el(d),u=wp(l??"",a);let f;e[0]!==a?(f=ls(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==h.data?(p=h.data?HN(h.data):null,e[2]=h.data,e[3]=p):p=e[3];const g=p,x=zne;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(R,P)=>x(R.path)?-1:x(P.path)?1:ls(R.path).localeCompare(ls(P.path)),e[4]=b):b=e[4];const v=(u.data??[]).filter(Bne).sort(b),[y,L]=E.useState(null),_=y===null?null:v.find(R=>R.path===y)??null,k=g?.name??m;let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(Ir,{size:18})}),e[5]=S):S=e[5];let w;e[6]!==k||e[7]!==i?(w=i==="dialog"?r.jsx($t,{className:"flex-1 truncate text-base font-medium text-foreground",children:k}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:k}),e[6]=k,e[7]=i,e[8]=w):w=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(cv,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:n,children:r.jsx(_s,{size:16})}),e[9]=n,e[10]=i,e[11]=j):j=e[11];let N;e[12]!==w||e[13]!==j?(N=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[S,w,j]}),e[12]=w,e[13]=j,e[14]=N):N=e[14];let A;e[15]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=A):A=e[15];const C="relative flex min-w-0 flex-1 flex-col overflow-y-auto",T=_?r.jsx(Lg,{file:{key:_.path,filename:ls(_.path),size:_.size,downloadUrl:c(l??"",_.path)}}):h.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(xt,{className:"h-4 w-1/3"}),r.jsx(xt,{className:"h-3 w-full"}),r.jsx(xt,{className:"h-3 w-5/6"}),r.jsx(xt,{className:"h-3 w-2/3"})]}):h.isError||!g?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:g.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(Vo,{id:`skill-preview-${s}`,text:g.body})})]});let V;return e[16]!==T?(V=r.jsx("div",{className:C,children:T}),e[16]=T,e[17]=V):V=e[17],r.jsxs(r.Fragment,{children:[N,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[A,u.isPending?r.jsx(xt,{className:"mx-2 h-4 w-24"}):v.map(R=>{const P=x(R.path)?_===null:y===R.path;return r.jsxs("button",{type:"button",onClick:()=>L(x(R.path)?null:R.path),className:ie("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",P?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(nr,{filename:ls(R.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ie("truncate text-sm",P?"text-foreground":"text-muted-foreground"),children:ls(R.path)})]},R.path)})]}),V]})]})}function Bne(t){return t.kind==="file"}function zne(t){return ls(t)==="SKILL.md"}function Mw(t){const e=F.c(8),{skillPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==n||e[3]!==s?(o=r.jsx(Pt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(One,{skillPath:s,onClose:n,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(Rt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Fne(t){const e=F.c(11),{onOpenDir:s}=t,n=re(),i=FV();let o;e[0]!==i.data?(o=i.data??[],e[0]=i.data,e[1]=o):o=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==o){let c;e[6]!==s||e[7]!==n?(c=d=>r.jsx(su,{name:d.volume,glyph:kn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:Qv(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=o.map(c),e[2]=s,e[3]=n,e[4]=o,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=r.jsx(r.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function wg(t){return`${window.location.origin}${t}`}function yd(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Une=[Sd,"uploads","outputs"],$w=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Qn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Nr}],G1=new Set([...$w.map(t=>t.volume),Ea("public")]),Hne=6;function Ow(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Yb(t),o=i?`public/${i}`:t==="home"?kd(s):t;return n?`${o}/${n}`:o}function l0(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 co(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function wr(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"@container",children:r.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 Mf(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(wr,{children:Array.from({length:n*3},Kne)}),e[0]=n,e[1]=i):i=e[1],i}function Kne(t,e){return r.jsx(xt,{className:"h-16 rounded-2xl"},e)}function Sg(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Wne(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=re(),a=GN(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]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(h=r.jsx(su,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:o}),e[6]=i,e[7]=o,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function qne(t){const e=F.c(12),{onOpenDir:s}=t,n=re(),o=Jv().data?.length??0;let l;e[0]!==s?(l=$w.map(h=>r.jsx(Wne,{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]!==o||e[4]!==n?(a=o>0&&r.jsx(su,{name:Ea("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:Ir,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=o,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=r.jsx(Fne,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=r.jsxs(r.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Gne(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=We();let o;e[0]!==s?(o=s[0]===Sd?s.slice(1):s,e[0]=s,e[1]=o):o=e[1];const l=o,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?r.jsx("span",{className:"truncate font-medium text-foreground",children:kd(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Sd),children:kd(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=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(gn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:Ea(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Ea(m)})]},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=r.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 Yne(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=re(),{org:d}=We(),h=oc(),u=KN(s,n);let f;e[0]!==h||e[1]!==l?(f=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:wg(h(S.volume,S.path))}),e[0]=h,e[1]=l,e[2]=f):f=e[2];const m=f;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Mf,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let w;e[14]!==s||e[15]!==c?(w=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=w):w=e[16];let j;e[17]!==w?(j=r.jsx(Sg,{children:w}),e[17]=w,e[18]=j):j=e[18],v=j;break e}const S=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=ie("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=co,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]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let y;e[21]!==p||e[22]!==x?(y=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=y):y=e[23];let L;if(e[24]!==h||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==h||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(S=w=>{const j=Yb(w.volume)!==null;return r.jsx(Xv,{filename:ls(w.path),updatedAt:w.updatedAt,downloadUrl:h(w.volume,w.path),subtitle:Ow(w.volume,w.path,d.slug),publicState:yd(w),onOpen:()=>o(Qb(w.volume,w.path)),onShare:j?void 0:()=>m(w),onDelete:j?void 0:()=>a({volume:w.volume,path:w.path,kind:"file"})},`${w.volume}/${w.path}`)},e[31]=h,e[32]=a,e[33]=o,e[34]=d,e[35]=m,e[36]=S):S=e[36],L=g.map(S),e[24]=h,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let _;e[37]!==L?(_=r.jsx(wr,{children:L}),e[37]=L,e[38]=_):_=e[38];let k;return e[39]!==b||e[40]!==y||e[41]!==_?(k=r.jsxs("div",{className:b,children:[y,_]}),e[39]=b,e[40]=y,e[41]=_,e[42]=k):k=e[42],k}function Qne(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=re(),{org:l}=We(),a=Gv(),c=oc();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:wg(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let y;e[5]!==v?(y=r.jsx(co,{children:v}),e[5]=v,e[6]=y):y=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Mf,{}),e[7]=L):L=e[7];let _;return e[8]!==y?(_=r.jsxs("div",{className:"flex flex-col gap-3",children:[y,L]}),e[8]=y,e[9]=_):_=e[9],_}let u,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==h||e[16]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,Hne);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let y;e[22]!==o?(y=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=y):y=e[23],e[24]!==y?(p=r.jsx(co,{children:y}),e[24]=y,e[25]=p):p=e[25],u=wr;let L;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==h?(L=_=>r.jsx(YN,{filename:ls(_.path),updatedAt:_.updatedAt,size:_.size,downloadUrl:c(_.volume,_.path),subtitle:Ow(_.volume,_.path,l.slug),publicState:yd(_),onOpen:()=>s(Qb(_.volume,_.path)),onShare:()=>h(_),onDelete:()=>i({volume:_.volume,path:_.path,kind:"file"})},`${_.volume}/${_.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=h,e[31]=L):L=e[31],f=v.map(L)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=h,e[16]=o,e[17]=u,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else u=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=r.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=r.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Jne(t){const e=F.c(16),{onOpenDir:s}=t,n=re(),i=Jv();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Mf,{}),e[0]=d):d=e[0],d}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const l=o;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=r.jsx(Sg,{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=>r.jsx(su,{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=r.jsx(wr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Xne(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=re(),{org:m}=We(),p=s.volume??"",g=wp(p,s.dirPath),x=oc();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&G1.has(C.toLowerCase())?`${kd(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let y;e[3]!==s.isHomeRoot||e[4]!==n?(y=s.isHomeRoot?r.jsx(qne,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=y):y=e[5];const L=y;if(g.isPending){let C;e[6]!==L||e[7]!==f?(C=L&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.folders")}),r.jsx(wr,{children:L})]}),e[6]=L,e[7]=f,e[8]=C):C=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(Mf,{rows:2}),e[9]=T):T=e[9];let V;return e[10]!==C?(V=r.jsxs(r.Fragment,{children:[C,T]}),e[10]=C,e[11]=V):V=e[11],V}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let T;return e[15]!==C?(T=r.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=T):T=e[16],T}let _,k,S,w,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],T=C.filter(sie),V=C.filter(tie),R=C.filter(eie),P=C.filter(Zne);if(C.length===0&&!s.isHomeRoot){let I;e[38]!==s.readOnly||e[39]!==f?(I=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=I):I=e[40];let O;e[41]!==I?(O=r.jsx(Sg,{children:I}),e[41]=I,e[42]=O):O=e[42],j=O;break e}let M;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(M=I=>s.readOnly?void 0:()=>c({volume:p,path:I.path,kind:I.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=M):M=e[46];const D=M;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=I=>s.readOnly?void 0:()=>a({volume:p,path:I.path,kind:I.kind,shareMode:I.shareMode??"private",effectivePublic:I.effectivePublic??!1,url:I.kind==="file"?wg(x(p,I.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const z=$;_=T.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.skills")}),r.jsx(wr,{children:T.map(I=>r.jsx(WN,{dirName:ls(I.path),updatedAt:I.updatedAt,skillMdUrl:x(p,`${I.path}/SKILL.md`),publicState:yd(I),onOpen:()=>o(ra(s,I.path)),onBrowse:()=>n(ra(s,I.path)),onShare:z(I),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"dir",{onDragStart:d,onContextMenu:h})},I.path))})]}),k=V.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.brands")}),r.jsx(wr,{children:V.map(I=>r.jsx(qN,{dirName:ls(I.path),updatedAt:I.updatedAt,tokensUrl:x(p,`${I.path}/tokens.css`),onOpen:()=>l(ra(s,I.path)),onBrowse:()=>n(ra(s,I.path)),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"dir",{onDragStart:d,onContextMenu:h})},I.path))})]}),S=(R.length>0||L)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.folders")}),r.jsxs(wr,{children:[L,R.map(I=>r.jsx(su,{name:ls(I.path),meta:Qv(I.updatedAt),subtitle:v(ls(I.path)),readOnly:s.readOnly,publicState:yd(I),onOpen:()=>n(ra(s,I.path)),onShare:z(I),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},I.path))]})]}),w=P.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(co,{children:f("library.libraryViews.files")}),r.jsx(wr,{children:P.map(I=>r.jsx(Xv,{filename:ls(I.path),updatedAt:I.updatedAt,downloadUrl:x(p,I.path),publicState:yd(I),onOpen:()=>i(ra(s,I.path)),onShare:z(I),onDelete:D(I),draggable:!s.readOnly,...l0(I.path,"file",{onDragStart:d,onContextMenu:h})},I.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=l,e[26]=n,e[27]=i,e[28]=o,e[29]=a,e[30]=L,e[31]=f,e[32]=p,e[33]=_,e[34]=k,e[35]=S,e[36]=w,e[37]=j}else _=e[33],k=e[34],S=e[35],w=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let N;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(N=s.isHomeRoot&&r.jsx(Qne,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=N):N=e[56];let A;return e[57]!==_||e[58]!==k||e[59]!==S||e[60]!==w||e[61]!==N?(A=r.jsxs(r.Fragment,{children:[_,k,S,w,N]}),e[57]=_,e[58]=k,e[59]=S,e[60]=w,e[61]=N,e[62]=A):A=e[62],A}function Zne(t){return t.kind==="file"}function eie(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function tie(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function sie(t){return t.kind==="dir"&&t.hasSkill}function nie({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=We(),o=Ls(),l=Ot(),a=So(),c=lr({strict:!1}),d=c.path||Sd,h=jh(d),u=UV(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,m=(J,me)=>l({to:".",search:ye=>({...ye,[J]:me||void 0})}),p=J=>m("path",J),g=(J,me)=>l({to:".",search:ye=>({...ye,preview:void 0,skill:void 0,brand:void 0,[J]:me})}),x=t??(J=>g("preview",J)),b=e??(J=>g("skill",J)),v=s??(J=>g("brand",J)),[y,L]=E.useState(""),_=Yh(y.trim(),300),k=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=k?n("library.library.searchInPlaceholder",{folder:Ea(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),w=f.isHomeRoot?kd(i.slug):Ea(f.segments.at(-1)??""),[j,N]=E.useState(null),[A,C]=E.useState(null),[T,V]=E.useState(!1),[R,P]=E.useState(""),[M,D]=E.useState(!1),[$,z]=E.useState(null),[I,O]=E.useState(""),B=E.useRef(null),[U,H]=E.useState(!1),K=E.useRef(0),W=f.readOnly?null:f.volume,{upload:Y,mkdir:Q,move:te}=Vd(W??Sd),{remove:ee}=Vd(j?.volume??"uploads");async function oe(J){if(!(!W||!J||J.length===0))try{await Y.mutateAsync({dir:f.dirPath,files:[...J]}),pe.success(J.length===1?n("library.library.uploadedSingle",{filename:J[0]?.name??""}):n("library.library.uploadedMultiple",{count:J.length}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.uploadFailed"))}finally{B.current&&(B.current.value="")}}const se=W!==null;function G(J){return J.dataTransfer.types.includes("Files")}function X(J){!se||!G(J)||(J.preventDefault(),K.current+=1,H(!0))}function q(J){!se||!G(J)||J.preventDefault()}function Z(){se&&(K.current=Math.max(0,K.current-1),K.current===0&&H(!1))}function le(J){se&&(J.preventDefault(),J.stopPropagation(),K.current=0,H(!1),J.dataTransfer.files.length>0&&oe(J.dataTransfer.files))}async function ne(){const J=R.trim();if(!(!W||!J)){if(f.isHomeRoot&&G1.has(J.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:J}));return}try{const me=f.dirPath;await Q.mutateAsync(me?`${me}/${J}`:J),pe.success(n("library.library.folderCreated",{name:J})),V(!1),P("")}catch(me){pe.error(me instanceof Error?me.message:n("library.library.folderCreateFailed"))}}}async function ae(){if(!j)return;const J=j;try{await ee.mutateAsync(J.path),pe.success(n("library.library.deleted",{name:ls(J.path)}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.deleteFailed"))}finally{N(null)}}async function de(){if(!$)return;const J=I.trim();if(!J||J.includes("/")||J.includes("..")||J===ls($.path)){D(!1),z(null),O("");return}if($.kind==="dir"&&f.isHomeRoot&&G1.has(J.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:J}));return}try{const me=$.path.includes("/")?$.path.slice(0,$.path.lastIndexOf("/")):"",ye=me?`${me}/${J}`:J;await te.mutateAsync({from:$.path,to:ye});const Le=J.replace(/[<>]/g,"");pe.success(n("library.library.renamed",{name:Le}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.renameFailed"))}finally{D(!1),z(null),O("")}}async function fe(J,me){try{const ye=ls(J),Le=me?`${me}/${ye}`:ye;await te.mutateAsync({from:J,to:Le}),pe.success(n("library.library.moved",{name:ye,destination:me||n("library.library.theLibrary")}))}catch(ye){pe.error(ye instanceof Error?ye.message:n("library.library.moveFailed"))}}function ue(){for(const J of Une)o.invalidateQueries({queryKey:it.orgFsVolume(i.id,J)});f.volume&&o.invalidateQueries({queryKey:it.orgFsVolume(i.id,f.volume)}),o.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:it.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:it.orgFsPublicSets(i.id)})}function ge(J){J.defaultPrevented||!W||J.target.closest("input, textarea, button, a, [role='button']")||(J.preventDefault(),V(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:X,onDragOver:q,onDragLeave:Z,onDrop:le,onContextMenu:ge,children:[U&&r.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:r.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:[r.jsx(Qn,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:w})})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:r.jsx(Gne,{segments:f.segments,onNavigate:p})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(Gh,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(pt,{value:y,onChange:J=>L(J.target.value),onKeyDown:J=>{J.key==="Escape"&&L("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),y&&r.jsx(he,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>L(""),"aria-label":n("library.library.clearSearch"),children:r.jsx(Si,{size:14})})]}),r.jsx(he,{variant:"ghost",size:"icon",onClick:ue,"aria-label":n("library.library.refresh"),children:r.jsx(Rn,{size:14})}),W&&r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[r.jsx(Dt,{size:14}),n("library.library.newFolder")]}),f.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(dc,{size:12}),n("library.library.readOnly")]}):r.jsxs(he,{size:"sm",disabled:Y.isPending,onClick:()=>B.current?.click(),children:[r.jsx(Qn,{size:14}),Y.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:J=>{oe(J.target.files)}})]}),_?r.jsx(Yne,{query:_,scope:k,stale:y.trim()!==_,onOpenFile:x,onShare:C,onDelete:N}):f.volume===null?r.jsx(Jne,{onOpenDir:p}):r.jsx(Xne,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:C,onDelete:N,onContextMenu:(J,me)=>{z({path:J,kind:me}),O(ls(J)),D(!0)},onMove:fe},f.volume)]})}),a&&(c.preview?r.jsx(Iw,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?r.jsx(Mw,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?r.jsx(Dw,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),r.jsx(Rt,{open:T,onOpenChange:V,children:r.jsxs(Pt,{children:[r.jsxs(ms,{children:[r.jsx($t,{children:n("library.library.newFolderTitle")}),r.jsx(Dn,{children:n("library.library.newFolderDescription",{path:w||n("library.library.theLibrary")})})]}),r.jsx(pt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:R,onChange:J=>P(J.target.value),onKeyDown:J=>{J.key==="Enter"&&ne()}}),r.jsxs(Gn,{children:[r.jsx(he,{variant:"outline",onClick:()=>V(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!R.trim()||Q.isPending,onClick:()=>{ne()},children:n("library.library.create")})]})]})}),r.jsx(Rt,{open:M,onOpenChange:J=>{D(J),J||(z(null),O(""))},children:r.jsxs(Pt,{children:[r.jsxs(ms,{children:[r.jsx($t,{children:$&&n("library.library.renameTitle",{name:ls($.path)})}),r.jsx(Dn,{children:n("library.library.renameDescription")})]}),r.jsx(pt,{autoFocus:!0,value:I,onChange:J=>O(J.target.value),onKeyDown:J=>{J.key==="Enter"&&de()}}),r.jsxs(Gn,{children:[r.jsx(he,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!I.trim()||te.isPending,onClick:()=>{de()},children:n("library.library.rename")})]})]})}),r.jsx(yne,{target:A,onOpenChange:J=>{J||C(null)}}),r.jsx(Ma,{open:j!==null,onOpenChange:J=>{J||N(null)},children:r.jsxs($a,{children:[r.jsxs(Oa,{children:[r.jsx(Ba,{children:n("library.library.deleteTitle",{name:j?ls(j.path):""})}),r.jsx(za,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(Fa,{children:[r.jsx(Ua,{children:n("library.library.cancel")}),r.jsx(Ha,{onClick:()=>{ae()},children:n("library.library.delete")})]})]})})]})}function iie(){const t=F.c(12),e=Ot(),[s,n]=E.useState(null),[i,o]=E.useState(null);let l;t[0]!==e?(l=f=>e({to:".",search:m=>({...m,main:f}),replace:!0}),t[0]=e,t[1]=l):l=t[1];const a=l;let c;t[2]!==a?(c=r.jsx(nie,{onOpenFile:f=>a(pC(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(Mw,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let h;t[6]!==i?(h=i&&r.jsx(Dw,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=h):h=t[7];let u;return t[8]!==c||t[9]!==d||t[10]!==h?(u=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,h]}),t[8]=c,t[9]=d,t[10]=h,t[11]=u):u=t[11],u}const f5=E.lazy(()=>In(()=>import("./project-app-view-C3T5V3cO.js"),__vite__mapDeps([164,1,2,52,53,15,3,18,4,5,6,7,8,9,10,11,12,13,14,16,17,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,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,120,109,110,111,112,113,114,115,116,117,102,103,104,105,106,107,108,118,119,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,98,136,137,138,139,100,140,141,142,143,144,145,146,147,148,149])).then(t=>({default:t.AppViewContent})));function rie(t){const e=F.c(63),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let _;return e[0]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(wK,{}),e[0]=_):_=e[0],_}if(s==="board"){let _;return e[1]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(sW,{})}),e[1]=_):_=e[1],_}if(gC(s)){let _;return e[2]!==n?(_=r.jsx(lx,{virtualMcpId:n}),e[2]=n,e[3]=_):_=e[3],_}if(s==="git"){let _;return e[4]!==n?(_=r.jsx(Fq,{virtualMcpId:n}),e[4]=n,e[5]=_):_=e[5],_}if(s==="automations"){let _;return e[6]!==n?(_=r.jsx(Zse,{virtualMcpId:n}),e[6]=n,e[7]=_):_=e[7],_}if(s==="preview"){let _;return e[8]!==n?(_=r.jsx(see,{virtualMcpId:n}),e[8]=n,e[9]=_):_=e[9],_}let c;e[10]!==s?(c=xC(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let _;return e[12]!==d.path?(_=r.jsx(oee,{openPath:d.path}),e[12]=d.path,e[13]=_):_=e[13],_}if(s==="content"){let _;return e[14]!==n?(_=r.jsx(lse,{virtualMcpId:n}),e[14]=n,e[15]=_):_=e[15],_}if(s==="assets"){let _;return e[16]!==n?(_=r.jsx(ase,{virtualMcpId:n}),e[16]=n,e[17]=_):_=e[17],_}if(s==="files"){let _;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(iie,{}),e[18]=_):_=e[18],_}if(s==="connect-sources"){let _;return e[19]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(ane,{}),e[19]=_):_=e[19],_}if(a){let _;return e[20]!==s?(_=r.jsx(Gse,{tabId:s}),e[20]=s,e[21]=_):_=e[21],_}let h;e[22]!==s?(h=_v(s),e[22]=s,e[23]=h):h=e[23];const u=h;if(u){let _;return e[24]!==u.path?(_=r.jsx(Lne,{path:u.path},u.path),e[24]=u.path,e[25]=_):_=e[25],_}let f;e[26]!==s?(f=yv(s),e[26]=s,e[27]=f):f=e[27];const m=f;if(m){let _;return e[28]!==m.key||e[29]!==i?(_=r.jsx(rne,{fileKey:m.key,taskId:i}),e[28]=m.key,e[29]=i,e[30]=_):_=e[30],_}let p;e[31]!==s?(p=Lv(s),e[31]=s,e[32]=p):p=e[32];const g=p;if(g){let _;return e[33]!==g.path?(_=r.jsx(jne,{path:g.path},g.path),e[33]=g.path,e[34]=_):_=e[34],_}let x;e[35]!==s?(x=bC(s),e[35]=s,e[36]=x):x=e[36];const b=x;if(b){let _;if(e[37]!==l||e[38]!==b.connectionId||e[39]!==b.toolName){let N;e[41]!==b.connectionId||e[42]!==b.toolName?(N=A=>A.appId===b.connectionId&&A.toolName===b.toolName,e[41]=b.connectionId,e[42]=b.toolName,e[43]=N):N=e[43],_=l.find(N),e[37]=l,e[38]=b.connectionId,e[39]=b.toolName,e[40]=_}else _=e[40];const k=_;let S;e[44]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(ul,{}),e[44]=S):S=e[44];const w=k?.args;let j;return e[45]!==s||e[46]!==b.connectionId||e[47]!==b.toolName||e[48]!==w?(j=r.jsx(E.Suspense,{fallback:S,children:r.jsx(f5,{connectionId:b.connectionId,toolName:b.toolName,args:w},s)}),e[45]=s,e[46]=b.connectionId,e[47]=b.toolName,e[48]=w,e[49]=j):j=e[49],j}let v;if(e[50]!==s||e[51]!==o){let _;e[53]!==s?(_=k=>k.id===s,e[53]=s,e[54]=_):_=e[54],v=o.find(_),e[50]=s,e[51]=o,e[52]=v}else v=e[52];const y=v;if(y){let _;e[55]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(ul,{}),e[55]=_):_=e[55];let k;return e[56]!==s||e[57]!==y.id||e[58]!==y.view.appId||e[59]!==y.view.args?(k=r.jsx(E.Suspense,{fallback:_,children:r.jsx(f5,{connectionId:y.view.appId,toolName:y.id,args:y.view.args},s)}),e[56]=s,e[57]=y.id,e[58]=y.view.appId,e[59]=y.view.args,e[60]=k):k=e[60],k}let L;return e[61]!==n?(L=r.jsx(lx,{virtualMcpId:n}),e[61]=n,e[62]=L):L=e[62],L}function oie(t){const e=F.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:o,layoutTabs:l,expandedTools:a,automationTabParsed:c}=u2(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(ul,{}),e[3]=d):d=e[3];let h;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(h=r.jsx(E.Suspense,{fallback:d,children:r.jsx(rie,{activeTab:o,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=o,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]!==o||e[12]!==h?(u=r.jsx(Js,{children:h},o),e[11]=o,e[12]=h,e[13]=u):u=e[13],u}function lie(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&vC.has(t.mainTab))}const Jo="setup";function aie(t){const e=F.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=_=>!t.scriptTabs.includes(_),e[3]=t.scriptTabs,e[4]=L):L=e[4],n=t.scripts.filter(L),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let o;e[5]!==t?(o=()=>{t.active===Jo?t.onToggle():t.onSelectTab(Jo)},e[5]=t,e[6]=o):o=e[6];const l=o;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?r.jsx(Jt,{className:"size-4"}):r.jsx(yy,{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=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{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=r.jsx(He,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=r.jsxs(Ke,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const m=t.active===Jo;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(cie,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(L=>r.jsx(uie,{active:t.active===L,onClick:()=>{t.active===L?t.onToggle():t.onSelectTab(L)},onClose:()=>t.onCloseScript(L),t:s,children:L},L)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=r.jsx(hie,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?r.jsx(fie,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(die,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let y;return e[53]!==b||e[54]!==v||e[55]!==f?(y=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=y):y=e[56],y}function cie(t){const e=F.c(11),{active:s,open:n,onClick:i,t:o}=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=r.jsx(lN,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==o?(u=o("sandbox.toolbar.setupTab"),e[3]=o,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=r.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 die(t){const e=F.c(40),{status:s,onStart:n,onStop:i,onRestart:o,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(tl,{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=r.jsxs(he,{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=r.jsx(tl,{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=r.jsxs(he,{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=r.jsx(Rn,{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=r.jsxs(he,{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"&&!!o,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 m;e[22]!==i||e[23]!==u||e[24]!==f?(m=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:i,className:u,children:f})}),e[22]=i,e[23]=u,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=r.jsx(He,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(Ke,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==o||e[34]!==d||e[35]!==c?(b=d&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(Jt,{className:"size-3"})})}),r.jsx(Yt,{align:"end",children:r.jsxs(et,{onClick:o,children:[r.jsx(Rn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=o,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=r.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function uie(t){const e=F.c(17),{active:s,onClick:n,onClose:i,children:o,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]!==o||e[6]!==n||e[7]!==u?(f=r.jsx("button",{type:"button",onClick:n,className:u,children:o}),e[5]=o,e[6]=n,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i||e[11]!==l?(m=i&&r.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(o)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:r.jsx(_s,{className:"size-3.5"})}),e[9]=o,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function hie(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=re(),[o,l]=E.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=r.jsx(Dt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(Ue,{asChild:!0,children:r.jsx(ts,{asChild:!0,children:r.jsx(he,{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=r.jsx(He,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=r.jsxs(Ke,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=r.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>r.jsxs("button",{type:"button",onClick:()=>{l(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=r.jsxs(ss,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==o||e[24]!==x||e[25]!==f?(b=r.jsxs(ns,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function fie(t){const e=F.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:o,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(ut,{className:"size-3.5 animate-spin"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=r.jsxs(he,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(tl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=r.jsx(Ue,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=r.jsx(He,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(Ke,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==o||e[21]!==a?(c=r.jsx(Ue,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:o,children:a})}),e[20]=o,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=r.jsx(He,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=r.jsxs(Ke,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var Bw=Object.defineProperty,mie=Object.getOwnPropertyDescriptor,pie=(t,e)=>{for(var s in e)Bw(t,s,{get:e[s],enumerable:!0})},ws=(t,e,s,n)=>{for(var i=n>1?void 0:n?mie(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&Bw(e,s,i),i},qe=(t,e)=>(s,n)=>e(s,n,t),m5="Terminal input",Y1={get:()=>m5,set:t=>m5=t},p5="Too much output to announce, navigate to rows manually to read",Q1={get:()=>p5,set:t=>p5=t};function gie(t){return t.replace(/\r?\n/g,"\r")}function xie(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function bie(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function vie(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");zw(i,e,s,n)}}function zw(t,e,s,n){t=gie(t),t=xie(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Fw(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,o=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function g5(t,e,s,n,i){Fw(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function ao(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function $f(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let o=t[i];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var yie=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 o=t.charCodeAt(i++);56320<=o&&o<=57343?e[n++]=(this._interim-55296)*1024+o-56320+65536:(e[n++]=this._interim,e[n++]=o),this._interim=0}for(let o=i;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,n;let a=t.charCodeAt(o);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}},_ie=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,o,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((i=t[u])&128)&&!((o=t[u+1])&128)&&!((l=t[u+2])&128)&&!((a=t[u+3])&128);)e[n++]=i,e[n++]=o,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(o=t[u++],(o&192)!==128){u--;continue}if(c=(i&31)<<6|o&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(i&15)<<12|(o&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(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Uw="",fo=" ",yu=class Hw{constructor(){this.fg=0,this.bg=0,this.extended=new mh}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 Hw;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}},mh=class Kw{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 Kw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},li=class Ww extends yu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mh,this.combinedData=""}static fromCharData(e){let s=new Ww;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?ao(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()]}},x5="di$target",J1="di$dependencies",M9=new Map;function Lie(t){return t[J1]||[]}function tn(t){if(M9.has(t))return M9.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");wie(e,s,i)};return e._id=t,M9.set(t,e),e}function wie(t,e,s){e[x5]===e?e[J1].push({id:t,index:s}):(e[J1]=[{id:t,index:s}],e[x5]=e)}var Nn=tn("BufferService"),qw=tn("CoreMouseService"),Vl=tn("CoreService"),Sie=tn("CharsetService"),kg=tn("InstantiationService"),Gw=tn("LogService"),Vn=tn("OptionsService"),Yw=tn("OscLinkService"),kie=tn("UnicodeService"),_u=tn("DecorationService"),X1=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,o=new li,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,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=h,a=o.extended.urlId;continue}else d=o.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}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:u,range:f,activate:(p,g)=>i?i.activate(p,g,f):jie(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=h,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};X1=ws([qe(0,Nn),qe(1,Vn),qe(2,Yw)],X1);function jie(t,e){if(confirm(`Do you want to navigate to ${e}?
725
725
 
726
726
  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 Of=tn("CharSizeService"),Or=tn("CoreBrowserService"),jg=tn("MouseService"),Br=tn("RenderService"),Cie=tn("SelectionService"),Qw=tn("CharacterJoinerService"),wc=tn("ThemeService"),Jw=tn("LinkProviderService"),Nie=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?b5.isErrorNoTelemetry(t)?new b5(t.message+`
727
727