decocms 4.263.3 → 4.263.4

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 (224) hide show
  1. package/dist/client/assets/{AlertCircle-C8ZNKM0T.js → AlertCircle-BTYGLFie.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BYK2gWYF.js → AreaChart-jerPjG-w.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-C4S3t4gh.js → ArrowLeft-BajYEy7J.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-BjteiNgF.js → ArrowUp-fnzebitz.js} +1 -1
  5. package/dist/client/assets/{Check-7fxTQqwV.js → Check-CJxsk2cd.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-Ds0VlJAl.js → CheckCircle-D8lsJrHv.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-DC3VmpPs.js → ChevronDown-Chn5-yQ3.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-DB1jERJP.js → ChevronRight-BUEJ-jyA.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-B9rG_ZYr.js → ChevronSelectorVertical-DuwT0Cdn.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-DklUcnpq.js → ChevronUp-Bis3nYDt.js} +1 -1
  11. package/dist/client/assets/{Copy01-0rsYyxBd.js → Copy01-oY33F6A4.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-C02kJIQ-.js → CreditCard01-BEFAf8Rs.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-CtEAbV8O.js → DotsVertical-CmNP1NFD.js} +1 -1
  14. package/dist/client/assets/{Download01-B_W2m-uX.js → Download01-BOB13r_i.js} +1 -1
  15. package/dist/client/assets/{Eye-CCl0QwVV.js → Eye-BQM4yrzA.js} +1 -1
  16. package/dist/client/assets/{FilterLines-v44MczT5.js → FilterLines-CM6IqjC1.js} +1 -1
  17. package/dist/client/assets/{Globe01-Dr2wIPy6.js → Globe01-BLkvMUGE.js} +1 -1
  18. package/dist/client/assets/{Globe04-BlbLK8Qh.js → Globe04-CJdUUoxg.js} +1 -1
  19. package/dist/client/assets/{HardDrive-DKQRwLSP.js → HardDrive-BFDRJjzR.js} +1 -1
  20. package/dist/client/assets/{Key01-kpUUZaqy.js → Key01-B5VoA08Z.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-NyjdMVf7.js → LinkExternal01-bgUoyTwQ.js} +1 -1
  22. package/dist/client/assets/{LockUnlocked01-DsKz0Xl2.js → LockUnlocked01-o0Eo7MuU.js} +1 -1
  23. package/dist/client/assets/{LogOut01-Dd8QdhEu.js → LogOut01-CKpl9BLq.js} +1 -1
  24. package/dist/client/assets/{Monitor01-CCXNZQlH.js → Monitor01-BHWFnGlJ.js} +1 -1
  25. package/dist/client/assets/{Palette-BffjPXio.js → Palette-DAsj4nYm.js} +1 -1
  26. package/dist/client/assets/{Play-D8AheaUt.js → Play-Ir6C5jzg.js} +1 -1
  27. package/dist/client/assets/{Plus-DfL6u6I_.js → Plus-CySlFZzQ.js} +1 -1
  28. package/dist/client/assets/{SearchLg-D1p_gJI8.js → SearchLg-BevUi4lQ.js} +1 -1
  29. package/dist/client/assets/{SearchMd-DVItXoZb.js → SearchMd-CUh5hEpd.js} +1 -1
  30. package/dist/client/assets/{Settings02-Bvo1tVwA.js → Settings02-DxEKOFeo.js} +1 -1
  31. package/dist/client/assets/{Share07-3Y0P_W3_.js → Share07-BAxn1THr.js} +1 -1
  32. package/dist/client/assets/{Shield01-C4putjAN.js → Shield01-Br0XuRfn.js} +1 -1
  33. package/dist/client/assets/{Stars01-ClK-g0zk.js → Stars01-DGSNhagZ.js} +1 -1
  34. package/dist/client/assets/{Stars02-DTCJxH0_.js → Stars02-DNyS1gcT.js} +1 -1
  35. package/dist/client/assets/{Sun-DBnfC6xb.js → Sun-CSIUl7xv.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-CQZ9t4Uh.js → SwitchHorizontal01-C8-bgNQy.js} +1 -1
  37. package/dist/client/assets/{Tool01-K1KtrUp3.js → Tool01-BjI8gxt5.js} +1 -1
  38. package/dist/client/assets/{Tool02-CaMOVLUq.js → Tool02-Ct3UvI4j.js} +1 -1
  39. package/dist/client/assets/{Trash01-Hh3vb-pV.js → Trash01-lppJr9kF.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-Cpu4_O9X.js → TrendUp01-vMMFYqH0.js} +1 -1
  41. package/dist/client/assets/{Upload01-PO1Z12J3.js → Upload01-CePHCnzY.js} +1 -1
  42. package/dist/client/assets/{User01-ClQH_5NK.js → User01-BqNQxSWl.js} +1 -1
  43. package/dist/client/assets/{UserSquare-DtGKXF0N.js → UserSquare-kfbSM3R7.js} +1 -1
  44. package/dist/client/assets/{Users01-Bvqsn2Z0.js → Users01-GyxqhIQS.js} +1 -1
  45. package/dist/client/assets/{Users03-C1f0X_bD.js → Users03-C8z46zgV.js} +1 -1
  46. package/dist/client/assets/{XCircle-qXvFFF3a.js → XCircle-BMgdweBK.js} +1 -1
  47. package/dist/client/assets/{XClose-F4_KA-E6.js → XClose-DnnJN04M.js} +1 -1
  48. package/dist/client/assets/{YAxis-Bwjlsmrn.js → YAxis-CFtxNrGp.js} +1 -1
  49. package/dist/client/assets/{Zap-DK06ViId.js → Zap-f9eGztfW.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-B8eYKtXE.js → ZapSquare-Z5gRSAcI.js} +1 -1
  51. package/dist/client/assets/{access-gate-C5Y4THSz.js → access-gate-CESQMRUh.js} +1 -1
  52. package/dist/client/assets/{agent-icon-BRsJ64Gp.js → agent-icon-BpKbS82g.js} +1 -1
  53. package/dist/client/assets/{agents-list-Cb5QyV0J.js → agents-list-DisSvTPm.js} +1 -1
  54. package/dist/client/assets/{ai-providers-F9sUAX3N.js → ai-providers-DvMfqbG9.js} +1 -1
  55. package/dist/client/assets/{alert-DjabJJJC.js → alert-Cjb2EB7F.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-C6uvTNV5.js → alert-dialog-_waxzl9D.js} +1 -1
  57. package/dist/client/assets/{api-keys-DmdCnjmd.js → api-keys-DMd6myi1.js} +1 -1
  58. package/dist/client/assets/{app-editor-CCEPa5_q.js → app-editor-BITYEeNm.js} +1 -1
  59. package/dist/client/assets/{auth-BjDvWFq6.js → auth-B5QCuHwo.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-CpusPL_F.js → auth-catchall-Db5A8udm.js} +1 -1
  61. package/dist/client/assets/{auth-entry-DhkykqHc.js → auth-entry-orPtywn8.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-BvVQruwK.js → auth-split-layout-BSXvcLZl.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-CfcfVqDI.js → authenticate-and-persist-oauth-CxmxlpAo.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-BO2X7Ov7.js → automation-list-row-kxVusV6D.js} +1 -1
  65. package/dist/client/assets/{automation-runs-BQpimZeU.js → automation-runs-aScQH7yb.js} +1 -1
  66. package/dist/client/assets/{automations-CYoHIEOo.js → automations-DFz--AKt.js} +1 -1
  67. package/dist/client/assets/{avatar-CiQyTRfd.js → avatar-BYLlYMrS.js} +1 -1
  68. package/dist/client/assets/{badge-Dp3mR27V.js → badge-DYcNbwP1.js} +1 -1
  69. package/dist/client/assets/{block-document-By6966PS.js → block-document-8DQ-Aj-N.js} +1 -1
  70. package/dist/client/assets/{buckets-BtAjuTXp.js → buckets-CsXTuRWK.js} +1 -1
  71. package/dist/client/assets/{bulk-category-panel-Crj0FXFd.js → bulk-category-panel-0Znxf5_5.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-DcN5DOFH.js → capability-load-error-CDe54R-X.js} +1 -1
  73. package/dist/client/assets/{cards-BKUYovMU.js → cards-DOZsSvdL.js} +1 -1
  74. package/dist/client/assets/{category-editor-BrklTiAF.js → category-editor-CxuIuX9c.js} +1 -1
  75. package/dist/client/assets/{chart-56471C1Y.js → chart-CoRPyY38.js} +1 -1
  76. package/dist/client/assets/{chat-context-_CA_JeeY.js → chat-context-Cdt5JBGq.js} +1 -1
  77. package/dist/client/assets/{checkbox-C1bUrPvW.js → checkbox-Z9SepXvp.js} +1 -1
  78. package/dist/client/assets/{choose-editor-nese6qE5.js → choose-editor-CHzYYlGa.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-CCmWyNoP.js → cli-auth-success-DJY05d2g.js} +1 -1
  80. package/dist/client/assets/{collection-detail-B90a00NV.js → collection-detail-BqqcCOIU.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-FKEWPN7M.js → collection-display-button-BEoC7J9b.js} +1 -1
  82. package/dist/client/assets/{collection-search-Bd6xu3h9.js → collection-search-BQ3PDw8g.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-15zlEhjP.js → collection-table-wrapper-CTaHHWBu.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-3ta98PDW.js → collection-tabs-BHE3DhBM.js} +1 -1
  85. package/dist/client/assets/{command-pFth6-af.js → command-Cj_b6QuL.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-BQlfD3LU.js → commerce-onboarding-DwEGH-Pm.js} +1 -1
  87. package/dist/client/assets/{connect-DMudoU2M.js → connect-DoOLtkHq.js} +1 -1
  88. package/dist/client/assets/{connection-QHosBlKh.js → connection-Bxg7evEC.js} +1 -1
  89. package/dist/client/assets/{connection-card-DXUN0HbG.js → connection-card-Bwep8BgY.js} +1 -1
  90. package/dist/client/assets/{connection-detail-BQZMFHWj.js → connection-detail-vMhRTHvc.js} +1 -1
  91. package/dist/client/assets/{connection-form-helpers-Dw_uRR_o.js → connection-form-helpers-ChTIA9-X.js} +1 -1
  92. package/dist/client/assets/{connections-Cdozilw9.js → connections-DABID4YF.js} +1 -1
  93. package/dist/client/assets/{decopilot-sse-pool-B2gldwFf.js → decopilot-sse-pool-CMc1xBx0.js} +1 -1
  94. package/dist/client/assets/{dialog-CLVbCjMu.js → dialog-K8-1cCDF.js} +1 -1
  95. package/dist/client/assets/{domain-settings-DoR6E0N1.js → domain-settings-CTNhof1S.js} +1 -1
  96. package/dist/client/assets/{drawer-Ckbm2CWJ.js → drawer-ClBcSM08.js} +1 -1
  97. package/dist/client/assets/{dropdown-menu-D2aUCLYk.js → dropdown-menu-C-7wwHBe.js} +1 -1
  98. package/dist/client/assets/{empty-state-BF41trPY.js → empty-state-CSKHHWG6.js} +1 -1
  99. package/dist/client/assets/{extract-connection-data-A9qAyYQA.js → extract-connection-data-C1XM4jmB.js} +1 -1
  100. package/dist/client/assets/{file-explorer-ws1ucCZl.js → file-explorer-BCiGm1Z3.js} +1 -1
  101. package/dist/client/assets/{file-type-icon-wuRfMh_5.js → file-type-icon-BrVi1nrA.js} +1 -1
  102. package/dist/client/assets/{form-BI3-Eb2L.js → form-Cv16yv_N.js} +1 -1
  103. package/dist/client/assets/{general-Dkq5x-QZ.js → general-DD84yKYj.js} +1 -1
  104. package/dist/client/assets/{github-repo-picker-BMkV5srU.js → github-repo-picker-DEedlZZB.js} +1 -1
  105. package/dist/client/assets/{hooks-DlPXzzl8.js → hooks-BsA5QClW.js} +1 -1
  106. package/dist/client/assets/{index-DS_PtpmP.js → index-BAzBxxL9.js} +3 -3
  107. package/dist/client/assets/{index-DAPcjavx.js → index-BL55GcNa.js} +1 -1
  108. package/dist/client/assets/{index-CV8Bfh5R.js → index-Bsu_VttZ.js} +6 -6
  109. package/dist/client/assets/{index-B1veCTx1.js → index-CiZciEsK.js} +1 -1
  110. package/dist/client/assets/{index-B_Ad5QPQ.js → index-D00QDYEH.js} +1 -1
  111. package/dist/client/assets/{index-DJM5ojUf.js → index-D6BHz3vf.js} +1 -1
  112. package/dist/client/assets/{index-Dh9w3kQB.js → index-DJjhCQSJ.js} +1 -1
  113. package/dist/client/assets/{index-C2XLHMiw.js → index-DgS45S3b.js} +1 -1
  114. package/dist/client/assets/{index-Dl5uUBVr.js → index-DwV5rndB.js} +1 -1
  115. package/dist/client/assets/{index-Cssg9t23.js → index-Rsz-z5IL.js} +1 -1
  116. package/dist/client/assets/{index-redirect-DO74fkKf.js → index-redirect-CbiwayST.js} +1 -1
  117. package/dist/client/assets/{infra-billing-DLGhuOLw.js → infra-billing-DTpLPCfp.js} +1 -1
  118. package/dist/client/assets/{input-Dsyfk4jo.js → input-CvrE4LEJ.js} +1 -1
  119. package/dist/client/assets/{integration-icon-DQzHhbi_.js → integration-icon-BnqPyHmt.js} +1 -1
  120. package/dist/client/assets/{invite-member-dialog-6MS0bODt.js → invite-member-dialog-CzYyGuZd.js} +1 -1
  121. package/dist/client/assets/{label-AZH9h-dP.js → label-CXiyMNnc.js} +1 -1
  122. package/dist/client/assets/{layout-jQzTnGd2.js → layout-CsrmRfJK.js} +1 -1
  123. package/dist/client/assets/{login-B5ShBVQi.js → login-BM_k5b-A.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-CV7iuGWl.js → mcp-oauth-BY7cxtZI.js} +1 -1
  125. package/dist/client/assets/{members-DyI3pT9y.js → members-Bee-glAy.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-CEXQCwfP.js → monaco-editor-ywPI1t16.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-C3Te4mdv.js → monitoring-stats-row-q0lDnj97.js} +1 -1
  128. package/dist/client/assets/{multi-select-DPBlx32W.js → multi-select-6289Ji5Q.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-CrdVqleB.js → oauth-callback-BI2EXPp9.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-ai-provider-KyQ1PZrQ.js → oauth-callback-ai-provider-CPN_n1pK.js} +1 -1
  131. package/dist/client/assets/{onboarding-BslW1pcP.js → onboarding-B1OeoqRD.js} +1 -1
  132. package/dist/client/assets/{org-layout-CO6jG1v2.js → org-layout-CJfUhWa8.js} +1 -1
  133. package/dist/client/assets/{organization-choice-CoM8gu7M.js → organization-choice-BI4eKBGM.js} +1 -1
  134. package/dist/client/assets/{orgs-CwehcPGm.js → orgs-DA0vFIQ1.js} +1 -1
  135. package/dist/client/assets/{page-seo-form-9OJihF4x.js → page-seo-form-jRWN82Bz.js} +1 -1
  136. package/dist/client/assets/{popover-BRZicoZW.js → popover-wGCNVbgm.js} +1 -1
  137. package/dist/client/assets/{post-calendar-hEguUc5o.js → post-calendar-pijaG7Tm.js} +1 -1
  138. package/dist/client/assets/{post-editor-pLSbc6mp.js → post-editor-B-3AULjS.js} +1 -1
  139. package/dist/client/assets/{primitives-CtBKfa_X.js → primitives-Do4YdhnP.js} +1 -1
  140. package/dist/client/assets/{profile-n9hx6gY-.js → profile-GePno2yS.js} +1 -1
  141. package/dist/client/assets/{project-app-view-DoK4zGoF.js → project-app-view-CYxJURVY.js} +1 -1
  142. package/dist/client/assets/record-editor-CnkB9zNF.js +1 -0
  143. package/dist/client/assets/{redirect-editor-feQIS-ih.js → redirect-editor-DJr4emyY.js} +1 -1
  144. package/dist/client/assets/registry-Br8pQVRC.js +2 -0
  145. package/dist/client/assets/{registry-layout-DaMCQA8V.js → registry-layout-BB4KsmkV.js} +1 -1
  146. package/dist/client/assets/{reports-DGCK2_12.js → reports-DzSMI3MZ.js} +1 -1
  147. package/dist/client/assets/{require-capability-BuB0VaIt.js → require-capability-Cr0gRW-f.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-C8K6T2Dl.js → required-auth-layout-ykPgRGg9.js} +1 -1
  149. package/dist/client/assets/{reset-password-Bv3lK8g1.js → reset-password-CWtcCFTs.js} +1 -1
  150. package/dist/client/assets/{roles-04svMQ-w.js → roles-Cy9PVzUY.js} +1 -1
  151. package/dist/client/assets/{search-input-BMFjaZW8.js → search-input-DzsO4XKy.js} +1 -1
  152. package/dist/client/assets/{secrets-CAom0Pas.js → secrets-DlU_ZsyZ.js} +1 -1
  153. package/dist/client/assets/{sections-editor-DYATNkxM.js → sections-editor-Cj6XZcig.js} +1 -1
  154. package/dist/client/assets/{select-v0HyS5wV.js → select-B2e4NALY.js} +1 -1
  155. package/dist/client/assets/{select-model-DbrnwWTj.js → select-model-BsIRDtab.js} +1 -1
  156. package/dist/client/assets/{self-tool-result-r1jsmu7J.js → self-tool-result-BBoUTXvN.js} +1 -1
  157. package/dist/client/assets/{seo-editor-BqjKMW9L.js → seo-editor-NyY02_7W.js} +1 -1
  158. package/dist/client/assets/{settings-layout-D3s-EDDq.js → settings-layout-DdXTfyPZ.js} +1 -1
  159. package/dist/client/assets/{shell-controls-BH090Ymi.js → shell-controls-DQlWaCbv.js} +1 -1
  160. package/dist/client/assets/{shell-layout-Ca7ET_6R.js → shell-layout-BH-NXnM4.js} +1 -1
  161. package/dist/client/assets/{spinner-Dzoa8exR.js → spinner-Bb-1R-dk.js} +1 -1
  162. package/dist/client/assets/{sprints-BDnw_QJc.js → sprints-C6bMPt1I.js} +1 -1
  163. package/dist/client/assets/{sso-Br3gVbj4.js → sso-Dvg67Md-.js} +1 -1
  164. package/dist/client/assets/{store-TksVzK51.js → store-DpbTTyvZ.js} +1 -1
  165. package/dist/client/assets/store-registry-BRvvONYG.js +2 -0
  166. package/dist/client/assets/{switch-CPOt6c8D.js → switch-BvYQVlYb.js} +1 -1
  167. package/dist/client/assets/{synced-repos-DMsM8gK7.js → synced-repos-4t6ZPuYG.js} +1 -1
  168. package/dist/client/assets/{tab-id-BOj9dZWT.js → tab-id-DMd10Dlk.js} +1 -1
  169. package/dist/client/assets/{table-yXN-B6JM.js → table-rERv-Q2u.js} +1 -1
  170. package/dist/client/assets/{tabs-DMoGi1te.js → tabs-C3QvtS8u.js} +1 -1
  171. package/dist/client/assets/{task-key-C2W_oYAM.js → task-key-sEZ4dWP_.js} +1 -1
  172. package/dist/client/assets/{tasks-BrWj9zEH.js → tasks-Rs06jPVw.js} +1 -1
  173. package/dist/client/assets/{textarea-CegtzxU_.js → textarea-DZcoj6k2.js} +1 -1
  174. package/dist/client/assets/{toggle-group-5omFh11U.js → toggle-group-CT-LedBS.js} +1 -1
  175. package/dist/client/assets/{toolbar-DORhO8If.js → toolbar-DDbKD-Ay.js} +1 -1
  176. package/dist/client/assets/{track-B8qKGWO9.js → track-BoWa7pFa.js} +1 -1
  177. package/dist/client/assets/{types-CE4AuZSY.js → types-CHsUC77L.js} +1 -1
  178. package/dist/client/assets/{use-ai-providers-DAYMp9NI.js → use-ai-providers-vhWA7gSP.js} +1 -1
  179. package/dist/client/assets/{use-api-keys-DnFSxnvy.js → use-api-keys-CwfibyAQ.js} +1 -1
  180. package/dist/client/assets/{use-automations-DWv6iLeU.js → use-automations-CqECqdXg.js} +1 -1
  181. package/dist/client/assets/{use-autosave-iV8J_MuB.js → use-autosave-CTd3ujOq.js} +1 -1
  182. package/dist/client/assets/{use-clock-tick-BuVoJTdT.js → use-clock-tick-c_pjCx_y.js} +1 -1
  183. package/dist/client/assets/{use-commerce-diagnostic-KLE4UXiE.js → use-commerce-diagnostic-BpYk1Ih5.js} +1 -1
  184. package/dist/client/assets/{use-connection-BJir_wda.js → use-connection-Brp0ROSB.js} +1 -1
  185. package/dist/client/assets/{use-copy-Ddcpb0Jm.js → use-copy-JYzS-t0x.js} +1 -1
  186. package/dist/client/assets/{use-create-virtual-mcp-D0oAOlYC.js → use-create-virtual-mcp-T4W7BRl2.js} +1 -1
  187. package/dist/client/assets/{use-debounced-autosave-DYJOZB4t.js → use-debounced-autosave-Lcvsez5G.js} +1 -1
  188. package/dist/client/assets/{use-debounced-value-DXPF8RW0.js → use-debounced-value-CHx-_V6p.js} +1 -1
  189. package/dist/client/assets/{use-decopilot-events-CUYP3xa6.js → use-decopilot-events-EyNfu7Kq.js} +1 -1
  190. package/dist/client/assets/{use-delete-connection-CaYWV75o.js → use-delete-connection-9tv1jgN0.js} +1 -1
  191. package/dist/client/assets/{use-deployment-admin-DiSPyrP4.js → use-deployment-admin-BH2VfdtE.js} +1 -1
  192. package/dist/client/assets/{use-file-configs-BZNx7FRl.js → use-file-configs-EX9fsqJc.js} +1 -1
  193. package/dist/client/assets/{use-infinite-scroll-DGa9MpTS.js → use-infinite-scroll-BwpbIlWm.js} +1 -1
  194. package/dist/client/assets/{use-join-requests-_j9mGSpf.js → use-join-requests-D3OvgAR4.js} +1 -1
  195. package/dist/client/assets/{use-mcp-client-Zz1TwEAh.js → use-mcp-client-DP99b3Me.js} +1 -1
  196. package/dist/client/assets/{use-mcp-tools-CXwtpaPy.js → use-mcp-tools-CjeO7xTP.js} +1 -1
  197. package/dist/client/assets/{use-members--D0gY-Nz.js → use-members-Fg8xu9zL.js} +1 -1
  198. package/dist/client/assets/{use-navigate-to-agent-BTDz1KOs.js → use-navigate-to-agent-B3WHCfCa.js} +1 -1
  199. package/dist/client/assets/{use-org-auth-client-C8dt2CEh.js → use-org-auth-client-CbgB99m_.js} +1 -1
  200. package/dist/client/assets/{use-org-repo-syncs-BMPkdDGr.js → use-org-repo-syncs-mnINiKx8.js} +1 -1
  201. package/dist/client/assets/{use-org-sso-DAANUxzR.js → use-org-sso-JpsBVP_t.js} +1 -1
  202. package/dist/client/assets/{use-organization-roles-C4JrUmJs.js → use-organization-roles-SDielVSw.js} +1 -1
  203. package/dist/client/assets/{use-organization-settings-BZyz9Mop.js → use-organization-settings-CjuBssHq.js} +1 -1
  204. package/dist/client/assets/{use-registry-connections-DrNpncD0.js → use-registry-connections-DYlN_mpo.js} +1 -1
  205. package/dist/client/assets/{use-secrets-XCXR_vh8.js → use-secrets-BFX9kjjo.js} +1 -1
  206. package/dist/client/assets/{use-section-preview-base-BuCg0_G0.js → use-section-preview-base-CMJMRXCJ.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-CjE1Nwyt.js → use-status-sounds-YIMtdt9I.js} +1 -1
  208. package/dist/client/assets/{use-tags-CtHBcu1c.js → use-tags-CGvsLsNg.js} +1 -1
  209. package/dist/client/assets/{use-view-mode-D2QnCor3.js → use-view-mode-DcnCbu_t.js} +1 -1
  210. package/dist/client/assets/{use-virtual-mcp-BHOLpD1P.js → use-virtual-mcp-Dg7xWNG-.js} +1 -1
  211. package/dist/client/assets/useInfiniteQuery-oSGVjzuL.js +1 -0
  212. package/dist/client/assets/useSuspenseInfiniteQuery-Cu_rUEsy.js +1 -0
  213. package/dist/client/assets/{users-BdTetp54.js → users-H55pONgO.js} +1 -1
  214. package/dist/client/assets/{variant-calendar-OvwXqvaE.js → variant-calendar-B3KUJEEH.js} +1 -1
  215. package/dist/client/assets/{view-mode-toggle-DYMYSHNc.js → view-mode-toggle-CVgUIU1G.js} +1 -1
  216. package/dist/client/index.html +1 -1
  217. package/dist/server/cli.js +1 -1
  218. package/dist/server/server.js +1 -1
  219. package/package.json +1 -1
  220. package/dist/client/assets/record-editor-BiTWcS2C.js +0 -1
  221. package/dist/client/assets/registry-zK072Ecp.js +0 -2
  222. package/dist/client/assets/store-registry-CH-meU9J.js +0 -2
  223. package/dist/client/assets/useInfiniteQuery-DrLMltTg.js +0 -1
  224. package/dist/client/assets/useSuspenseInfiniteQuery-bgdhkmFx.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-DYATNkxM.js","assets/index-DS_PtpmP.js","assets/index-DfOjcoHJ.css","assets/chat-context-_CA_JeeY.js","assets/tab-id-BOj9dZWT.js","assets/dialog-CLVbCjMu.js","assets/Check-7fxTQqwV.js","assets/Copy01-0rsYyxBd.js","assets/Download01-B_W2m-uX.js","assets/session-runtime-wVXsCwcJ.js","assets/hooks-DlPXzzl8.js","assets/use-mcp-client-Zz1TwEAh.js","assets/constants-_08zpzmT.js","assets/auth-BjDvWFq6.js","assets/decopilot-sse-pool-B2gldwFf.js","assets/backoff-CrEUbyZT.js","assets/delay-CnY5UFtP.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-BHOLpD1P.js","assets/use-ai-providers-DAYMp9NI.js","assets/use-decopilot-events-CUYP3xa6.js","assets/use-organization-settings-BZyz9Mop.js","assets/ChevronDown-DC3VmpPs.js","assets/agent-icon-BRsJ64Gp.js","assets/AlertCircle-C8ZNKM0T.js","assets/Tool01-K1KtrUp3.js","assets/ArrowUp-BjteiNgF.js","assets/ArrowLeft-C4S3t4gh.js","assets/Tool02-CaMOVLUq.js","assets/XCircle-qXvFFF3a.js","assets/TrendUp01-Cpu4_O9X.js","assets/ZapSquare-B8eYKtXE.js","assets/Users03-C1f0X_bD.js","assets/UserSquare-DtGKXF0N.js","assets/CheckCircle-Ds0VlJAl.js","assets/ChevronRight-DB1jERJP.js","assets/ChevronSelectorVertical-B9rG_ZYr.js","assets/ChevronUp-DklUcnpq.js","assets/DotsVertical-CtEAbV8O.js","assets/Stars02-DTCJxH0_.js","assets/CreditCard01-C02kJIQ-.js","assets/Settings02-Bvo1tVwA.js","assets/Eye-CCl0QwVV.js","assets/FilterLines-v44MczT5.js","assets/Share07-3Y0P_W3_.js","assets/Globe01-Dr2wIPy6.js","assets/Globe04-BlbLK8Qh.js","assets/SwitchHorizontal01-CQZ9t4Uh.js","assets/HardDrive-DKQRwLSP.js","assets/Key01-kpUUZaqy.js","assets/LinkExternal01-NyjdMVf7.js","assets/LockUnlocked01-DsKz0Xl2.js","assets/LogOut01-Dd8QdhEu.js","assets/Monitor01-CCXNZQlH.js","assets/Sun-DBnfC6xb.js","assets/Palette-BffjPXio.js","assets/Play-D8AheaUt.js","assets/Plus-DfL6u6I_.js","assets/SearchLg-D1p_gJI8.js","assets/SearchMd-DVItXoZb.js","assets/Shield01-C4putjAN.js","assets/Stars01-ClK-g0zk.js","assets/Trash01-Hh3vb-pV.js","assets/Upload01-PO1Z12J3.js","assets/User01-ClQH_5NK.js","assets/Users01-Bvqsn2Z0.js","assets/XClose-F4_KA-E6.js","assets/Zap-DK06ViId.js","assets/automation-runs-BQpimZeU.js","assets/select-v0HyS5wV.js","assets/useInfiniteQuery-DrLMltTg.js","assets/use-infinite-scroll-DGa9MpTS.js","assets/use-connection-BJir_wda.js","assets/table-yXN-B6JM.js","assets/empty-state-BF41trPY.js","assets/use-members--D0gY-Nz.js","assets/use-org-auth-client-C8dt2CEh.js","assets/use-clock-tick-BuVoJTdT.js","assets/use-automations-DWv6iLeU.js","assets/useSuspenseInfiniteQuery-bgdhkmFx.js","assets/avatar-CiQyTRfd.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-Ddcpb0Jm.js","assets/monaco-editor-CEXQCwfP.js","assets/spinner-Dzoa8exR.js","assets/types-CE4AuZSY.js","assets/shell-layout-Ca7ET_6R.js","assets/required-auth-layout-C8K6T2Dl.js","assets/use-org-sso-DAANUxzR.js","assets/integration-icon-DQzHhbi_.js","assets/use-navigate-to-agent-BTDz1KOs.js","assets/reusable-new-chat-CzvRy4Pe.js","assets/chart-56471C1Y.js","assets/index-B_Ad5QPQ.js","assets/form-BI3-Eb2L.js","assets/label-AZH9h-dP.js","assets/input-Dsyfk4jo.js","assets/file-type-icon-wuRfMh_5.js","assets/dropdown-menu-D2aUCLYk.js","assets/page-seo-form-9OJihF4x.js","assets/switch-CPOt6c8D.js","assets/use-section-preview-base-BuCg0_G0.js","assets/drawer-Ckbm2CWJ.js","assets/collection-search-Bd6xu3h9.js","assets/tabs-DMoGi1te.js","assets/toggle-group-5omFh11U.js","assets/use-commerce-diagnostic-KLE4UXiE.js","assets/popover-BRZicoZW.js","assets/self-tool-result-r1jsmu7J.js","assets/alert-dialog-C6uvTNV5.js","assets/extract-connection-data-A9qAyYQA.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-DXPF8RW0.js","assets/authenticate-and-persist-oauth-CfcfVqDI.js","assets/mcp-oauth-CV7iuGWl.js","assets/track-B8qKGWO9.js","assets/toolbar-DORhO8If.js","assets/github-repo-picker-BMkV5srU.js","assets/use-mcp-tools-CXwtpaPy.js","assets/agent-capabilities-C4tLW0Za.js","assets/connection-card-DXUN0HbG.js","assets/use-registry-connections-DrNpncD0.js","assets/retry-CErkP7V6.js","assets/connection-slug-eyAPH6o3.js","assets/textarea-CegtzxU_.js","assets/connection-form-helpers-Dw_uRR_o.js","assets/collection-tabs-3ta98PDW.js","assets/badge-Dp3mR27V.js","assets/command-pFth6-af.js","assets/index-B1veCTx1.js","assets/select-model-DbrnwWTj.js","assets/checkbox-C1bUrPvW.js","assets/ai-providers-logos-DD3qZ33J.js","assets/cards-BKUYovMU.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-CjE1Nwyt.js","assets/use-file-configs-BZNx7FRl.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-DYJOZB4t.js","assets/search-input-BMFjaZW8.js","assets/index-C2XLHMiw.js","assets/use-secrets-XCXR_vh8.js","assets/AreaChart-BYK2gWYF.js","assets/task-key-C2W_oYAM.js","assets/sprints-BDnw_QJc.js","assets/use-tags-CtHBcu1c.js","assets/get-initials-D-f_fDFw.js","assets/automation-list-row-BO2X7Ov7.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-BMPkdDGr.js","assets/file-explorer-ws1ucCZl.js","assets/app-editor-CCEPa5_q.js","assets/post-editor-pLSbc6mp.js","assets/multi-select-DPBlx32W.js","assets/block-document-By6966PS.js","assets/primitives-CtBKfa_X.js","assets/use-autosave-iV8J_MuB.js","assets/record-editor-BiTWcS2C.js","assets/category-editor-BrklTiAF.js","assets/bulk-category-panel-Crj0FXFd.js","assets/seo-editor-BqjKMW9L.js","assets/variant-calendar-OvwXqvaE.js","assets/view-mode-toggle-DYMYSHNc.js","assets/post-calendar-hEguUc5o.js","assets/alert-DjabJJJC.js","assets/redirect-editor-feQIS-ih.js","assets/project-app-view-DoK4zGoF.js"])))=>i.map(i=>d[i]);
2
- import{p as bs,r as A,ah as cj,ai as dj,c as F,H as qe,n as re,j as r,E as Fs,b as ie,t as pe,aa as fr,a5 as Ro,a8 as He,a9 as Ke,ab as We,aj as _s,ak as Vi,al as uj,am as on,an as op,I as lp,B as de,ao as ap,ap as dv,aq as hj,ar as fj,x as Oi,as as Ds,at as el,au as L3,d as zt,av as $s,e as Rs,q as Je,aw as mj,D as Io,ax as pj,ay as uv,az as gj,aA as er,aB as d9,aC as Bn,aD as xj,aE as u9,aF as bj,aG as vj,aH as yj,aI as _j,z as Fh,K as et,aJ as Lj,aK as Sj,aL as wj,aM as kj,aN as hv,aO as _d,o as Et,k as ft,a as xi,C as lu,aP as Od,u as br,f as Uh,R as fv,aQ as cp,aR as jj,aS as Cj,L as Nj,a3 as mv,aT as K0,aU as tl,Y as vt,aV as pv,aW as gv,aX as zn,P as Ni,aY as Nt,s as xv,aZ as Vj,a_ as Tj,a$ as Ej,b0 as Aj,b1 as Pj,b2 as bv,b3 as vv,b4 as yv,b5 as _v,b6 as Lv,b7 as Sv,b8 as wv,b9 as kv,ba as jv,bb as Cv,bc as Tn,bd as Nv,be as Dj,bf as Rj,bg as Vv,bh as Ij,bi as Mj,bj as $j,bk as Oj,bl as Da,bm as Bj,bn as zj,N as Fj,bo as Uj,bp as Hj,M as Kj,ag as Wj}from"./index-DS_PtpmP.js";import{i as Hh,n as qj}from"./ArrowUp-BjteiNgF.js";import{u as Mo,a as bi,b as Ls,c as sn,d as Tv,s as Gj,e as Yj,f as Jj,g as Qj,h as Xj,i as Zj,j as eC,k as dp,A as tC,l as sC,m as nC,p as Ev,V as iC,E as Kh,S as Av,n as Ga,t as rC,o as oC,q as Wh,r as as,v as Ya,H as Bd,w as zd,x as _a,y as Pv,z as Dv,B as lC,D as aC}from"./chat-context-_CA_JeeY.js";import{c as qh,s as bc,g as ar,P as Fd,d as up,t as dl,a as cC,M as dC,i as uC,b as Ur,e as Gh,f as hC,D as fC,h as mC,j as pC,k as Ja,l as gC,m as xC,u as hp,E as bC,n as au,o as vC,F as yC,p as fp,q as mp,r as Rv,S as _C,v as LC,w as SC,x as wC,y as S3,z as kC,A as Iv,O as jC,B as $o,C as sr,G as CC,T as Mv,H as h9,I as ld,J as NC,K as VC,L as $v,N as TC,Q as vr,R as EC,U as AC,V as Ov,W as kr,X as PC,Y as zc,Z as DC,_ as Bv,$ as zv,a0 as pp,a1 as Fv,a2 as RC,a3 as IC,a4 as MC,a5 as Oo,a6 as gp,a7 as Uv,a8 as Hv,a9 as Kv,aa as $C,ab as OC,ac as Wv,ad as BC,ae as zC,af as FC,ag as UC,ah as HC,ai as KC}from"./automation-runs-BQpimZeU.js";import{S as Ud}from"./spinner-Dzoa8exR.js";import{a as xs,b as Wt,d as It,e as Mt,h as Fn,c as Zn,i as qv}from"./dialog-CLVbCjMu.js";import{c as WC,b as Yh,a as Jh,D as Qh,d as Gv,e as qC,f as GC}from"./drawer-Ckbm2CWJ.js";import{C as YC}from"./collection-search-Bd6xu3h9.js";import{u as Jt,a as JC,m as QC}from"./use-mcp-client-Zz1TwEAh.js";import{a as Cl,i as W0,S as Nl,b as XC,W as Yv,c as ZC,C as b1,g as q0,d as Jv,e as w3,f as eN,Q as tN,h as sN,j as nN,k as iN}from"./constants-_08zpzmT.js";import{u as Qv,g as cu,l as v1,C as rN,a as oN,b as lN}from"./chart-56471C1Y.js";import{t as Qt}from"./ChevronDown-DC3VmpPs.js";import{t as aN,z as cN,s as Xv,a as du,b as xp,u as dN,c as Zv}from"./hooks-DlPXzzl8.js";import{K as uN,i as ey,u as vc,a as ty,m as hN}from"./shell-layout-Ca7ET_6R.js";import{a as Ws,u as uu,b as bp,c as fN}from"./use-virtual-mcp-BHOLpD1P.js";import{w as sy,A as mN,r as Ra,b as pN,p as ny,f as Ld,c as iy,d as ry,e as oy,g as gN,F as xN,h as bN,j as vN,k as yN,l as _N,m as LN,O as SN,n as wN,o as kN}from"./tab-id-BOj9dZWT.js";import{r as ly,d as ay,a as vp,p as jN,b as CN,s as NN}from"./session-runtime-wVXsCwcJ.js";import{i as Bo,b as yp,a as VN}from"./XCircle-qXvFFF3a.js";import{h as cy,j as _p,k as Vl,l as dy,m as Lp,n as uy,A as Vo,o as hy,p as Qa,s as Hr,q as fy,r as zo,u as TN,v as EN,c as my,w as y1,x as yc,y as Ku,z as AN,B as Ti,C as mi,D as PN,E as py,f as DN,F as Xh,G as Tl,H as RN,I as Sp,J as gy,K as xy,L as _1,M as f9,N as k3,e as Zh,O as IN,P as MN,Q as $N,R as ON,S as BN,T as wp,U as by,V as ei,W as kp,X as jp,d as hu,Y as fu,Z as vy,_ as yy,$ as _y,a0 as zN,a1 as Cp,a2 as FN,a3 as j3,a4 as UN,a5 as HN,t as Ly,a6 as ef,a7 as mu,a8 as KN,a9 as $r,aa as So,i as tf,ab as WN,ac as qN,ad as GN,ae as YN,af as JN,ag as QN,ah as Or,ai as C3,aj as Sy,ak as XN,al as ZN,am as eV,an as Xa,ao as Np,ap as tV,aq as N3,ar as sV,as as nV,at as iV,au as wy,av as rV,aw as oV,ax as lV,ay as aV,az as cV,aA as dV,aB as uV,aC as hV,aD as ky,aE as Vp,aF as fV,aG as mV,aH as pV,aI as gV}from"./agent-icon-BRsJ64Gp.js";import{i as Rt}from"./Check-7fxTQqwV.js";import{a as Ei,i as xV,b as Tp,c as Ep}from"./Tool01-K1KtrUp3.js";import{i as ti}from"./Upload01-PO1Z12J3.js";import{i as cn}from"./AlertCircle-C8ZNKM0T.js";import{a as an}from"./Copy01-0rsYyxBd.js";import{F as L1,a as Ap,b as Pp,c as Dp,d as jy}from"./form-BI3-Eb2L.js";import{d as Pt,S as Cs,a as Ns,b as Is,c as Vs}from"./select-v0HyS5wV.js";import{t as sf,i as Rp,a as Ip,b as bV,c as vV,d as yV}from"./UserSquare-DtGKXF0N.js";import{i as nf}from"./ArrowLeft-C4S3t4gh.js";import{T as rl,a as _c,b as cr,c as pu}from"./tabs-DMoGi1te.js";import{t as S1}from"./Tool02-CaMOVLUq.js";import{T as Mp,a as Hd}from"./toggle-group-5omFh11U.js";import{I as bt}from"./input-Dsyfk4jo.js";import{u as $p,b as Op,g as Cy,i as _V,j as LV,C as Bp,a as SV,c as wV,T as kV,f as jV,A as CV,N as NV}from"./use-commerce-diagnostic-KLE4UXiE.js";import{u as Ny,M as VV,a as TV,m as rf,i as EV,g as Vy,b as AV,N as PV,c as DV}from"./select-model-DbrnwWTj.js";import{s as Ai}from"./XClose-F4_KA-E6.js";import{a as is,b as rs,P as os,c as RV}from"./popover-BRZicoZW.js";import{t as Br}from"./Stars01-ClK-g0zk.js";import{c as IV,a as of,b as zp,d as Ty,e as Ey,f as Fp,u as V3}from"./use-organization-settings-BZyz9Mop.js";import{u as lf,a as MV}from"./use-ai-providers-DAYMp9NI.js";import{b as Up,g as gu,c as Ay,a as en,r as Py,f as $V,d as OV}from"./agent-capabilities-C4tLW0Za.js";import{f as BV,a as zV,u as Kd,b as Lc,c as Dy,d as FV,e as Hp,g as ul,h as Ry,i as Kp,j as UV,k as Wp,l as qp,m as HV,p as KV,n as WV,o as qV,q as GV,r as YV,F as xu,t as Iy,s as JV,v as My,S as QV,B as XV,w as $y,x as ZV,R as eT}from"./cards-BKUYovMU.js";import{c as Ft,D as Ut,b as Ht,a as Qe,d as nr,e as ir,f as rr,g as hl,h as Nn,i as dr,j as Fc}from"./dropdown-menu-D2aUCLYk.js";import{s as $t}from"./Plus-DfL6u6I_.js";import{p as tT,q as sT}from"./question-004-sINsf4GQ.js";import{A as Hs}from"./avatar-CiQyTRfd.js";import{u as Oy,a as af}from"./use-members--D0gY-Nz.js";import{i as dn}from"./ChevronRight-DB1jERJP.js";import{u as cf}from"./use-is-desktop-app-BNujXJc_.js";import{i as vi}from"./CheckCircle-Ds0VlJAl.js";import{I as Bi}from"./integration-icon-DQzHhbi_.js";import{e as bu}from"./backoff-CrEUbyZT.js";import{u as nT}from"./use-status-sounds-CjE1Nwyt.js";import{E as To}from"./empty-state-BF41trPY.js";import{T as yo,a as iT}from"./toolbar-DORhO8If.js";import{b as By,n as Gp}from"./ZapSquare-B8eYKtXE.js";import{i as Kr,a as rT}from"./Share07-3Y0P_W3_.js";import{i as Hn}from"./Globe01-Dr2wIPy6.js";import{i as zy}from"./Monitor01-CCXNZQlH.js";import{u as Pi,a as Yp,b as Jp}from"./use-connection-BJir_wda.js";import{u as Fy,a as Qp,b as Uy}from"./use-mcp-tools-CXwtpaPy.js";import{g as df,M as oT}from"./types-CE4AuZSY.js";import{F as mr}from"./file-type-icon-wuRfMh_5.js";import{d as Xp,c as Zp,s as vu,b as lT}from"./TrendUp01-Cpu4_O9X.js";import{u as e2,a as Hy}from"./use-file-configs-BZNx7FRl.js";import{n as Za}from"./Download01-B_W2m-uX.js";import{n as yn}from"./LinkExternal01-NyjdMVf7.js";import{w as T3,M as yu,F as aT}from"./monaco-editor-CEXQCwfP.js";import{i as uf}from"./Key01-kpUUZaqy.js";import{p as cT,f as dT}from"./pt-BR-CLy76QW2.js";import{g as uT,e as hT}from"./extract-connection-data-A9qAyYQA.js";import{a as fT,i as E3}from"./mcp-oauth-CV7iuGWl.js";import{A as ec,a as tc,b as sc,c as nc,d as ic,e as rc,f as oc,g as lc}from"./alert-dialog-C6uvTNV5.js";import{L as Bt}from"./label-AZH9h-dP.js";import{S as pr}from"./switch-CPOt6c8D.js";import{T as Wr}from"./textarea-CegtzxU_.js";import{i as fl}from"./Play-D8AheaUt.js";import{s as tn}from"./Trash01-Hh3vb-pV.js";import{u as G0}from"./use-debounced-autosave-DYJOZB4t.js";import{i as Wd}from"./SearchMd-DVItXoZb.js";import{C as Sc}from"./checkbox-C1bUrPvW.js";import{S as hf}from"./search-input-BMFjaZW8.js";import{C as Ky}from"./collection-tabs-3ta98PDW.js";import{T as Wy,u as qy,I as mT,R as pT,a as gT}from"./index-C2XLHMiw.js";import{n as xT}from"./LockUnlocked01-DsKz0Xl2.js";import{g as bT,s as Gy}from"./connection-slug-eyAPH6o3.js";import{a as vT,i as yT}from"./Settings02-Bvo1tVwA.js";import{d as wc}from"./delay-CnY5UFtP.js";import{G as Vn,a as t2,u as _T}from"./github-repo-picker-BMkV5srU.js";import{s as Y0}from"./User01-ClQH_5NK.js";import{t as s2}from"./Users01-Bvqsn2Z0.js";import{u as Yy,a as Jy}from"./use-secrets-XCXR_vh8.js";import{i as Qy,a as n2}from"./DotsVertical-CtEAbV8O.js";import{a as kc}from"./format-time-BnbuEtat.js";import{f as Xy,g as LT,l as Zy,a as ST}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as wT}from"./authenticate-and-persist-oauth-CfcfVqDI.js";import{X as kT,A as jT,a as CT}from"./AreaChart-BYK2gWYF.js";import{t as NT,u as e6,a as t6,p as VT}from"./task-key-C2W_oYAM.js";import{s as jc}from"./Eye-CCl0QwVV.js";import{D as TT,R as ET,i as qd,a as AT,S as ls,b as s6,n as PT}from"./decopilot-sse-pool-B2gldwFf.js";import{s as DT,a as n6,b as i6}from"./sprints-BDnw_QJc.js";import{u as m9}from"./use-copy-Ddcpb0Jm.js";import{i as i2,c as r6}from"./SwitchHorizontal01-CQZ9t4Uh.js";import{u as r2,a as RT,b as IT}from"./use-tags-CtHBcu1c.js";import{g as Qn}from"./get-initials-D-f_fDFw.js";import{C as yi,a as si,b as Yt,c as gs,d as _i,e as zi,f as MT,g as A3}from"./command-pFth6-af.js";import{i as ff}from"./ChevronSelectorVertical-B9rG_ZYr.js";import{i as o2}from"./FilterLines-v44MczT5.js";import{i as mf}from"./SearchLg-D1p_gJI8.js";import{u as w1,a as $T,c as OT,p as o6,b as BT,s as k1,n as zT}from"./self-tool-result-r1jsmu7J.js";import{a as j1}from"./Palette-BffjPXio.js";import{u as pf}from"./use-debounced-value-DXPF8RW0.js";import{u as l6}from"./useInfiniteQuery-DrLMltTg.js";import{i as qr}from"./Zap-DK06ViId.js";import{B as FT}from"./badge-Dp3mR27V.js";import{u as _u,a as UT,b as HT,c as KT,d as WT}from"./use-automations-DWv6iLeU.js";import{s as Sd}from"./Stars02-DTCJxH0_.js";import{A as qT}from"./automation-list-row-BO2X7Ov7.js";import{t as GT}from"./site-error--i37Vnuw.js";import{u as YT,a as JT}from"./use-org-repo-syncs-BMPkdDGr.js";import{n as a6}from"./ChevronUp-DklUcnpq.js";function c6(t,e){const s=bs(e);return QT({filters:{...t,status:"pending"}},s).length}function P3(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function QT(t={},e){const s=bs(e).getMutationCache(),n=A.useRef(t),i=A.useRef(null);return i.current===null&&(i.current=P3(s,t)),A.useEffect(()=>{n.current=t}),A.useSyncExternalStore(A.useCallback(o=>s.subscribe(()=>{const l=cj(i.current,P3(s,n.current));i.current!==l&&(i.current=l,dj.schedule(o))}),[s]),()=>i.current,()=>i.current)}const D3=3,d6="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",XT="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function u6(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 w=ar(c._meta);d=c.title??up(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const u=d,h=c.description||null;if(a==="card"){let w;e[4]!==n||e[5]!==c?(w=()=>n(c),e[4]=n,e[5]=c,e[6]=w):w=e[6];const S=o||i,j=i&&"bg-accent/40",C=(o||i)&&"cursor-not-allowed opacity-50";let N;e[7]!==j||e[8]!==C?(N=re(XT,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=N):N=e[9];let V;e[10]!==u?(V=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=V):V=e[11];let T;e[12]!==i?(T=i&&r.jsx(Ud,{size:"xs"}),e[12]=i,e[13]=T):T=e[13];let E;e[14]!==V||e[15]!==T?(E=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[V,T]}),e[14]=V,e[15]=T,e[16]=E):E=e[16];let P;e[17]!==h?(P=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=P):P=e[18];let D;return e[19]!==E||e[20]!==P||e[21]!==w||e[22]!==S||e[23]!==N?(D=r.jsxs("button",{type:"button",onClick:w,disabled:S,className:N,children:[E,P]}),e[19]=E,e[20]=P,e[21]=w,e[22]=S,e[23]=N,e[24]=D):D=e[24],D}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=re(d6,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(Ud,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(_=r.jsx(He,{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]=_):_=e[40];const L=h??u;let y;e[41]!==L?(y=r.jsx(Ke,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=y):y=e[42];let k;return e[43]!==_||e[44]!==y?(k=r.jsxs(We,{delayDuration:400,children:[_,y]}),e[43]=_,e[44]=y,e[45]=k):k=e[45],k}function ZT(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=ie(),[c,d]=A.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(V=>{const T=c.toLowerCase();return V.prompt.name.toLowerCase().includes(T)||(V.prompt.title??"").toLowerCase().includes(T)||(V.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Ro();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]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==o){let V;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==o?(V=T=>r.jsx(u6,{item:T,variant:"card",onSelect:E=>{i(!1),o(E)},isLoading:l?.name===T.prompt.name,isDisabled:u&&l?.name!==T.prompt.name},T.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=V):V=e[17],g=f.map(V),e[7]=f,e[8]=u,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 _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=V=>{V.key==="Escape"&&d("")},e[23]=_):_=e[23];let L;e[24]!==c||e[25]!==v?(L=r.jsx(YC,{value:c,onChange:d,placeholder:v,onKeyDown:_}),e[24]=c,e[25]=v,e[26]=L):L=e[26];const y=L;if(m){let V;e[27]!==a?(V=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=V):V=e[28];let T;e[29]!==V?(T=r.jsx(WC,{className:"sr-only",children:r.jsx(Yh,{children:V})}),e[29]=V,e[30]=T):T=e[30];let E;e[31]!==a?(E=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=E):E=e[32];let P;e[33]!==E?(P=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:E})}),e[33]=E,e[34]=P):P=e[34];let D;e[35]!==b||e[36]!==y||e[37]!==P||e[38]!==T?(D=r.jsxs(Jh,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,P,y,b]}),e[35]=b,e[36]=y,e[37]=P,e[38]=T,e[39]=D):D=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==D?(I=r.jsx(fr,{delayDuration:400,children:r.jsx(Qh,{open:n,onOpenChange:i,children:D})}),e[40]=i,e[41]=n,e[42]=D,e[43]=I):I=e[43],I}let k;e[44]!==a?(k=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=k):k=e[45];let w;e[46]!==k?(w=r.jsx(xs,{className:"sr-only",children:r.jsx(Wt,{children:k})}),e[46]=k,e[47]=w):w=e[47];let S;e[48]!==a?(S=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=S):S=e[49];let j;e[50]!==S?(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:S})}),e[50]=S,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==w?(C=r.jsxs(It,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=w,e[56]=C):C=e[56];let N;return e[57]!==i||e[58]!==n||e[59]!==C?(N=r.jsx(fr,{delayDuration:400,children:r.jsx(Mt,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=N):N=e[60],N}function eE(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=ie(),[a,c]=A.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,D3),v=s.slice(D3),_=!!i;let L;e[10]!==_||e[11]!==i?.name||e[12]!==n?(L=k=>r.jsx(u6,{item:k,onSelect:n,isLoading:i?.name===k.prompt.name,isDisabled:_&&i?.name!==k.prompt.name},k.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=L):L=e[13];const y=b.map(L);d=fr,m=400,e[14]!==o?(u=re("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=u):u=e[15],h=y,f=v.length>0&&r.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:re(d6,"hover:bg-muted/70 hover:text-foreground",_&&"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]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=r.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=r.jsx(ZT,{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 tE(){return null}function sE(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 nE(t){const e=F.c(31),{connectionId:s}=t,n=ie(),{sendMessage:i}=bi(),{org:o}=qe();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=Jt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=Qv(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(iE),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=A.useReducer(sE,p),[b,v]=A.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(E,P)=>{if(!a){pe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const D=await cu(a,E.name,P);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[qh({id:E.name,name:bc(E.name,ar(E._meta)),metadata:D.messages,char:"/",kind:"prompt",args:P}),{type:"text",text:" "}]}]};await i(I)}catch(D){console.error("[ice-breakers] Failed to fetch prompt:",D),pe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=_):_=e[14];const L=_;let y;e[15]!==L?(y=async E=>{if(E.arguments&&E.arguments.length>0){x({type:"SELECT_PROMPT",prompt:E}),v(E);return}x({type:"START_LOADING",prompt:E}),await L(E)},e[15]=L,e[16]=y):y=e[16];const k=y;let w;e[17]!==b||e[18]!==L?(w=async E=>{b&&(x({type:"START_LOADING",prompt:b,arguments:E}),v(null),await L(b,E))},e[17]=b,e[18]=L,e[19]=w):w=e[19];const S=w;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==k||e[21]!==m||e[22]!==j?(C=r.jsx(eE,{items:m,onSelect:k,loadingPrompt:j}),e[20]=k,e[21]=m,e[22]=j,e[23]=C):C=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{v(null),x({type:"RESET"})},e[24]=N):N=e[24];let V;e[25]!==b||e[26]!==S?(V=r.jsx(Fd,{prompt:b,setPrompt:N,onSubmit:S}),e[25]=b,e[26]=S,e[27]=V):V=e[27];let T;return e[28]!==C||e[29]!==V?(T=r.jsxs(r.Fragment,{children:[C,V]}),e[28]=C,e[29]=V,e[30]=T):T=e[30],T}function iE(t){return{prompt:t}}function rE(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=Mo(),{org:i}=qe();let o;e[0]!==i.id?(o=Cl(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=re("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(tE,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=r.jsx(nE,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Fs,{fallback:null,children:r.jsx(A.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const p9="cubic-bezier(0.645, 0.045, 0.355, 1)",oE=44,lE={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"},aE={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},cE={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Eo(t){const e=F.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=ie(),[p,g]=A.useState(d),[x,b]=A.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const _=v;if(x)return null;const L=aE[f],y=lE[f];let k;e[2]!==L||e[3]!==y?(k=re("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,y),e[2]=L,e[3]=y,e[4]=k):k=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(dE),e[5]=w):w=e[5];const S=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let C;e[6]!==S||e[7]!==j?(C=re("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",S,j),e[6]=S,e[7]=j,e[8]=C):C=e[8];const N=cE[f];let V;e[9]!==N?(V=re("shrink-0",N),e[9]=N,e[10]=V):V=e[10];let T;e[11]!==s||e[12]!==V?(T=r.jsx("span",{className:V,children:s}),e[11]=s,e[12]=V,e[13]=T):T=e[13];let E;e[14]!==n?(E=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=E):E=e[15];let P;e[16]!==i?(P=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=P):P=e[17];const D=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==D?(I=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(Qt,{size:16,style:{transform:D,transition:`transform 180ms ${p9}`}})}),e[18]=D,e[19]=I):I=e[19];let R;e[20]!==m?(R=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=R):R=e[21];let $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let B,M;e[24]!==_?(B=te=>{te.stopPropagation(),_()},M=te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),te.stopPropagation(),_())},e[24]=_,e[25]=B,e[26]=M):(B=e[25],M=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 z;e[28]!==R||e[29]!==$||e[30]!==B||e[31]!==M?(z=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":R,title:$,onClick:B,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:O}),e[28]=R,e[29]=$,e[30]=B,e[31]=M,e[32]=z):z=e[32];let U;e[33]!==p||e[34]!==T||e[35]!==E||e[36]!==P||e[37]!==I||e[38]!==z||e[39]!==C?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:w,className:C,children:[T,E,P,I,z]}),e[33]=p,e[34]=T,e[35]=E,e[36]=P,e[37]=I,e[38]=z,e[39]=C,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 ${p9}`},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 X;e[44]!==Y?(X={opacity:Y,transition:`opacity 120ms ${p9}`,maxHeight:"60vh"},e[44]=Y,e[45]=X):X=e[45];let ne;e[46]!==o?(ne=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]=ne):ne=e[47];let se;e[48]!==c||e[49]!==o?(se=c?r.jsx("div",{className:re("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=se):se=e[50];let oe;e[51]!==ne||e[52]!==se?(oe=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ne,se]}),e[51]=ne,e[52]=se,e[53]=oe):oe=e[53];let Z;e[54]!==l||e[55]!==a?(Z=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]=Z):Z=e[56];let J;e[57]!==X||e[58]!==oe||e[59]!==Z?(J=r.jsx("div",{style:W,children:r.jsxs("div",{className:"flex flex-col",style:X,children:[oe,Z]})}),e[57]=X,e[58]=oe,e[59]=Z,e[60]=J):J=e[60];let q;e[61]!==K||e[62]!==J?(q=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:J}),e[61]=K,e[62]=J,e[63]=q):q=e[63];let G;return e[64]!==U||e[65]!==q||e[66]!==k||e[67]!==f?(G=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:k,children:[U,q]}),e[64]=U,e[65]=q,e[66]=k,e[67]=f,e[68]=G):G=e[68],G}function dE(t){return!t}const uE=Vi({content:on().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:op(["pending","in_progress","completed"]),activeForm:on().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),h6=Vi({todos:uj(uE)}),hE="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.";aN({description:hE,inputSchema:cN(h6),execute:async({todos:t})=>({ok:!0,count:t.length})});const fE="tool-todo_write",mE=new Set(["input-available","output-available"]);function pE(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!==fE||typeof o.state!="string"||!mE.has(o.state))continue;const l=h6.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function f6(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:dl(cC(n)),input:s.input})}return e}function m6(t){return t.at(-1)}function p6(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 gE(t){return t?t.message.startsWith("[CREDITS]"):!1}const xE="[SUBSCRIPTION_REQUIRED]";function g6(t){return t?.message.startsWith(xE)?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 bE={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function vE(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&gE(s))return{...bE,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,h=p6(a),f=f6(c),m=pE(e),p=i?null:g6(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=h.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function x6(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=bi(),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=vE({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 yE(){const t=x6();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 b6(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 _E="__home__";function l2(t,e){return lp.chatDraft(t,e)}function LE(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 v6(t,e,s,n,i){const o=l2(e,s);if(b6(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(wE(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function R3(t,e,s){const n=l2(e,s),i=t.getItem(n),o=LE(i);return i!==null&&o===null&&t.removeItem(n),o}function SE(t,e,s){t.removeItem(l2(e,s))}function wE(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function En(t){const e=F.c(14),s=Ws(t),n=Ls(),i=s?.metadata,o=n?.activeTask,l=o?.metadata?.runtime;let a;e[0]!==l?(a=jN(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!o&&!o.partial,u=o?.metadata;let h;e[2]!==i||e[3]!==u?(h=ly(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=ay(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=vp(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function kE(t){const e=F.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=ie();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=re("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==l?(u=l("chat.pagination.previousLabel"),e[2]=l,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(nf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=r.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":u,children:h}),e[5]=i,e[6]=a,e[7]=d,e[8]=u,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=re("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let _;e[18]!==l?(_=l("chat.pagination.nextLabel"),e[18]=l,e[19]=_):_=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Bo,{size:14}),e[20]=L):L=e[20];let y;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":_,children:L}),e[21]=o,e[22]=x,e[23]=v,e[24]=_,e[25]=y):y=e[25];let k;return e[26]!==y||e[27]!==f||e[28]!==g?(k=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,y]}),e[26]=y,e[27]=f,e[28]=g,e[29]=k):k=e[29],k}function y6(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(kE,{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 jE(t){const e=F.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,submitLabel:l,nextLabel:a}=t,u=n?l===void 0?"Submit":l:a===void 0?"Next":a,h=n?s:!i,f=h?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==h||e[1]!==o?(m=()=>{h||o()},e[0]=h,e[1]=o,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=re("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==g?(x=r.jsx(de,{type:"button",size:"sm","aria-disabled":h,onClick:m,className:g,children:u}),e[5]=h,e[6]=u,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(He,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==f?(_=r.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;return e[14]!==v||e[15]!==_?(L=r.jsxs(We,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16],L}function _6(t,e,s){return t.findIndex(n=>e(n)===s)}function I3(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function M3(t,e,s,n,i){if(t.length===0)return null;const o=_6(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 CE(t){return!t.isStreaming&&t.allAnswered}function L6(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=A.useState(c),[h,f]=A.useState(!1),m=ap({resolver:dv(n),defaultValues:i}),p=m.watch(),g=_6(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=I3(e,s,p,l),_=CE({isStreaming:o,allAnswered:v}),L=()=>{if(g>0){const N=e[g-1];N&&u(s(N))}},y=()=>{if(g>=0&&g<e.length-1){const N=e[g+1];N&&u(s(N))}},k=()=>{const N=m.getValues(),V=M3(e,s,N,l,d);V&&u(V)},w=()=>{m.handleSubmit(N=>{const V=N;for(const T of e)a(T,V[s(T)])})()},S=A.useRef(w);S.current=w;const j=()=>{_&&(f(!1),S.current())},C=()=>{const N=m.getValues();if(I3(e,s,N,l)){if(o){f(!0);return}f(!1),S.current()}else{const V=M3(e,s,N,l,d);V&&u(V)}};return A.useEffect(()=>{if(h&&!o){if(!v){f(!1);return}f(!1),S.current()}},[h,o,v]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:_,goPrev:L,goNext:y,advanceToNextUnanswered:k,submit:j,submitOrAdvance:C}}const S6="chat.approval.defaultDenyReason";function w6(t){const e=F.c(36),{onYolo:s}=t,n=ie(),[i,o]=Oi();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const L=el.find(w=>w.value===i.toolApprovalLevel)??el[0];let y;e[13]!==s||e[14]!==i||e[15]!==o?(y=w=>{const S=w,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:S}),S==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=y):y=e[16];const k=y;c=Cs,m=i.toolApprovalLevel,p=k,a=Ns,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=NE,l=Is,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]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],u=e[8],h=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]!==u||e[22]!==h||e[23]!==f||e[24]!==g?(x=r.jsx(a,{size:u,className:h,onClick:f,children:g}),e[20]=a,e[21]=u,e[22]=h,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=el.map(L=>r.jsx(Pt,{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(Vs,{children:b}),e[28]=b,e[29]=v):v=e[29];let _;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(_=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]=_):_=e[35],_}function NE(t){return t.stopPropagation()}function k6(t){const e=F.c(8),{input:s}=t,n=ie();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 VE(t){const e=F.c(38),{approval:s,onRespond:n}=t,i=ie(),[o]=Oi(),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(S6),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 u=d;let h;e[9]!==s.approvalId||e[10]!==n?(h=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=h):h=e[11];const f=h;let m;e[12]!==f?(m=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(w6,{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(de,{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]!==u||e[22]!==b?(v=r.jsx(de,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:b}),e[21]=u,e[22]=b,e[23]=v):v=e[23];let _;e[24]!==x||e[25]!==v?(_=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=_):_=e[26];const L=_;let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(sf,{size:14}),e[27]=y):y=e[27];let k;e[28]!==i?(k=i("chat.approval.needsApproval"),e[28]=i,e[29]=k):k=e[29];let w;e[30]!==s.input?(w=r.jsx(k6,{input:s.input}),e[30]=s.input,e[31]=w):w=e[31];let S;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==k||e[36]!==w?(S=r.jsx(Eo,{icon:y,label:k,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:w}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=k,e[36]=w,e[37]=S):S=e[37],S}const TE=hj(on(),Vi({approved:fj().optional(),levelOverride:op(["auto","readonly"]).optional()}));function EE(t){const e=F.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=ie(),[l]=Oi(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(DE)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==o?(u=(V,T)=>{const E=T;typeof E?.approved=="boolean"&&i(V.approvalId,E.approved,E.approved===!1?o(S6):void 0,E.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:PE,schema:TE,defaultValues:d,isStreaming:n,hasAnswer:AE,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=L6(h);let m;e[11]!==s||e[12]!==f?(m=V=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:V}]))),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=V=>{V.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(sf,{size:14}),e[16]=v):v=e[16];let _;e[17]!==s.length||e[18]!==o?(_=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=_):_=e[19];const L=g?.friendlyName??"";let y;e[20]!==p?(y=r.jsx(w6,{onYolo:p}),e[20]=p,e[21]=y):y=e[21];let k;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==y?(k=r.jsx(y6,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:y}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=y,e[27]=k):k=e[27];let w;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(w=g?r.jsx(RE,{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]=w):w=e[31];let S;e[32]!==g?(S=g?r.jsx(k6,{input:g.input}):null,e[32]=g,e[33]=S):S=e[33];let j;e[34]!==k||e[35]!==w||e[36]!==S||e[37]!==_||e[38]!==L?(j=r.jsx(Eo,{icon:v,label:_,title:L,defaultExpanded:!0,footerLeft:k,footerRight:w,children:S}),e[34]=k,e[35]=w,e[36]=S,e[37]=_,e[38]=L,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==b?(C=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=C):C=e[42];let N;return e[43]!==f.form||e[44]!==C?(N=r.jsx(L1,{...x,children:C}),e[43]=f.form,e[44]=C,e[45]=N):N=e[45],N}function AE(t){return typeof t?.approved=="boolean"}function PE(t){return t.approvalId}function DE(t){return[t.approvalId,{approved:void 0}]}function RE(t){const e=F.c(7),{approvalId:s,control:n,onChange:i}=t,o=ie(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(de,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),i()},"aria-pressed":f,children:o("chat.approval.denyButton")}),r.jsx(de,{type:"button",variant:h?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),i()},"aria-pressed":h,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(Ds,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function IE(){const t=F.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(sf,{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 ME(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(IE,{}),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(VE,{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(EE,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function $E(t){const e=F.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=ie();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(de,{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 u;e[8]!==o?(u=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=r.jsx(de,{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:u}),e[10]=a,e[11]=u,e[12]=h):h=e[12];let f;e[13]!==d||e[14]!==h?(f=r.jsxs(r.Fragment,{children:[d,h]}),e[13]=d,e[14]=h,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(cy,{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(dC,{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(Eo,{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 OE(t){const e=F.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=m6(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($E,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function j6(t){return t?"response"in t?t.response:t.option??t.draft:""}const $3=Vi({response:on().min(1,"Response is required")}),BE=Vi({option:on().nullable(),draft:on()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),zE=Vi({response:op(["yes","no"])});function FE(t){switch(t.type){case"text":return $3;case"choice":return BE;case"confirm":return zE;default:return $3}}function UE(t){const e={};for(const s of t)e[s.toolCallId]=FE(s.input);return Vi(e)}function HE(t){const e=F.c(7),{control:s,name:n,placeholder:i}=t,o=ie();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,u=d.value??"";return r.jsxs(Ap,{children:[r.jsx(Pp,{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(_p,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:u,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(Dp,{})]})},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(jy,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function C6(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]),A.useEffect(n,i)}function KE(t){const e=F.c(51),{control:s,name:n,options:i}=t,o=ie(),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}=L3(a),d=`${n}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:h}=L3(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=D=>{const I=i[D];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=p):p=e[8],C6(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 D;e[16]!==c||e[17]!==f||e[18]!==o?(D=(I,R)=>{const $=f===I;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:re("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:I}),children:[r.jsx("span",{className:re("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:R+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${R}-${I}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=D):D=e[19],b=i.map(D),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",_=!g&&"hover:bg-accent/30";let L;e[20]!==v||e[21]!==_?(L=re("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,_),e[20]=v,e[21]=_,e[22]=L):L=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(_p,{size:16,className:"text-muted-foreground"})}),e[23]=y):y=e[23];const k=g?m:"";let w;e[24]!==h||e[25]!==c||e[26]!==f?(w=D=>{h.onChange(D.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=w):w=e[27];let S;e[28]!==c||e[29]!==f?(S=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=S):S=e[30];let j;e[31]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let C;e[33]!==o?(C=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=C):C=e[34];let N;e[35]!==k||e[36]!==w||e[37]!==S||e[38]!==j||e[39]!==C?(N=r.jsx("input",{type:"text",value:k,onChange:w,onFocus:S,placeholder:j,"aria-label":C,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=k,e[36]=w,e[37]=S,e[38]=j,e[39]=C,e[40]=N):N=e[40];let V;e[41]!==L||e[42]!==N?(V=r.jsxs("label",{className:L,children:[y,N]}),e[41]=L,e[42]=N,e[43]=V):V=e[43];let T;e[44]!==V||e[45]!==x||e[46]!==b?(T=r.jsx(Pp,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,V]})}),e[44]=V,e[45]=x,e[46]=b,e[47]=T):T=e[47];let E;e[48]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(Dp,{}),e[48]=E):E=e[48];let P;return e[49]!==T?(P=r.jsxs(Ap,{children:[T,E]}),e[49]=T,e[50]=P):P=e[50],P}function WE(t){const e=F.c(8),{control:s,name:n}=t,i=ie();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=A.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{a.current?.onChange(l[h]??"")},e[1]=c):c=e[1],C6(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,r.jsxs(Ap,{children:[r.jsx(Pp,{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:re("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:re("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(Dp,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=r.jsx(jy,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}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(HE,{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(KE,{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(WE,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function qE(t){const e=F.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=UE(s.map(QE)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(JE)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(M,O)=>{const z=j6(O);z&&i(M,z)},e[4]=i,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(u={parts:s,partKey:YE,schema:l,defaultValues:c,isStreaming:n,hasAnswer:GE,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=u):u=e[11];const h=L6(u),f=h.currentPart,m=ie();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const M=f;if(!M)return;const O=m("chat.userAskQuestion.skipMessage"),z=M.toolCallId;M.input?.type==="choice"?(h.form.setValue(`${z}.option`,null),h.form.setValue(`${z}.draft`,O)):h.form.setValue(`${z}.response`,O),h.advanceToNextUnanswered()},e[12]=f,e[13]=h,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==h.currentIndex||e[17]!==h.goNext||e[18]!==h.goPrev||e[19]!==s.length?(x=r.jsx(y6,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext}),e[16]=h.currentIndex,e[17]=h.goNext,e[18]=h.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 _;e[23]!==g||e[24]!==v?(_=r.jsx(de,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=_):_=e[25];let L;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(L=r.jsx(jE,{isStreaming:n,isAllAnswered:h.isAllAnswered,isCurrentAnswered:h.isCurrentAnswered,onAdvanceOrSubmit:h.submitOrAdvance}),e[26]=h.isAllAnswered,e[27]=h.isCurrentAnswered,e[28]=h.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let y;e[31]!==_||e[32]!==L?(y=r.jsxs(r.Fragment,{children:[_,L]}),e[31]=_,e[32]=L,e[33]=y):y=e[33];const k=y;if(s.length===1){const M=s[0];if(!M?.input)return null;const O=h.form;let z;e[34]!==h?(z=oe=>{oe.preventDefault(),h.submit()},e[34]=h,e[35]=z):z=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(S1,{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]!==M.input?.prompt||e[40]!==m?(K=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=K):K=e[41];const W=M.input;let Y;e[42]!==h.form.control||e[43]!==M.toolCallId||e[44]!==W?(Y=r.jsx(O3,{input:W,control:h.form.control,toolCallId:M.toolCallId}),e[42]=h.form.control,e[43]=M.toolCallId,e[44]=W,e[45]=Y):Y=e[45];let X;e[46]!==k||e[47]!==H||e[48]!==K||e[49]!==Y?(X=r.jsx(Eo,{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]=X):X=e[50];let ne;e[51]!==z||e[52]!==X?(ne=r.jsx("form",{onSubmit:z,autoComplete:"off",children:X}),e[51]=z,e[52]=X,e[53]=ne):ne=e[53];let se;return e[54]!==h.form||e[55]!==ne?(se=r.jsx(L1,{...O,children:ne}),e[54]=h.form,e[55]=ne,e[56]=se):se=e[56],se}const w=h.form;let S;e[57]!==h?(S=M=>{M.preventDefault(),h.submit()},e[57]=h,e[58]=S):S=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(S1,{size:14}),e[59]=j):j=e[59];let C;e[60]!==m?(C=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=C):C=e[61];const N=h.currentIndex+1;let V;e[62]!==s.length||e[63]!==m||e[64]!==N?(V=m("chat.userAskQuestion.questionCount",{current:N,total:s.length}),e[62]=s.length,e[63]=m,e[64]=N,e[65]=V):V=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 E=h.activeKey,P=h.setActiveKey;let D;if(e[69]!==h.form||e[70]!==s){let M;e[72]!==h.form?(M=O=>r.jsx(rl,{value:O.toolCallId,className:"mt-0",children:r.jsx(O3,{input:O.input,control:h.form.control,toolCallId:O.toolCallId})},O.toolCallId),e[72]=h.form,e[73]=M):M=e[73],D=s.map(M),e[69]=h.form,e[70]=s,e[71]=D}else D=e[71];let I;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==D?(I=r.jsx(_c,{value:E,onValueChange:P,children:D}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=D,e[77]=I):I=e[77];let R;e[78]!==b||e[79]!==k||e[80]!==C||e[81]!==V||e[82]!==T||e[83]!==I?(R=r.jsx(Eo,{icon:j,label:C,count:V,title:T,defaultExpanded:!0,footerLeft:b,footerRight:k,children:I}),e[78]=b,e[79]=k,e[80]=C,e[81]=V,e[82]=T,e[83]=I,e[84]=R):R=e[84];let $;e[85]!==S||e[86]!==R?($=r.jsx("form",{onSubmit:S,autoComplete:"off",children:R}),e[85]=S,e[86]=R,e[87]=$):$=e[87];let B;return e[88]!==h.form||e[89]!==$?(B=r.jsx(L1,{...w,children:$}),e[88]=h.form,e[89]=$,e[90]=B):B=e[90],B}function GE(t){return!!j6(t)}function YE(t){return t.toolCallId}function JE(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function QE(t){return{toolCallId:t.toolCallId,input:t.input}}function XE(){const t=F.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(S1,{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 N6(t){const e=F.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(ZE),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(XE,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(qE,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function ZE(t){return t.state==="input-available"}function eA(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 tA(t){const e=F.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=eA(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx(rA,{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(sA),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 u;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==o||e[11]!==d?(u=r.jsx(Eo,{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]=u):u=e[12],u}function sA(t,e){return r.jsx(nA,{todo:t},e)}function nA(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(iA,{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=re("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",u=n?"width 300ms ease 200ms":"width 150ms ease";let h;e[4]!==d||e[5]!==u?(h=r.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=h):h=e[6];let f;e[7]!==o||e[8]!==c||e[9]!==h?(f=r.jsxs("span",{className:c,children:[o,h]}),e[7]=o,e[8]=c,e[9]=h,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 iA(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 rA(t){const e=F.c(13),{status:s}=t,n=ie();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 oA={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"}]},lA=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function V6(t){const e=F.c(65),{onDismiss:s}=t,{org:n}=qe(),i=zt(),{decoKeyId:o}=$p(),l=$s(),a=ie(),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Je("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]),A.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 _;e[8]!==a?(_=W=>{pe.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=_):_=e[9];let L;e[10]!==b||e[11]!==v||e[12]!==_?(L={mutationFn:b,onSuccess:v,onError:_},e[10]=b,e[11]=v,e[12]=_,e[13]=L):L=e[13];const{mutate:y,isPending:k}=Rs(L),w=parseFloat(c),S=!isNaN(w)&&w>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["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]=C):C=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=N):N=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=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]=V):V=e[18];let T;e[19]!==a?(T=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=T):T=e[20];let E;e[21]!==T?(E=r.jsx(Wt,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=E):E=e[22];let P;e[23]!==a?(P=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=P):P=e[24];let D;e[25]!==P?(D=r.jsx(Fn,{className:"mt-1.5 text-sm leading-relaxed",children:P}),e[25]=P,e[26]=D):D=e[26];let I;e[27]!==E||e[28]!==D?(I=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,r.jsxs(xs,{className:"relative gap-4",children:[V,r.jsxs("div",{children:[E,D]})]})]}),e[27]=E,e[28]=D,e[29]=I):I=e[29];let R;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==w||e[34]!==o||e[35]!==S||e[36]!==k||e[37]!==u||e[38]!==a||e[39]!==y?(R=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(Hd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Hd,{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:oA[f].map(W=>{const{dollars:Y,labelKey:X}=W;return r.jsxs("button",{type:"button",disabled:k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Y*100,currency:f,tier_label:X,source:"exhausted_banner"}),y(Y*100)},className:re("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(X)})]},Y)})}),u?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(bt,{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(de,{className:"h-10",disabled:!S||k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(w*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(w*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:()=>h(!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:lA.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(Rt,{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]=w,e[34]=o,e[35]=S,e[36]=k,e[37]=u,e[38]=a,e[39]=y,e[40]=R):R=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let B;e[43]!==s||e[44]!==$?(B=r.jsx(de,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=B):B=e[45];let M;e[46]!==i||e[47]!==s||e[48]!==n.slug?(M=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let O;e[50]!==a?(O=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=O):O=e[51];let z;e[52]!==M||e[53]!==O?(z=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:O}),e[52]=M,e[53]=O,e[54]=z):z=e[54];let U;e[55]!==B||e[56]!==z?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,z]}),e[55]=B,e[56]=z,e[57]=U):U=e[57];let H;e[58]!==I||e[59]!==R||e[60]!==U?(H=r.jsxs(It,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:aA,children:[I,R,U]}),e[58]=I,e[59]=R,e[60]=U,e[61]=H):H=e[61];let K;return e[62]!==H||e[63]!==j?(K=r.jsx(Mt,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=K):K=e[64],K}function aA(t){return t.preventDefault()}const cA={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 dA(t){const e=F.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=ie(),{label:l,title:a}=cA[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Vl,{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 u;e[4]!==o||e[5]!==a?(u=o(a),e[4]=o,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==o?(h=s==="trial_exhausted"?r.jsx(de,{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]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=r.jsx(Eo,{icon:c,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:h}),e[11]=n,e[12]=d,e[13]=u,e[14]=h,e[15]=f):f=e[15],f}function uA(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 hA={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function J0(t){const e=F.c(29),s=ie(),{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?cn:Io;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=hA[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 u=d;let h;e[8]!==o||e[9]!==u?(h=o?uA(u):{summary:u,rawDetails:null},e[8]=o,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;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(de,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(de,{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(an,{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(Eo,{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 gf(){const t=F.c(73),e=ie(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=bi(),[u,h]=Oi(),{virtualMcpId:f,createTaskWithMessage:m}=sn(),{chatMode:p,simpleModeTier:g}=Mo(),{mutate:x}=Ny("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 _;t[2]!==p||t[3]!==g||t[4]!==f?(_=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=_):_=t[5];const L=_;let y;t[6]!==u.toolApprovalLevel?(y=u.toolApprovalLevel??mj(),t[6]=u.toolApprovalLevel,t[7]=y):y=t[7];const k=y,w=l.at(-1),S=w?.role==="assistant"?w.parts:[],j=S.filter(gA),C=p6(S),N=f6(S);let V;t[8]!==s||t[9]!==d||t[10]!==e?(V=()=>{if(s){const ee={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ee)}},t[8]=s,t[9]=d,t[10]=e,t[11]=V):V=t[11];const T=V;let E;t[12]!==d||t[13]!==e?(E=()=>{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]=E):E=t[14];const P=E;let D;t[15]!==L||t[16]!==k||t[17]!==c?(D=(le,ee)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ee}},L(k))},t[15]=L,t[16]=k,t[17]=c,t[18]=D):D=t[18];const I=D;let R;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(R=le=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=R):R=t[24];const $=R,B=pA;let M;t[25]!==L||t[26]!==c?(M=(le,ee,ae,ue)=>{c({kind:"approval",approvalId:le,approved:ee,...ae?{reason:ae}:{}},L(ue))},t[25]=L,t[26]=c,t[27]=M):M=t[27];const O=M,z=x6();if(z.isCreditExhausted){let le;return t[28]!==n?(le=r.jsx(V6,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:U,showWarning:H,hasApprovals:K}=z,W=j.map(mA).join("|"),Y=m6(C)?.toolCallId??"",X=N.map(fA).join("|");let ne;t[30]!==z.todos?(ne=r.jsx(tA,{todos:z.todos}),t[30]=z.todos,t[31]=ne):ne=t[31];let se;t[32]!==n||t[33]!==z.subscriptionErrorKind||t[34]!==v?(se=z.subscriptionErrorKind&&r.jsx(dA,{kind:z.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=z.subscriptionErrorKind,t[34]=v,t[35]=se):se=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==U?(oe=U&&r.jsx(J0,{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 Z;t[41]!==o||t[42]!==i||t[43]!==P||t[44]!==H?(Z=H&&r.jsx(J0,{variant:"warning",finishReason:i,onDismiss:o,onContinue:P}),t[41]=o,t[42]=i,t[43]=P,t[44]=H,t[45]=Z):Z=t[45];let J;t[46]!==X||t[47]!==O||t[48]!==K||t[49]!==a||t[50]!==N?(J=K&&r.jsx(ME,{approvals:N,isStreaming:a,onRespond:O},X),t[46]=X,t[47]=O,t[48]=K,t[49]=a,t[50]=N,t[51]=J):J=t[51];let q;t[52]!==z.hasPlans||t[53]!==$||t[54]!==B||t[55]!==a||t[56]!==C||t[57]!==Y?(q=z.hasPlans&&r.jsx(OE,{plans:C,isStreaming:a,onApprove:$,onDismiss:B},Y),t[52]=z.hasPlans,t[53]=$,t[54]=B,t[55]=a,t[56]=C,t[57]=Y,t[58]=q):q=t[58];let G;t[59]!==z.isWaitingForUserInput||t[60]!==I||t[61]!==a||t[62]!==W||t[63]!==j?(G=z.isWaitingForUserInput&&r.jsx(N6,{userAskParts:j,isStreaming:a,onSubmit:I},W),t[59]=z.isWaitingForUserInput,t[60]=I,t[61]=a,t[62]=W,t[63]=j,t[64]=G):G=t[64];let te;return t[65]!==oe||t[66]!==Z||t[67]!==J||t[68]!==q||t[69]!==G||t[70]!==ne||t[71]!==se?(te=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[ne,se,oe,Z,J,q,G]}),t[65]=oe,t[66]=Z,t[67]=J,t[68]=q,t[69]=G,t[70]=ne,t[71]=se,t[72]=te):te=t[72],te}function fA(t){return t.approvalId}function mA(t){return t.toolCallId}function pA(){document.querySelector("[data-chat-input]")?.focus()}function gA(t){return t.type==="tool-user_ask"}gf.Error=function(e){return r.jsx(J0,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};gf.Warning=function(e){return r.jsx(J0,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};gf.UserAskQuestion=N6;function xA(t){const e=F.c(20),{taskId:s}=t,n=ie(),i=Tv(s),o=Gj(i),l=Yj(),{stop:a,removeLocalMessage:c}=bi();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 u;e[2]!==a?(u=()=>{a()},e[2]=a,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Hh,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:h})}),e[5]=d,e[6]=u,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(Ke,{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(We,{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(de,{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(_=>{_&&(Jj(s,b.messageId),c(b.messageId))})},children:r.jsx(Ai,{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 bA(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 vA={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function yA(t){const e=F.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=ie(),u=lf(),h=new Set(u.map(_A)),f=Qj([i,n,o],h),m=f?.keyId??null,[p,g]=A.useState(m??u[0]?.id??null),x=u.some(R=>R.id===p)?p:m??u[0]?.id??null,b=x?u.find(R=>R.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",_=vA[s];let L;e[0]!==d||e[1]!==_?(L=d(_),e[0]=d,e[1]=_,e[2]=L):L=e[2];let y;e[3]!==L?(y=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=y):y=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 w;e[9]!==y||e[10]!==k?(w=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[y,k]}),e[9]=y,e[10]=k,e[11]=w):w=e[11];const S="flex-1 min-h-0",j=A.Suspense;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(TV,{}),e[12]=C):C=e[12];const N=VV,V=!0,T=bA(m?f:null,b?.providerId??"deco");let E;e[13]!==x||e[14]!==l||e[15]!==g?(E=R=>{const $=R.keyId??x??"";g($),l({keyId:$,modelId:R.modelId,title:R.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=E):E=e[16];let P;e[17]!==N||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==E?(P=r.jsx(N,{compact:V,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:E}),e[17]=N,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=E,e[23]=P):P=e[23];let D;e[24]!==j||e[25]!==P||e[26]!==C?(D=r.jsx("div",{className:S,children:r.jsx(j,{fallback:C,children:P})}),e[24]=j,e[25]=P,e[26]=C,e[27]=D):D=e[27];let I;return e[28]!==D||e[29]!==w?(I=r.jsxs("div",{className:v,children:[w,D]}),e[28]=D,e[29]=w,e[30]=I):I=e[30],I}function _A(t){return t.id}const LA=["fast","smart","thinking"];function T6(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const SA={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function wA(t){const e=F.c(28),{tier:s,pillIcon:n,groups:i}=t,o=ie();let l;e[0]!==o?(l=T6(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=A.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=S=>{S.onSelect(),d(!1)},e[2]=u):u=e[2];const h=u,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=re("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=re("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(Qt,{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(He,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(is,{asChild:!0,children:r.jsxs(de,{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 _;e[12]!==f?(_=r.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;e[14]!==v||e[15]!==_?(L=r.jsxs(We,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16];let y;if(e[17]!==i||e[18]!==o){let S;e[20]!==o?(S=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(C=>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":C.title,onClick:()=>h(C),className:re("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",C.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[C.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:C.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:C.title}),C.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle})]}),C.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(Rt,{size:14,className:"text-foreground mt-0.5"})})]}),C.modelOverride&&r.jsx(jA,{label:C.title,render:C.modelOverride})]},C.key))},j.key),e[20]=o,e[21]=S):S=e[21],y=i.map(S),e[17]=i,e[18]=o,e[19]=y}else y=e[19];let k;e[22]!==y?(k=r.jsx(rs,{align:"end",className:"p-1 w-64",onOpenAutoFocus:kA,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:y})}),e[22]=y,e[23]=k):k=e[23];let w;return e[24]!==c||e[25]!==L||e[26]!==k?(w=r.jsxs(os,{open:c,onOpenChange:d,children:[L,k]}),e[24]=c,e[25]=L,e[26]=k,e[27]=w):w=e[27],w}function kA(t){return t.preventDefault()}function jA(t){const e=F.c(38),{label:s,render:n}=t,i=ie(),o=Ro(),[l,a]=A.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 u;e[1]!==s||e[2]!==i?(u=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=u):u=e[3];const h=l&&"opacity-100";let f;e[4]!==h?(f=re("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",h),e[4]=h,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Lp,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=r.jsx("button",{type:"button","aria-label":u,className:f,children:m}),e[7]=u,e[8]=f,e[9]=p):p=e[9];const g=p;if(o){let L;e[10]!==g?(L=r.jsx(Gv,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let y;e[12]!==s||e[13]!==i?(y=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=y):y=e[14];let k;e[15]!==y?(k=r.jsx(Yh,{className:"sr-only",children:y}),e[15]=y,e[16]=k):k=e[16];let w;e[17]!==l||e[18]!==n?(w=l&&n(d),e[17]=l,e[18]=n,e[19]=w):w=e[19];let S;e[20]!==w||e[21]!==k?(S=r.jsxs(Jh,{className:"p-0 flex flex-col max-h-[95vh]",children:[k,w]}),e[20]=w,e[21]=k,e[22]=S):S=e[22];let j;return e[23]!==l||e[24]!==S||e[25]!==L?(j=r.jsxs(Qh,{open:l,onOpenChange:a,children:[L,S]}),e[23]=l,e[24]=S,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(is,{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(rs,{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 _;return e[34]!==l||e[35]!==x||e[36]!==v?(_=r.jsxs(os,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=_):_=e[37],_}function B3(t){return t==="fast"?r.jsx(Vl,{size:16}):t==="thinking"?r.jsx(dy,{size:16}):r.jsx(Br,{size:16})}function CA(t){const e=F.c(13),s=eC();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const u=s.tiers[d];return u?u.title??u.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 NA(){const t=F.c(22),e=ie(),{simpleModeTier:s,setSimpleModeTier:n}=Mo(),i=IV(),o=lf(),l=MV(o),a=CA(l),{data:c,error:d}=Xj();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=Zj();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]!==h||t[10]!==d){const _=T6(e);m="decopilot",p=LA.map(L=>{const y=a[L],k=h.tiers[L];return{key:`decopilot-${L}`,icon:B3(L),title:_[L],subtitle:y??e(SA[L]),active:s===L,onSelect:()=>n(L),modelOverride:w=>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(yA,{tier:L,orgSlot:i.tiers[L],userSlot:k,autoSlot:l.chat[L],onClose:w,onPick:S=>f.mutate({tier:L,slot:S}),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]=h,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=B3(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(wA,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function a2(t,e,s,n,i,o){if(!rf(e)){pe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!EV(l,e)){const c=Vy(e).parts.map(u=>o(u)).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 u=await d,h={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};uC(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),pe.error(`Failed to load file "${s.name}"`)}}function VA(t){const e=F.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=ie(),l=A.useRef(EA);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(h,f)=>{await a2(s,n,h,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]),A.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new Ur("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new Gh({key:h,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 _=p.posAtCoords({left:g.clientX,top:g.clientY});if(!_)return!1;const L=Array.from(v);return(async()=>{let y=_.pos;for(const k of L)await l.current?.(k,y),y=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(TA);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const _ of b){const L=_.getAsFile();L&&(await l.current?.(L,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(h)}},u=[s],e[6]=s,e[7]=d,e[8]=u):(d=e[7],u=e[8]),A.useEffect(d,u),null}function TA(t){return t.kind==="file"}function EA(){return Promise.resolve()}function AA(t){const e=F.c(43),{info:s,onClose:n}=t,i=ie(),o=s!==null;let l;e[0]!==n?(l=V=>!V&&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(Io,{size:18})}),e[4]=d):d=e[4];let u;e[5]!==i?(u=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Wt,{className:"text-xl font-semibold tracking-tight",children:u}),e[7]=u,e[8]=h):h=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(Fn,{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]!==h?(x=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(xs,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,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 _;e[22]!==v?(_=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=_):_=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(uy,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const y=s?.accepted;let k;e[25]!==y?(k=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,r.jsx("span",{className:"capitalize",children:y})]}),e[25]=y,e[26]=k):k=e[26];let w;e[27]!==_||e[28]!==k?(w=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:[_,k]})}),e[27]=_,e[28]=k,e[29]=w):w=e[29];let S;e[30]!==i?(S=i("chat.uploader.gotIt"),e[30]=i,e[31]=S):S=e[31];let j;e[32]!==n||e[33]!==S?(j=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(de,{onClick:n,children:S})}),e[32]=n,e[33]=S,e[34]=j):j=e[34];let C;e[35]!==x||e[36]!==w||e[37]!==j?(C=r.jsxs(It,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:PA,children:[x,w,j]}),e[35]=x,e[36]=w,e[37]=j,e[38]=C):C=e[38];let N;return e[39]!==o||e[40]!==l||e[41]!==C?(N=r.jsx(Mt,{open:o,onOpenChange:l,children:C}),e[39]=o,e[40]=l,e[41]=C,e[42]=N):N=e[42],N}function PA(t){return t.preventDefault()}function DA(){const t=F.c(3),[e,s]=A.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 E6=hC;var RA=["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] *)"],C1=RA.join(","),A6=typeof Element>"u",Gd=A6?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Q0=!A6&&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},X0=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]"):X0(e.parentNode));return l},IA=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},MA=function(e,s,n){if(X0(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(C1));return s&&Gd.call(e,C1)&&i.unshift(e),i=i.filter(n),i},N1=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!X0(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=N1(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=Gd.call(l,C1);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!X0(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=N1(h===!0?l.children:h.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},P6=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},D6=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||IA(e))&&!P6(e)?0:e.tabIndex},$A=function(e,s){var n=D6(e);return n<0&&s&&!P6(e)?0:n},OA=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},R6=function(e){return e.tagName==="INPUT"},BA=function(e){return R6(e)&&e.type==="hidden"},zA=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},FA=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},UA=function(e){if(!e.name)return!0;var s=e.form||Q0(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=FA(i,e.form);return!o||o===e},HA=function(e){return R6(e)&&e.type==="radio"},KA=function(e){return HA(e)&&!UA(e)},WA=function(e){var s,n=e&&Q0(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,u,h;n=Q0(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return o},z3=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},qA=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=Gd.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Gd.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,u=Q0(e);if(d&&!d.shadowRoot&&i(d)===!0)return z3(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(WA(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return z3(e);return!1},GA=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 Gd.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},YA=function(e,s){return!(s.disabled||BA(s)||qA(s,e)||zA(s)||GA(s))},F3=function(e,s){return!(KA(s)||D6(s)<0||!YA(e,s))},JA=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},I6=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=$A(a,l),d=l?I6(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(OA).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},M6=function(e,s){s=s||{};var n;return s.getShadowRoot?n=N1([e],s.includeContainer,{filter:F3.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:JA}):n=MA(e,s.includeContainer,F3.bind(null,s)),I6(n)};function QA(){return/apple/i.test(navigator.vendor)}const U3="data-floating-ui-focusable";function XA(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 V1(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&pj(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function Uc(t){return"composedPath"in t?t.composedPath()[0]:t.target}function g9(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 ZA(t){return t.matches("html,body")}function Yd(t){return t?.ownerDocument||document}function eP(t){return t?t.hasAttribute(U3)?t:t.querySelector("["+U3+"]")||t:null}function A0(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,...A0(t,i.id,s)])}function tP(t){return"nativeEvent"in t}var sP=typeof document<"u",nP=function(){},ol=sP?A.useLayoutEffect:nP;const iP={...uv},rP=iP.useInsertionEffect,oP=rP||(t=>t());function Ta(t){const e=A.useRef(()=>{});return oP(()=>{e.current=t}),A.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 $6=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function O6(t,e){const s=M6(t,$6()),n=s.length;if(n===0)return;const i=XA(Yd(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function lP(t){return O6(Yd(t).body,1)||t}function aP(t){return O6(Yd(t).body,-1)||t}function x9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!V1(s,n)}function cP(t){M6(t,$6()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function H3(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 dP="data-floating-ui-focusable",K3="active",W3="selected",uP={...uv};let q3=!1,hP=0;const G3=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hP++;function fP(){const[t,e]=A.useState(()=>q3?G3():void 0);return ol(()=>{t==null&&e(G3())},[]),A.useEffect(()=>{q3=!0},[]),t}const mP=uP.useId,c2=mP||fP;function pP(){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 gP=A.createContext(null),xP=A.createContext(null),B6=()=>{var t;return((t=A.useContext(gP))==null?void 0:t.id)||null},z6=()=>A.useContext(xP);function d2(t){return"data-floating-ui-"+t}const bP={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},Y3=A.forwardRef(function(e,s){const[n,i]=A.useState();ol(()=>{QA()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[d2("focus-guard")]:"",style:bP};return r.jsx("span",{...e,...o})}),vP={clipPath:"inset(50%)",position:"fixed",top:0,left:0},F6=A.createContext(null),J3=d2("portal");function yP(t){t===void 0&&(t={});const{id:e,root:s}=t,n=c2(),i=LP(),[o,l]=A.useState(null),a=A.useRef(null);return ol(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),ol(()=>{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(J3,""),c.appendChild(d),a.current=d,l(d)},[e,n]),ol(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!_j(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const u=document.createElement("div");u.id=n,u.setAttribute(J3,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),o}function _P(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=yP({id:s,root:n}),[l,a]=A.useState(null),c=A.useRef(null),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return A.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&x9(x)&&(x.type==="focusin"?H3:cP)(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]),A.useEffect(()=>{o&&(m||H3(o))},[m,o]),r.jsxs(F6.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(Y3,{"data-type":"outside",ref:c,onFocus:g=>{if(x9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=aP(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:vP}),o&&Bn.createPortal(e,o),p&&o&&r.jsx(Y3,{"data-type":"outside",ref:d,onFocus:g=>{if(x9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=lP(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const LP=()=>A.useContext(F6),SP={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},wP={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Q3=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 kP(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:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=z6(),x=Ta(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=A.useRef(!1),{escapeKey:_,outsidePress:L}=Q3(m),{escapeKey:y,outsidePress:k}=Q3(p),w=A.useRef(!1),S=Ta(E=>{var P;if(!s||!l||!a||E.key!=="Escape"||w.current)return;const D=(P=o.current.floatingContext)==null?void 0:P.nodeId,I=g?A0(g.nodesRef.current,D):[];if(!_&&(E.stopPropagation(),I.length>0)){let R=!0;if(I.forEach($=>{var B;if((B=$.context)!=null&&B.open&&!$.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}n(!1,tP(E)?E.nativeEvent:E,"escape-key")}),j=Ta(E=>{var P;const D=()=>{var I;S(E),(I=Uc(E))==null||I.removeEventListener("keydown",D)};(P=Uc(E))==null||P.addEventListener("keydown",D)}),C=Ta(E=>{var P;const D=o.current.insideReactTree;o.current.insideReactTree=!1;const I=v.current;if(v.current=!1,d==="click"&&I||D||typeof b=="function"&&!b(E))return;const R=Uc(E),$="["+d2("inert")+"]",B=Yd(i.floating).querySelectorAll($);let M=er(R)?R:null;for(;M&&!u9(M);){const H=bj(M);if(u9(H)||!er(H))break;M=H}if(B.length&&er(R)&&!ZA(R)&&!V1(R,i.floating)&&Array.from(B).every(H=>!V1(M,H)))return;if(vj(R)&&T){const H=u9(R),K=yj(R),W=/auto|scroll/,Y=H||W.test(K.overflowX),X=H||W.test(K.overflowY),ne=Y&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,se=X&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,oe=K.direction==="rtl",Z=se&&(oe?E.offsetX<=R.offsetWidth-R.clientWidth:E.offsetX>R.clientWidth),J=ne&&E.offsetY>R.clientHeight;if(Z||J)return}const O=(P=o.current.floatingContext)==null?void 0:P.nodeId,z=g&&A0(g.nodesRef.current,O).some(H=>{var K;return g9(E,(K=H.context)==null?void 0:K.elements.floating)});if(g9(E,i.floating)||g9(E,i.domReference)||z)return;const U=g?A0(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,E,"outside-press")}),N=Ta(E=>{var P;const D=()=>{var I;C(E),(I=Uc(E))==null||I.removeEventListener(d,D)};(P=Uc(E))==null||P.addEventListener(d,D)});A.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=_,o.current.__outsidePressBubbles=L;let E=-1;function P(B){n(!1,B,"ancestor-scroll")}function D(){window.clearTimeout(E),w.current=!0}function I(){E=window.setTimeout(()=>{w.current=!1},xj()?5:0)}const R=Yd(i.floating);a&&(R.addEventListener("keydown",y?j:S,y),R.addEventListener("compositionstart",D),R.addEventListener("compositionend",I)),b&&R.addEventListener(d,k?N:C,k);let $=[];return f&&(er(i.domReference)&&($=d9(i.domReference)),er(i.floating)&&($=$.concat(d9(i.floating))),!er(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(d9(i.reference.contextElement)))),$=$.filter(B=>{var M;return B!==((M=R.defaultView)==null?void 0:M.visualViewport)}),$.forEach(B=>{B.addEventListener("scroll",P,{passive:!0})}),()=>{a&&(R.removeEventListener("keydown",y?j:S,y),R.removeEventListener("compositionstart",D),R.removeEventListener("compositionend",I)),b&&R.removeEventListener(d,k?N:C,k),$.forEach(B=>{B.removeEventListener("scroll",P)}),window.clearTimeout(E)}},[o,i,a,b,d,s,n,f,l,_,L,S,y,j,C,k,N]),A.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const V=A.useMemo(()=>({onKeyDown:S,...u&&{[SP[h]]:E=>{n(!1,E.nativeEvent,"reference-press")},...h!=="click"&&{onClick(E){n(!1,E.nativeEvent,"reference-press")}}}}),[S,n,u,h]),T=A.useMemo(()=>{function E(P){P.button===0&&(v.current=!0)}return{onKeyDown:S,onMouseDown:E,onMouseUp:E,[wP[d]]:()=>{o.current.insideReactTree=!0}}},[S,d,o]);return A.useMemo(()=>l?{reference:V,floating:T}:{},[l,V,T])}function jP(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=c2(),o=A.useRef({}),[l]=A.useState(()=>pP()),a=B6()!=null,[c,d]=A.useState(n.reference),u=Ta((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)}),h=A.useMemo(()=>({setPositionReference:d}),[]),f=A.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return A.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function CP(t){t===void 0&&(t={});const{nodeId:e}=t,s=jP({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=A.useState(null),[a,c]=A.useState(null),u=i?.domReference||o,h=A.useRef(null),f=z6();ol(()=>{u&&(h.current=u)},[u]);const m=gj({...t,elements:{...i,...a&&{reference:a}}}),p=A.useCallback(_=>{const L=er(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(L),m.refs.setReference(L)},[m.refs]),g=A.useCallback(_=>{(er(_)||_===null)&&(h.current=_,l(_)),(er(m.refs.reference.current)||m.refs.reference.current===null||_!==null&&!er(_))&&m.refs.setReference(_)},[m.refs]),x=A.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=A.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=A.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return ol(()=>{n.dataRef.current.floatingContext=v;const _=f?.nodesRef.current.find(L=>L.id===e);_&&(_.context=v)}),A.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function b9(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[K3]:l,[W3]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[dP]:""},...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,u]=c;if(!(i&&[K3,W3].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof u=="function"){var h;(h=n.get(d))==null||h.push(u),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]=u}),l),{})}}function NP(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=A.useCallback(a=>b9(a,t,"reference"),e),o=A.useCallback(a=>b9(a,t,"floating"),s),l=A.useCallback(a=>b9(a,t,"item"),n);return A.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const VP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function TP(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=c2(),u=((s=o.domReference)==null?void 0:s.id)||d,h=A.useMemo(()=>{var v;return((v=eP(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=VP.get(c))!=null?n:c,p=B6()!=null,g=A.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?h:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?h:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,h,p,i,u,c]),x=A.useMemo(()=>{const v={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=A.useCallback(v=>{let{active:_,selected:L}=v;const y={role:"option",..._&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...y,"aria-selected":L}}return{}},[h,c]);return A.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function EP(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=pC(s),u=new RegExp(`\\s${d}$`),h=l?"^":"",f=i?"":d,m=c?new RegExp(`${h}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${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 _=g+x.index;let L=_+x[0].length;return c&&u.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),_<a.pos&&L>=a.pos?{range:{from:_,to:L},query:x[0].slice(s.length),text:x[0]}:null}var AP=new Ur("suggestion");function PP({pluginKey:t=AP,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=EP,shouldShow:x}){let b;const v=m?.(),_=()=>{const w=e.state.selection.$anchor.pos,S=e.view.coordsAtPos(w),{top:j,right:C,bottom:N,left:V}=S;try{return new DOMRect(V,j,C-V,N-j)}catch{return null}},L=(w,S)=>S?()=>{const j=t.getState(e.state),C=j?.decorationId,N=w.dom.querySelector(`[data-decoration-id="${C}"]`);return N?.getBoundingClientRect()||null}:_;function y(w,S){var j;try{const N=t.getState(w.state),V=N?.decorationId?w.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,T={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:E=>h({editor:e,range:N?.range||{from:0,to:0},props:E}),decorationNode:V,clientRect:L(w,V)};(j=v?.onExit)==null||j.call(v,T)}catch{}const C=w.state.tr.setMeta(S,{exit:!0});w.dispatch(C)}const k=new Gh({key:t,view(){return{update:async(w,S)=>{var j,C,N,V,T,E,P;const D=(j=this.key)==null?void 0:j.getState(S),I=(C=this.key)==null?void 0:C.getState(w.state),R=D.active&&I.active&&D.range.from!==I.range.from,$=!D.active&&I.active,B=D.active&&!I.active,M=!$&&!B&&D.query!==I.query,O=$||R&&M,z=M||R,U=B||R&&M;if(!O&&!z&&!U)return;const H=U&&!O?D:I,K=w.dom.querySelector(`[data-decoration-id="${H.decorationId}"]`);b={editor:e,range:H.range,query:H.query,text:H.text,items:[],command:W=>h({editor:e,range:H.range,props:W}),decorationNode:K,clientRect:L(w,K)},O&&((N=v?.onBeforeStart)==null||N.call(v,b)),z&&((V=v?.onBeforeUpdate)==null||V.call(v,b)),(z||O)&&(b.items=await f({editor:e,query:H.query})),U&&((T=v?.onExit)==null||T.call(v,b)),z&&((E=v?.onUpdate)==null||E.call(v,b)),O&&((P=v?.onStart)==null||P.call(v,b))},destroy:()=>{var w;b&&((w=v?.onExit)==null||w.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(w,S,j,C){const{isEditable:N}=e,{composing:V}=e.view,{selection:T}=w,{empty:E,from:P}=T,D={...S},I=w.getMeta(t);if(I&&I.exit)return D.active=!1,D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null,D;if(D.composing=V,N&&(E||e.view.composing)){(P<S.range.from||P>S.range.to)&&!V&&!S.composing&&(D.active=!1);const R=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:T.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;R&&p({editor:e,state:C,range:R.range,isActive:S.active})&&(!x||x({editor:e,range:R.range,query:R.query,text:R.text,transaction:w}))?(D.active=!0,D.decorationId=S.decorationId?S.decorationId:$,D.range=R.range,D.query=R.query,D.text=R.text):D.active=!1}else D.active=!1;return D.active||(D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null),D}},props:{handleKeyDown(w,S){var j,C,N,V;const{active:T,range:E}=k.getState(w.state);if(!T)return!1;if(S.key==="Escape"||S.key==="Esc"){const D=k.getState(w.state),I=(j=b?.decorationNode)!=null?j:null,R=I??(D?.decorationId?w.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`):null);if(((C=v?.onKeyDown)==null?void 0:C.call(v,{view:w,event:S,range:D.range}))||!1)return!0;const B={editor:e,range:D.range,query:D.query,text:D.text,items:[],command:M=>h({editor:e,range:D.range,props:M}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(N=v?.onExit)==null||N.call(v,B),y(w,t),!0}return((V=v?.onKeyDown)==null?void 0:V.call(v,{view:w,event:S,range:E}))||!1},decorations(w){const{active:S,range:j,decorationId:C,query:N}=k.getState(w);if(!S)return null;const V=!N?.length,T=[c];return V&&T.push(u),fC.create(w.doc,[mC.inline(j.from,j.to,{nodeName:a,class:T.join(" "),"data-decoration-id":C,"data-decoration-content":d})])}}});return k}function DP(t){const e=F.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=A.useState(0),d=A.useRef(i),u=A.useRef(a),h=A.useRef(o),f=A.useRef(l),m=A.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],A.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]),A.useEffect(x,b);let v,_;e[7]!==i?(v=()=>{d.current=i},_=[i],e[7]=i,e[8]=v,e[9]=_):(v=e[8],_=e[9]),A.useEffect(v,_);let L,y;e[10]!==a?(L=()=>{u.current=a},y=[a],e[10]=a,e[11]=L,e[12]=y):(L=e[11],y=e[12]),A.useEffect(L,y);let k,w;e[13]!==o?(w=()=>{h.current=o},k=[o],e[13]=o,e[14]=k,e[15]=w):(k=e[14],w=e[15]),A.useEffect(w,k);let S,j;e[16]!==l?(S=()=>{f.current=l},j=[l],e[16]=l,e[17]=S,e[18]=j):(S=e[17],j=e[18]),A.useEffect(S,j);let C,N;e[19]!==s?(C=()=>{if(s?.isDestroyed)return;let E;try{E=s.view.dom}catch{return}if(!E)return;const P=I=>{const R=d.current;if(!R.length)return!1;const $=()=>c(M=>(M+1)%R.length),B=()=>c(M=>(M-1+R.length)%R.length);switch(I.key){case"ArrowUp":return I.preventDefault(),B(),!0;case"ArrowDown":return I.preventDefault(),$(),!0;case"Tab":return I.preventDefault(),I.shiftKey?B():$(),!0;case"Home":return I.preventDefault(),c(0),!0;case"End":return I.preventDefault(),c(R.length-1),!0;case"Enter":{if(I.isComposing)return!1;I.preventDefault();const M=u.current;return M!==-1&&R[M]&&h.current?.(R[M],M),!0}case"Escape":return I.preventDefault(),f.current?.(),!0;default:return!1}},D=I=>{P(I)};return E.addEventListener("keydown",D,!0),()=>{E?.removeEventListener("keydown",D,!0)}},N=[s],e[19]=s,e[20]=C,e[21]=N):(C=e[20],N=e[21]),A.useEffect(C,N);const V=i.length?a:void 0;let T;return e[22]!==V?(T={selectedIndex:V,setSelectedIndex:c},e[22]=V,e[23]=T):T=e[23],T}function RP(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 U6=A.createContext(void 0);function H6(){const t=A.useContext(U6);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function IP(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]=A.useReducer(RP,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=A.useEffectEvent(u);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof Ur?i:new Ur(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=PP({pluginKey:g,editor:s,char:n,allow(v){const _=s.state.doc.resolve(v.range.from);for(let L=_.depth;L>0;L--)if(_.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}}),h(!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"}),h(!1)}}),items:MP});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=h,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],A.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 MP(){return[]}function $P({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=H6(),l=A.useDeferredValue(i.query),{data:a}=Fh({queryKey:et.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){o({type:"SET_SELECTED_ITEM",payload:h});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:h})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=DP({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function OP({children:t}){const{state:e,dispatch:s}=H6(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=CP({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[Lj(10),Sj(),wj()],whileElementsMounted:kj}),d=kP(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=TP(c,{role:"listbox"}),{getFloatingProps:h}=NP([d,u]);return n?r.jsx(_P,{children:r.jsx("div",{ref:l.setFloating,style:a,...h(),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 BP=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=ar(s._meta);a=s.title||up(s.name,k),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,u=s.icon,h=n&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=re("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",h,f),e[2]=h,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==u||e[6]!==c?(p=u!==void 0&&r.jsx(Vo,{icon:u,name:c,size:"xs",className:"mr-2"}),e[5]=u,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(Ud,{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 _;e[17]!==b||e[18]!==v?(_=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]=_):_=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 y;return e[22]!==i||e[23]!==l||e[24]!==_||e[25]!==L||e[26]!==m||e[27]!==p?(y=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,_,L]}),e[22]=i,e[23]=l,e[24]=_,e[25]=L,e[26]=m,e[27]=p,e[28]=y):y=e[28],y},zP=t=>{const e=F.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=ie();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:u,selectedItem:h}=$P(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]!==u||e[11]!==c||e[12]!==d||e[13]!==h?.name){let g;e[15]!==u||e[16]!==d||e[17]!==h?.name?(g=(x,b)=>r.jsx(BP,{item:x,isSelected:b===d,ref:b===d?HP:void 0,onSelect:()=>u(x,b),isLoading:h?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=u,e[16]=d,e[17]=h?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=u,e[11]=c,e[12]=d,e[13]=h?.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 FP(){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(UP)}),t[0]=e):e=t[0],e}function UP(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 K6(t){const e=F.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let u;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(u={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]=u):u=e[5];const{state:h,dispatch:f}=IP(u);let m;e[6]!==f||e[7]!==h?(m={state:h,dispatch:f},e[6]=f,e[7]=h,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(FP,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(OP,{children:r.jsx(A.Suspense,{fallback:p,children:r.jsx(zP,{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(U6.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function HP(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const KP=t=>{const e=F.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=ie(),l=bs(),{org:a}=qe(),c=uu();let d;e[0]!==c?(d=Up(c),e[0]=c,e[1]=d):d=e[1];const u=d;let h;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(h={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=h):h=e[5];const f=Jt(h);let m;e[6]!==a.id||e[7]!==n?(m=et.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=A.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=A.useEffectEvent(b),_=A.useRef(null),L=A.useRef(!1),y=n??"default";let k;e[11]!==g||e[12]!==a.id||e[13]!==y?(k=["at-mention",a.id,y,g],e[11]=g,e[12]=a.id,e[13]=y,e[14]=k):k=e[14];const w=k;let S;e[15]!==o?(S=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=S):S=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let C;e[19]!==S||e[20]!==j?(C={name:"agents",title:S,description:j,kind:"category",drillable:!0},e[19]=S,e[20]=j,e[21]=C):C=e[21];let N;e[22]!==o?(N=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=N):N=e[23];let V;e[24]!==o?(V=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=V):V=e[25];let T;e[26]!==N||e[27]!==V?(T={name:"resources",title:N,description:V,kind:"category",drillable:!0},e[26]=N,e[27]=V,e[28]=T):T=e[28];let E;e[29]!==T||e[30]!==C?(E=[C,T],e[29]=T,e[30]=C,e[31]=E):E=e[31];const P=E;let D;e[32]!==f||e[33]!==s||e[34]!==o?(D=async z=>{const{item:U,range:H}=z;if(Je("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){Ja(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 hv(f,U.uri);Ja(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]=D):D=e[35];const I=D;let R;e[36]!==c||e[37]!==P||e[38]!==f||e[39]!==u||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(R=async z=>{const{query:U}=z,H=v();if(H==="categories"){if(!U.trim())return P;const Y=U.toLowerCase(),X=c.filter(se=>se.status==="active"&&(!se.id||!W0(se.id))&&!u.has(se.id)&&se.id!==n&&(se.title.toLowerCase().includes(Y)||se.description?.toLowerCase().includes(Y))).map(WP),ne=await(async()=>{if(!f)return[];let se=l.getQueryData(p);return se||(se=await l.fetchQuery({queryKey:p,queryFn:()=>_d(f),staleTime:6e4})),(se?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(Y)||oe.name?.toLowerCase().includes(Y)||oe.description?.toLowerCase().includes(Y)).map(qP)})();return[...X,...ne]}if(H==="agents"){let Y=c.filter(X=>X.status==="active"&&(!X.id||!W0(X.id))&&!u.has(X.id)&&X.id!==n);if(U.trim()){const X=U.toLowerCase();Y=Y.filter(ne=>ne.title.toLowerCase().includes(X)||ne.description?.toLowerCase().includes(X))}return Y.map(GP)}if(!f)return[];let K=l.getQueryData(p);K?l.fetchQuery({queryKey:p,queryFn:()=>_d(f),staleTime:6e4}).catch(YP):K=await l.fetchQuery({queryKey:p,queryFn:()=>_d(f),staleTime:6e4});let W=K?.resources??[];if(U.trim()){const Y=U.toLowerCase();W=W.filter(X=>X.uri.toLowerCase().includes(Y)||X.name?.toLowerCase().includes(Y)||X.description?.toLowerCase().includes(Y))}return W.map(JP)},e[36]=c,e[37]=P,e[38]=f,e[39]=u,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=R):R=e[44];const $=R;let B;e[45]!==i?(B=z=>{if(i&&(i.current=z),z)_.current=Date.now(),L.current=!1,Je("chat_picker_opened",{picker:"@"});else{const U=_.current;Je("chat_picker_closed",{picker:"@",outcome:L.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),_.current=null,x("categories")}},e[45]=i,e[46]=B):B=e[46];const M=B;let O;return e[47]!==s||e[48]!==$||e[49]!==I||e[50]!==M||e[51]!==w?(O=r.jsx(K6,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:w,queryFn:$,onSelect:I,onOpenChange:M}),e[47]=s,e[48]=$,e[49]=I,e[50]=M,e[51]=w,e[52]=O):O=e[52],O};function WP(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function qP(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function GP(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function YP(){}function JP(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function X3(t,e,s,n,i,o,l){try{const a=await cu(s,n,o);Ja(t,e,{id:n,name:bc(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 QP(t,e,s,n,i){try{const o=await hv(s,n);Ja(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 XP(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await BV(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};Ja(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 ZP=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=ie(),i=bs(),{org:o}=qe(),l=Jt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=et.virtualMcpPrompts(e,o.id),c=et.virtualMcpResources(e,o.id),d=et.slashSkills(o.id),u=["slash-mention",o.id,e??"default"],[h,f]=A.useState(null),[m,p]=A.useState(null),g=gC(t);g&&(g.onEditChip=async w=>{if(l)try{const j=(await Z3(i,a,l)).find(C=>C.name===w.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...w,prompt:j})}catch(S){console.error("[slash] Failed to load prompt for editing:",S),pe.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=A.useRef(null),b=A.useRef(!1),v=async({item:w,range:S})=>{if(Je("chat_picker_item_selected",{picker:"/",item_kind:w.kind,item_name:w.name}),b.current=!0,!!l)if(w.kind==="prompt"){if(w.arguments&&w.arguments.length>0){f({range:S,item:w});return}const j=ar(w._meta);await X3(t,S,l,w.name,j,void 0,{t:n})}else w.kind==="skill"?w.skill&&await XP(t,S,o.slug,w.skill,{t:n}):w.uri&&await QP(t,S,l,w.uri,{t:n})},_=async w=>{if(!h||!l)return;const{range:S,item:j}=h,C=ar(j._meta);await X3(t,S,l,j.name,C,w,{t:n}),f(null)},L=async w=>{if(!(!m||!l)){if(!xC(t,m.pos,m.promptId)){pe.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const S=await cu(l,m.promptId,w),j=ar(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,qh({id:m.promptId,name:bc(m.promptId,j),metadata:S.messages,char:"/",kind:"prompt",args:w})).run(),Je("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(S){console.error("[slash] Failed to update prompt:",S),pe.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},y=async w=>{const{query:S}=w;if(!l)return[];const[j,C,N]=await Promise.all([Z3(i,a,l),tD(i,c,l),eD(i,d,o.slug)]),V=S.trim().toLowerCase(),T=(j??[]).filter(D=>!V||D.name.toLowerCase().includes(V)||D.title?.toLowerCase().includes(V)||D.description?.toLowerCase().includes(V)).map(D=>({name:D.name,title:D.title,description:D.description,kind:"prompt",arguments:D.arguments,_meta:D._meta})),E=(C??[]).filter(D=>!V||D.uri.toLowerCase().includes(V)||D.name?.toLowerCase().includes(V)||D.description?.toLowerCase().includes(V)).map(D=>({name:D.name??D.uri,title:D.name,description:D.description,kind:"resource",uri:D.uri})),P=(N??[]).filter(D=>!V||D.name.toLowerCase().includes(V)||D.id.toLowerCase().includes(V)||D.description?.toLowerCase().includes(V)).map(D=>({name:D.name,title:D.name,description:D.description??void 0,kind:"skill",skill:D}));return[...T,...E,...P]},k=h?.item.kind==="prompt"?{name:h.item.name,title:h.item.title,arguments:h.item.arguments,description:h.item.description,_meta:h.item._meta}:null;return r.jsxs(r.Fragment,{children:[r.jsx(K6,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:y,onSelect:v,onOpenChange:w=>{if(s&&(s.current=w),w)x.current=Date.now(),b.current=!1,Je("chat_picker_opened",{picker:"/"});else{const S=x.current;Je("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:S?Date.now()-S:null}),x.current=null}}}),r.jsx(Fd,{prompt:k,setPrompt:()=>f(null),onSubmit:_}),r.jsx(Fd,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:L,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function Z3(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>v1(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>v1(s),staleTime:6e4}),n?.prompts??[]}async function eD(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>zV(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function tD(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>_d(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>_d(s),staleTime:6e4}),n?.resources??[]}const W6="Ask anything, / for prompts & skills, @ for agents & resources...";function sD(t){return[fp.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),E6.configure({placeholder:()=>t.current??W6,showOnlyWhenEditable:!1}),vC,yC]}function q6({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=A.useRef(o),d=A.useRef(e),u=A.useRef(n),h=A.useRef(i),f=hp({extensions:sD(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":i??W6,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&&u.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return A.useEffect(()=>{f?.setEditable(!s)},[f,s]),A.useEffect(()=>{c.current=o},[o]),A.useEffect(()=>{d.current=e},[e]),A.useEffect(()=>{u.current=n},[n]),A.useEffect(()=>{h.current=i},[i]),A.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(bC.Provider,{value:{editor:f},children:a})}function G6(t){const e=F.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=au();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const C=f.state.doc.textContent.trim()==="";f.commands.focus("end"),C||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,C)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),C)){f.commands.focus("end");const N=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:N?" "+C:C})}},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]),A.useImperativeHandle(c??null,m,p),!f)return null;const g=u&&"cursor-not-allowed opacity-70",x=u&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=re("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(mp,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const _=n??null;let L;e[10]!==f||e[11]!==a||e[12]!==_?(L=r.jsx(A.Suspense,{fallback:null,children:r.jsx(ZP,{editor:f,virtualMcpId:_,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=_,e[13]=L):L=e[13];const y=n??null;let k;e[14]!==f||e[15]!==a||e[16]!==y?(k=r.jsx(A.Suspense,{fallback:null,children:r.jsx(KP,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=y,e[17]=k):k=e[17];let w;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==h?(w=h&&o&&!u?r.jsx(VA,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=o,e[22]=h,e[23]=w):w=e[23];let S;return e[24]!==L||e[25]!==k||e[26]!==w||e[27]!==v?(S=r.jsxs(r.Fragment,{children:[v,L,k,w]}),e[24]=L,e[25]=k,e[26]=w,e[27]=v,e[28]=S):S=e[28],S}function Y6(t){const e=F.c(3),[s]=Oi();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&tT(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 nD={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"},iD=uN.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),rD=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function oD(){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:rD.map(lD)}),t[0]=e):e=t[0],e}function lD(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 aD({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=ie(),[a,c]=A.useState(!1),d=Y6(nD),{org:u}=qe(),{editor:h}=au(),f=A.useRef(null),m=rf(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async W=>{const Y=W.target.files;if(!Y||Y.length===0||!h)return;const X=Array.from(Y);try{let ne=h.state.selection.from;for(const se of X)await a2(h,n??null,se,ne,o,l),ne=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=Jt({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=et.virtualMcpPrompts(s,u.id),{data:v,isLoading:_}=Et({queryKey:b,queryFn:()=>v1(x),staleTime:6e4,enabled:a&&!!x}),L=v?.prompts??[],[y,k]=A.useState(null),{chatMode:w,setChatMode:S}=Mo(),[j,C]=Oi(),N=el.find(W=>W.value===j.toolApprovalLevel)??el[0],V=l(N.shortKey),T=W=>{const Y=el.find(X=>X.value===W);if(Y){if(Y.value===j.toolApprovalLevel){c(!1);return}d(),Je("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:Y.value,source:"tools_popover"}),C({...j,toolApprovalLevel:Y.value}),c(!1)}},E=w==="plan",P=()=>{d();const W=E?"default":"plan";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},D=()=>{e(),c(!1)},I=async(W,Y)=>{if(!h||!x)return;const X=ar(W._meta),ne={from:h.state.selection.from,to:h.state.selection.to};try{const se=await cu(x,W.name,Y);Ja(h,ne,{id:W.name,name:bc(W.name,X),metadata:se.messages,char:"/",kind:"prompt",args:Y})}catch{pe.error(l("chat.toolsPopover.failedLoadPrompt"))}},R=async W=>{c(!1);const Y=!!(W.arguments&&W.arguments.length>0);if(Je("chat_prompt_inserted",{prompt_name:W.name,with_arguments:Y}),Y){k(W);return}await I(W)},$=async W=>{y&&(await I(y,W),k(null))},B=()=>{d();const W=w==="gen-image"?"default":"gen-image";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},M=()=>{d();const W=w==="web-search"?"default":"web-search";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},O=()=>{d();const W=w==="deep-research"?"default":"deep-research";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},z=w==="gen-image",U=w==="web-search",H=w==="deep-research",K=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:AV(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[K,r.jsxs(Ft,{open:a,onOpenChange:W=>{W&&!a&&Je("chat_tools_popover_opened",{chat_mode:w}),c(W)},children:[r.jsx(Ut,{asChild:!0,children:r.jsxs(de,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:re("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(hy,{size:14}),r.jsx("span",{className:re("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(Ht,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(Qe,{onClick:p,disabled:i,children:[r.jsx($t,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsxs(Qe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[r.jsx($t,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(Ke,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(Qe,{onClick:P,className:re(E&&"text-special"),children:[r.jsx(Qa,{size:16,className:re(E&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:re("text-xs text-muted-foreground",E&&"text-special font-medium"),children:iD})]}),r.jsxs(Qe,{onClick:B,className:re(z&&"text-special"),children:[r.jsx(Ei,{size:16,className:re(z&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),z&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Qe,{onClick:M,className:re(U&&"text-special"),children:[r.jsx(Hr,{size:16,className:re(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(Qe,{onClick:O,className:re(H&&"text-special"),children:[r.jsx(fy,{size:16,className:re(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(nr,{children:[r.jsxs(ir,{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(rr,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:_?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(ft,{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(Qe,{onClick:()=>R(W),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||up(W.name,ar(W._meta))}),W.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),r.jsxs(nr,{children:[r.jsxs(ir,{className:"gap-2",children:[r.jsx(sf,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:V})]}),r.jsx(rr,{className:"w-48 p-1.5",children:r.jsx(hl,{value:j.toolApprovalLevel,onValueChange:T,children:el.map(W=>r.jsx(Nn,{value:W.value,children:l(W.labelKey)},W.value))})})]}),r.jsxs(Qe,{onClick:D,children:[r.jsx(yp,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(A.Suspense,{children:r.jsx(oD,{})})]})]})]}),r.jsx(Fd,{prompt:y,setPrompt:k,onSubmit:$})]})}const cD=[{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 dD(){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:cD.map(uD)}),t[0]=e):e=t[0],e}function uD(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 hD(t){const e=F.c(10),{onClick:s}=t,n=ie();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=re("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(dD,{}),c=r.jsx(dn,{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 ad=48;function fD(){const t=F.c(9),[e,s]=A.useState("idle"),[n,i]=A.useState(""),[o,l]=A.useState(""),[a,c]=A.useState(gD),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=A.useRef(null),m=A.useRef(0),p=A.useRef(!1),g=A.useRef(""),x=A.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),u.current?.close().catch(pD),f.current?.getTracks().forEach(mD),h.current=null,u.current=null,f.current=null},t[0]=v):v=t[0];const _=v;let L;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=V=>{f.current=V;const T=new AudioContext;u.current=T;const E=T.createMediaStreamSource(V),P=T.createAnalyser();P.fftSize=128,P.smoothingTimeConstant=.8,E.connect(P),h.current=P;const D=new Uint8Array(P.frequencyBinCount),I=()=>{if(!h.current)return;h.current.getByteFrequencyData(D);const R=[];for(let $=0;$<ad;$++){const B=Math.floor($/ad*D.length);R.push(Math.max(.04,(D[B]??0)/255))}c(R),m.current=requestAnimationFrame(I)};I()};L=async()=>{const V=window.SpeechRecognition||window.webkitSpeechRecognition;if(!V)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"),N(T);const E=new V;d.current=E,E.interimResults=!0,E.continuous=!0,E.lang=navigator.language||"en-US",E.onresult=P=>{let D="",I="";for(let R=P.resultIndex;R<P.results.length;R++){const $=P.results[R],B=$?.[0]?.transcript??"";$?.isFinal?I=I+B:D=D+B}I&&(g.current=g.current+I,i(g.current)),x.current=D,l(D)},E.onerror=P=>{d.current===E&&P.error!=="no-speech"&&(p.current=!1,d.current=null,_(),s(P.error==="not-allowed"?"permission-denied":"idle"))},E.onend=()=>{if(d.current===E&&p.current)try{E.start()}catch{}};try{E.start()}catch{return p.current=!1,d.current=null,_(),s("idle"),"idle"}return"recording"},t[1]=L}else L=t[1];const y=L;let k;t[2]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.stop(),_(),s("idle"),c(Array(ad).fill(.05)),l("");const N=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",N},t[2]=k):k=t[2];const w=k;let S;t[3]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{p.current=!1,d.current?.abort(),_(),s("idle"),i(""),l(""),c(Array(ad).fill(.05)),g.current="",x.current=""},t[3]=S):S=t[3];const j=S;let C;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(C={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:y,stopRecording:w,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=C):C=t[8],C}function mD(t){return t.stop()}function pD(){}function gD(){return Array(ad).fill(.05)}function xD(t){const e=F.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(bD),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 bD(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 vD(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function Wu(t){const e=F.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??r.jsx(lu,{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 yD(t,e,s){const n=F.c(7),{editor:i}=au(),o=ie(),[l,a]=A.useState(!1),c=A.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(d=()=>{const h=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=_D,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!rf(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 _ of b)await a2(i,t,_,v,e,o),v=i.state.selection.to})()};return window.addEventListener("dragenter",h),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",h),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},u=[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]=u):(d=n[5],u=n[6]),A.useEffect(d,u),l}function _D(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function LD(t){const e=F.c(14),{selectedModel:s}=t,n=ie();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=Vy(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(ti,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let u;e[6]!==n?(u=h=>n(h),e[6]=n,e[7]=u):u=e[7],o=n("chat.input.dropFilesHere",{fileTypes:d.map(u).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 SD(){const t=F.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(lu,{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 wD(t){const e=F.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=yD(s,n,i);let l;e[0]!==s?(l=rf(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 u;e[2]!==c||e[3]!==d?(u=re("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]=u):u=e[4];let h;e[5]!==s||e[6]!==a?(h=a?r.jsx(LD,{selectedModel:s}):r.jsx(SD,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function qu(t){const e=F.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=re("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=re("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 u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(_s,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let h;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(h=r.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,u]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=h):h=e[13],h}function kD(){const t=F.c(6),e=zt(),{org:s,locator:n}=qe(),{create:i}=du();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(),u=c?.id??Cl(s.id).id;sy(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:mN};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:h})},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 jD({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=ie(),n=dp(),i=Ls(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||_E,h=kD(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:_,setChatMode:L}=Mo(),{data:y}=xi.useSession(),k=y?.user?.id,{org:w,locator:S}=qe(),j=Cl(w.id).id,C=Ws(m?.id),N=En(C?.id).runtime==="cms",V=Y6(sT),[T,E]=A.useState(!1),{unsupportedFile:P,onUnsupportedFile:D,clearUnsupportedFile:I}=DA(),R=fD(),$=A.useRef(void 0),B=async()=>{$.current=se;const ye=await R.startRecording();Je("chat_voice_started",{thread_id:d,outcome:ye==="recording"?"started":ye==="unsupported"?"unsupported":ye==="permission-denied"?"permission_denied":"unknown"})},M=()=>{Je("chat_voice_confirmed",{thread_id:d});const ye=R.stopRecording();te.current?.syncVoiceText($.current,ye),te.current?.focus()},O=()=>{Je("chat_voice_cancelled",{thread_id:d}),R.cancelRecording(),te.current?.restoreContent($.current)};A.useEffect(()=>{if(R.status!=="recording")return;const ye=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();te.current?.syncVoiceText($.current,ye)},[R.transcript,R.interimTranscript,R.status]);const z=i?.activeTask??null,U=z?.created_by,H=!!(k&&U&&U!==k),{data:K}=Oy({enabled:H}),W=(K?.data?.members??[]).find(ye=>ye.userId===U),Y=W?.user?.name??W?.user?.email?.split("@")[0]??null,X=cf(),ne=Xv({isDesktopApp:X,harnessId:z?.harness_id,sandboxProviderKind:z?.sandbox_provider_kind}),[se,oe]=A.useState(()=>R3(sessionStorage,S,u)??void 0),Z=ye=>{oe(ye),g.current=ye,v6(sessionStorage,S,u,ye,{onQuotaExceeded:({docSizeBytes:Le})=>{Je("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Le}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},J=A.useRef(d);if(J.current!==d){J.current=d;const ye=R3(sessionStorage,S,u)??void 0;oe(ye),g.current=ye}const G=[...o].reverse().find(ye=>ye.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,te=A.useRef(null),le=A.useRef(!1),ee=_==="plan",ae=ye=>{V(),Je("chat_mode_changed",{from_mode:ye,to_mode:"default",source:"pill_dismiss"}),L("default")};A.useEffect(()=>{const ye=Le=>{ey(Le)&&Le.code==="KeyL"&&(Le.preventDefault(),Le.shiftKey&&L(_==="plan"?"default":"plan"),te.current?.focus())};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[_,L]);const ue=Rv(o),ce=[...o].reverse().find(ye=>ye.role==="assistant"&&ye.metadata?.usage)?.metadata?.usage?.contextTokens??0,ge=!p&&!b6(se),Q=vD({hasDraft:ge,isStreaming:l,isRunInProgress:a}),me=Q==="send",ve=Q==="stop",we=ye=>{if(ye?.preventDefault(),Q==="send"&&se){if(Je("chat_message_sent",{thread_id:d||null,mode:_,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:ye?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){pe.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(se)}else h({tiptapDoc:se,virtualMcp:m});SE(sessionStorage,S,u),Z(void 0)}else Q==="stop"&&(Je("chat_message_stopped",{thread_id:d}),c())};if(H)return r.jsx(Wu,{message:Y?s("chat.input.readOnlyOthersChatNamed",{name:Y}):s("chat.input.readOnlyOthersChat"),icon:Y?r.jsx(Hs,{shape:"circle",size:"2xs",url:W?.user?.image??void 0,fallback:Y.slice(0,2).toUpperCase()}):void 0});if(z?.metadata?.read_only)return r.jsx(Wu,{message:s("chat.input.readOnlyThread")});if(ne)return r.jsx(Wu,{message:s("chat.input.codingAgentRequiresDesktop")});if(N){if(!i)return r.jsx(Wu,{message:s("chat.input.fastPreviewUnavailable")});const ye=()=>{const Le=i.createTask({runtime:"sandbox"});Je("coding_session_started",{thread_id:Le})};return r.jsxs("button",{type:"button",onClick:ye,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(zo,{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(Bo,{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(gf,{}),n&&i&&d?r.jsx(xA,{taskId:d}):null,r.jsx(q6,{tiptapDoc:se,setTiptapDoc:Z,disabled:R.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:we,suggestionOpenRef:le,children:r.jsxs("form",{onSubmit:we,className:re("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(wD,{selectedModel:f,onUnsupportedFile:D,disabled:R.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(G6,{ref:te,disabled:R.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:D,suggestionOpenRef:le})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.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(xD,{data:R.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:O,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:M,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(Rt,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(aD,{disabled:!1,onOpenConnections:()=>{Je("connections_dialog_opened",{source:"tools_popover",mode:"add"}),E(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:D}),ee&&r.jsx(qu,{onClick:()=>ae("plan"),label:s("chat.input.planMode"),icon:r.jsx(Qa,{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"}),_==="gen-image"&&x&&r.jsx(qu,{onClick:()=>ae("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(Ei,{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]"}),_==="web-search"&&b&&r.jsx(qu,{onClick:()=>ae("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Hr,{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]"}),_==="deep-research"&&v&&r.jsx(qu,{onClick:()=>ae("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(fy,{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]"}),G&&ce>0&&r.jsx(_C,{usage:ue,totalTokens:ce,contextWindow:G,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(NA,{}),R.isSupported&&r.jsx(de,{type:"button",onClick:B,disabled:!1,variant:"ghost",size:"icon",className:re("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(TN,{size:18})}),r.jsx(de,{type:ve?"button":"submit",onClick:ye=>{ve&&(ye.preventDefault(),ye.stopPropagation(),c())},variant:me||ve?"default":"ghost",size:"icon",disabled:!me&&!ve,className:re("size-8 rounded-lg transition-all",!me&&!ve&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(Q==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(Q==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:ve?r.jsx(EN,{size:20}):r.jsx(Hh,{size:20})})]})]})})]})},d),e&&r.jsx(hD,{onClick:()=>{Je("connections_banner_clicked",{source:"home_chat_input"}),Je("connections_dialog_opened",{source:"home_banner",mode:"add"}),E(!0)}})]})}),r.jsx(Op,{mode:"browse",open:T,onOpenChange:E,defaultTab:"all"}),r.jsx(AA,{info:P,onClose:I})]})}function CD(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 ND(){const t=F.c(8),e=zt(),s=xp(),n=dp()?.messages??[],i=Ls()?.taskId??null;let o;t[0]!==n?(o=CD(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=A.useRef(null),c=A.useRef(null);let d,u;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const h=`${i}:${l}`;c.current!==h&&(c.current=h,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e({to:".",search:VD,replace:!0}))},u=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=u):(d=t[6],u=t[7]),A.useEffect(d,u)}function VD(t){return{...t,main:"preview"}}const TD={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 J6(t){return`deco-credits-empty-dismissed:${t}`}function ED(t){try{return localStorage.getItem(J6(t))==="1"}catch{return!1}}function AD(){const t=F.c(68),e=ie(),{org:s}=qe(),n=zt(),{decoKeyId:i}=$p(),o=$s(),[l,a]=A.useState(!0),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Je("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(J6(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&&Je("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]),A.useEffect(b,v);let _;t[6]!==f||t[7]!==o?(_=async X=>{const{url:ne}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:X,currency:f});return ne},t[6]=f,t[7]=o,t[8]=_):_=t[8];let L;t[9]!==x?(L=X=>{X&&window.open(X,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=L):L=t[10];let y;t[11]!==e?(y=X=>{pe.error(e("chat.creditsEmptyState.topUpFailed",{message:X.message}))},t[11]=e,t[12]=y):y=t[12];let k;t[13]!==_||t[14]!==L||t[15]!==y?(k={mutationFn:_,onSuccess:L,onError:y},t[13]=_,t[14]=L,t[15]=y,t[16]=k):k=t[16];const{mutate:w,isPending:S}=Rs(k),j=parseFloat(c),C=!isNaN(j)&&j>=1;if(!l)return null;let N;t[17]!==x?(N=X=>!X&&x(),t[17]=x,t[18]=N):N=t[18];let V;t[19]===Symbol.for("react.memo_cache_sentinel")?(V=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]=V):V=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(my,{size:20,className:"text-warning"})}),t[20]=T):T=t[20];let E;t[21]!==e?(E=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=E):E=t[22];let P;t[23]!==E?(P=r.jsx(Wt,{className:"text-lg font-semibold",children:E}),t[23]=E,t[24]=P):P=t[24];let D;t[25]!==e?(D=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=D):D=t[26];let I;t[27]!==D?(I=r.jsx(Fn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:D}),t[27]=D,t[28]=I):I=t[28];let R;t[29]!==P||t[30]!==I?(R=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[V,r.jsxs(xs,{className:"relative gap-3",children:[T,r.jsxs("div",{className:"text-center",children:[P,I]})]})]}),t[29]=P,t[30]=I,t[31]=R):R=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==C||t[38]!==S||t[39]!==u||t[40]!==e||t[41]!==w?($=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:X=>{X&&m(X)},children:[r.jsx(Hd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Hd,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:TD[f].map(X=>{const{dollars:ne,labelKey:se}=X;return r.jsxs("button",{type:"button",disabled:S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:ne*100,currency:f,tier_label:se,source:"empty_state"}),w(ne*100)},className:re("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,ne]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(se)})]},ne)})}),u?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(bt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:X=>d(X.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(de,{className:"h-10",disabled:!C||S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),w(Math.round(j*100))},children:e(S?"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:()=>h(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=C,t[38]=S,t[39]=u,t[40]=e,t[41]=w,t[42]=$):$=t[42];let B;t[43]!==x||t[44]!==n||t[45]!==s.slug?(B=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=B):B=t[46];let M;t[47]!==e?(M=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=M):M=t[48];let O;t[49]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(Bo,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=O):O=t[49];let z;t[50]!==B||t[51]!==M?(z=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:B,children:[M,O]}),t[50]=B,t[51]=M,t[52]=z):z=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(de,{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]!==z||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:[z,H]}),t[58]=z,t[59]=H,t[60]=K):K=t[60];let W;t[61]!==R||t[62]!==$||t[63]!==K?(W=r.jsxs(It,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:PD,children:[R,$,K]}),t[61]=R,t[62]=$,t[63]=K,t[64]=W):W=t[64];let Y;return t[65]!==W||t[66]!==N?(Y=r.jsx(Mt,{open:!0,onOpenChange:N,children:W}),t[65]=W,t[66]=N,t[67]=Y):Y=t[67],Y}function PD(t){return t.preventDefault()}function DD(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=re("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(my,{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 RD(){const t=F.c(8),{org:e}=qe(),s=zt();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=re("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(cn,{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 ID(t){const e=F.c(11),{className:s}=t;let n;e[0]!==s?(n=re("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(Gu,{align:"right",width:"w-3/4"}),r.jsx(Gu,{align:"left",width:"w-full",lines:3}),r.jsx(Gu,{align:"right",width:"w-2/3"}),r.jsx(Gu,{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 u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[8];let h;return e[9]!==n?(h=r.jsxs("div",{className:n,children:[l,a,u]}),e[9]=n,e[10]=h):h=e[10],h}function Gu(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=re("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 u;e[2]!==d?(u=re("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=h):h=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=re("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((_,L)=>r.jsx("div",{className:re("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]!==u?(b=r.jsxs("div",{className:u,children:[h,x]}),e[16]=x,e[17]=u,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 MD(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,u=s.current;if(!d||!u||!i)return;const h=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||o||!i)return;const p=u.scrollHeight,g=u.scrollTop;await l(),requestAnimationFrame(()=>{const x=u.scrollHeight;u.scrollTop=g+(x-p)})},{root:u,rootMargin:"200px 0px 0px 0px"});return h.observe(d),()=>h.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]),A.useEffect(a,c)}function $D(t){const e=F.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=re("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 OD(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=re("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 BD(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 zD(){const t=ie(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=bi(),{taskId:l}=sn();ND();const a=Tv(l??""),c=nC(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),u=LC(d),h=u.at(-1),m=yE()*oE+16,p=A.useRef(null),g=A.useRef(null);MD({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=SC({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(wC,{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")}),u.slice(0,-1).map((v,_)=>r.jsx(S3,{pair:v,isLastPair:!1,status:_===u.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),h&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(S3,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(de,{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(qj,{size:14})})]})})}function FD(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=re("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 ms=Object.assign($D,{Main:OD,Messages:zD,EmptyState:BD,Footer:FD,Input:jD,Provider:sC,ActiveTaskProvider:tC,Skeleton:ID,IceBreakers:rE,NoAiProviderEmptyState:PV,CreditsEmptyState:AD,CreditsEyebrow:DD,NoCreditsEyebrow:RD,CreditsExhaustedBanner:V6});function UD({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function HD(){const t=F.c(3),e=lf(),n=Ls()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=UD({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function Hc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function v9(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 KD(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function WD(t){const e=F.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(qD),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 qD(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 GD(t){const e=F.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=ie(),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 u;e[0]!==a?(u=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==c?(h=c>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=h):h=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]!==u||e[7]!==h||e[8]!==f?(m=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[u,h,f]}),e[6]=u,e[7]=h,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 _;e[20]!==v?(_=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]=_):_=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 y;e[26]!==_||e[27]!==L||e[28]!==x?(y=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,_,L]}),e[26]=_,e[27]=L,e[28]=x,e[29]=y):y=e[29];let k;return e[30]!==y||e[31]!==m?(k=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,y]}),e[30]=y,e[31]=m,e[32]=k):k=e[32],k}function YD(t){const e=F.c(14),{agentId:s,isError:n}=t,i=Ws(s),o=ie();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(Bi,{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 u=n?"text-destructive":"text-foreground";let h;e[6]!==u?(h=re("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=r.jsx("span",{className:h,children:a}),e[8]=a,e[9]=h,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 JD(t){const e=F.c(12),{isError:s}=t,n=ie();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(Bi,{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=re("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 u;return e[9]!==l||e[10]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function QD(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(JD,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(YD,{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(A.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==s.input?(u=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]=u):u=e[9];let h;e[10]!==l||e[11]!==o||e[12]!==i?(h=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(ft,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(VN,{size:12,className:"text-destructive"}):l?r.jsx(cn,{size:12,className:"text-warning"}):r.jsx(vi,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,u,h]}),e[14]=d,e[15]=u,e[16]=h,e[17]=f):f=e[17],f}function XD(t){const e=F.c(78),{onClose:s,back:n,className:i}=t,o=ie(),[l,a]=A.useState(null),{messages:c}=bi(),{activeTask:d}=sn(),{selectedModel:u,selectedVirtualMcp:h}=Mo();let f,m,p,g,x,b,v,_;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==u||e[7]!==h?.title||e[8]!==o){_=Symbol.for("react.early_return_sentinel");e:{const k=Rv(c),w=[...c].reverse().find(cR),S=w?.metadata?.usage,j=w?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,C=S?.contextTokens??0,N=j&&j>0?(C/j*100).toFixed(1):null,V=c;let T;e[17]!==V?(T=V.filter(aR).reduce(lR,0),e[17]=V,e[18]=T):T=e[18];const E=T,P=c;let D;e[19]!==P?(D=P.filter(oR).reduce(rR,0),e[19]=P,e[20]=D):D=e[20];const I=D,R=Math.max(0,k.totalTokens-E-I),$=c[0],B=c.at(-1),M=$?.metadata?.created_at??d?.created_at,O=B?.metadata?.created_at??d?.updated_at,z=c.filter(iR),U=c.flatMap(sR),H=u?.modelId?KD(u.modelId):"—",K=h?.title??"Super Agent",W=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:z.length},{label:o("chat.contextPanel.agentLabel"),value:K},{label:o("chat.contextPanel.modelLabel"),value:H},{label:o("chat.contextPanel.contextLimitLabel"),value:j?Hc(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:k.totalTokens>0?Hc(k.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:N!==null?`${N}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:k.inputTokens>0?Hc(k.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:k.outputTokens>0?Hc(k.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:k.reasoningTokens>0?Hc(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:v9(M)},{label:o("chat.contextPanel.lastActivityLabel"),value:v9(O)}];if(!d&&z.length===0){let q;e[21]!==i?(q=re("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=q):q=e[22];let G;e[23]!==o?(G=o("chat.contextPanel.title"),e[23]=o,e[24]=G):G=e[24];let te;e[25]!==G?(te=r.jsx("span",{className:"text-sm font-medium text-foreground",children:G}),e[25]=G,e[26]=te):te=e[26];let le;e[27]!==n?(le=n?r.jsx(y1,{size:14,className:"text-muted-foreground"}):r.jsx(Ai,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=le):le=e[28];let ee;e[29]!==s||e[30]!==le?(ee=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]=ee):ee=e[31];let ae;e[32]!==te||e[33]!==ee?(ae=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[te,ee]}),e[32]=te,e[33]=ee,e[34]=ae):ae=e[34];let ue;e[35]!==o?(ue=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=ue):ue=e[36];let he;e[37]!==ue?(he=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:ue})}),e[37]=ue,e[38]=he):he=e[38];let ce;e[39]!==q||e[40]!==ae||e[41]!==he?(ce=r.jsxs("div",{className:q,children:[ae,he]}),e[39]=q,e[40]=ae,e[41]=he,e[42]=ce):ce=e[42],_=ce;break e}e[43]!==i?(b=re("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 X;e[47]!==Y?(X=r.jsx("span",{className:"text-sm font-medium text-foreground",children:Y}),e[47]=Y,e[48]=X):X=e[48];let ne;e[49]!==n?(ne=n?r.jsx(y1,{size:14}):r.jsx(Ai,{size:14}),e[49]=n,e[50]=ne):ne=e[50];let se;e[51]!==s||e[52]!==ne?(se=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:ne}),e[51]=s,e[52]=ne,e[53]=se):se=e[53],e[54]!==X||e[55]!==se?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[X,se]}),e[54]=X,e[55]=se,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(tR)})]}),p=r.jsx(WD,{items:W});let oe;e[57]!==o?(oe=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=oe):oe=e[58];let Z;e[59]!==oe?(Z=r.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=Z):Z=e[60];let J;e[61]!==I||e[62]!==R||e[63]!==E?(J=r.jsx(GD,{userTokens:E,assistantTokens:I,otherTokens:R}),e[61]=I,e[62]=R,e[63]=E,e[64]=J):J=e[64],e[65]!==Z||e[66]!==J?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[Z,J]}),e[65]=Z,e[66]=J,e[67]=g):g=e[67],x=z.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:z.map(q=>{const G=q.metadata?.created_at,te=l?.id===q.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(te?null:q),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:re("shrink-0 font-medium",q.role==="user"?"text-chart-1":"text-chart-2"),children:q.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:q.id})]}),G&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:v9(G)})]}),te&&r.jsxs(r.Fragment,{children:[q.role==="assistant"&&(()=>{const le=q.metadata?._request;if(!le)return null;const ee=le.systemSections??[],ae=Math.max(1,...ee.map(eR)),ue=ee.reduce(ZD,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")]})]}),ee.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(ue/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),ee.map((he,ce)=>{const ge=he.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ce}`,Q=he.chars/ae*100,me=Math.round(he.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:`${Q}%`}})})]},ce)})]})]})})(),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(q,null,2)})]})]},q.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=u,e[7]=h?.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]=_}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],_=e[16];if(_!==Symbol.for("react.early_return_sentinel"))return _;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 y;return e[74]!==b||e[75]!==v||e[76]!==L?(y=r.jsxs("div",{className:b,children:[v,L]}),e[74]=b,e[75]=v,e[76]=L,e[77]=y):y=e[77],y}function ZD(t,e){return t+e.chars}function eR(t){return t.chars}function tR(t,e){return r.jsx(QD,{part:t},e)}function sR(t){return(t.parts??[]).filter(nR)}function nR(t){return t.type==="tool-subtask"}function iR(t){return t.role!=="system"}function rR(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function oR(t){return t.role==="assistant"}function lR(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function aR(t){return t.role==="user"}function cR(t){return t.role==="assistant"&&t.metadata?.usage}function dR(t){const e=F.c(21),{onOpenContextPanel:s}=t,{org:n}=qe(),{selectedVirtualMcp:i}=Mo();let o;e[0]!==n.id?(o=Cl(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Ws(a.id)??a,u=d.title??"Super Agent",h=d.icon??null,f=d.description??null;let m;e[2]!==h||e[3]!==u?(m=r.jsx(Vo,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:u}),e[5]=u,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(ms.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let _;e[16]!==s?(_=r.jsxs(ms.Footer,{children:[v,r.jsx(ms.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=_):_=e[17];let L;return e[18]!==b||e[19]!==_?(L=r.jsxs(r.Fragment,{children:[b,_]}),e[18]=b,e[19]=_,e[20]=L):L=e[20],L}function ex(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=re(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 u;e[3]!==d?(u=re("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=r.jsx(Qt,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(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,h]}),e[7]=i,e[8]=h,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(uR)}),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 uR(t){return r.jsx(jC,{file:t},t.key)}function hR(){const t=F.c(13),e=Ls()?.taskId??null,s=kC();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=Iv(e,n),[o,l]=A.useState(!1),[a,c]=A.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(mR),t[2]=d):d=t[2];let u;t[3]!==o||t[4]!==i?(u=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(ex,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(fR),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(ex,{variant:"bar",outputs:i,collapsed:a,onToggle:h})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==u||t[11]!==f?(m=r.jsxs(r.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function fR(t){return!t}function mR(t){return!t}function pR(){const t=F.c(31),{org:e}=qe(),s=Ls(),{isChatEmpty:n}=bi(),[i,o]=A.useState("chat"),l=$p(),a=HD(),{runtime:c}=En(s?.virtualMcpId);if(a&&c!=="cms"){let C;return t[0]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(ms,{className:"animate-in fade-in-0 duration-200",children:r.jsx(ms.Main,{className:"flex flex-col items-center",children:r.jsx(ms.EmptyState,{children:r.jsx(ms.NoAiProviderEmptyState,{})})})}),t[0]=C):C=t[0],C}let u;t[1]!==l.hasDecoKey||t[2]!==l.hasOnlyDecoProvider||t[3]!==l.isLoading||t[4]!==l.isZeroBalance||t[5]!==n||t[6]!==e?(u=l.hasDecoKey&&l.isZeroBalance&&l.hasOnlyDecoProvider&&!l.isLoading&&n&&!ED(e.id),t[1]=l.hasDecoKey,t[2]=l.hasOnlyDecoProvider,t[3]=l.isLoading,t[4]=l.isZeroBalance,t[5]=n,t[6]=e,t[7]=u):u=t[7];const h=u;let f;t[8]!==h?(f=h&&r.jsx(ms.CreditsEmptyState,{}),t[8]=h,t[9]=f):f=t[9];const m=i!=="chat"?!0:void 0,p=i!=="chat",g=i!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=re("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?r.jsx(dR,{onOpenContextPanel:()=>o("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(ms.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(hR,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ms.Messages,{})})]}),r.jsx(ms.Footer,{children:r.jsx(ms.Input,{onOpenContextPanel:()=>o("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let v;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(v=r.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=v):v=t[19];const _=i!=="context"?!0:void 0,L=i!=="context",y=i==="context"?"opacity-100":"opacity-0 pointer-events-none";let k;t[20]!==y?(k=re("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[20]=y,t[21]=k):k=t[21];let w;t[22]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(XD,{back:!0,onClose:()=>o("chat")}),t[22]=w):w=t[22];let S;t[23]!==k||t[24]!==_||t[25]!==L?(S=r.jsx("div",{inert:_,"aria-hidden":L,className:k,children:w}),t[23]=k,t[24]=_,t[25]=L,t[26]=S):S=t[26];let j;return t[27]!==f||t[28]!==S||t[29]!==v?(j=r.jsxs(ms,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,v,S]}),t[27]=f,t[28]=S,t[29]=v,t[30]=j):j=t[30],j}function Q6(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(ms.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Fs,{fallback:e,children:r.jsx(A.Suspense,{fallback:r.jsx(ms.Skeleton,{}),children:r.jsx(pR,{})})}),t[1]=s):s=t[1],s}function gR(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function u2(t){return t?.name||t?.email?.split("@")[0]||void 0}function xf(t){const e=gR(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function xR(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 X6=["SANDBOX_START"],Yu=new Map,bR=t=>`${t.virtualMcpId}::${t.branch??""}`,vR=t=>t.message.includes("retry shortly"),y9=new Set,T1={mark:(t,e)=>y9.add(`${t}::${e}`),clear:(t,e)=>y9.delete(`${t}::${e}`),isStopped:(t,e)=>y9.has(`${t}::${e}`)};function Z6(t,e){const s=bs();return Rs({mutationKey:X6,retry:(n,i)=>vR(i)&&n<6,retryDelay:n=>bu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&T1.clear(n.virtualMcpId,n.branch);const i=bR(n),o=Yu.get(i);if(o)return o;const l=(async()=>(await xR(t,"SANDBOX_START",n)).structuredContent)();Yu.set(i,l);try{return await l}finally{Yu.get(i)===l&&Yu.delete(i)}},onSuccess:()=>{Od(s),e?.onStarted?.()}})}function yR(t,e){const s=F.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:X6,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],c6(n)>0}function tx(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function _R(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function LR(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 _R({sidePanel:l,mainOpen:i})}function _9(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?tx("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?tx("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function SR(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 wR(t){const{sidePanel:e,mainOpen:s}=t.visibility;return e!==null&&(t.sidePanelParamPresent||!s)?e:s?"main":"chat"}function kR(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function jR(t,e){const s=zt(),n=br({strict:!1}),i=Uh({strict:!1}),{create:o}=du(),{threads:l}=dN(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,u=n.main===0?"0":n.main,{sidePanel:h,mainOpen:f}=LR({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:u,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:h,mainOpen:f},p=A.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=N=>({org:c,taskId:N}),v=d?{virtualmcpid:a}:{},_=(N,V)=>{s({to:x,params:b(g),search:T=>({...T,...N}),replace:V?.replace??!1})},L=(N,V)=>{s({to:x,params:b(N),search:T=>{const E={};return V?E.virtualmcpid=V:d&&(E.virtualmcpid=a),E}})},y=()=>{const N=_9({type:"toggleMain",openMainValue:Ra(t)},m);N&&_(N,{replace:!0})},k=N=>{const V=_9({type:"toggleSidePanel",sidePanel:N},m);V&&_(V,{replace:!0})},w=N=>{const V=u&&u!=="0"?u:Ra(t);_(kR(N,V),{replace:!0})},S=N=>{const V=_9({type:"openSidePanel",sidePanel:N},m);V&&_(V,{replace:!0})},j=async()=>{const N=crypto.randomUUID(),V=l.find(T=>T.id===g)?.branch??null;try{await o({id:N,virtual_mcp_id:a,...V?{branch:V}:{}})}catch{}s({to:x,params:b(N),search:T=>({...v})})},C=N=>{_({main:N==="0"?0:N},{replace:!0})};return{taskId:g,sidePanel:h,mainOpen:f,mainParam:u,sidePanelParamPresent:n.sidepanel!==void 0,setTaskId:L,toggleMain:y,toggleSidePanel:k,setMobileSurface:w,openSidePanel:S,createNewTask:j,openTab:C}}function CR(t){const e=F.c(10),{org:s}=qe(),n=xp(),{data:i}=xi.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=et.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let u;e[3]!==n||e[4]!==l?(u=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==d||e[8]!==u?(h={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:u},e[6]=c,e[7]=d,e[8]=u,e[9]=h):h=e[9],Et(h)}function NR(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function VR(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function TR(t){return t/100*window.innerHeight}function ER(t){return t/100*window.innerWidth}function AR(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 cd({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=AR(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=VR(e,i);break}case"em":{n=NR(e,i);break}case"vh":{n=TR(i);break}case"vw":{n=ER(i);break}}return n}function kn(t){return parseFloat(t.toFixed(3))}function ac({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 E1(t){const{panels:e}=t,s=ac({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 u=cd({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=kn(u/s*100)}let a;if(o.defaultSize!==void 0){const u=cd({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=kn(u/s*100)}let c=0;if(o.minSize!==void 0){const u=cd({groupSize:s,panelElement:i,styleProp:o.minSize});c=kn(u/s*100)}let d=100;if(o.maxSize!==void 0){const u=cd({groupSize:s,panelElement:i,styleProp:o.maxSize});d=kn(u/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 Gt(t,e="Assertion error"){if(!t)throw Error(e)}function A1(t,e){return Array.from(e).sort(t==="horizontal"?PR:DR)}function PR(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function DR(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function e8(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function t8(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 RR({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}=t8(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Gt(i,"No rect found"),i}let Ju;function IR(){return Ju===void 0&&(typeof matchMedia=="function"?Ju=!!matchMedia("(pointer:coarse)").matches:Ju=!1),Ju}function s8(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=A1(s,Array.from(e.children).filter(e8).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,u=-1,h=0,f,m=[];{let p=-1;for(const g of o)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(h++,d===-1&&(d=p),u=p))}if(h>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 _;if(c){const L=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),y=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:{_=[L,y];break}case 1:{const k=m[0],w=RR({orientation:s,rects:[b,v],targetRect:k.element.getBoundingClientRect()});_=[k,w===b?y:L];break}default:{_=m;break}}}else m.length?_=m:_=[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 _){let y="width"in L?L:L.element.getBoundingClientRect();const k=IR()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(y.width<k){const S=k-y.width;y=new DOMRect(y.x-S/2,y.y,y.width+S,y.height)}if(y.height<k){const S=k-y.height;y=new DOMRect(y.x,y.y-S/2,y.width,y.height+S)}const w=p<=d||p>u;!a&&!w&&l.push({group:t,groupSize:ac({group:t}),panels:[f,x],separator:"width"in L?void 0:L,rect:y}),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 n8=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)}}},Ba={cursorFlags:0,state:"inactive"};const h2=new n8;function ml(){return Ba}function MR(t){return h2.addListener("change",t)}function $R(t){const e=Ba,s={...Ba};s.cursorFlags=t,Ba=s,h2.emit("change",{prev:e,next:s})}function za(t){const e=Ba;Ba=t,h2.emit("change",{prev:e,next:t})}const OR=t=>t,L9=()=>{},i8=1,r8=2,o8=4,l8=8,sx=3,nx=12;let Qu;function ix(){return Qu===void 0&&(Qu=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Qu=!0)),Qu}function BR({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&&ix()){const o=(t&i8)!==0,l=(t&r8)!==0,a=(t&o8)!==0,c=(t&l8)!==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 ix()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const rx=new WeakMap;function f2(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=rx.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=ml();switch(n.state){case"active":case"hover":{const i=BR({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}}rx.set(t,{prevStyle:e,styleSheet:s})}let or=new Map;const a8=new n8;function zR(t){or=new Map(or),or.delete(t)}function ox(t,e){for(const[s]of or)if(s.id===t)return s}function wo(t,e){for(const[s,n]of or)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function El(){return or}function m2(t,e){return a8.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function Gr(t,e,s){const n=or.get(t);or=new Map(or),or.set(t,e),a8.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function c8(t){const e=ml();let s=!1;return e.state==="active"&&(za({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(f2(t),s=!0,e.hitRegions.forEach(n=>{const i=wo(n.group.id,!0);Gr(n.group,i,{isUserInteraction:!0})}))),s}function lx(t){t.defaultPrevented||c8(t.currentTarget)}function FR(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=t8(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 UR(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function HR(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:dx(t),b:dx(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Gt(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:cx(ax(s.a)),b:cx(ax(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 KR=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function WR(t){const e=getComputedStyle(d8(t)??t).display;return e==="flex"||e==="inline-flex"}function qR(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||WR(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"||KR.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function ax(t){let e=t.length;for(;e--;){const s=t[e];if(Gt(s,"Missing node"),qR(s))return s}return null}function cx(t){return t&&Number(getComputedStyle(t).zIndex)||0}function dx(t){const e=[];for(;t;)e.push(t),t=d8(t);return e}function d8(t){const{parentNode:e}=t;return UR(e)?e.host:e}function GR(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 YR({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!e8(s)||s.contains(t)||t.contains(s))return!0;if(HR(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(GR(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function p2(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=s8(i),l=FR(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&YR({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function JR(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 vn(t,e,s=0){return Math.abs(kn(t)-kn(e))<=s}function Zi(t,e){return vn(t,e)?0:t>e?1:-1}function Ia({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(Zi(n,c)<0)if(o){const d=(i+c)/2;Zi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=kn(n),n}function Jd({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(vn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Gt(u!=null,"Invalid first pivot index"),Gt(h!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?h:u,x=s[g];Gt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:_=0}=x;if(v){const L=a[g];if(Gt(L!=null,`Previous layout not found for panel index ${g}`),vn(L,b)){const y=_-L;Zi(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const g=t<0?u:h,x=s[g];Gt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:_=0}=x;if(v){const L=a[g];if(Gt(L!=null,`Previous layout not found for panel index ${g}`),vn(L,_)){const y=L-b;Zi(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}break}default:{const g=t<0?h:u,x=s[g];Gt(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:_,minSize:L}=x;if(v&&Zi(b,L)<0)if(t>0){const y=L-_,k=y/2,w=b+t;Zi(w,L)<0&&(t=Zi(t,k)<=0?0:y)}else{const y=L-_,k=100-y/2,w=b-t;Zi(w,L)<0&&(t=Zi(100+t,k)>0?0:-y)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const _=a[x];Gt(_!=null,`Previous layout not found for panel index ${x}`);const L=Ia({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:_,size:100})-_;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?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Gt(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,_=Ia({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!vn(b,_)&&(f+=b-_,d[g]=_,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(JR(c,d))return i;{const g=t<0?h:u,x=a[g];Gt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=Ia({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!vn(v,b)){let _=b-v,L=t<0?h:u;for(;L>=0&&L<s.length;){const y=d[L];Gt(y!=null,`Previous layout not found for panel index ${L}`);const k=y+_,w=Ia({overrideDisabledPanels:l,panelConstraints:s[L],prevSize:y,size:k});if(vn(y,w)||(_-=w-y,d[L]=w),vn(_,0))break;t>0?L--:L++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!vn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function pl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Zi(t[s],e[s])!==0)return!1;return!0}function gl({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(!vn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Gt(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];Gt(c!=null,`No layout data found for index ${a}`);const d=n[a];Gt(d!=null,`No layout data found for index ${a}`);const u=Ia({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(o+=d-u,n[a]=u)}if(!vn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Gt(c!=null,`No layout data found for index ${a}`);const d=c+o,u=Ia({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(o-=u-c,n[a]=u,vn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function u8({groupId:t,panelId:e}){const s=()=>{const c=El();for(const[d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,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:u,derivedPanelConstraints:h})=>{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=h[b];return v?.collapsible&&vn(v.collapsedSize,u[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+u[v.id],0);return{...u,[e]:kn(100-x)}}return Jd({delta:g?f-c:c-f,initialLayout:u,panelConstraints:h,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:u,trigger:"imperative-api"})},a=c=>{const d=o();if(c===d)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:h}),b=gl({layout:x,panelConstraints:h});pl(p,b)||Gr(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=o();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=o();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=o();return c&&vn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=ac({group:d}),f=cd({groupSize:h,panelElement:u,styleProp:c}),m=kn(f/h*100);a(m)}}}function ux(t){if(t.defaultPrevented)return;const e=El();p2(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=u8({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function P0(t){const e=El();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 h8({groupId:t}){const e=()=>{const s=El();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=gl({layout:s,panelConstraints:i});return n?a:(pl(a,d)||Gr(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function Ko(t,e){const s=P0(t),n=wo(s.id,!0),i=s.separators.find(u=>u.element===t);Gt(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Gt(o,"Matching panels not found");const l=o.map(u=>s.panels.indexOf(u)),a=h8({groupId:s.id}).getLayout(),c=Jd({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=gl({layout:c,panelConstraints:n.derivedPanelConstraints});pl(a,d)||Gr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function hx(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=P0(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&Ko(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&Ko(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&Ko(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&Ko(e,-5);break}case"End":{t.preventDefault(),Ko(e,100);break}case"Enter":{t.preventDefault();const n=P0(e),i=wo(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Gt(c,"Matching separator not found");const d=a.get(c);Gt(d,"Matching panels not found");const u=d[0],h=o.find(f=>f.panelId===u.id);if(Gt(h,"Panel metadata not found"),h.collapsible){const f=l[u.id],m=h.collapsedSize===f?n.mutableState.expandedPanelSizes[u.id]??h.minSize:h.collapsedSize;Ko(e,m-f)}break}case"F6":{t.preventDefault();const n=P0(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Gt(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(),Ko(e,-100);break}}}function fx(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=El(),s=p2(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)}),za({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function f8({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:u,groupSize:h}=d,{orientation:f,panels:m}=u,{disableCursor:p}=u.mutableState;let g=0;o?f==="horizontal"?g=(e.clientX-o.x)/h*100:g=(e.clientY-o.y)/h*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(u),b=i.get(u);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:_,groupSize:L,layout:y,separatorToPanels:k}=b;if(_&&y&&k){const w=Jd({delta:g,initialLayout:x,panelConstraints:_,pivotIndices:d.panels.map(S=>m.indexOf(S)),prevLayout:y,trigger:"mouse-or-touch"});if(pl(w,y)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?i8:r8;break}case"vertical":{a|=g<0?o8:l8;break}}}else Gr(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:_,groupSize:L,layout:w,separatorToPanels:k})}});let c=0;e.movementX===0?c|=l&sx:c|=a&sx,e.movementY===0?c|=l&nx:c|=a&nx,$R(c),f2(t)}function mx(t){const e=El(),s=ml();s.state==="active"&&f8({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function px(t){if(t.defaultPrevented)return;const e=ml(),s=El();switch(e.state){case"active":{if(t.buttons===0){za({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=wo(n.group.id,!0);Gr(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)}f8({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=p2(t,s);n.length===0?e.state!=="inactive"&&za({cursorFlags:0,state:"inactive"}):za({cursorFlags:0,hitRegions:n,state:"hover"}),f2(t.currentTarget);break}}}function gx(t){t.relatedTarget instanceof HTMLIFrameElement&&ml().state==="hover"&&za({cursorFlags:0,state:"inactive"})}function xx(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||c8(t.currentTarget)&&t.preventDefault()}function bx(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=kn(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=kn((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=ac({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:kn(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function XR(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 ZR({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 h of t.panels){const f=n[h.id]??0;if(h.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=kn(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),o+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),o>0)for(const h of c){const f=n[h]??0;u[h]=kn(f/o*d)}else{const h=kn(d/c.length);for(const f of c)u[f]=h}return u}function eI(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 La=new Map;function tI(t){let e=!0;Gt(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=ac({group:t});if(v===0)return;const _=wo(t.id);if(!_)return;const L=E1(t),y=_.defaultLayoutDeferred?bx(L):_.layout,k=ZR({group:t,nextGroupSize:v,prevGroupSize:_.groupSize,prevLayout:y}),w=gl({layout:k,panelConstraints:L});if(!_.defaultLayoutDeferred&&pl(_.layout,w)&&XR(_.derivedPanelConstraints,L)&&_.groupSize===v)return;Gr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:v,layout:w,separatorToPanels:_.separatorToPanels})}}else QR(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Gt(!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=ac({group:t}),a=E1(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(eI(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??bx(a),h=gl({layout:u,panelConstraints:a}),f=t.element.ownerDocument;La.set(f,(La.get(f)??0)+1);const m=new Map;return s8(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),Gr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Gt(!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",hx)}),La.get(f)===1&&(f.addEventListener("contextmenu",lx,!0),f.addEventListener("dblclick",ux,!0),f.addEventListener("pointerdown",fx,!0),f.addEventListener("pointerleave",mx),f.addEventListener("pointermove",px),f.addEventListener("pointerout",gx),f.addEventListener("pointerup",xx,!0)),function(){e=!1,La.set(f,Math.max(0,(La.get(f)??0)-1)),zR(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",hx)}),La.get(f)||(f.removeEventListener("contextmenu",lx,!0),f.removeEventListener("dblclick",ux,!0),f.removeEventListener("pointerdown",fx,!0),f.removeEventListener("pointerleave",mx),f.removeEventListener("pointermove",px),f.removeEventListener("pointerout",gx),f.removeEventListener("pointerup",xx,!0)),o.disconnect()}}function sI(){const[t,e]=A.useState({}),s=A.useCallback(()=>e({}),[]);return[t,s]}function g2(t){const e=A.useId();return`${t??e}`}const Al=typeof window<"u"?A.useLayoutEffect:A.useEffect;function wd(t){const e=A.useRef(t);return Al(()=>{e.current=t},[t]),A.useCallback((...s)=>e.current?.(...s),[e])}function x2(...t){return wd(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function b2(t){const e=A.useRef({...t});return Al(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const m8=A.createContext(null);function nI(t,e){const s=A.useRef({getLayout:()=>({}),setLayout:OR});A.useImperativeHandle(e,()=>s.current,[]),Al(()=>{Object.assign(s.current,h8({groupId:t}))})}function p8({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=A.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=wd(N=>{pl(p.current.onLayoutChange,N)||(p.current.onLayoutChange=N,c?.(N))}),x=wd((N,V)=>{pl(p.current.onLayoutChanged,N)||(p.current.onLayoutChanged=N,d?.(N,{isUserInteraction:V}))}),b=g2(a),v=A.useRef(null),[_,L]=sI(),y=A.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),k=x2(v,o);nI(b,l);const w=wd((N,V)=>{const T=ml(),E=ox(N),P=wo(N);if(P){let D=!1;return T.state==="active"&&(D=T.hitRegions.some(I=>I.group===E)),{flexGrow:P.layout[V]??1,pointerEvents:D?"none":void 0}}if(s?.[V])return{flexGrow:s?.[V]}}),S=b2({defaultLayout:s,disableCursor:n}),j=A.useMemo(()=>({get disableCursor(){return!!S.disableCursor},getPanelStyles:w,id:b,orientation:u,registerPanel:N=>{const V=y.current;return V.panels=A1(u,[...V.panels,N]),L(),()=>{V.panels=V.panels.filter(T=>T!==N),L()}},registerSeparator:N=>{const V=y.current;return V.separators=A1(u,[...V.separators,N]),L(),()=>{V.separators=V.separators.filter(T=>T!==N),L()}},updatePanelProps:(N,{disabled:V})=>{const T=y.current.panels.find(D=>D.id===N);T&&(T.panelConstraints.disabled=V);const E=ox(b),P=wo(b);E&&P&&Gr(E,{...P,derivedPanelConstraints:E1(E)})},updateSeparatorProps:(N,{disabled:V,disableDoubleClick:T})=>{const E=y.current.separators.find(P=>P.id===N);E&&(E.disabled=V,E.disableDoubleClick=T)}}),[w,b,L,u,S]),C=A.useRef(null);return Al(()=>{const N=v.current;if(N===null)return;const V=y.current;let T;if(S.defaultLayout!==void 0&&Object.keys(S.defaultLayout).length===V.panels.length){T={};for(const B of V.panels){const M=S.defaultLayout[B.id];M!==void 0&&(T[B.id]=M)}}const E={disabled:!!i,element:N,id:b,mutableState:{defaultLayout:T,disableCursor:!!S.disableCursor,expandedPanelSizes:y.current.lastExpandedPanelSizes,layouts:y.current.layouts},orientation:u,panels:V.panels,resizeTargetMinimumSize:V.resizeTargetMinimumSize,separators:V.separators};C.current=E;const P=tI(E),{defaultLayoutDeferred:D,derivedPanelConstraints:I,layout:R}=wo(E.id,!0);!D&&I.length>0&&(g(R),x(R,!1));const $=m2(b,B=>{const{defaultLayoutDeferred:M,derivedPanelConstraints:O,layout:z}=B.next;if(M||O.length===0)return;const U=E.panels.map(({id:K})=>K).join(",");E.mutableState.layouts[U]=z,O.forEach(K=>{if(K.collapsible){const{layout:W}=B.prev??{};if(W){const Y=vn(K.collapsedSize,z[K.panelId]),X=vn(K.collapsedSize,W[K.panelId]);Y&&!X&&(E.mutableState.expandedPanelSizes[K.panelId]=W[K.panelId])}}});const H=ml().state!=="active";g(z),H&&x(z,B.isUserInteraction)});return()=>{C.current=null,P(),$()}},[i,b,x,g,u,_,S]),A.useEffect(()=>{const N=C.current;N&&(N.mutableState.defaultLayout=s,N.mutableState.disableCursor=!!n)}),r.jsx(m8.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:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}p8.displayName="Group";function v2(){const t=A.useContext(m8);return Gt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function iI(t,e){const{id:s}=v2(),n=A.useRef({collapse:L9,expand:L9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:L9});A.useImperativeHandle(e,()=>n.current,[]),Al(()=>{Object.assign(n.current,u8({groupId:s,panelId:t}))})}function g8({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:u="0%",onResize:h,panelRef:f,style:m,...p}){const g=!!c,x=g2(c),b=b2({disabled:o}),v=A.useRef(null),_=x2(v,l),{getPanelStyles:L,id:y,orientation:k,registerPanel:w,updatePanelProps:S}=v2(),j=h!==null,C=wd((E,P,D)=>{h?.(E,c,D)});Al(()=>{const E=v.current;if(E!==null){const P={element:E,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?C:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return w(P)}},[a,s,n,i,j,x,g,d,u,C,w,b]),A.useEffect(()=>{S(x,{disabled:o})},[o,x,S]),iI(x,f);const N=()=>{const E=L(y,x);if(E)return JSON.stringify(E)},V=A.useSyncExternalStore(E=>m2(y,E),N,N);let T;return V?T=JSON.parse(V):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:_,style:{...rI,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})})}g8.displayName="Panel";const rI={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function oI({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,u=[n,n+1];o=gl({layout:Jd({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=gl({layout:Jd({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function x8({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=g2(o),d=b2({disabled:s,disableDoubleClick:n}),[u,h]=A.useState({}),[f,m]=A.useState("inactive"),[p,g]=A.useState(!1),x=A.useRef(null),b=x2(x,i),{disableCursor:v,id:_,orientation:L,registerSeparator:y,updateSeparatorProps:k}=v2(),w=L==="horizontal"?"vertical":"horizontal";Al(()=>{const C=x.current;if(C!==null){const N={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:C,id:c},V=y(N),T=MR(P=>{m(P.next.state!=="inactive"&&P.next.hitRegions.some(D=>D.separator===N)?P.next.state:"inactive")}),E=m2(_,P=>{const{derivedPanelConstraints:D,layout:I,separatorToPanels:R}=P.next,$=R.get(N);if($){const B=$[0],M=$.indexOf(B);h(oI({layout:I,panelConstraints:D,panelId:B.id,panelIndex:M}))}});return()=>{T(),E(),V()}}},[_,c,y,d]),A.useEffect(()=>{k(c,{disabled:s,disableDoubleClick:n})},[s,n,c,k]);let S;s&&!v&&(S="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":w,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.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:S,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}x8.displayName="Separator";function b8(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=re("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(p8,{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 Z0(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(g8,{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 v8(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=re("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(yc,{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(x8,{"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 vx(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function lI(t,e){const s=F.c(8);let n;s[0]!==e?(n=c=>vx(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=fv(t,n);let l;s[2]!==e||s[3]!==i?(l=vx(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 aI=33;function cI(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=lp.sidePanelWidth(),t[0]=e):e=t[0],lI(e,aI)}function P1(){const t=F.c(3),[e,s]=A.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function y8(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 y2(t){const e=y8(t);if(e)throw new Error(e)}function dI(t){try{return JSON.parse(t)}catch{return null}}function uI(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,n=s?dI(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=uI(t);return e===null?null:e}function _8(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 hI(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=_8(s);return!n||!s?null:{number:n,htmlUrl:s}}function yx(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const _x=/[\r\n<>]/,fI=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Su(t){const e=t?.userName?.trim();if(!e||_x.test(e))return null;const s=t?.userEmail?.trim();return!s||_x.test(s)?{userName:e}:fI.test(s)?{userName:e,userEmail:s}:{userName:e}}function mI(t){return t.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-Cj6XZcig.js","assets/index-BAzBxxL9.js","assets/index-DfOjcoHJ.css","assets/chat-context-Cdt5JBGq.js","assets/tab-id-DMd10Dlk.js","assets/dialog-K8-1cCDF.js","assets/Check-CJxsk2cd.js","assets/Copy01-oY33F6A4.js","assets/Download01-BOB13r_i.js","assets/session-runtime-wVXsCwcJ.js","assets/hooks-BsA5QClW.js","assets/use-mcp-client-DP99b3Me.js","assets/constants-_08zpzmT.js","assets/auth-B5QCuHwo.js","assets/decopilot-sse-pool-CMc1xBx0.js","assets/backoff-CrEUbyZT.js","assets/delay-CnY5UFtP.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-Dg7xWNG-.js","assets/use-ai-providers-vhWA7gSP.js","assets/use-decopilot-events-EyNfu7Kq.js","assets/use-organization-settings-CjuBssHq.js","assets/ChevronDown-Chn5-yQ3.js","assets/agent-icon-BpKbS82g.js","assets/AlertCircle-BTYGLFie.js","assets/Tool01-BjI8gxt5.js","assets/ArrowUp-fnzebitz.js","assets/ArrowLeft-BajYEy7J.js","assets/Tool02-Ct3UvI4j.js","assets/XCircle-BMgdweBK.js","assets/TrendUp01-vMMFYqH0.js","assets/ZapSquare-Z5gRSAcI.js","assets/Users03-C8z46zgV.js","assets/UserSquare-kfbSM3R7.js","assets/CheckCircle-D8lsJrHv.js","assets/ChevronRight-BUEJ-jyA.js","assets/ChevronSelectorVertical-DuwT0Cdn.js","assets/ChevronUp-Bis3nYDt.js","assets/DotsVertical-CmNP1NFD.js","assets/Stars02-DNyS1gcT.js","assets/CreditCard01-BEFAf8Rs.js","assets/Settings02-DxEKOFeo.js","assets/Eye-BQM4yrzA.js","assets/FilterLines-CM6IqjC1.js","assets/Share07-BAxn1THr.js","assets/Globe01-BLkvMUGE.js","assets/Globe04-CJdUUoxg.js","assets/SwitchHorizontal01-C8-bgNQy.js","assets/HardDrive-BFDRJjzR.js","assets/Key01-B5VoA08Z.js","assets/LinkExternal01-bgUoyTwQ.js","assets/LockUnlocked01-o0Eo7MuU.js","assets/LogOut01-CKpl9BLq.js","assets/Monitor01-BHWFnGlJ.js","assets/Sun-CSIUl7xv.js","assets/Palette-DAsj4nYm.js","assets/Play-Ir6C5jzg.js","assets/Plus-CySlFZzQ.js","assets/SearchLg-BevUi4lQ.js","assets/SearchMd-CUh5hEpd.js","assets/Shield01-Br0XuRfn.js","assets/Stars01-DGSNhagZ.js","assets/Trash01-lppJr9kF.js","assets/Upload01-CePHCnzY.js","assets/User01-BqNQxSWl.js","assets/Users01-GyxqhIQS.js","assets/XClose-DnnJN04M.js","assets/Zap-f9eGztfW.js","assets/automation-runs-aScQH7yb.js","assets/select-B2e4NALY.js","assets/useInfiniteQuery-oSGVjzuL.js","assets/use-infinite-scroll-BwpbIlWm.js","assets/use-connection-Brp0ROSB.js","assets/table-rERv-Q2u.js","assets/empty-state-CSKHHWG6.js","assets/use-members-Fg8xu9zL.js","assets/use-org-auth-client-CbgB99m_.js","assets/use-clock-tick-c_pjCx_y.js","assets/use-automations-CqECqdXg.js","assets/useSuspenseInfiniteQuery-Cu_rUEsy.js","assets/avatar-BYLlYMrS.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-JYzS-t0x.js","assets/monaco-editor-ywPI1t16.js","assets/spinner-Bb-1R-dk.js","assets/types-CHsUC77L.js","assets/shell-layout-BH-NXnM4.js","assets/required-auth-layout-ykPgRGg9.js","assets/use-org-sso-JpsBVP_t.js","assets/integration-icon-BnqPyHmt.js","assets/use-navigate-to-agent-B3WHCfCa.js","assets/reusable-new-chat-CzvRy4Pe.js","assets/chart-CoRPyY38.js","assets/index-D00QDYEH.js","assets/form-Cv16yv_N.js","assets/label-CXiyMNnc.js","assets/input-CvrE4LEJ.js","assets/file-type-icon-BrVi1nrA.js","assets/dropdown-menu-C-7wwHBe.js","assets/page-seo-form-jRWN82Bz.js","assets/switch-BvYQVlYb.js","assets/use-section-preview-base-CMJMRXCJ.js","assets/drawer-ClBcSM08.js","assets/collection-search-BQ3PDw8g.js","assets/tabs-C3QvtS8u.js","assets/toggle-group-CT-LedBS.js","assets/use-commerce-diagnostic-BpYk1Ih5.js","assets/popover-wGCNVbgm.js","assets/self-tool-result-BBoUTXvN.js","assets/alert-dialog-_waxzl9D.js","assets/extract-connection-data-C1XM4jmB.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-CHx-_V6p.js","assets/authenticate-and-persist-oauth-CxmxlpAo.js","assets/mcp-oauth-BY7cxtZI.js","assets/track-BoWa7pFa.js","assets/toolbar-DDbKD-Ay.js","assets/github-repo-picker-DEedlZZB.js","assets/use-mcp-tools-CjeO7xTP.js","assets/agent-capabilities-C4tLW0Za.js","assets/connection-card-Bwep8BgY.js","assets/use-registry-connections-DYlN_mpo.js","assets/retry-CErkP7V6.js","assets/connection-slug-eyAPH6o3.js","assets/textarea-DZcoj6k2.js","assets/connection-form-helpers-ChTIA9-X.js","assets/collection-tabs-BHE3DhBM.js","assets/badge-DYcNbwP1.js","assets/command-Cj_b6QuL.js","assets/index-CiZciEsK.js","assets/select-model-BsIRDtab.js","assets/checkbox-Z9SepXvp.js","assets/ai-providers-logos-DD3qZ33J.js","assets/cards-DOZsSvdL.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-YIMtdt9I.js","assets/use-file-configs-EX9fsqJc.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-Lcvsez5G.js","assets/search-input-DzsO4XKy.js","assets/index-DgS45S3b.js","assets/use-secrets-BFX9kjjo.js","assets/AreaChart-jerPjG-w.js","assets/task-key-sEZ4dWP_.js","assets/sprints-C6bMPt1I.js","assets/use-tags-CGvsLsNg.js","assets/get-initials-D-f_fDFw.js","assets/automation-list-row-kxVusV6D.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-mnINiKx8.js","assets/file-explorer-BCiGm1Z3.js","assets/app-editor-BITYEeNm.js","assets/post-editor-B-3AULjS.js","assets/multi-select-6289Ji5Q.js","assets/block-document-8DQ-Aj-N.js","assets/primitives-Do4YdhnP.js","assets/use-autosave-CTd3ujOq.js","assets/record-editor-CnkB9zNF.js","assets/category-editor-CxuIuX9c.js","assets/bulk-category-panel-0Znxf5_5.js","assets/seo-editor-NyY02_7W.js","assets/variant-calendar-B3KUJEEH.js","assets/view-mode-toggle-CVgUIU1G.js","assets/post-calendar-pijaG7Tm.js","assets/alert-Cjb2EB7F.js","assets/redirect-editor-DJr4emyY.js","assets/project-app-view-CYxJURVY.js"])))=>i.map(i=>d[i]);
2
+ import{p as bs,r as A,ah as cj,ai as dj,c as F,H as qe,n as re,j as r,E as Fs,b as ie,t as pe,aa as fr,a5 as Ro,a8 as He,a9 as Ke,ab as We,aj as _s,ak as Vi,al as uj,am as on,an as op,I as lp,B as de,ao as ap,ap as dv,aq as hj,ar as fj,x as Oi,as as Ds,at as el,au as L3,d as zt,av as $s,e as Rs,q as Je,aw as mj,D as Io,ax as pj,ay as uv,az as gj,aA as er,aB as d9,aC as Bn,aD as xj,aE as u9,aF as bj,aG as vj,aH as yj,aI as _j,z as Fh,K as et,aJ as Lj,aK as Sj,aL as wj,aM as kj,aN as hv,aO as _d,o as Et,k as ft,a as xi,C as lu,aP as Od,u as br,f as Uh,R as fv,aQ as cp,aR as jj,aS as Cj,L as Nj,a3 as mv,aT as K0,aU as tl,Y as vt,aV as pv,aW as gv,aX as zn,P as Ni,aY as Nt,s as xv,aZ as Vj,a_ as Tj,a$ as Ej,b0 as Aj,b1 as Pj,b2 as bv,b3 as vv,b4 as yv,b5 as _v,b6 as Lv,b7 as Sv,b8 as wv,b9 as kv,ba as jv,bb as Cv,bc as Tn,bd as Nv,be as Dj,bf as Rj,bg as Vv,bh as Ij,bi as Mj,bj as $j,bk as Oj,bl as Da,bm as Bj,bn as zj,N as Fj,bo as Uj,bp as Hj,M as Kj,ag as Wj}from"./index-BAzBxxL9.js";import{i as Hh,n as qj}from"./ArrowUp-fnzebitz.js";import{u as Mo,a as bi,b as Ls,c as sn,d as Tv,s as Gj,e as Yj,f as Jj,g as Qj,h as Xj,i as Zj,j as eC,k as dp,A as tC,l as sC,m as nC,p as Ev,V as iC,E as Kh,S as Av,n as Ga,t as rC,o as oC,q as Wh,r as as,v as Ya,H as Bd,w as zd,x as _a,y as Pv,z as Dv,B as lC,D as aC}from"./chat-context-Cdt5JBGq.js";import{c as qh,s as bc,g as ar,P as Fd,d as up,t as dl,a as cC,M as dC,i as uC,b as Ur,e as Gh,f as hC,D as fC,h as mC,j as pC,k as Ja,l as gC,m as xC,u as hp,E as bC,n as au,o as vC,F as yC,p as fp,q as mp,r as Rv,S as _C,v as LC,w as SC,x as wC,y as S3,z as kC,A as Iv,O as jC,B as $o,C as sr,G as CC,T as Mv,H as h9,I as ld,J as NC,K as VC,L as $v,N as TC,Q as vr,R as EC,U as AC,V as Ov,W as kr,X as PC,Y as zc,Z as DC,_ as Bv,$ as zv,a0 as pp,a1 as Fv,a2 as RC,a3 as IC,a4 as MC,a5 as Oo,a6 as gp,a7 as Uv,a8 as Hv,a9 as Kv,aa as $C,ab as OC,ac as Wv,ad as BC,ae as zC,af as FC,ag as UC,ah as HC,ai as KC}from"./automation-runs-aScQH7yb.js";import{S as Ud}from"./spinner-Bb-1R-dk.js";import{a as xs,b as Wt,d as It,e as Mt,h as Fn,c as Zn,i as qv}from"./dialog-K8-1cCDF.js";import{c as WC,b as Yh,a as Jh,D as Qh,d as Gv,e as qC,f as GC}from"./drawer-ClBcSM08.js";import{C as YC}from"./collection-search-BQ3PDw8g.js";import{u as Jt,a as JC,m as QC}from"./use-mcp-client-DP99b3Me.js";import{a as Cl,i as W0,S as Nl,b as XC,W as Yv,c as ZC,C as b1,g as q0,d as Jv,e as w3,f as eN,Q as tN,h as sN,j as nN,k as iN}from"./constants-_08zpzmT.js";import{u as Qv,g as cu,l as v1,C as rN,a as oN,b as lN}from"./chart-CoRPyY38.js";import{t as Qt}from"./ChevronDown-Chn5-yQ3.js";import{t as aN,z as cN,s as Xv,a as du,b as xp,u as dN,c as Zv}from"./hooks-BsA5QClW.js";import{K as uN,i as ey,u as vc,a as ty,m as hN}from"./shell-layout-BH-NXnM4.js";import{a as Ws,u as uu,b as bp,c as fN}from"./use-virtual-mcp-Dg7xWNG-.js";import{w as sy,A as mN,r as Ra,b as pN,p as ny,f as Ld,c as iy,d as ry,e as oy,g as gN,F as xN,h as bN,j as vN,k as yN,l as _N,m as LN,O as SN,n as wN,o as kN}from"./tab-id-DMd10Dlk.js";import{r as ly,d as ay,a as vp,p as jN,b as CN,s as NN}from"./session-runtime-wVXsCwcJ.js";import{i as Bo,b as yp,a as VN}from"./XCircle-BMgdweBK.js";import{h as cy,j as _p,k as Vl,l as dy,m as Lp,n as uy,A as Vo,o as hy,p as Qa,s as Hr,q as fy,r as zo,u as TN,v as EN,c as my,w as y1,x as yc,y as Ku,z as AN,B as Ti,C as mi,D as PN,E as py,f as DN,F as Xh,G as Tl,H as RN,I as Sp,J as gy,K as xy,L as _1,M as f9,N as k3,e as Zh,O as IN,P as MN,Q as $N,R as ON,S as BN,T as wp,U as by,V as ei,W as kp,X as jp,d as hu,Y as fu,Z as vy,_ as yy,$ as _y,a0 as zN,a1 as Cp,a2 as FN,a3 as j3,a4 as UN,a5 as HN,t as Ly,a6 as ef,a7 as mu,a8 as KN,a9 as $r,aa as So,i as tf,ab as WN,ac as qN,ad as GN,ae as YN,af as JN,ag as QN,ah as Or,ai as C3,aj as Sy,ak as XN,al as ZN,am as eV,an as Xa,ao as Np,ap as tV,aq as N3,ar as sV,as as nV,at as iV,au as wy,av as rV,aw as oV,ax as lV,ay as aV,az as cV,aA as dV,aB as uV,aC as hV,aD as ky,aE as Vp,aF as fV,aG as mV,aH as pV,aI as gV}from"./agent-icon-BpKbS82g.js";import{i as Rt}from"./Check-CJxsk2cd.js";import{a as Ei,i as xV,b as Tp,c as Ep}from"./Tool01-BjI8gxt5.js";import{i as ti}from"./Upload01-CePHCnzY.js";import{i as cn}from"./AlertCircle-BTYGLFie.js";import{a as an}from"./Copy01-oY33F6A4.js";import{F as L1,a as Ap,b as Pp,c as Dp,d as jy}from"./form-Cv16yv_N.js";import{d as Pt,S as Cs,a as Ns,b as Is,c as Vs}from"./select-B2e4NALY.js";import{t as sf,i as Rp,a as Ip,b as bV,c as vV,d as yV}from"./UserSquare-kfbSM3R7.js";import{i as nf}from"./ArrowLeft-BajYEy7J.js";import{T as rl,a as _c,b as cr,c as pu}from"./tabs-C3QvtS8u.js";import{t as S1}from"./Tool02-Ct3UvI4j.js";import{T as Mp,a as Hd}from"./toggle-group-CT-LedBS.js";import{I as bt}from"./input-CvrE4LEJ.js";import{u as $p,b as Op,g as Cy,i as _V,j as LV,C as Bp,a as SV,c as wV,T as kV,f as jV,A as CV,N as NV}from"./use-commerce-diagnostic-BpYk1Ih5.js";import{u as Ny,M as VV,a as TV,m as rf,i as EV,g as Vy,b as AV,N as PV,c as DV}from"./select-model-BsIRDtab.js";import{s as Ai}from"./XClose-DnnJN04M.js";import{a as is,b as rs,P as os,c as RV}from"./popover-wGCNVbgm.js";import{t as Br}from"./Stars01-DGSNhagZ.js";import{c as IV,a as of,b as zp,d as Ty,e as Ey,f as Fp,u as V3}from"./use-organization-settings-CjuBssHq.js";import{u as lf,a as MV}from"./use-ai-providers-vhWA7gSP.js";import{b as Up,g as gu,c as Ay,a as en,r as Py,f as $V,d as OV}from"./agent-capabilities-C4tLW0Za.js";import{f as BV,a as zV,u as Kd,b as Lc,c as Dy,d as FV,e as Hp,g as ul,h as Ry,i as Kp,j as UV,k as Wp,l as qp,m as HV,p as KV,n as WV,o as qV,q as GV,r as YV,F as xu,t as Iy,s as JV,v as My,S as QV,B as XV,w as $y,x as ZV,R as eT}from"./cards-DOZsSvdL.js";import{c as Ft,D as Ut,b as Ht,a as Qe,d as nr,e as ir,f as rr,g as hl,h as Nn,i as dr,j as Fc}from"./dropdown-menu-C-7wwHBe.js";import{s as $t}from"./Plus-CySlFZzQ.js";import{p as tT,q as sT}from"./question-004-sINsf4GQ.js";import{A as Hs}from"./avatar-BYLlYMrS.js";import{u as Oy,a as af}from"./use-members-Fg8xu9zL.js";import{i as dn}from"./ChevronRight-BUEJ-jyA.js";import{u as cf}from"./use-is-desktop-app-BNujXJc_.js";import{i as vi}from"./CheckCircle-D8lsJrHv.js";import{I as Bi}from"./integration-icon-BnqPyHmt.js";import{e as bu}from"./backoff-CrEUbyZT.js";import{u as nT}from"./use-status-sounds-YIMtdt9I.js";import{E as To}from"./empty-state-CSKHHWG6.js";import{T as yo,a as iT}from"./toolbar-DDbKD-Ay.js";import{b as By,n as Gp}from"./ZapSquare-Z5gRSAcI.js";import{i as Kr,a as rT}from"./Share07-BAxn1THr.js";import{i as Hn}from"./Globe01-BLkvMUGE.js";import{i as zy}from"./Monitor01-BHWFnGlJ.js";import{u as Pi,a as Yp,b as Jp}from"./use-connection-Brp0ROSB.js";import{u as Fy,a as Qp,b as Uy}from"./use-mcp-tools-CjeO7xTP.js";import{g as df,M as oT}from"./types-CHsUC77L.js";import{F as mr}from"./file-type-icon-BrVi1nrA.js";import{d as Xp,c as Zp,s as vu,b as lT}from"./TrendUp01-vMMFYqH0.js";import{u as e2,a as Hy}from"./use-file-configs-EX9fsqJc.js";import{n as Za}from"./Download01-BOB13r_i.js";import{n as yn}from"./LinkExternal01-bgUoyTwQ.js";import{w as T3,M as yu,F as aT}from"./monaco-editor-ywPI1t16.js";import{i as uf}from"./Key01-B5VoA08Z.js";import{p as cT,f as dT}from"./pt-BR-CLy76QW2.js";import{g as uT,e as hT}from"./extract-connection-data-C1XM4jmB.js";import{a as fT,i as E3}from"./mcp-oauth-BY7cxtZI.js";import{A as ec,a as tc,b as sc,c as nc,d as ic,e as rc,f as oc,g as lc}from"./alert-dialog-_waxzl9D.js";import{L as Bt}from"./label-CXiyMNnc.js";import{S as pr}from"./switch-BvYQVlYb.js";import{T as Wr}from"./textarea-DZcoj6k2.js";import{i as fl}from"./Play-Ir6C5jzg.js";import{s as tn}from"./Trash01-lppJr9kF.js";import{u as G0}from"./use-debounced-autosave-Lcvsez5G.js";import{i as Wd}from"./SearchMd-CUh5hEpd.js";import{C as Sc}from"./checkbox-Z9SepXvp.js";import{S as hf}from"./search-input-DzsO4XKy.js";import{C as Ky}from"./collection-tabs-BHE3DhBM.js";import{T as Wy,u as qy,I as mT,R as pT,a as gT}from"./index-DgS45S3b.js";import{n as xT}from"./LockUnlocked01-o0Eo7MuU.js";import{g as bT,s as Gy}from"./connection-slug-eyAPH6o3.js";import{a as vT,i as yT}from"./Settings02-DxEKOFeo.js";import{d as wc}from"./delay-CnY5UFtP.js";import{G as Vn,a as t2,u as _T}from"./github-repo-picker-DEedlZZB.js";import{s as Y0}from"./User01-BqNQxSWl.js";import{t as s2}from"./Users01-GyxqhIQS.js";import{u as Yy,a as Jy}from"./use-secrets-BFX9kjjo.js";import{i as Qy,a as n2}from"./DotsVertical-CmNP1NFD.js";import{a as kc}from"./format-time-BnbuEtat.js";import{f as Xy,g as LT,l as Zy,a as ST}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as wT}from"./authenticate-and-persist-oauth-CxmxlpAo.js";import{X as kT,A as jT,a as CT}from"./AreaChart-jerPjG-w.js";import{t as NT,u as e6,a as t6,p as VT}from"./task-key-sEZ4dWP_.js";import{s as jc}from"./Eye-BQM4yrzA.js";import{D as TT,R as ET,i as qd,a as AT,S as ls,b as s6,n as PT}from"./decopilot-sse-pool-CMc1xBx0.js";import{s as DT,a as n6,b as i6}from"./sprints-C6bMPt1I.js";import{u as m9}from"./use-copy-JYzS-t0x.js";import{i as i2,c as r6}from"./SwitchHorizontal01-C8-bgNQy.js";import{u as r2,a as RT,b as IT}from"./use-tags-CGvsLsNg.js";import{g as Qn}from"./get-initials-D-f_fDFw.js";import{C as yi,a as si,b as Yt,c as gs,d as _i,e as zi,f as MT,g as A3}from"./command-Cj_b6QuL.js";import{i as ff}from"./ChevronSelectorVertical-DuwT0Cdn.js";import{i as o2}from"./FilterLines-CM6IqjC1.js";import{i as mf}from"./SearchLg-BevUi4lQ.js";import{u as w1,a as $T,c as OT,p as o6,b as BT,s as k1,n as zT}from"./self-tool-result-BBoUTXvN.js";import{a as j1}from"./Palette-DAsj4nYm.js";import{u as pf}from"./use-debounced-value-CHx-_V6p.js";import{u as l6}from"./useInfiniteQuery-oSGVjzuL.js";import{i as qr}from"./Zap-f9eGztfW.js";import{B as FT}from"./badge-DYcNbwP1.js";import{u as _u,a as UT,b as HT,c as KT,d as WT}from"./use-automations-CqECqdXg.js";import{s as Sd}from"./Stars02-DNyS1gcT.js";import{A as qT}from"./automation-list-row-kxVusV6D.js";import{t as GT}from"./site-error--i37Vnuw.js";import{u as YT,a as JT}from"./use-org-repo-syncs-mnINiKx8.js";import{n as a6}from"./ChevronUp-Bis3nYDt.js";function c6(t,e){const s=bs(e);return QT({filters:{...t,status:"pending"}},s).length}function P3(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function QT(t={},e){const s=bs(e).getMutationCache(),n=A.useRef(t),i=A.useRef(null);return i.current===null&&(i.current=P3(s,t)),A.useEffect(()=>{n.current=t}),A.useSyncExternalStore(A.useCallback(o=>s.subscribe(()=>{const l=cj(i.current,P3(s,n.current));i.current!==l&&(i.current=l,dj.schedule(o))}),[s]),()=>i.current,()=>i.current)}const D3=3,d6="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",XT="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function u6(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 w=ar(c._meta);d=c.title??up(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const u=d,h=c.description||null;if(a==="card"){let w;e[4]!==n||e[5]!==c?(w=()=>n(c),e[4]=n,e[5]=c,e[6]=w):w=e[6];const S=o||i,j=i&&"bg-accent/40",C=(o||i)&&"cursor-not-allowed opacity-50";let N;e[7]!==j||e[8]!==C?(N=re(XT,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=N):N=e[9];let V;e[10]!==u?(V=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=V):V=e[11];let T;e[12]!==i?(T=i&&r.jsx(Ud,{size:"xs"}),e[12]=i,e[13]=T):T=e[13];let E;e[14]!==V||e[15]!==T?(E=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[V,T]}),e[14]=V,e[15]=T,e[16]=E):E=e[16];let P;e[17]!==h?(P=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=P):P=e[18];let D;return e[19]!==E||e[20]!==P||e[21]!==w||e[22]!==S||e[23]!==N?(D=r.jsxs("button",{type:"button",onClick:w,disabled:S,className:N,children:[E,P]}),e[19]=E,e[20]=P,e[21]=w,e[22]=S,e[23]=N,e[24]=D):D=e[24],D}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=re(d6,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(Ud,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(_=r.jsx(He,{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]=_):_=e[40];const L=h??u;let y;e[41]!==L?(y=r.jsx(Ke,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=y):y=e[42];let k;return e[43]!==_||e[44]!==y?(k=r.jsxs(We,{delayDuration:400,children:[_,y]}),e[43]=_,e[44]=y,e[45]=k):k=e[45],k}function ZT(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=ie(),[c,d]=A.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(V=>{const T=c.toLowerCase();return V.prompt.name.toLowerCase().includes(T)||(V.prompt.title??"").toLowerCase().includes(T)||(V.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Ro();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]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==o){let V;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==o?(V=T=>r.jsx(u6,{item:T,variant:"card",onSelect:E=>{i(!1),o(E)},isLoading:l?.name===T.prompt.name,isDisabled:u&&l?.name!==T.prompt.name},T.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=V):V=e[17],g=f.map(V),e[7]=f,e[8]=u,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 _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=V=>{V.key==="Escape"&&d("")},e[23]=_):_=e[23];let L;e[24]!==c||e[25]!==v?(L=r.jsx(YC,{value:c,onChange:d,placeholder:v,onKeyDown:_}),e[24]=c,e[25]=v,e[26]=L):L=e[26];const y=L;if(m){let V;e[27]!==a?(V=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=V):V=e[28];let T;e[29]!==V?(T=r.jsx(WC,{className:"sr-only",children:r.jsx(Yh,{children:V})}),e[29]=V,e[30]=T):T=e[30];let E;e[31]!==a?(E=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=E):E=e[32];let P;e[33]!==E?(P=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:E})}),e[33]=E,e[34]=P):P=e[34];let D;e[35]!==b||e[36]!==y||e[37]!==P||e[38]!==T?(D=r.jsxs(Jh,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,P,y,b]}),e[35]=b,e[36]=y,e[37]=P,e[38]=T,e[39]=D):D=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==D?(I=r.jsx(fr,{delayDuration:400,children:r.jsx(Qh,{open:n,onOpenChange:i,children:D})}),e[40]=i,e[41]=n,e[42]=D,e[43]=I):I=e[43],I}let k;e[44]!==a?(k=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=k):k=e[45];let w;e[46]!==k?(w=r.jsx(xs,{className:"sr-only",children:r.jsx(Wt,{children:k})}),e[46]=k,e[47]=w):w=e[47];let S;e[48]!==a?(S=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=S):S=e[49];let j;e[50]!==S?(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:S})}),e[50]=S,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==w?(C=r.jsxs(It,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=w,e[56]=C):C=e[56];let N;return e[57]!==i||e[58]!==n||e[59]!==C?(N=r.jsx(fr,{delayDuration:400,children:r.jsx(Mt,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=N):N=e[60],N}function eE(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=ie(),[a,c]=A.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,D3),v=s.slice(D3),_=!!i;let L;e[10]!==_||e[11]!==i?.name||e[12]!==n?(L=k=>r.jsx(u6,{item:k,onSelect:n,isLoading:i?.name===k.prompt.name,isDisabled:_&&i?.name!==k.prompt.name},k.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=L):L=e[13];const y=b.map(L);d=fr,m=400,e[14]!==o?(u=re("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=u):u=e[15],h=y,f=v.length>0&&r.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:re(d6,"hover:bg-muted/70 hover:text-foreground",_&&"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]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=r.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=r.jsx(ZT,{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 tE(){return null}function sE(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 nE(t){const e=F.c(31),{connectionId:s}=t,n=ie(),{sendMessage:i}=bi(),{org:o}=qe();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=Jt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=Qv(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(iE),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=A.useReducer(sE,p),[b,v]=A.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(E,P)=>{if(!a){pe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const D=await cu(a,E.name,P);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[qh({id:E.name,name:bc(E.name,ar(E._meta)),metadata:D.messages,char:"/",kind:"prompt",args:P}),{type:"text",text:" "}]}]};await i(I)}catch(D){console.error("[ice-breakers] Failed to fetch prompt:",D),pe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=_):_=e[14];const L=_;let y;e[15]!==L?(y=async E=>{if(E.arguments&&E.arguments.length>0){x({type:"SELECT_PROMPT",prompt:E}),v(E);return}x({type:"START_LOADING",prompt:E}),await L(E)},e[15]=L,e[16]=y):y=e[16];const k=y;let w;e[17]!==b||e[18]!==L?(w=async E=>{b&&(x({type:"START_LOADING",prompt:b,arguments:E}),v(null),await L(b,E))},e[17]=b,e[18]=L,e[19]=w):w=e[19];const S=w;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==k||e[21]!==m||e[22]!==j?(C=r.jsx(eE,{items:m,onSelect:k,loadingPrompt:j}),e[20]=k,e[21]=m,e[22]=j,e[23]=C):C=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{v(null),x({type:"RESET"})},e[24]=N):N=e[24];let V;e[25]!==b||e[26]!==S?(V=r.jsx(Fd,{prompt:b,setPrompt:N,onSubmit:S}),e[25]=b,e[26]=S,e[27]=V):V=e[27];let T;return e[28]!==C||e[29]!==V?(T=r.jsxs(r.Fragment,{children:[C,V]}),e[28]=C,e[29]=V,e[30]=T):T=e[30],T}function iE(t){return{prompt:t}}function rE(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=Mo(),{org:i}=qe();let o;e[0]!==i.id?(o=Cl(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=re("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(tE,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=r.jsx(nE,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Fs,{fallback:null,children:r.jsx(A.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const p9="cubic-bezier(0.645, 0.045, 0.355, 1)",oE=44,lE={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"},aE={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},cE={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Eo(t){const e=F.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=ie(),[p,g]=A.useState(d),[x,b]=A.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const _=v;if(x)return null;const L=aE[f],y=lE[f];let k;e[2]!==L||e[3]!==y?(k=re("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,y),e[2]=L,e[3]=y,e[4]=k):k=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(dE),e[5]=w):w=e[5];const S=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let C;e[6]!==S||e[7]!==j?(C=re("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",S,j),e[6]=S,e[7]=j,e[8]=C):C=e[8];const N=cE[f];let V;e[9]!==N?(V=re("shrink-0",N),e[9]=N,e[10]=V):V=e[10];let T;e[11]!==s||e[12]!==V?(T=r.jsx("span",{className:V,children:s}),e[11]=s,e[12]=V,e[13]=T):T=e[13];let E;e[14]!==n?(E=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=E):E=e[15];let P;e[16]!==i?(P=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=P):P=e[17];const D=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==D?(I=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(Qt,{size:16,style:{transform:D,transition:`transform 180ms ${p9}`}})}),e[18]=D,e[19]=I):I=e[19];let R;e[20]!==m?(R=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=R):R=e[21];let $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let B,M;e[24]!==_?(B=te=>{te.stopPropagation(),_()},M=te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),te.stopPropagation(),_())},e[24]=_,e[25]=B,e[26]=M):(B=e[25],M=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 z;e[28]!==R||e[29]!==$||e[30]!==B||e[31]!==M?(z=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":R,title:$,onClick:B,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:O}),e[28]=R,e[29]=$,e[30]=B,e[31]=M,e[32]=z):z=e[32];let U;e[33]!==p||e[34]!==T||e[35]!==E||e[36]!==P||e[37]!==I||e[38]!==z||e[39]!==C?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:w,className:C,children:[T,E,P,I,z]}),e[33]=p,e[34]=T,e[35]=E,e[36]=P,e[37]=I,e[38]=z,e[39]=C,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 ${p9}`},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 X;e[44]!==Y?(X={opacity:Y,transition:`opacity 120ms ${p9}`,maxHeight:"60vh"},e[44]=Y,e[45]=X):X=e[45];let ne;e[46]!==o?(ne=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]=ne):ne=e[47];let se;e[48]!==c||e[49]!==o?(se=c?r.jsx("div",{className:re("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=se):se=e[50];let oe;e[51]!==ne||e[52]!==se?(oe=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ne,se]}),e[51]=ne,e[52]=se,e[53]=oe):oe=e[53];let Z;e[54]!==l||e[55]!==a?(Z=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]=Z):Z=e[56];let J;e[57]!==X||e[58]!==oe||e[59]!==Z?(J=r.jsx("div",{style:W,children:r.jsxs("div",{className:"flex flex-col",style:X,children:[oe,Z]})}),e[57]=X,e[58]=oe,e[59]=Z,e[60]=J):J=e[60];let q;e[61]!==K||e[62]!==J?(q=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:J}),e[61]=K,e[62]=J,e[63]=q):q=e[63];let G;return e[64]!==U||e[65]!==q||e[66]!==k||e[67]!==f?(G=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:k,children:[U,q]}),e[64]=U,e[65]=q,e[66]=k,e[67]=f,e[68]=G):G=e[68],G}function dE(t){return!t}const uE=Vi({content:on().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:op(["pending","in_progress","completed"]),activeForm:on().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),h6=Vi({todos:uj(uE)}),hE="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.";aN({description:hE,inputSchema:cN(h6),execute:async({todos:t})=>({ok:!0,count:t.length})});const fE="tool-todo_write",mE=new Set(["input-available","output-available"]);function pE(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!==fE||typeof o.state!="string"||!mE.has(o.state))continue;const l=h6.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function f6(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:dl(cC(n)),input:s.input})}return e}function m6(t){return t.at(-1)}function p6(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 gE(t){return t?t.message.startsWith("[CREDITS]"):!1}const xE="[SUBSCRIPTION_REQUIRED]";function g6(t){return t?.message.startsWith(xE)?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 bE={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function vE(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&gE(s))return{...bE,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,h=p6(a),f=f6(c),m=pE(e),p=i?null:g6(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=h.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function x6(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=bi(),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=vE({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 yE(){const t=x6();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 b6(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 _E="__home__";function l2(t,e){return lp.chatDraft(t,e)}function LE(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 v6(t,e,s,n,i){const o=l2(e,s);if(b6(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(wE(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function R3(t,e,s){const n=l2(e,s),i=t.getItem(n),o=LE(i);return i!==null&&o===null&&t.removeItem(n),o}function SE(t,e,s){t.removeItem(l2(e,s))}function wE(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function En(t){const e=F.c(14),s=Ws(t),n=Ls(),i=s?.metadata,o=n?.activeTask,l=o?.metadata?.runtime;let a;e[0]!==l?(a=jN(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!o&&!o.partial,u=o?.metadata;let h;e[2]!==i||e[3]!==u?(h=ly(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=ay(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=vp(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function kE(t){const e=F.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=ie();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=re("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==l?(u=l("chat.pagination.previousLabel"),e[2]=l,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(nf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=r.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":u,children:h}),e[5]=i,e[6]=a,e[7]=d,e[8]=u,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=re("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let _;e[18]!==l?(_=l("chat.pagination.nextLabel"),e[18]=l,e[19]=_):_=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Bo,{size:14}),e[20]=L):L=e[20];let y;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":_,children:L}),e[21]=o,e[22]=x,e[23]=v,e[24]=_,e[25]=y):y=e[25];let k;return e[26]!==y||e[27]!==f||e[28]!==g?(k=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,y]}),e[26]=y,e[27]=f,e[28]=g,e[29]=k):k=e[29],k}function y6(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(kE,{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 jE(t){const e=F.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,submitLabel:l,nextLabel:a}=t,u=n?l===void 0?"Submit":l:a===void 0?"Next":a,h=n?s:!i,f=h?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==h||e[1]!==o?(m=()=>{h||o()},e[0]=h,e[1]=o,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=re("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==g?(x=r.jsx(de,{type:"button",size:"sm","aria-disabled":h,onClick:m,className:g,children:u}),e[5]=h,e[6]=u,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(He,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==f?(_=r.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;return e[14]!==v||e[15]!==_?(L=r.jsxs(We,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16],L}function _6(t,e,s){return t.findIndex(n=>e(n)===s)}function I3(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function M3(t,e,s,n,i){if(t.length===0)return null;const o=_6(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 CE(t){return!t.isStreaming&&t.allAnswered}function L6(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=A.useState(c),[h,f]=A.useState(!1),m=ap({resolver:dv(n),defaultValues:i}),p=m.watch(),g=_6(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=I3(e,s,p,l),_=CE({isStreaming:o,allAnswered:v}),L=()=>{if(g>0){const N=e[g-1];N&&u(s(N))}},y=()=>{if(g>=0&&g<e.length-1){const N=e[g+1];N&&u(s(N))}},k=()=>{const N=m.getValues(),V=M3(e,s,N,l,d);V&&u(V)},w=()=>{m.handleSubmit(N=>{const V=N;for(const T of e)a(T,V[s(T)])})()},S=A.useRef(w);S.current=w;const j=()=>{_&&(f(!1),S.current())},C=()=>{const N=m.getValues();if(I3(e,s,N,l)){if(o){f(!0);return}f(!1),S.current()}else{const V=M3(e,s,N,l,d);V&&u(V)}};return A.useEffect(()=>{if(h&&!o){if(!v){f(!1);return}f(!1),S.current()}},[h,o,v]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:_,goPrev:L,goNext:y,advanceToNextUnanswered:k,submit:j,submitOrAdvance:C}}const S6="chat.approval.defaultDenyReason";function w6(t){const e=F.c(36),{onYolo:s}=t,n=ie(),[i,o]=Oi();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const L=el.find(w=>w.value===i.toolApprovalLevel)??el[0];let y;e[13]!==s||e[14]!==i||e[15]!==o?(y=w=>{const S=w,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:S}),S==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=y):y=e[16];const k=y;c=Cs,m=i.toolApprovalLevel,p=k,a=Ns,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=NE,l=Is,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]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],u=e[8],h=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]!==u||e[22]!==h||e[23]!==f||e[24]!==g?(x=r.jsx(a,{size:u,className:h,onClick:f,children:g}),e[20]=a,e[21]=u,e[22]=h,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=el.map(L=>r.jsx(Pt,{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(Vs,{children:b}),e[28]=b,e[29]=v):v=e[29];let _;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(_=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]=_):_=e[35],_}function NE(t){return t.stopPropagation()}function k6(t){const e=F.c(8),{input:s}=t,n=ie();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 VE(t){const e=F.c(38),{approval:s,onRespond:n}=t,i=ie(),[o]=Oi(),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(S6),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 u=d;let h;e[9]!==s.approvalId||e[10]!==n?(h=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=h):h=e[11];const f=h;let m;e[12]!==f?(m=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(w6,{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(de,{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]!==u||e[22]!==b?(v=r.jsx(de,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:b}),e[21]=u,e[22]=b,e[23]=v):v=e[23];let _;e[24]!==x||e[25]!==v?(_=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=_):_=e[26];const L=_;let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(sf,{size:14}),e[27]=y):y=e[27];let k;e[28]!==i?(k=i("chat.approval.needsApproval"),e[28]=i,e[29]=k):k=e[29];let w;e[30]!==s.input?(w=r.jsx(k6,{input:s.input}),e[30]=s.input,e[31]=w):w=e[31];let S;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==k||e[36]!==w?(S=r.jsx(Eo,{icon:y,label:k,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:w}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=k,e[36]=w,e[37]=S):S=e[37],S}const TE=hj(on(),Vi({approved:fj().optional(),levelOverride:op(["auto","readonly"]).optional()}));function EE(t){const e=F.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=ie(),[l]=Oi(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(DE)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==o?(u=(V,T)=>{const E=T;typeof E?.approved=="boolean"&&i(V.approvalId,E.approved,E.approved===!1?o(S6):void 0,E.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:PE,schema:TE,defaultValues:d,isStreaming:n,hasAnswer:AE,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=L6(h);let m;e[11]!==s||e[12]!==f?(m=V=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:V}]))),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=V=>{V.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(sf,{size:14}),e[16]=v):v=e[16];let _;e[17]!==s.length||e[18]!==o?(_=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=_):_=e[19];const L=g?.friendlyName??"";let y;e[20]!==p?(y=r.jsx(w6,{onYolo:p}),e[20]=p,e[21]=y):y=e[21];let k;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==y?(k=r.jsx(y6,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:y}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=y,e[27]=k):k=e[27];let w;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(w=g?r.jsx(RE,{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]=w):w=e[31];let S;e[32]!==g?(S=g?r.jsx(k6,{input:g.input}):null,e[32]=g,e[33]=S):S=e[33];let j;e[34]!==k||e[35]!==w||e[36]!==S||e[37]!==_||e[38]!==L?(j=r.jsx(Eo,{icon:v,label:_,title:L,defaultExpanded:!0,footerLeft:k,footerRight:w,children:S}),e[34]=k,e[35]=w,e[36]=S,e[37]=_,e[38]=L,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==b?(C=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=C):C=e[42];let N;return e[43]!==f.form||e[44]!==C?(N=r.jsx(L1,{...x,children:C}),e[43]=f.form,e[44]=C,e[45]=N):N=e[45],N}function AE(t){return typeof t?.approved=="boolean"}function PE(t){return t.approvalId}function DE(t){return[t.approvalId,{approved:void 0}]}function RE(t){const e=F.c(7),{approvalId:s,control:n,onChange:i}=t,o=ie(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(de,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),i()},"aria-pressed":f,children:o("chat.approval.denyButton")}),r.jsx(de,{type:"button",variant:h?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),i()},"aria-pressed":h,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(Ds,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function IE(){const t=F.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(sf,{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 ME(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(IE,{}),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(VE,{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(EE,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function $E(t){const e=F.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=ie();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(de,{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 u;e[8]!==o?(u=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=r.jsx(de,{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:u}),e[10]=a,e[11]=u,e[12]=h):h=e[12];let f;e[13]!==d||e[14]!==h?(f=r.jsxs(r.Fragment,{children:[d,h]}),e[13]=d,e[14]=h,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(cy,{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(dC,{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(Eo,{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 OE(t){const e=F.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=m6(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($E,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function j6(t){return t?"response"in t?t.response:t.option??t.draft:""}const $3=Vi({response:on().min(1,"Response is required")}),BE=Vi({option:on().nullable(),draft:on()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),zE=Vi({response:op(["yes","no"])});function FE(t){switch(t.type){case"text":return $3;case"choice":return BE;case"confirm":return zE;default:return $3}}function UE(t){const e={};for(const s of t)e[s.toolCallId]=FE(s.input);return Vi(e)}function HE(t){const e=F.c(7),{control:s,name:n,placeholder:i}=t,o=ie();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,u=d.value??"";return r.jsxs(Ap,{children:[r.jsx(Pp,{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(_p,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:u,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(Dp,{})]})},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(jy,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function C6(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]),A.useEffect(n,i)}function KE(t){const e=F.c(51),{control:s,name:n,options:i}=t,o=ie(),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}=L3(a),d=`${n}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:h}=L3(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=D=>{const I=i[D];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=p):p=e[8],C6(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 D;e[16]!==c||e[17]!==f||e[18]!==o?(D=(I,R)=>{const $=f===I;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:re("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:I}),children:[r.jsx("span",{className:re("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:R+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${R}-${I}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=D):D=e[19],b=i.map(D),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",_=!g&&"hover:bg-accent/30";let L;e[20]!==v||e[21]!==_?(L=re("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,_),e[20]=v,e[21]=_,e[22]=L):L=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(_p,{size:16,className:"text-muted-foreground"})}),e[23]=y):y=e[23];const k=g?m:"";let w;e[24]!==h||e[25]!==c||e[26]!==f?(w=D=>{h.onChange(D.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=w):w=e[27];let S;e[28]!==c||e[29]!==f?(S=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=S):S=e[30];let j;e[31]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let C;e[33]!==o?(C=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=C):C=e[34];let N;e[35]!==k||e[36]!==w||e[37]!==S||e[38]!==j||e[39]!==C?(N=r.jsx("input",{type:"text",value:k,onChange:w,onFocus:S,placeholder:j,"aria-label":C,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=k,e[36]=w,e[37]=S,e[38]=j,e[39]=C,e[40]=N):N=e[40];let V;e[41]!==L||e[42]!==N?(V=r.jsxs("label",{className:L,children:[y,N]}),e[41]=L,e[42]=N,e[43]=V):V=e[43];let T;e[44]!==V||e[45]!==x||e[46]!==b?(T=r.jsx(Pp,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,V]})}),e[44]=V,e[45]=x,e[46]=b,e[47]=T):T=e[47];let E;e[48]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(Dp,{}),e[48]=E):E=e[48];let P;return e[49]!==T?(P=r.jsxs(Ap,{children:[T,E]}),e[49]=T,e[50]=P):P=e[50],P}function WE(t){const e=F.c(8),{control:s,name:n}=t,i=ie();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=A.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{a.current?.onChange(l[h]??"")},e[1]=c):c=e[1],C6(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,r.jsxs(Ap,{children:[r.jsx(Pp,{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:re("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:re("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(Dp,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=r.jsx(jy,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}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(HE,{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(KE,{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(WE,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function qE(t){const e=F.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=UE(s.map(QE)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(JE)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(M,O)=>{const z=j6(O);z&&i(M,z)},e[4]=i,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(u={parts:s,partKey:YE,schema:l,defaultValues:c,isStreaming:n,hasAnswer:GE,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=u):u=e[11];const h=L6(u),f=h.currentPart,m=ie();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const M=f;if(!M)return;const O=m("chat.userAskQuestion.skipMessage"),z=M.toolCallId;M.input?.type==="choice"?(h.form.setValue(`${z}.option`,null),h.form.setValue(`${z}.draft`,O)):h.form.setValue(`${z}.response`,O),h.advanceToNextUnanswered()},e[12]=f,e[13]=h,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==h.currentIndex||e[17]!==h.goNext||e[18]!==h.goPrev||e[19]!==s.length?(x=r.jsx(y6,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext}),e[16]=h.currentIndex,e[17]=h.goNext,e[18]=h.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 _;e[23]!==g||e[24]!==v?(_=r.jsx(de,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=_):_=e[25];let L;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(L=r.jsx(jE,{isStreaming:n,isAllAnswered:h.isAllAnswered,isCurrentAnswered:h.isCurrentAnswered,onAdvanceOrSubmit:h.submitOrAdvance}),e[26]=h.isAllAnswered,e[27]=h.isCurrentAnswered,e[28]=h.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let y;e[31]!==_||e[32]!==L?(y=r.jsxs(r.Fragment,{children:[_,L]}),e[31]=_,e[32]=L,e[33]=y):y=e[33];const k=y;if(s.length===1){const M=s[0];if(!M?.input)return null;const O=h.form;let z;e[34]!==h?(z=oe=>{oe.preventDefault(),h.submit()},e[34]=h,e[35]=z):z=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(S1,{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]!==M.input?.prompt||e[40]!==m?(K=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=K):K=e[41];const W=M.input;let Y;e[42]!==h.form.control||e[43]!==M.toolCallId||e[44]!==W?(Y=r.jsx(O3,{input:W,control:h.form.control,toolCallId:M.toolCallId}),e[42]=h.form.control,e[43]=M.toolCallId,e[44]=W,e[45]=Y):Y=e[45];let X;e[46]!==k||e[47]!==H||e[48]!==K||e[49]!==Y?(X=r.jsx(Eo,{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]=X):X=e[50];let ne;e[51]!==z||e[52]!==X?(ne=r.jsx("form",{onSubmit:z,autoComplete:"off",children:X}),e[51]=z,e[52]=X,e[53]=ne):ne=e[53];let se;return e[54]!==h.form||e[55]!==ne?(se=r.jsx(L1,{...O,children:ne}),e[54]=h.form,e[55]=ne,e[56]=se):se=e[56],se}const w=h.form;let S;e[57]!==h?(S=M=>{M.preventDefault(),h.submit()},e[57]=h,e[58]=S):S=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(S1,{size:14}),e[59]=j):j=e[59];let C;e[60]!==m?(C=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=C):C=e[61];const N=h.currentIndex+1;let V;e[62]!==s.length||e[63]!==m||e[64]!==N?(V=m("chat.userAskQuestion.questionCount",{current:N,total:s.length}),e[62]=s.length,e[63]=m,e[64]=N,e[65]=V):V=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 E=h.activeKey,P=h.setActiveKey;let D;if(e[69]!==h.form||e[70]!==s){let M;e[72]!==h.form?(M=O=>r.jsx(rl,{value:O.toolCallId,className:"mt-0",children:r.jsx(O3,{input:O.input,control:h.form.control,toolCallId:O.toolCallId})},O.toolCallId),e[72]=h.form,e[73]=M):M=e[73],D=s.map(M),e[69]=h.form,e[70]=s,e[71]=D}else D=e[71];let I;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==D?(I=r.jsx(_c,{value:E,onValueChange:P,children:D}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=D,e[77]=I):I=e[77];let R;e[78]!==b||e[79]!==k||e[80]!==C||e[81]!==V||e[82]!==T||e[83]!==I?(R=r.jsx(Eo,{icon:j,label:C,count:V,title:T,defaultExpanded:!0,footerLeft:b,footerRight:k,children:I}),e[78]=b,e[79]=k,e[80]=C,e[81]=V,e[82]=T,e[83]=I,e[84]=R):R=e[84];let $;e[85]!==S||e[86]!==R?($=r.jsx("form",{onSubmit:S,autoComplete:"off",children:R}),e[85]=S,e[86]=R,e[87]=$):$=e[87];let B;return e[88]!==h.form||e[89]!==$?(B=r.jsx(L1,{...w,children:$}),e[88]=h.form,e[89]=$,e[90]=B):B=e[90],B}function GE(t){return!!j6(t)}function YE(t){return t.toolCallId}function JE(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function QE(t){return{toolCallId:t.toolCallId,input:t.input}}function XE(){const t=F.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(S1,{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 N6(t){const e=F.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(ZE),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(XE,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(qE,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function ZE(t){return t.state==="input-available"}function eA(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 tA(t){const e=F.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=eA(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx(rA,{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(sA),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 u;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==o||e[11]!==d?(u=r.jsx(Eo,{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]=u):u=e[12],u}function sA(t,e){return r.jsx(nA,{todo:t},e)}function nA(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(iA,{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=re("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",u=n?"width 300ms ease 200ms":"width 150ms ease";let h;e[4]!==d||e[5]!==u?(h=r.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=h):h=e[6];let f;e[7]!==o||e[8]!==c||e[9]!==h?(f=r.jsxs("span",{className:c,children:[o,h]}),e[7]=o,e[8]=c,e[9]=h,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 iA(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 rA(t){const e=F.c(13),{status:s}=t,n=ie();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 oA={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"}]},lA=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function V6(t){const e=F.c(65),{onDismiss:s}=t,{org:n}=qe(),i=zt(),{decoKeyId:o}=$p(),l=$s(),a=ie(),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Je("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]),A.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 _;e[8]!==a?(_=W=>{pe.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=_):_=e[9];let L;e[10]!==b||e[11]!==v||e[12]!==_?(L={mutationFn:b,onSuccess:v,onError:_},e[10]=b,e[11]=v,e[12]=_,e[13]=L):L=e[13];const{mutate:y,isPending:k}=Rs(L),w=parseFloat(c),S=!isNaN(w)&&w>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["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]=C):C=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=N):N=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=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]=V):V=e[18];let T;e[19]!==a?(T=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=T):T=e[20];let E;e[21]!==T?(E=r.jsx(Wt,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=E):E=e[22];let P;e[23]!==a?(P=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=P):P=e[24];let D;e[25]!==P?(D=r.jsx(Fn,{className:"mt-1.5 text-sm leading-relaxed",children:P}),e[25]=P,e[26]=D):D=e[26];let I;e[27]!==E||e[28]!==D?(I=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,r.jsxs(xs,{className:"relative gap-4",children:[V,r.jsxs("div",{children:[E,D]})]})]}),e[27]=E,e[28]=D,e[29]=I):I=e[29];let R;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==w||e[34]!==o||e[35]!==S||e[36]!==k||e[37]!==u||e[38]!==a||e[39]!==y?(R=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(Hd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Hd,{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:oA[f].map(W=>{const{dollars:Y,labelKey:X}=W;return r.jsxs("button",{type:"button",disabled:k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Y*100,currency:f,tier_label:X,source:"exhausted_banner"}),y(Y*100)},className:re("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(X)})]},Y)})}),u?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(bt,{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(de,{className:"h-10",disabled:!S||k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(w*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(w*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:()=>h(!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:lA.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(Rt,{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]=w,e[34]=o,e[35]=S,e[36]=k,e[37]=u,e[38]=a,e[39]=y,e[40]=R):R=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let B;e[43]!==s||e[44]!==$?(B=r.jsx(de,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=B):B=e[45];let M;e[46]!==i||e[47]!==s||e[48]!==n.slug?(M=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let O;e[50]!==a?(O=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=O):O=e[51];let z;e[52]!==M||e[53]!==O?(z=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:O}),e[52]=M,e[53]=O,e[54]=z):z=e[54];let U;e[55]!==B||e[56]!==z?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,z]}),e[55]=B,e[56]=z,e[57]=U):U=e[57];let H;e[58]!==I||e[59]!==R||e[60]!==U?(H=r.jsxs(It,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:aA,children:[I,R,U]}),e[58]=I,e[59]=R,e[60]=U,e[61]=H):H=e[61];let K;return e[62]!==H||e[63]!==j?(K=r.jsx(Mt,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=K):K=e[64],K}function aA(t){return t.preventDefault()}const cA={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 dA(t){const e=F.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=ie(),{label:l,title:a}=cA[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Vl,{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 u;e[4]!==o||e[5]!==a?(u=o(a),e[4]=o,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==o?(h=s==="trial_exhausted"?r.jsx(de,{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]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=r.jsx(Eo,{icon:c,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:h}),e[11]=n,e[12]=d,e[13]=u,e[14]=h,e[15]=f):f=e[15],f}function uA(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 hA={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function J0(t){const e=F.c(29),s=ie(),{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?cn:Io;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=hA[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 u=d;let h;e[8]!==o||e[9]!==u?(h=o?uA(u):{summary:u,rawDetails:null},e[8]=o,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;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(de,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(de,{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(an,{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(Eo,{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 gf(){const t=F.c(73),e=ie(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=bi(),[u,h]=Oi(),{virtualMcpId:f,createTaskWithMessage:m}=sn(),{chatMode:p,simpleModeTier:g}=Mo(),{mutate:x}=Ny("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 _;t[2]!==p||t[3]!==g||t[4]!==f?(_=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=_):_=t[5];const L=_;let y;t[6]!==u.toolApprovalLevel?(y=u.toolApprovalLevel??mj(),t[6]=u.toolApprovalLevel,t[7]=y):y=t[7];const k=y,w=l.at(-1),S=w?.role==="assistant"?w.parts:[],j=S.filter(gA),C=p6(S),N=f6(S);let V;t[8]!==s||t[9]!==d||t[10]!==e?(V=()=>{if(s){const ee={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ee)}},t[8]=s,t[9]=d,t[10]=e,t[11]=V):V=t[11];const T=V;let E;t[12]!==d||t[13]!==e?(E=()=>{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]=E):E=t[14];const P=E;let D;t[15]!==L||t[16]!==k||t[17]!==c?(D=(le,ee)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ee}},L(k))},t[15]=L,t[16]=k,t[17]=c,t[18]=D):D=t[18];const I=D;let R;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(R=le=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=R):R=t[24];const $=R,B=pA;let M;t[25]!==L||t[26]!==c?(M=(le,ee,ae,ue)=>{c({kind:"approval",approvalId:le,approved:ee,...ae?{reason:ae}:{}},L(ue))},t[25]=L,t[26]=c,t[27]=M):M=t[27];const O=M,z=x6();if(z.isCreditExhausted){let le;return t[28]!==n?(le=r.jsx(V6,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:U,showWarning:H,hasApprovals:K}=z,W=j.map(mA).join("|"),Y=m6(C)?.toolCallId??"",X=N.map(fA).join("|");let ne;t[30]!==z.todos?(ne=r.jsx(tA,{todos:z.todos}),t[30]=z.todos,t[31]=ne):ne=t[31];let se;t[32]!==n||t[33]!==z.subscriptionErrorKind||t[34]!==v?(se=z.subscriptionErrorKind&&r.jsx(dA,{kind:z.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=z.subscriptionErrorKind,t[34]=v,t[35]=se):se=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==U?(oe=U&&r.jsx(J0,{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 Z;t[41]!==o||t[42]!==i||t[43]!==P||t[44]!==H?(Z=H&&r.jsx(J0,{variant:"warning",finishReason:i,onDismiss:o,onContinue:P}),t[41]=o,t[42]=i,t[43]=P,t[44]=H,t[45]=Z):Z=t[45];let J;t[46]!==X||t[47]!==O||t[48]!==K||t[49]!==a||t[50]!==N?(J=K&&r.jsx(ME,{approvals:N,isStreaming:a,onRespond:O},X),t[46]=X,t[47]=O,t[48]=K,t[49]=a,t[50]=N,t[51]=J):J=t[51];let q;t[52]!==z.hasPlans||t[53]!==$||t[54]!==B||t[55]!==a||t[56]!==C||t[57]!==Y?(q=z.hasPlans&&r.jsx(OE,{plans:C,isStreaming:a,onApprove:$,onDismiss:B},Y),t[52]=z.hasPlans,t[53]=$,t[54]=B,t[55]=a,t[56]=C,t[57]=Y,t[58]=q):q=t[58];let G;t[59]!==z.isWaitingForUserInput||t[60]!==I||t[61]!==a||t[62]!==W||t[63]!==j?(G=z.isWaitingForUserInput&&r.jsx(N6,{userAskParts:j,isStreaming:a,onSubmit:I},W),t[59]=z.isWaitingForUserInput,t[60]=I,t[61]=a,t[62]=W,t[63]=j,t[64]=G):G=t[64];let te;return t[65]!==oe||t[66]!==Z||t[67]!==J||t[68]!==q||t[69]!==G||t[70]!==ne||t[71]!==se?(te=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[ne,se,oe,Z,J,q,G]}),t[65]=oe,t[66]=Z,t[67]=J,t[68]=q,t[69]=G,t[70]=ne,t[71]=se,t[72]=te):te=t[72],te}function fA(t){return t.approvalId}function mA(t){return t.toolCallId}function pA(){document.querySelector("[data-chat-input]")?.focus()}function gA(t){return t.type==="tool-user_ask"}gf.Error=function(e){return r.jsx(J0,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};gf.Warning=function(e){return r.jsx(J0,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};gf.UserAskQuestion=N6;function xA(t){const e=F.c(20),{taskId:s}=t,n=ie(),i=Tv(s),o=Gj(i),l=Yj(),{stop:a,removeLocalMessage:c}=bi();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 u;e[2]!==a?(u=()=>{a()},e[2]=a,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Hh,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:h})}),e[5]=d,e[6]=u,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(Ke,{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(We,{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(de,{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(_=>{_&&(Jj(s,b.messageId),c(b.messageId))})},children:r.jsx(Ai,{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 bA(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 vA={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function yA(t){const e=F.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=ie(),u=lf(),h=new Set(u.map(_A)),f=Qj([i,n,o],h),m=f?.keyId??null,[p,g]=A.useState(m??u[0]?.id??null),x=u.some(R=>R.id===p)?p:m??u[0]?.id??null,b=x?u.find(R=>R.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",_=vA[s];let L;e[0]!==d||e[1]!==_?(L=d(_),e[0]=d,e[1]=_,e[2]=L):L=e[2];let y;e[3]!==L?(y=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=y):y=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 w;e[9]!==y||e[10]!==k?(w=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[y,k]}),e[9]=y,e[10]=k,e[11]=w):w=e[11];const S="flex-1 min-h-0",j=A.Suspense;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(TV,{}),e[12]=C):C=e[12];const N=VV,V=!0,T=bA(m?f:null,b?.providerId??"deco");let E;e[13]!==x||e[14]!==l||e[15]!==g?(E=R=>{const $=R.keyId??x??"";g($),l({keyId:$,modelId:R.modelId,title:R.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=E):E=e[16];let P;e[17]!==N||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==E?(P=r.jsx(N,{compact:V,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:E}),e[17]=N,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=E,e[23]=P):P=e[23];let D;e[24]!==j||e[25]!==P||e[26]!==C?(D=r.jsx("div",{className:S,children:r.jsx(j,{fallback:C,children:P})}),e[24]=j,e[25]=P,e[26]=C,e[27]=D):D=e[27];let I;return e[28]!==D||e[29]!==w?(I=r.jsxs("div",{className:v,children:[w,D]}),e[28]=D,e[29]=w,e[30]=I):I=e[30],I}function _A(t){return t.id}const LA=["fast","smart","thinking"];function T6(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const SA={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function wA(t){const e=F.c(28),{tier:s,pillIcon:n,groups:i}=t,o=ie();let l;e[0]!==o?(l=T6(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=A.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=S=>{S.onSelect(),d(!1)},e[2]=u):u=e[2];const h=u,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=re("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=re("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(Qt,{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(He,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(is,{asChild:!0,children:r.jsxs(de,{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 _;e[12]!==f?(_=r.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;e[14]!==v||e[15]!==_?(L=r.jsxs(We,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16];let y;if(e[17]!==i||e[18]!==o){let S;e[20]!==o?(S=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(C=>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":C.title,onClick:()=>h(C),className:re("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",C.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[C.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:C.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:C.title}),C.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle})]}),C.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(Rt,{size:14,className:"text-foreground mt-0.5"})})]}),C.modelOverride&&r.jsx(jA,{label:C.title,render:C.modelOverride})]},C.key))},j.key),e[20]=o,e[21]=S):S=e[21],y=i.map(S),e[17]=i,e[18]=o,e[19]=y}else y=e[19];let k;e[22]!==y?(k=r.jsx(rs,{align:"end",className:"p-1 w-64",onOpenAutoFocus:kA,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:y})}),e[22]=y,e[23]=k):k=e[23];let w;return e[24]!==c||e[25]!==L||e[26]!==k?(w=r.jsxs(os,{open:c,onOpenChange:d,children:[L,k]}),e[24]=c,e[25]=L,e[26]=k,e[27]=w):w=e[27],w}function kA(t){return t.preventDefault()}function jA(t){const e=F.c(38),{label:s,render:n}=t,i=ie(),o=Ro(),[l,a]=A.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 u;e[1]!==s||e[2]!==i?(u=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=u):u=e[3];const h=l&&"opacity-100";let f;e[4]!==h?(f=re("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",h),e[4]=h,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Lp,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=r.jsx("button",{type:"button","aria-label":u,className:f,children:m}),e[7]=u,e[8]=f,e[9]=p):p=e[9];const g=p;if(o){let L;e[10]!==g?(L=r.jsx(Gv,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let y;e[12]!==s||e[13]!==i?(y=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=y):y=e[14];let k;e[15]!==y?(k=r.jsx(Yh,{className:"sr-only",children:y}),e[15]=y,e[16]=k):k=e[16];let w;e[17]!==l||e[18]!==n?(w=l&&n(d),e[17]=l,e[18]=n,e[19]=w):w=e[19];let S;e[20]!==w||e[21]!==k?(S=r.jsxs(Jh,{className:"p-0 flex flex-col max-h-[95vh]",children:[k,w]}),e[20]=w,e[21]=k,e[22]=S):S=e[22];let j;return e[23]!==l||e[24]!==S||e[25]!==L?(j=r.jsxs(Qh,{open:l,onOpenChange:a,children:[L,S]}),e[23]=l,e[24]=S,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(is,{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(rs,{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 _;return e[34]!==l||e[35]!==x||e[36]!==v?(_=r.jsxs(os,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=_):_=e[37],_}function B3(t){return t==="fast"?r.jsx(Vl,{size:16}):t==="thinking"?r.jsx(dy,{size:16}):r.jsx(Br,{size:16})}function CA(t){const e=F.c(13),s=eC();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const u=s.tiers[d];return u?u.title??u.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 NA(){const t=F.c(22),e=ie(),{simpleModeTier:s,setSimpleModeTier:n}=Mo(),i=IV(),o=lf(),l=MV(o),a=CA(l),{data:c,error:d}=Xj();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=Zj();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]!==h||t[10]!==d){const _=T6(e);m="decopilot",p=LA.map(L=>{const y=a[L],k=h.tiers[L];return{key:`decopilot-${L}`,icon:B3(L),title:_[L],subtitle:y??e(SA[L]),active:s===L,onSelect:()=>n(L),modelOverride:w=>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(yA,{tier:L,orgSlot:i.tiers[L],userSlot:k,autoSlot:l.chat[L],onClose:w,onPick:S=>f.mutate({tier:L,slot:S}),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]=h,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=B3(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(wA,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function a2(t,e,s,n,i,o){if(!rf(e)){pe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!EV(l,e)){const c=Vy(e).parts.map(u=>o(u)).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 u=await d,h={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};uC(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),pe.error(`Failed to load file "${s.name}"`)}}function VA(t){const e=F.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=ie(),l=A.useRef(EA);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(h,f)=>{await a2(s,n,h,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]),A.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new Ur("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new Gh({key:h,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 _=p.posAtCoords({left:g.clientX,top:g.clientY});if(!_)return!1;const L=Array.from(v);return(async()=>{let y=_.pos;for(const k of L)await l.current?.(k,y),y=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(TA);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const _ of b){const L=_.getAsFile();L&&(await l.current?.(L,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(h)}},u=[s],e[6]=s,e[7]=d,e[8]=u):(d=e[7],u=e[8]),A.useEffect(d,u),null}function TA(t){return t.kind==="file"}function EA(){return Promise.resolve()}function AA(t){const e=F.c(43),{info:s,onClose:n}=t,i=ie(),o=s!==null;let l;e[0]!==n?(l=V=>!V&&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(Io,{size:18})}),e[4]=d):d=e[4];let u;e[5]!==i?(u=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Wt,{className:"text-xl font-semibold tracking-tight",children:u}),e[7]=u,e[8]=h):h=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(Fn,{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]!==h?(x=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(xs,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,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 _;e[22]!==v?(_=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=_):_=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(uy,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const y=s?.accepted;let k;e[25]!==y?(k=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,r.jsx("span",{className:"capitalize",children:y})]}),e[25]=y,e[26]=k):k=e[26];let w;e[27]!==_||e[28]!==k?(w=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:[_,k]})}),e[27]=_,e[28]=k,e[29]=w):w=e[29];let S;e[30]!==i?(S=i("chat.uploader.gotIt"),e[30]=i,e[31]=S):S=e[31];let j;e[32]!==n||e[33]!==S?(j=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(de,{onClick:n,children:S})}),e[32]=n,e[33]=S,e[34]=j):j=e[34];let C;e[35]!==x||e[36]!==w||e[37]!==j?(C=r.jsxs(It,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:PA,children:[x,w,j]}),e[35]=x,e[36]=w,e[37]=j,e[38]=C):C=e[38];let N;return e[39]!==o||e[40]!==l||e[41]!==C?(N=r.jsx(Mt,{open:o,onOpenChange:l,children:C}),e[39]=o,e[40]=l,e[41]=C,e[42]=N):N=e[42],N}function PA(t){return t.preventDefault()}function DA(){const t=F.c(3),[e,s]=A.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 E6=hC;var RA=["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] *)"],C1=RA.join(","),A6=typeof Element>"u",Gd=A6?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Q0=!A6&&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},X0=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]"):X0(e.parentNode));return l},IA=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},MA=function(e,s,n){if(X0(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(C1));return s&&Gd.call(e,C1)&&i.unshift(e),i=i.filter(n),i},N1=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!X0(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=N1(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=Gd.call(l,C1);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!X0(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=N1(h===!0?l.children:h.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},P6=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},D6=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||IA(e))&&!P6(e)?0:e.tabIndex},$A=function(e,s){var n=D6(e);return n<0&&s&&!P6(e)?0:n},OA=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},R6=function(e){return e.tagName==="INPUT"},BA=function(e){return R6(e)&&e.type==="hidden"},zA=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},FA=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},UA=function(e){if(!e.name)return!0;var s=e.form||Q0(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=FA(i,e.form);return!o||o===e},HA=function(e){return R6(e)&&e.type==="radio"},KA=function(e){return HA(e)&&!UA(e)},WA=function(e){var s,n=e&&Q0(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,u,h;n=Q0(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return o},z3=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},qA=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=Gd.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Gd.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,u=Q0(e);if(d&&!d.shadowRoot&&i(d)===!0)return z3(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(WA(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return z3(e);return!1},GA=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 Gd.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},YA=function(e,s){return!(s.disabled||BA(s)||qA(s,e)||zA(s)||GA(s))},F3=function(e,s){return!(KA(s)||D6(s)<0||!YA(e,s))},JA=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},I6=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=$A(a,l),d=l?I6(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(OA).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},M6=function(e,s){s=s||{};var n;return s.getShadowRoot?n=N1([e],s.includeContainer,{filter:F3.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:JA}):n=MA(e,s.includeContainer,F3.bind(null,s)),I6(n)};function QA(){return/apple/i.test(navigator.vendor)}const U3="data-floating-ui-focusable";function XA(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 V1(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&pj(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function Uc(t){return"composedPath"in t?t.composedPath()[0]:t.target}function g9(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 ZA(t){return t.matches("html,body")}function Yd(t){return t?.ownerDocument||document}function eP(t){return t?t.hasAttribute(U3)?t:t.querySelector("["+U3+"]")||t:null}function A0(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,...A0(t,i.id,s)])}function tP(t){return"nativeEvent"in t}var sP=typeof document<"u",nP=function(){},ol=sP?A.useLayoutEffect:nP;const iP={...uv},rP=iP.useInsertionEffect,oP=rP||(t=>t());function Ta(t){const e=A.useRef(()=>{});return oP(()=>{e.current=t}),A.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 $6=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function O6(t,e){const s=M6(t,$6()),n=s.length;if(n===0)return;const i=XA(Yd(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function lP(t){return O6(Yd(t).body,1)||t}function aP(t){return O6(Yd(t).body,-1)||t}function x9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!V1(s,n)}function cP(t){M6(t,$6()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function H3(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 dP="data-floating-ui-focusable",K3="active",W3="selected",uP={...uv};let q3=!1,hP=0;const G3=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hP++;function fP(){const[t,e]=A.useState(()=>q3?G3():void 0);return ol(()=>{t==null&&e(G3())},[]),A.useEffect(()=>{q3=!0},[]),t}const mP=uP.useId,c2=mP||fP;function pP(){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 gP=A.createContext(null),xP=A.createContext(null),B6=()=>{var t;return((t=A.useContext(gP))==null?void 0:t.id)||null},z6=()=>A.useContext(xP);function d2(t){return"data-floating-ui-"+t}const bP={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},Y3=A.forwardRef(function(e,s){const[n,i]=A.useState();ol(()=>{QA()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[d2("focus-guard")]:"",style:bP};return r.jsx("span",{...e,...o})}),vP={clipPath:"inset(50%)",position:"fixed",top:0,left:0},F6=A.createContext(null),J3=d2("portal");function yP(t){t===void 0&&(t={});const{id:e,root:s}=t,n=c2(),i=LP(),[o,l]=A.useState(null),a=A.useRef(null);return ol(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),ol(()=>{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(J3,""),c.appendChild(d),a.current=d,l(d)},[e,n]),ol(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!_j(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const u=document.createElement("div");u.id=n,u.setAttribute(J3,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),o}function _P(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=yP({id:s,root:n}),[l,a]=A.useState(null),c=A.useRef(null),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return A.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&x9(x)&&(x.type==="focusin"?H3:cP)(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]),A.useEffect(()=>{o&&(m||H3(o))},[m,o]),r.jsxs(F6.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(Y3,{"data-type":"outside",ref:c,onFocus:g=>{if(x9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=aP(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:vP}),o&&Bn.createPortal(e,o),p&&o&&r.jsx(Y3,{"data-type":"outside",ref:d,onFocus:g=>{if(x9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=lP(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const LP=()=>A.useContext(F6),SP={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},wP={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Q3=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 kP(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:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=z6(),x=Ta(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=A.useRef(!1),{escapeKey:_,outsidePress:L}=Q3(m),{escapeKey:y,outsidePress:k}=Q3(p),w=A.useRef(!1),S=Ta(E=>{var P;if(!s||!l||!a||E.key!=="Escape"||w.current)return;const D=(P=o.current.floatingContext)==null?void 0:P.nodeId,I=g?A0(g.nodesRef.current,D):[];if(!_&&(E.stopPropagation(),I.length>0)){let R=!0;if(I.forEach($=>{var B;if((B=$.context)!=null&&B.open&&!$.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}n(!1,tP(E)?E.nativeEvent:E,"escape-key")}),j=Ta(E=>{var P;const D=()=>{var I;S(E),(I=Uc(E))==null||I.removeEventListener("keydown",D)};(P=Uc(E))==null||P.addEventListener("keydown",D)}),C=Ta(E=>{var P;const D=o.current.insideReactTree;o.current.insideReactTree=!1;const I=v.current;if(v.current=!1,d==="click"&&I||D||typeof b=="function"&&!b(E))return;const R=Uc(E),$="["+d2("inert")+"]",B=Yd(i.floating).querySelectorAll($);let M=er(R)?R:null;for(;M&&!u9(M);){const H=bj(M);if(u9(H)||!er(H))break;M=H}if(B.length&&er(R)&&!ZA(R)&&!V1(R,i.floating)&&Array.from(B).every(H=>!V1(M,H)))return;if(vj(R)&&T){const H=u9(R),K=yj(R),W=/auto|scroll/,Y=H||W.test(K.overflowX),X=H||W.test(K.overflowY),ne=Y&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,se=X&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,oe=K.direction==="rtl",Z=se&&(oe?E.offsetX<=R.offsetWidth-R.clientWidth:E.offsetX>R.clientWidth),J=ne&&E.offsetY>R.clientHeight;if(Z||J)return}const O=(P=o.current.floatingContext)==null?void 0:P.nodeId,z=g&&A0(g.nodesRef.current,O).some(H=>{var K;return g9(E,(K=H.context)==null?void 0:K.elements.floating)});if(g9(E,i.floating)||g9(E,i.domReference)||z)return;const U=g?A0(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,E,"outside-press")}),N=Ta(E=>{var P;const D=()=>{var I;C(E),(I=Uc(E))==null||I.removeEventListener(d,D)};(P=Uc(E))==null||P.addEventListener(d,D)});A.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=_,o.current.__outsidePressBubbles=L;let E=-1;function P(B){n(!1,B,"ancestor-scroll")}function D(){window.clearTimeout(E),w.current=!0}function I(){E=window.setTimeout(()=>{w.current=!1},xj()?5:0)}const R=Yd(i.floating);a&&(R.addEventListener("keydown",y?j:S,y),R.addEventListener("compositionstart",D),R.addEventListener("compositionend",I)),b&&R.addEventListener(d,k?N:C,k);let $=[];return f&&(er(i.domReference)&&($=d9(i.domReference)),er(i.floating)&&($=$.concat(d9(i.floating))),!er(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(d9(i.reference.contextElement)))),$=$.filter(B=>{var M;return B!==((M=R.defaultView)==null?void 0:M.visualViewport)}),$.forEach(B=>{B.addEventListener("scroll",P,{passive:!0})}),()=>{a&&(R.removeEventListener("keydown",y?j:S,y),R.removeEventListener("compositionstart",D),R.removeEventListener("compositionend",I)),b&&R.removeEventListener(d,k?N:C,k),$.forEach(B=>{B.removeEventListener("scroll",P)}),window.clearTimeout(E)}},[o,i,a,b,d,s,n,f,l,_,L,S,y,j,C,k,N]),A.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const V=A.useMemo(()=>({onKeyDown:S,...u&&{[SP[h]]:E=>{n(!1,E.nativeEvent,"reference-press")},...h!=="click"&&{onClick(E){n(!1,E.nativeEvent,"reference-press")}}}}),[S,n,u,h]),T=A.useMemo(()=>{function E(P){P.button===0&&(v.current=!0)}return{onKeyDown:S,onMouseDown:E,onMouseUp:E,[wP[d]]:()=>{o.current.insideReactTree=!0}}},[S,d,o]);return A.useMemo(()=>l?{reference:V,floating:T}:{},[l,V,T])}function jP(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=c2(),o=A.useRef({}),[l]=A.useState(()=>pP()),a=B6()!=null,[c,d]=A.useState(n.reference),u=Ta((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)}),h=A.useMemo(()=>({setPositionReference:d}),[]),f=A.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return A.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function CP(t){t===void 0&&(t={});const{nodeId:e}=t,s=jP({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=A.useState(null),[a,c]=A.useState(null),u=i?.domReference||o,h=A.useRef(null),f=z6();ol(()=>{u&&(h.current=u)},[u]);const m=gj({...t,elements:{...i,...a&&{reference:a}}}),p=A.useCallback(_=>{const L=er(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(L),m.refs.setReference(L)},[m.refs]),g=A.useCallback(_=>{(er(_)||_===null)&&(h.current=_,l(_)),(er(m.refs.reference.current)||m.refs.reference.current===null||_!==null&&!er(_))&&m.refs.setReference(_)},[m.refs]),x=A.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=A.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=A.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return ol(()=>{n.dataRef.current.floatingContext=v;const _=f?.nodesRef.current.find(L=>L.id===e);_&&(_.context=v)}),A.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function b9(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[K3]:l,[W3]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[dP]:""},...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,u]=c;if(!(i&&[K3,W3].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof u=="function"){var h;(h=n.get(d))==null||h.push(u),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]=u}),l),{})}}function NP(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=A.useCallback(a=>b9(a,t,"reference"),e),o=A.useCallback(a=>b9(a,t,"floating"),s),l=A.useCallback(a=>b9(a,t,"item"),n);return A.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const VP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function TP(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=c2(),u=((s=o.domReference)==null?void 0:s.id)||d,h=A.useMemo(()=>{var v;return((v=eP(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=VP.get(c))!=null?n:c,p=B6()!=null,g=A.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?h:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?h:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,h,p,i,u,c]),x=A.useMemo(()=>{const v={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=A.useCallback(v=>{let{active:_,selected:L}=v;const y={role:"option",..._&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...y,"aria-selected":L}}return{}},[h,c]);return A.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function EP(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=pC(s),u=new RegExp(`\\s${d}$`),h=l?"^":"",f=i?"":d,m=c?new RegExp(`${h}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${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 _=g+x.index;let L=_+x[0].length;return c&&u.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),_<a.pos&&L>=a.pos?{range:{from:_,to:L},query:x[0].slice(s.length),text:x[0]}:null}var AP=new Ur("suggestion");function PP({pluginKey:t=AP,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=EP,shouldShow:x}){let b;const v=m?.(),_=()=>{const w=e.state.selection.$anchor.pos,S=e.view.coordsAtPos(w),{top:j,right:C,bottom:N,left:V}=S;try{return new DOMRect(V,j,C-V,N-j)}catch{return null}},L=(w,S)=>S?()=>{const j=t.getState(e.state),C=j?.decorationId,N=w.dom.querySelector(`[data-decoration-id="${C}"]`);return N?.getBoundingClientRect()||null}:_;function y(w,S){var j;try{const N=t.getState(w.state),V=N?.decorationId?w.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,T={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:E=>h({editor:e,range:N?.range||{from:0,to:0},props:E}),decorationNode:V,clientRect:L(w,V)};(j=v?.onExit)==null||j.call(v,T)}catch{}const C=w.state.tr.setMeta(S,{exit:!0});w.dispatch(C)}const k=new Gh({key:t,view(){return{update:async(w,S)=>{var j,C,N,V,T,E,P;const D=(j=this.key)==null?void 0:j.getState(S),I=(C=this.key)==null?void 0:C.getState(w.state),R=D.active&&I.active&&D.range.from!==I.range.from,$=!D.active&&I.active,B=D.active&&!I.active,M=!$&&!B&&D.query!==I.query,O=$||R&&M,z=M||R,U=B||R&&M;if(!O&&!z&&!U)return;const H=U&&!O?D:I,K=w.dom.querySelector(`[data-decoration-id="${H.decorationId}"]`);b={editor:e,range:H.range,query:H.query,text:H.text,items:[],command:W=>h({editor:e,range:H.range,props:W}),decorationNode:K,clientRect:L(w,K)},O&&((N=v?.onBeforeStart)==null||N.call(v,b)),z&&((V=v?.onBeforeUpdate)==null||V.call(v,b)),(z||O)&&(b.items=await f({editor:e,query:H.query})),U&&((T=v?.onExit)==null||T.call(v,b)),z&&((E=v?.onUpdate)==null||E.call(v,b)),O&&((P=v?.onStart)==null||P.call(v,b))},destroy:()=>{var w;b&&((w=v?.onExit)==null||w.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(w,S,j,C){const{isEditable:N}=e,{composing:V}=e.view,{selection:T}=w,{empty:E,from:P}=T,D={...S},I=w.getMeta(t);if(I&&I.exit)return D.active=!1,D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null,D;if(D.composing=V,N&&(E||e.view.composing)){(P<S.range.from||P>S.range.to)&&!V&&!S.composing&&(D.active=!1);const R=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:T.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;R&&p({editor:e,state:C,range:R.range,isActive:S.active})&&(!x||x({editor:e,range:R.range,query:R.query,text:R.text,transaction:w}))?(D.active=!0,D.decorationId=S.decorationId?S.decorationId:$,D.range=R.range,D.query=R.query,D.text=R.text):D.active=!1}else D.active=!1;return D.active||(D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null),D}},props:{handleKeyDown(w,S){var j,C,N,V;const{active:T,range:E}=k.getState(w.state);if(!T)return!1;if(S.key==="Escape"||S.key==="Esc"){const D=k.getState(w.state),I=(j=b?.decorationNode)!=null?j:null,R=I??(D?.decorationId?w.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`):null);if(((C=v?.onKeyDown)==null?void 0:C.call(v,{view:w,event:S,range:D.range}))||!1)return!0;const B={editor:e,range:D.range,query:D.query,text:D.text,items:[],command:M=>h({editor:e,range:D.range,props:M}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(N=v?.onExit)==null||N.call(v,B),y(w,t),!0}return((V=v?.onKeyDown)==null?void 0:V.call(v,{view:w,event:S,range:E}))||!1},decorations(w){const{active:S,range:j,decorationId:C,query:N}=k.getState(w);if(!S)return null;const V=!N?.length,T=[c];return V&&T.push(u),fC.create(w.doc,[mC.inline(j.from,j.to,{nodeName:a,class:T.join(" "),"data-decoration-id":C,"data-decoration-content":d})])}}});return k}function DP(t){const e=F.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=A.useState(0),d=A.useRef(i),u=A.useRef(a),h=A.useRef(o),f=A.useRef(l),m=A.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],A.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]),A.useEffect(x,b);let v,_;e[7]!==i?(v=()=>{d.current=i},_=[i],e[7]=i,e[8]=v,e[9]=_):(v=e[8],_=e[9]),A.useEffect(v,_);let L,y;e[10]!==a?(L=()=>{u.current=a},y=[a],e[10]=a,e[11]=L,e[12]=y):(L=e[11],y=e[12]),A.useEffect(L,y);let k,w;e[13]!==o?(w=()=>{h.current=o},k=[o],e[13]=o,e[14]=k,e[15]=w):(k=e[14],w=e[15]),A.useEffect(w,k);let S,j;e[16]!==l?(S=()=>{f.current=l},j=[l],e[16]=l,e[17]=S,e[18]=j):(S=e[17],j=e[18]),A.useEffect(S,j);let C,N;e[19]!==s?(C=()=>{if(s?.isDestroyed)return;let E;try{E=s.view.dom}catch{return}if(!E)return;const P=I=>{const R=d.current;if(!R.length)return!1;const $=()=>c(M=>(M+1)%R.length),B=()=>c(M=>(M-1+R.length)%R.length);switch(I.key){case"ArrowUp":return I.preventDefault(),B(),!0;case"ArrowDown":return I.preventDefault(),$(),!0;case"Tab":return I.preventDefault(),I.shiftKey?B():$(),!0;case"Home":return I.preventDefault(),c(0),!0;case"End":return I.preventDefault(),c(R.length-1),!0;case"Enter":{if(I.isComposing)return!1;I.preventDefault();const M=u.current;return M!==-1&&R[M]&&h.current?.(R[M],M),!0}case"Escape":return I.preventDefault(),f.current?.(),!0;default:return!1}},D=I=>{P(I)};return E.addEventListener("keydown",D,!0),()=>{E?.removeEventListener("keydown",D,!0)}},N=[s],e[19]=s,e[20]=C,e[21]=N):(C=e[20],N=e[21]),A.useEffect(C,N);const V=i.length?a:void 0;let T;return e[22]!==V?(T={selectedIndex:V,setSelectedIndex:c},e[22]=V,e[23]=T):T=e[23],T}function RP(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 U6=A.createContext(void 0);function H6(){const t=A.useContext(U6);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function IP(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]=A.useReducer(RP,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=A.useEffectEvent(u);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof Ur?i:new Ur(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=PP({pluginKey:g,editor:s,char:n,allow(v){const _=s.state.doc.resolve(v.range.from);for(let L=_.depth;L>0;L--)if(_.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}}),h(!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"}),h(!1)}}),items:MP});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=h,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],A.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 MP(){return[]}function $P({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=H6(),l=A.useDeferredValue(i.query),{data:a}=Fh({queryKey:et.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){o({type:"SET_SELECTED_ITEM",payload:h});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:h})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=DP({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function OP({children:t}){const{state:e,dispatch:s}=H6(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=CP({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[Lj(10),Sj(),wj()],whileElementsMounted:kj}),d=kP(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=TP(c,{role:"listbox"}),{getFloatingProps:h}=NP([d,u]);return n?r.jsx(_P,{children:r.jsx("div",{ref:l.setFloating,style:a,...h(),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 BP=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=ar(s._meta);a=s.title||up(s.name,k),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,u=s.icon,h=n&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=re("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",h,f),e[2]=h,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==u||e[6]!==c?(p=u!==void 0&&r.jsx(Vo,{icon:u,name:c,size:"xs",className:"mr-2"}),e[5]=u,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(Ud,{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 _;e[17]!==b||e[18]!==v?(_=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]=_):_=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 y;return e[22]!==i||e[23]!==l||e[24]!==_||e[25]!==L||e[26]!==m||e[27]!==p?(y=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,_,L]}),e[22]=i,e[23]=l,e[24]=_,e[25]=L,e[26]=m,e[27]=p,e[28]=y):y=e[28],y},zP=t=>{const e=F.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=ie();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:u,selectedItem:h}=$P(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]!==u||e[11]!==c||e[12]!==d||e[13]!==h?.name){let g;e[15]!==u||e[16]!==d||e[17]!==h?.name?(g=(x,b)=>r.jsx(BP,{item:x,isSelected:b===d,ref:b===d?HP:void 0,onSelect:()=>u(x,b),isLoading:h?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=u,e[16]=d,e[17]=h?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=u,e[11]=c,e[12]=d,e[13]=h?.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 FP(){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(UP)}),t[0]=e):e=t[0],e}function UP(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 K6(t){const e=F.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let u;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(u={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]=u):u=e[5];const{state:h,dispatch:f}=IP(u);let m;e[6]!==f||e[7]!==h?(m={state:h,dispatch:f},e[6]=f,e[7]=h,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(FP,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(OP,{children:r.jsx(A.Suspense,{fallback:p,children:r.jsx(zP,{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(U6.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function HP(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const KP=t=>{const e=F.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=ie(),l=bs(),{org:a}=qe(),c=uu();let d;e[0]!==c?(d=Up(c),e[0]=c,e[1]=d):d=e[1];const u=d;let h;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(h={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=h):h=e[5];const f=Jt(h);let m;e[6]!==a.id||e[7]!==n?(m=et.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=A.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=A.useEffectEvent(b),_=A.useRef(null),L=A.useRef(!1),y=n??"default";let k;e[11]!==g||e[12]!==a.id||e[13]!==y?(k=["at-mention",a.id,y,g],e[11]=g,e[12]=a.id,e[13]=y,e[14]=k):k=e[14];const w=k;let S;e[15]!==o?(S=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=S):S=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let C;e[19]!==S||e[20]!==j?(C={name:"agents",title:S,description:j,kind:"category",drillable:!0},e[19]=S,e[20]=j,e[21]=C):C=e[21];let N;e[22]!==o?(N=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=N):N=e[23];let V;e[24]!==o?(V=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=V):V=e[25];let T;e[26]!==N||e[27]!==V?(T={name:"resources",title:N,description:V,kind:"category",drillable:!0},e[26]=N,e[27]=V,e[28]=T):T=e[28];let E;e[29]!==T||e[30]!==C?(E=[C,T],e[29]=T,e[30]=C,e[31]=E):E=e[31];const P=E;let D;e[32]!==f||e[33]!==s||e[34]!==o?(D=async z=>{const{item:U,range:H}=z;if(Je("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){Ja(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 hv(f,U.uri);Ja(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]=D):D=e[35];const I=D;let R;e[36]!==c||e[37]!==P||e[38]!==f||e[39]!==u||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(R=async z=>{const{query:U}=z,H=v();if(H==="categories"){if(!U.trim())return P;const Y=U.toLowerCase(),X=c.filter(se=>se.status==="active"&&(!se.id||!W0(se.id))&&!u.has(se.id)&&se.id!==n&&(se.title.toLowerCase().includes(Y)||se.description?.toLowerCase().includes(Y))).map(WP),ne=await(async()=>{if(!f)return[];let se=l.getQueryData(p);return se||(se=await l.fetchQuery({queryKey:p,queryFn:()=>_d(f),staleTime:6e4})),(se?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(Y)||oe.name?.toLowerCase().includes(Y)||oe.description?.toLowerCase().includes(Y)).map(qP)})();return[...X,...ne]}if(H==="agents"){let Y=c.filter(X=>X.status==="active"&&(!X.id||!W0(X.id))&&!u.has(X.id)&&X.id!==n);if(U.trim()){const X=U.toLowerCase();Y=Y.filter(ne=>ne.title.toLowerCase().includes(X)||ne.description?.toLowerCase().includes(X))}return Y.map(GP)}if(!f)return[];let K=l.getQueryData(p);K?l.fetchQuery({queryKey:p,queryFn:()=>_d(f),staleTime:6e4}).catch(YP):K=await l.fetchQuery({queryKey:p,queryFn:()=>_d(f),staleTime:6e4});let W=K?.resources??[];if(U.trim()){const Y=U.toLowerCase();W=W.filter(X=>X.uri.toLowerCase().includes(Y)||X.name?.toLowerCase().includes(Y)||X.description?.toLowerCase().includes(Y))}return W.map(JP)},e[36]=c,e[37]=P,e[38]=f,e[39]=u,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=R):R=e[44];const $=R;let B;e[45]!==i?(B=z=>{if(i&&(i.current=z),z)_.current=Date.now(),L.current=!1,Je("chat_picker_opened",{picker:"@"});else{const U=_.current;Je("chat_picker_closed",{picker:"@",outcome:L.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),_.current=null,x("categories")}},e[45]=i,e[46]=B):B=e[46];const M=B;let O;return e[47]!==s||e[48]!==$||e[49]!==I||e[50]!==M||e[51]!==w?(O=r.jsx(K6,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:w,queryFn:$,onSelect:I,onOpenChange:M}),e[47]=s,e[48]=$,e[49]=I,e[50]=M,e[51]=w,e[52]=O):O=e[52],O};function WP(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function qP(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function GP(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function YP(){}function JP(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function X3(t,e,s,n,i,o,l){try{const a=await cu(s,n,o);Ja(t,e,{id:n,name:bc(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 QP(t,e,s,n,i){try{const o=await hv(s,n);Ja(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 XP(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await BV(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};Ja(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 ZP=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=ie(),i=bs(),{org:o}=qe(),l=Jt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=et.virtualMcpPrompts(e,o.id),c=et.virtualMcpResources(e,o.id),d=et.slashSkills(o.id),u=["slash-mention",o.id,e??"default"],[h,f]=A.useState(null),[m,p]=A.useState(null),g=gC(t);g&&(g.onEditChip=async w=>{if(l)try{const j=(await Z3(i,a,l)).find(C=>C.name===w.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...w,prompt:j})}catch(S){console.error("[slash] Failed to load prompt for editing:",S),pe.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=A.useRef(null),b=A.useRef(!1),v=async({item:w,range:S})=>{if(Je("chat_picker_item_selected",{picker:"/",item_kind:w.kind,item_name:w.name}),b.current=!0,!!l)if(w.kind==="prompt"){if(w.arguments&&w.arguments.length>0){f({range:S,item:w});return}const j=ar(w._meta);await X3(t,S,l,w.name,j,void 0,{t:n})}else w.kind==="skill"?w.skill&&await XP(t,S,o.slug,w.skill,{t:n}):w.uri&&await QP(t,S,l,w.uri,{t:n})},_=async w=>{if(!h||!l)return;const{range:S,item:j}=h,C=ar(j._meta);await X3(t,S,l,j.name,C,w,{t:n}),f(null)},L=async w=>{if(!(!m||!l)){if(!xC(t,m.pos,m.promptId)){pe.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const S=await cu(l,m.promptId,w),j=ar(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,qh({id:m.promptId,name:bc(m.promptId,j),metadata:S.messages,char:"/",kind:"prompt",args:w})).run(),Je("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(S){console.error("[slash] Failed to update prompt:",S),pe.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},y=async w=>{const{query:S}=w;if(!l)return[];const[j,C,N]=await Promise.all([Z3(i,a,l),tD(i,c,l),eD(i,d,o.slug)]),V=S.trim().toLowerCase(),T=(j??[]).filter(D=>!V||D.name.toLowerCase().includes(V)||D.title?.toLowerCase().includes(V)||D.description?.toLowerCase().includes(V)).map(D=>({name:D.name,title:D.title,description:D.description,kind:"prompt",arguments:D.arguments,_meta:D._meta})),E=(C??[]).filter(D=>!V||D.uri.toLowerCase().includes(V)||D.name?.toLowerCase().includes(V)||D.description?.toLowerCase().includes(V)).map(D=>({name:D.name??D.uri,title:D.name,description:D.description,kind:"resource",uri:D.uri})),P=(N??[]).filter(D=>!V||D.name.toLowerCase().includes(V)||D.id.toLowerCase().includes(V)||D.description?.toLowerCase().includes(V)).map(D=>({name:D.name,title:D.name,description:D.description??void 0,kind:"skill",skill:D}));return[...T,...E,...P]},k=h?.item.kind==="prompt"?{name:h.item.name,title:h.item.title,arguments:h.item.arguments,description:h.item.description,_meta:h.item._meta}:null;return r.jsxs(r.Fragment,{children:[r.jsx(K6,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:y,onSelect:v,onOpenChange:w=>{if(s&&(s.current=w),w)x.current=Date.now(),b.current=!1,Je("chat_picker_opened",{picker:"/"});else{const S=x.current;Je("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:S?Date.now()-S:null}),x.current=null}}}),r.jsx(Fd,{prompt:k,setPrompt:()=>f(null),onSubmit:_}),r.jsx(Fd,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:L,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function Z3(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>v1(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>v1(s),staleTime:6e4}),n?.prompts??[]}async function eD(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>zV(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function tD(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>_d(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>_d(s),staleTime:6e4}),n?.resources??[]}const W6="Ask anything, / for prompts & skills, @ for agents & resources...";function sD(t){return[fp.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),E6.configure({placeholder:()=>t.current??W6,showOnlyWhenEditable:!1}),vC,yC]}function q6({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=A.useRef(o),d=A.useRef(e),u=A.useRef(n),h=A.useRef(i),f=hp({extensions:sD(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":i??W6,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&&u.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return A.useEffect(()=>{f?.setEditable(!s)},[f,s]),A.useEffect(()=>{c.current=o},[o]),A.useEffect(()=>{d.current=e},[e]),A.useEffect(()=>{u.current=n},[n]),A.useEffect(()=>{h.current=i},[i]),A.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(bC.Provider,{value:{editor:f},children:a})}function G6(t){const e=F.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=au();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const C=f.state.doc.textContent.trim()==="";f.commands.focus("end"),C||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,C)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),C)){f.commands.focus("end");const N=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:N?" "+C:C})}},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]),A.useImperativeHandle(c??null,m,p),!f)return null;const g=u&&"cursor-not-allowed opacity-70",x=u&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=re("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(mp,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const _=n??null;let L;e[10]!==f||e[11]!==a||e[12]!==_?(L=r.jsx(A.Suspense,{fallback:null,children:r.jsx(ZP,{editor:f,virtualMcpId:_,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=_,e[13]=L):L=e[13];const y=n??null;let k;e[14]!==f||e[15]!==a||e[16]!==y?(k=r.jsx(A.Suspense,{fallback:null,children:r.jsx(KP,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=y,e[17]=k):k=e[17];let w;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==h?(w=h&&o&&!u?r.jsx(VA,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=o,e[22]=h,e[23]=w):w=e[23];let S;return e[24]!==L||e[25]!==k||e[26]!==w||e[27]!==v?(S=r.jsxs(r.Fragment,{children:[v,L,k,w]}),e[24]=L,e[25]=k,e[26]=w,e[27]=v,e[28]=S):S=e[28],S}function Y6(t){const e=F.c(3),[s]=Oi();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&tT(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 nD={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"},iD=uN.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),rD=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function oD(){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:rD.map(lD)}),t[0]=e):e=t[0],e}function lD(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 aD({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=ie(),[a,c]=A.useState(!1),d=Y6(nD),{org:u}=qe(),{editor:h}=au(),f=A.useRef(null),m=rf(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async W=>{const Y=W.target.files;if(!Y||Y.length===0||!h)return;const X=Array.from(Y);try{let ne=h.state.selection.from;for(const se of X)await a2(h,n??null,se,ne,o,l),ne=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=Jt({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=et.virtualMcpPrompts(s,u.id),{data:v,isLoading:_}=Et({queryKey:b,queryFn:()=>v1(x),staleTime:6e4,enabled:a&&!!x}),L=v?.prompts??[],[y,k]=A.useState(null),{chatMode:w,setChatMode:S}=Mo(),[j,C]=Oi(),N=el.find(W=>W.value===j.toolApprovalLevel)??el[0],V=l(N.shortKey),T=W=>{const Y=el.find(X=>X.value===W);if(Y){if(Y.value===j.toolApprovalLevel){c(!1);return}d(),Je("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:Y.value,source:"tools_popover"}),C({...j,toolApprovalLevel:Y.value}),c(!1)}},E=w==="plan",P=()=>{d();const W=E?"default":"plan";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},D=()=>{e(),c(!1)},I=async(W,Y)=>{if(!h||!x)return;const X=ar(W._meta),ne={from:h.state.selection.from,to:h.state.selection.to};try{const se=await cu(x,W.name,Y);Ja(h,ne,{id:W.name,name:bc(W.name,X),metadata:se.messages,char:"/",kind:"prompt",args:Y})}catch{pe.error(l("chat.toolsPopover.failedLoadPrompt"))}},R=async W=>{c(!1);const Y=!!(W.arguments&&W.arguments.length>0);if(Je("chat_prompt_inserted",{prompt_name:W.name,with_arguments:Y}),Y){k(W);return}await I(W)},$=async W=>{y&&(await I(y,W),k(null))},B=()=>{d();const W=w==="gen-image"?"default":"gen-image";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},M=()=>{d();const W=w==="web-search"?"default":"web-search";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},O=()=>{d();const W=w==="deep-research"?"default":"deep-research";Je("chat_mode_changed",{from_mode:w,to_mode:W,source:"tools_popover"}),S(W),c(!1)},z=w==="gen-image",U=w==="web-search",H=w==="deep-research",K=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:AV(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[K,r.jsxs(Ft,{open:a,onOpenChange:W=>{W&&!a&&Je("chat_tools_popover_opened",{chat_mode:w}),c(W)},children:[r.jsx(Ut,{asChild:!0,children:r.jsxs(de,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:re("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(hy,{size:14}),r.jsx("span",{className:re("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(Ht,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(Qe,{onClick:p,disabled:i,children:[r.jsx($t,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsxs(Qe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[r.jsx($t,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(Ke,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(Qe,{onClick:P,className:re(E&&"text-special"),children:[r.jsx(Qa,{size:16,className:re(E&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:re("text-xs text-muted-foreground",E&&"text-special font-medium"),children:iD})]}),r.jsxs(Qe,{onClick:B,className:re(z&&"text-special"),children:[r.jsx(Ei,{size:16,className:re(z&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),z&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Qe,{onClick:M,className:re(U&&"text-special"),children:[r.jsx(Hr,{size:16,className:re(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(Qe,{onClick:O,className:re(H&&"text-special"),children:[r.jsx(fy,{size:16,className:re(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(nr,{children:[r.jsxs(ir,{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(rr,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:_?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(ft,{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(Qe,{onClick:()=>R(W),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||up(W.name,ar(W._meta))}),W.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),r.jsxs(nr,{children:[r.jsxs(ir,{className:"gap-2",children:[r.jsx(sf,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:V})]}),r.jsx(rr,{className:"w-48 p-1.5",children:r.jsx(hl,{value:j.toolApprovalLevel,onValueChange:T,children:el.map(W=>r.jsx(Nn,{value:W.value,children:l(W.labelKey)},W.value))})})]}),r.jsxs(Qe,{onClick:D,children:[r.jsx(yp,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(A.Suspense,{children:r.jsx(oD,{})})]})]})]}),r.jsx(Fd,{prompt:y,setPrompt:k,onSubmit:$})]})}const cD=[{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 dD(){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:cD.map(uD)}),t[0]=e):e=t[0],e}function uD(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 hD(t){const e=F.c(10),{onClick:s}=t,n=ie();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=re("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(dD,{}),c=r.jsx(dn,{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 ad=48;function fD(){const t=F.c(9),[e,s]=A.useState("idle"),[n,i]=A.useState(""),[o,l]=A.useState(""),[a,c]=A.useState(gD),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=A.useRef(null),m=A.useRef(0),p=A.useRef(!1),g=A.useRef(""),x=A.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),u.current?.close().catch(pD),f.current?.getTracks().forEach(mD),h.current=null,u.current=null,f.current=null},t[0]=v):v=t[0];const _=v;let L;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=V=>{f.current=V;const T=new AudioContext;u.current=T;const E=T.createMediaStreamSource(V),P=T.createAnalyser();P.fftSize=128,P.smoothingTimeConstant=.8,E.connect(P),h.current=P;const D=new Uint8Array(P.frequencyBinCount),I=()=>{if(!h.current)return;h.current.getByteFrequencyData(D);const R=[];for(let $=0;$<ad;$++){const B=Math.floor($/ad*D.length);R.push(Math.max(.04,(D[B]??0)/255))}c(R),m.current=requestAnimationFrame(I)};I()};L=async()=>{const V=window.SpeechRecognition||window.webkitSpeechRecognition;if(!V)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"),N(T);const E=new V;d.current=E,E.interimResults=!0,E.continuous=!0,E.lang=navigator.language||"en-US",E.onresult=P=>{let D="",I="";for(let R=P.resultIndex;R<P.results.length;R++){const $=P.results[R],B=$?.[0]?.transcript??"";$?.isFinal?I=I+B:D=D+B}I&&(g.current=g.current+I,i(g.current)),x.current=D,l(D)},E.onerror=P=>{d.current===E&&P.error!=="no-speech"&&(p.current=!1,d.current=null,_(),s(P.error==="not-allowed"?"permission-denied":"idle"))},E.onend=()=>{if(d.current===E&&p.current)try{E.start()}catch{}};try{E.start()}catch{return p.current=!1,d.current=null,_(),s("idle"),"idle"}return"recording"},t[1]=L}else L=t[1];const y=L;let k;t[2]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.stop(),_(),s("idle"),c(Array(ad).fill(.05)),l("");const N=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",N},t[2]=k):k=t[2];const w=k;let S;t[3]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{p.current=!1,d.current?.abort(),_(),s("idle"),i(""),l(""),c(Array(ad).fill(.05)),g.current="",x.current=""},t[3]=S):S=t[3];const j=S;let C;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(C={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:y,stopRecording:w,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=C):C=t[8],C}function mD(t){return t.stop()}function pD(){}function gD(){return Array(ad).fill(.05)}function xD(t){const e=F.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(bD),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 bD(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 vD(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function Wu(t){const e=F.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??r.jsx(lu,{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 yD(t,e,s){const n=F.c(7),{editor:i}=au(),o=ie(),[l,a]=A.useState(!1),c=A.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(d=()=>{const h=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=_D,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!rf(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 _ of b)await a2(i,t,_,v,e,o),v=i.state.selection.to})()};return window.addEventListener("dragenter",h),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",h),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},u=[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]=u):(d=n[5],u=n[6]),A.useEffect(d,u),l}function _D(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function LD(t){const e=F.c(14),{selectedModel:s}=t,n=ie();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=Vy(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(ti,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let u;e[6]!==n?(u=h=>n(h),e[6]=n,e[7]=u):u=e[7],o=n("chat.input.dropFilesHere",{fileTypes:d.map(u).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 SD(){const t=F.c(5),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(lu,{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 wD(t){const e=F.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=yD(s,n,i);let l;e[0]!==s?(l=rf(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 u;e[2]!==c||e[3]!==d?(u=re("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]=u):u=e[4];let h;e[5]!==s||e[6]!==a?(h=a?r.jsx(LD,{selectedModel:s}):r.jsx(SD,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function qu(t){const e=F.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=re("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=re("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 u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(_s,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let h;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(h=r.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,u]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=h):h=e[13],h}function kD(){const t=F.c(6),e=zt(),{org:s,locator:n}=qe(),{create:i}=du();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(),u=c?.id??Cl(s.id).id;sy(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:mN};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:h})},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 jD({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=ie(),n=dp(),i=Ls(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||_E,h=kD(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:_,setChatMode:L}=Mo(),{data:y}=xi.useSession(),k=y?.user?.id,{org:w,locator:S}=qe(),j=Cl(w.id).id,C=Ws(m?.id),N=En(C?.id).runtime==="cms",V=Y6(sT),[T,E]=A.useState(!1),{unsupportedFile:P,onUnsupportedFile:D,clearUnsupportedFile:I}=DA(),R=fD(),$=A.useRef(void 0),B=async()=>{$.current=se;const ye=await R.startRecording();Je("chat_voice_started",{thread_id:d,outcome:ye==="recording"?"started":ye==="unsupported"?"unsupported":ye==="permission-denied"?"permission_denied":"unknown"})},M=()=>{Je("chat_voice_confirmed",{thread_id:d});const ye=R.stopRecording();te.current?.syncVoiceText($.current,ye),te.current?.focus()},O=()=>{Je("chat_voice_cancelled",{thread_id:d}),R.cancelRecording(),te.current?.restoreContent($.current)};A.useEffect(()=>{if(R.status!=="recording")return;const ye=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();te.current?.syncVoiceText($.current,ye)},[R.transcript,R.interimTranscript,R.status]);const z=i?.activeTask??null,U=z?.created_by,H=!!(k&&U&&U!==k),{data:K}=Oy({enabled:H}),W=(K?.data?.members??[]).find(ye=>ye.userId===U),Y=W?.user?.name??W?.user?.email?.split("@")[0]??null,X=cf(),ne=Xv({isDesktopApp:X,harnessId:z?.harness_id,sandboxProviderKind:z?.sandbox_provider_kind}),[se,oe]=A.useState(()=>R3(sessionStorage,S,u)??void 0),Z=ye=>{oe(ye),g.current=ye,v6(sessionStorage,S,u,ye,{onQuotaExceeded:({docSizeBytes:Le})=>{Je("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Le}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},J=A.useRef(d);if(J.current!==d){J.current=d;const ye=R3(sessionStorage,S,u)??void 0;oe(ye),g.current=ye}const G=[...o].reverse().find(ye=>ye.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,te=A.useRef(null),le=A.useRef(!1),ee=_==="plan",ae=ye=>{V(),Je("chat_mode_changed",{from_mode:ye,to_mode:"default",source:"pill_dismiss"}),L("default")};A.useEffect(()=>{const ye=Le=>{ey(Le)&&Le.code==="KeyL"&&(Le.preventDefault(),Le.shiftKey&&L(_==="plan"?"default":"plan"),te.current?.focus())};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[_,L]);const ue=Rv(o),ce=[...o].reverse().find(ye=>ye.role==="assistant"&&ye.metadata?.usage)?.metadata?.usage?.contextTokens??0,ge=!p&&!b6(se),Q=vD({hasDraft:ge,isStreaming:l,isRunInProgress:a}),me=Q==="send",ve=Q==="stop",we=ye=>{if(ye?.preventDefault(),Q==="send"&&se){if(Je("chat_message_sent",{thread_id:d||null,mode:_,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:ye?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){pe.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(se)}else h({tiptapDoc:se,virtualMcp:m});SE(sessionStorage,S,u),Z(void 0)}else Q==="stop"&&(Je("chat_message_stopped",{thread_id:d}),c())};if(H)return r.jsx(Wu,{message:Y?s("chat.input.readOnlyOthersChatNamed",{name:Y}):s("chat.input.readOnlyOthersChat"),icon:Y?r.jsx(Hs,{shape:"circle",size:"2xs",url:W?.user?.image??void 0,fallback:Y.slice(0,2).toUpperCase()}):void 0});if(z?.metadata?.read_only)return r.jsx(Wu,{message:s("chat.input.readOnlyThread")});if(ne)return r.jsx(Wu,{message:s("chat.input.codingAgentRequiresDesktop")});if(N){if(!i)return r.jsx(Wu,{message:s("chat.input.fastPreviewUnavailable")});const ye=()=>{const Le=i.createTask({runtime:"sandbox"});Je("coding_session_started",{thread_id:Le})};return r.jsxs("button",{type:"button",onClick:ye,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(zo,{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(Bo,{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(gf,{}),n&&i&&d?r.jsx(xA,{taskId:d}):null,r.jsx(q6,{tiptapDoc:se,setTiptapDoc:Z,disabled:R.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:we,suggestionOpenRef:le,children:r.jsxs("form",{onSubmit:we,className:re("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(wD,{selectedModel:f,onUnsupportedFile:D,disabled:R.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(G6,{ref:te,disabled:R.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:D,suggestionOpenRef:le})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.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(xD,{data:R.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:O,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:M,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(Rt,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(aD,{disabled:!1,onOpenConnections:()=>{Je("connections_dialog_opened",{source:"tools_popover",mode:"add"}),E(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:D}),ee&&r.jsx(qu,{onClick:()=>ae("plan"),label:s("chat.input.planMode"),icon:r.jsx(Qa,{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"}),_==="gen-image"&&x&&r.jsx(qu,{onClick:()=>ae("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(Ei,{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]"}),_==="web-search"&&b&&r.jsx(qu,{onClick:()=>ae("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Hr,{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]"}),_==="deep-research"&&v&&r.jsx(qu,{onClick:()=>ae("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(fy,{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]"}),G&&ce>0&&r.jsx(_C,{usage:ue,totalTokens:ce,contextWindow:G,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(NA,{}),R.isSupported&&r.jsx(de,{type:"button",onClick:B,disabled:!1,variant:"ghost",size:"icon",className:re("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(TN,{size:18})}),r.jsx(de,{type:ve?"button":"submit",onClick:ye=>{ve&&(ye.preventDefault(),ye.stopPropagation(),c())},variant:me||ve?"default":"ghost",size:"icon",disabled:!me&&!ve,className:re("size-8 rounded-lg transition-all",!me&&!ve&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(Q==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(Q==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:ve?r.jsx(EN,{size:20}):r.jsx(Hh,{size:20})})]})]})})]})},d),e&&r.jsx(hD,{onClick:()=>{Je("connections_banner_clicked",{source:"home_chat_input"}),Je("connections_dialog_opened",{source:"home_banner",mode:"add"}),E(!0)}})]})}),r.jsx(Op,{mode:"browse",open:T,onOpenChange:E,defaultTab:"all"}),r.jsx(AA,{info:P,onClose:I})]})}function CD(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 ND(){const t=F.c(8),e=zt(),s=xp(),n=dp()?.messages??[],i=Ls()?.taskId??null;let o;t[0]!==n?(o=CD(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=A.useRef(null),c=A.useRef(null);let d,u;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const h=`${i}:${l}`;c.current!==h&&(c.current=h,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e({to:".",search:VD,replace:!0}))},u=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=u):(d=t[6],u=t[7]),A.useEffect(d,u)}function VD(t){return{...t,main:"preview"}}const TD={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 J6(t){return`deco-credits-empty-dismissed:${t}`}function ED(t){try{return localStorage.getItem(J6(t))==="1"}catch{return!1}}function AD(){const t=F.c(68),e=ie(),{org:s}=qe(),n=zt(),{decoKeyId:i}=$p(),o=$s(),[l,a]=A.useState(!0),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Je("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(J6(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&&Je("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]),A.useEffect(b,v);let _;t[6]!==f||t[7]!==o?(_=async X=>{const{url:ne}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:X,currency:f});return ne},t[6]=f,t[7]=o,t[8]=_):_=t[8];let L;t[9]!==x?(L=X=>{X&&window.open(X,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=L):L=t[10];let y;t[11]!==e?(y=X=>{pe.error(e("chat.creditsEmptyState.topUpFailed",{message:X.message}))},t[11]=e,t[12]=y):y=t[12];let k;t[13]!==_||t[14]!==L||t[15]!==y?(k={mutationFn:_,onSuccess:L,onError:y},t[13]=_,t[14]=L,t[15]=y,t[16]=k):k=t[16];const{mutate:w,isPending:S}=Rs(k),j=parseFloat(c),C=!isNaN(j)&&j>=1;if(!l)return null;let N;t[17]!==x?(N=X=>!X&&x(),t[17]=x,t[18]=N):N=t[18];let V;t[19]===Symbol.for("react.memo_cache_sentinel")?(V=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]=V):V=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(my,{size:20,className:"text-warning"})}),t[20]=T):T=t[20];let E;t[21]!==e?(E=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=E):E=t[22];let P;t[23]!==E?(P=r.jsx(Wt,{className:"text-lg font-semibold",children:E}),t[23]=E,t[24]=P):P=t[24];let D;t[25]!==e?(D=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=D):D=t[26];let I;t[27]!==D?(I=r.jsx(Fn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:D}),t[27]=D,t[28]=I):I=t[28];let R;t[29]!==P||t[30]!==I?(R=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[V,r.jsxs(xs,{className:"relative gap-3",children:[T,r.jsxs("div",{className:"text-center",children:[P,I]})]})]}),t[29]=P,t[30]=I,t[31]=R):R=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==C||t[38]!==S||t[39]!==u||t[40]!==e||t[41]!==w?($=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:X=>{X&&m(X)},children:[r.jsx(Hd,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Hd,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:TD[f].map(X=>{const{dollars:ne,labelKey:se}=X;return r.jsxs("button",{type:"button",disabled:S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:ne*100,currency:f,tier_label:se,source:"empty_state"}),w(ne*100)},className:re("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,ne]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(se)})]},ne)})}),u?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(bt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:X=>d(X.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(de,{className:"h-10",disabled:!C||S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),w(Math.round(j*100))},children:e(S?"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:()=>h(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=C,t[38]=S,t[39]=u,t[40]=e,t[41]=w,t[42]=$):$=t[42];let B;t[43]!==x||t[44]!==n||t[45]!==s.slug?(B=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=B):B=t[46];let M;t[47]!==e?(M=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=M):M=t[48];let O;t[49]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(Bo,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=O):O=t[49];let z;t[50]!==B||t[51]!==M?(z=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:B,children:[M,O]}),t[50]=B,t[51]=M,t[52]=z):z=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(de,{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]!==z||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:[z,H]}),t[58]=z,t[59]=H,t[60]=K):K=t[60];let W;t[61]!==R||t[62]!==$||t[63]!==K?(W=r.jsxs(It,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:PD,children:[R,$,K]}),t[61]=R,t[62]=$,t[63]=K,t[64]=W):W=t[64];let Y;return t[65]!==W||t[66]!==N?(Y=r.jsx(Mt,{open:!0,onOpenChange:N,children:W}),t[65]=W,t[66]=N,t[67]=Y):Y=t[67],Y}function PD(t){return t.preventDefault()}function DD(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=re("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(my,{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 RD(){const t=F.c(8),{org:e}=qe(),s=zt();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=re("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(cn,{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 ID(t){const e=F.c(11),{className:s}=t;let n;e[0]!==s?(n=re("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(Gu,{align:"right",width:"w-3/4"}),r.jsx(Gu,{align:"left",width:"w-full",lines:3}),r.jsx(Gu,{align:"right",width:"w-2/3"}),r.jsx(Gu,{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 u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[8];let h;return e[9]!==n?(h=r.jsxs("div",{className:n,children:[l,a,u]}),e[9]=n,e[10]=h):h=e[10],h}function Gu(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=re("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 u;e[2]!==d?(u=re("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=h):h=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=re("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((_,L)=>r.jsx("div",{className:re("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]!==u?(b=r.jsxs("div",{className:u,children:[h,x]}),e[16]=x,e[17]=u,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 MD(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,u=s.current;if(!d||!u||!i)return;const h=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||o||!i)return;const p=u.scrollHeight,g=u.scrollTop;await l(),requestAnimationFrame(()=>{const x=u.scrollHeight;u.scrollTop=g+(x-p)})},{root:u,rootMargin:"200px 0px 0px 0px"});return h.observe(d),()=>h.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]),A.useEffect(a,c)}function $D(t){const e=F.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=re("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 OD(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=re("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 BD(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 zD(){const t=ie(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=bi(),{taskId:l}=sn();ND();const a=Tv(l??""),c=nC(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),u=LC(d),h=u.at(-1),m=yE()*oE+16,p=A.useRef(null),g=A.useRef(null);MD({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=SC({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(wC,{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")}),u.slice(0,-1).map((v,_)=>r.jsx(S3,{pair:v,isLastPair:!1,status:_===u.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),h&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(S3,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(de,{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(qj,{size:14})})]})})}function FD(t){const e=F.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=re("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 ms=Object.assign($D,{Main:OD,Messages:zD,EmptyState:BD,Footer:FD,Input:jD,Provider:sC,ActiveTaskProvider:tC,Skeleton:ID,IceBreakers:rE,NoAiProviderEmptyState:PV,CreditsEmptyState:AD,CreditsEyebrow:DD,NoCreditsEyebrow:RD,CreditsExhaustedBanner:V6});function UD({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function HD(){const t=F.c(3),e=lf(),n=Ls()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=UD({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function Hc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function v9(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 KD(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function WD(t){const e=F.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(qD),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 qD(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 GD(t){const e=F.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=ie(),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 u;e[0]!==a?(u=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==c?(h=c>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=h):h=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]!==u||e[7]!==h||e[8]!==f?(m=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[u,h,f]}),e[6]=u,e[7]=h,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 _;e[20]!==v?(_=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]=_):_=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 y;e[26]!==_||e[27]!==L||e[28]!==x?(y=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,_,L]}),e[26]=_,e[27]=L,e[28]=x,e[29]=y):y=e[29];let k;return e[30]!==y||e[31]!==m?(k=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,y]}),e[30]=y,e[31]=m,e[32]=k):k=e[32],k}function YD(t){const e=F.c(14),{agentId:s,isError:n}=t,i=Ws(s),o=ie();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(Bi,{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 u=n?"text-destructive":"text-foreground";let h;e[6]!==u?(h=re("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=r.jsx("span",{className:h,children:a}),e[8]=a,e[9]=h,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 JD(t){const e=F.c(12),{isError:s}=t,n=ie();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(Bi,{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=re("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 u;return e[9]!==l||e[10]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function QD(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(JD,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(YD,{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(A.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==s.input?(u=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]=u):u=e[9];let h;e[10]!==l||e[11]!==o||e[12]!==i?(h=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(ft,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(VN,{size:12,className:"text-destructive"}):l?r.jsx(cn,{size:12,className:"text-warning"}):r.jsx(vi,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,u,h]}),e[14]=d,e[15]=u,e[16]=h,e[17]=f):f=e[17],f}function XD(t){const e=F.c(78),{onClose:s,back:n,className:i}=t,o=ie(),[l,a]=A.useState(null),{messages:c}=bi(),{activeTask:d}=sn(),{selectedModel:u,selectedVirtualMcp:h}=Mo();let f,m,p,g,x,b,v,_;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==u||e[7]!==h?.title||e[8]!==o){_=Symbol.for("react.early_return_sentinel");e:{const k=Rv(c),w=[...c].reverse().find(cR),S=w?.metadata?.usage,j=w?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,C=S?.contextTokens??0,N=j&&j>0?(C/j*100).toFixed(1):null,V=c;let T;e[17]!==V?(T=V.filter(aR).reduce(lR,0),e[17]=V,e[18]=T):T=e[18];const E=T,P=c;let D;e[19]!==P?(D=P.filter(oR).reduce(rR,0),e[19]=P,e[20]=D):D=e[20];const I=D,R=Math.max(0,k.totalTokens-E-I),$=c[0],B=c.at(-1),M=$?.metadata?.created_at??d?.created_at,O=B?.metadata?.created_at??d?.updated_at,z=c.filter(iR),U=c.flatMap(sR),H=u?.modelId?KD(u.modelId):"—",K=h?.title??"Super Agent",W=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:z.length},{label:o("chat.contextPanel.agentLabel"),value:K},{label:o("chat.contextPanel.modelLabel"),value:H},{label:o("chat.contextPanel.contextLimitLabel"),value:j?Hc(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:k.totalTokens>0?Hc(k.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:N!==null?`${N}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:k.inputTokens>0?Hc(k.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:k.outputTokens>0?Hc(k.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:k.reasoningTokens>0?Hc(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:v9(M)},{label:o("chat.contextPanel.lastActivityLabel"),value:v9(O)}];if(!d&&z.length===0){let q;e[21]!==i?(q=re("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=q):q=e[22];let G;e[23]!==o?(G=o("chat.contextPanel.title"),e[23]=o,e[24]=G):G=e[24];let te;e[25]!==G?(te=r.jsx("span",{className:"text-sm font-medium text-foreground",children:G}),e[25]=G,e[26]=te):te=e[26];let le;e[27]!==n?(le=n?r.jsx(y1,{size:14,className:"text-muted-foreground"}):r.jsx(Ai,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=le):le=e[28];let ee;e[29]!==s||e[30]!==le?(ee=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]=ee):ee=e[31];let ae;e[32]!==te||e[33]!==ee?(ae=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[te,ee]}),e[32]=te,e[33]=ee,e[34]=ae):ae=e[34];let ue;e[35]!==o?(ue=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=ue):ue=e[36];let he;e[37]!==ue?(he=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:ue})}),e[37]=ue,e[38]=he):he=e[38];let ce;e[39]!==q||e[40]!==ae||e[41]!==he?(ce=r.jsxs("div",{className:q,children:[ae,he]}),e[39]=q,e[40]=ae,e[41]=he,e[42]=ce):ce=e[42],_=ce;break e}e[43]!==i?(b=re("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 X;e[47]!==Y?(X=r.jsx("span",{className:"text-sm font-medium text-foreground",children:Y}),e[47]=Y,e[48]=X):X=e[48];let ne;e[49]!==n?(ne=n?r.jsx(y1,{size:14}):r.jsx(Ai,{size:14}),e[49]=n,e[50]=ne):ne=e[50];let se;e[51]!==s||e[52]!==ne?(se=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:ne}),e[51]=s,e[52]=ne,e[53]=se):se=e[53],e[54]!==X||e[55]!==se?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[X,se]}),e[54]=X,e[55]=se,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(tR)})]}),p=r.jsx(WD,{items:W});let oe;e[57]!==o?(oe=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=oe):oe=e[58];let Z;e[59]!==oe?(Z=r.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=Z):Z=e[60];let J;e[61]!==I||e[62]!==R||e[63]!==E?(J=r.jsx(GD,{userTokens:E,assistantTokens:I,otherTokens:R}),e[61]=I,e[62]=R,e[63]=E,e[64]=J):J=e[64],e[65]!==Z||e[66]!==J?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[Z,J]}),e[65]=Z,e[66]=J,e[67]=g):g=e[67],x=z.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:z.map(q=>{const G=q.metadata?.created_at,te=l?.id===q.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(te?null:q),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:re("shrink-0 font-medium",q.role==="user"?"text-chart-1":"text-chart-2"),children:q.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:q.id})]}),G&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:v9(G)})]}),te&&r.jsxs(r.Fragment,{children:[q.role==="assistant"&&(()=>{const le=q.metadata?._request;if(!le)return null;const ee=le.systemSections??[],ae=Math.max(1,...ee.map(eR)),ue=ee.reduce(ZD,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")]})]}),ee.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(ue/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),ee.map((he,ce)=>{const ge=he.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ce}`,Q=he.chars/ae*100,me=Math.round(he.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:`${Q}%`}})})]},ce)})]})]})})(),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(q,null,2)})]})]},q.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=u,e[7]=h?.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]=_}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],_=e[16];if(_!==Symbol.for("react.early_return_sentinel"))return _;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 y;return e[74]!==b||e[75]!==v||e[76]!==L?(y=r.jsxs("div",{className:b,children:[v,L]}),e[74]=b,e[75]=v,e[76]=L,e[77]=y):y=e[77],y}function ZD(t,e){return t+e.chars}function eR(t){return t.chars}function tR(t,e){return r.jsx(QD,{part:t},e)}function sR(t){return(t.parts??[]).filter(nR)}function nR(t){return t.type==="tool-subtask"}function iR(t){return t.role!=="system"}function rR(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function oR(t){return t.role==="assistant"}function lR(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function aR(t){return t.role==="user"}function cR(t){return t.role==="assistant"&&t.metadata?.usage}function dR(t){const e=F.c(21),{onOpenContextPanel:s}=t,{org:n}=qe(),{selectedVirtualMcp:i}=Mo();let o;e[0]!==n.id?(o=Cl(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Ws(a.id)??a,u=d.title??"Super Agent",h=d.icon??null,f=d.description??null;let m;e[2]!==h||e[3]!==u?(m=r.jsx(Vo,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:u}),e[5]=u,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(ms.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let _;e[16]!==s?(_=r.jsxs(ms.Footer,{children:[v,r.jsx(ms.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=_):_=e[17];let L;return e[18]!==b||e[19]!==_?(L=r.jsxs(r.Fragment,{children:[b,_]}),e[18]=b,e[19]=_,e[20]=L):L=e[20],L}function ex(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=re(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 u;e[3]!==d?(u=re("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=r.jsx(Qt,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(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,h]}),e[7]=i,e[8]=h,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(uR)}),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 uR(t){return r.jsx(jC,{file:t},t.key)}function hR(){const t=F.c(13),e=Ls()?.taskId??null,s=kC();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=Iv(e,n),[o,l]=A.useState(!1),[a,c]=A.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(mR),t[2]=d):d=t[2];let u;t[3]!==o||t[4]!==i?(u=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(ex,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(fR),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(ex,{variant:"bar",outputs:i,collapsed:a,onToggle:h})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==u||t[11]!==f?(m=r.jsxs(r.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function fR(t){return!t}function mR(t){return!t}function pR(){const t=F.c(31),{org:e}=qe(),s=Ls(),{isChatEmpty:n}=bi(),[i,o]=A.useState("chat"),l=$p(),a=HD(),{runtime:c}=En(s?.virtualMcpId);if(a&&c!=="cms"){let C;return t[0]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(ms,{className:"animate-in fade-in-0 duration-200",children:r.jsx(ms.Main,{className:"flex flex-col items-center",children:r.jsx(ms.EmptyState,{children:r.jsx(ms.NoAiProviderEmptyState,{})})})}),t[0]=C):C=t[0],C}let u;t[1]!==l.hasDecoKey||t[2]!==l.hasOnlyDecoProvider||t[3]!==l.isLoading||t[4]!==l.isZeroBalance||t[5]!==n||t[6]!==e?(u=l.hasDecoKey&&l.isZeroBalance&&l.hasOnlyDecoProvider&&!l.isLoading&&n&&!ED(e.id),t[1]=l.hasDecoKey,t[2]=l.hasOnlyDecoProvider,t[3]=l.isLoading,t[4]=l.isZeroBalance,t[5]=n,t[6]=e,t[7]=u):u=t[7];const h=u;let f;t[8]!==h?(f=h&&r.jsx(ms.CreditsEmptyState,{}),t[8]=h,t[9]=f):f=t[9];const m=i!=="chat"?!0:void 0,p=i!=="chat",g=i!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=re("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?r.jsx(dR,{onOpenContextPanel:()=>o("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(ms.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(hR,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ms.Messages,{})})]}),r.jsx(ms.Footer,{children:r.jsx(ms.Input,{onOpenContextPanel:()=>o("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let v;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(v=r.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=v):v=t[19];const _=i!=="context"?!0:void 0,L=i!=="context",y=i==="context"?"opacity-100":"opacity-0 pointer-events-none";let k;t[20]!==y?(k=re("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[20]=y,t[21]=k):k=t[21];let w;t[22]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(XD,{back:!0,onClose:()=>o("chat")}),t[22]=w):w=t[22];let S;t[23]!==k||t[24]!==_||t[25]!==L?(S=r.jsx("div",{inert:_,"aria-hidden":L,className:k,children:w}),t[23]=k,t[24]=_,t[25]=L,t[26]=S):S=t[26];let j;return t[27]!==f||t[28]!==S||t[29]!==v?(j=r.jsxs(ms,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,v,S]}),t[27]=f,t[28]=S,t[29]=v,t[30]=j):j=t[30],j}function Q6(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(ms.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Fs,{fallback:e,children:r.jsx(A.Suspense,{fallback:r.jsx(ms.Skeleton,{}),children:r.jsx(pR,{})})}),t[1]=s):s=t[1],s}function gR(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function u2(t){return t?.name||t?.email?.split("@")[0]||void 0}function xf(t){const e=gR(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function xR(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 X6=["SANDBOX_START"],Yu=new Map,bR=t=>`${t.virtualMcpId}::${t.branch??""}`,vR=t=>t.message.includes("retry shortly"),y9=new Set,T1={mark:(t,e)=>y9.add(`${t}::${e}`),clear:(t,e)=>y9.delete(`${t}::${e}`),isStopped:(t,e)=>y9.has(`${t}::${e}`)};function Z6(t,e){const s=bs();return Rs({mutationKey:X6,retry:(n,i)=>vR(i)&&n<6,retryDelay:n=>bu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&T1.clear(n.virtualMcpId,n.branch);const i=bR(n),o=Yu.get(i);if(o)return o;const l=(async()=>(await xR(t,"SANDBOX_START",n)).structuredContent)();Yu.set(i,l);try{return await l}finally{Yu.get(i)===l&&Yu.delete(i)}},onSuccess:()=>{Od(s),e?.onStarted?.()}})}function yR(t,e){const s=F.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:X6,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],c6(n)>0}function tx(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function _R(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function LR(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 _R({sidePanel:l,mainOpen:i})}function _9(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?tx("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?tx("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function SR(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 wR(t){const{sidePanel:e,mainOpen:s}=t.visibility;return e!==null&&(t.sidePanelParamPresent||!s)?e:s?"main":"chat"}function kR(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function jR(t,e){const s=zt(),n=br({strict:!1}),i=Uh({strict:!1}),{create:o}=du(),{threads:l}=dN(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,u=n.main===0?"0":n.main,{sidePanel:h,mainOpen:f}=LR({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:u,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:h,mainOpen:f},p=A.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=N=>({org:c,taskId:N}),v=d?{virtualmcpid:a}:{},_=(N,V)=>{s({to:x,params:b(g),search:T=>({...T,...N}),replace:V?.replace??!1})},L=(N,V)=>{s({to:x,params:b(N),search:T=>{const E={};return V?E.virtualmcpid=V:d&&(E.virtualmcpid=a),E}})},y=()=>{const N=_9({type:"toggleMain",openMainValue:Ra(t)},m);N&&_(N,{replace:!0})},k=N=>{const V=_9({type:"toggleSidePanel",sidePanel:N},m);V&&_(V,{replace:!0})},w=N=>{const V=u&&u!=="0"?u:Ra(t);_(kR(N,V),{replace:!0})},S=N=>{const V=_9({type:"openSidePanel",sidePanel:N},m);V&&_(V,{replace:!0})},j=async()=>{const N=crypto.randomUUID(),V=l.find(T=>T.id===g)?.branch??null;try{await o({id:N,virtual_mcp_id:a,...V?{branch:V}:{}})}catch{}s({to:x,params:b(N),search:T=>({...v})})},C=N=>{_({main:N==="0"?0:N},{replace:!0})};return{taskId:g,sidePanel:h,mainOpen:f,mainParam:u,sidePanelParamPresent:n.sidepanel!==void 0,setTaskId:L,toggleMain:y,toggleSidePanel:k,setMobileSurface:w,openSidePanel:S,createNewTask:j,openTab:C}}function CR(t){const e=F.c(10),{org:s}=qe(),n=xp(),{data:i}=xi.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=et.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let u;e[3]!==n||e[4]!==l?(u=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==d||e[8]!==u?(h={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:u},e[6]=c,e[7]=d,e[8]=u,e[9]=h):h=e[9],Et(h)}function NR(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function VR(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function TR(t){return t/100*window.innerHeight}function ER(t){return t/100*window.innerWidth}function AR(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 cd({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=AR(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=VR(e,i);break}case"em":{n=NR(e,i);break}case"vh":{n=TR(i);break}case"vw":{n=ER(i);break}}return n}function kn(t){return parseFloat(t.toFixed(3))}function ac({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 E1(t){const{panels:e}=t,s=ac({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 u=cd({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=kn(u/s*100)}let a;if(o.defaultSize!==void 0){const u=cd({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=kn(u/s*100)}let c=0;if(o.minSize!==void 0){const u=cd({groupSize:s,panelElement:i,styleProp:o.minSize});c=kn(u/s*100)}let d=100;if(o.maxSize!==void 0){const u=cd({groupSize:s,panelElement:i,styleProp:o.maxSize});d=kn(u/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 Gt(t,e="Assertion error"){if(!t)throw Error(e)}function A1(t,e){return Array.from(e).sort(t==="horizontal"?PR:DR)}function PR(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function DR(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function e8(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function t8(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 RR({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}=t8(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Gt(i,"No rect found"),i}let Ju;function IR(){return Ju===void 0&&(typeof matchMedia=="function"?Ju=!!matchMedia("(pointer:coarse)").matches:Ju=!1),Ju}function s8(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=A1(s,Array.from(e.children).filter(e8).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,u=-1,h=0,f,m=[];{let p=-1;for(const g of o)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(h++,d===-1&&(d=p),u=p))}if(h>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 _;if(c){const L=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),y=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:{_=[L,y];break}case 1:{const k=m[0],w=RR({orientation:s,rects:[b,v],targetRect:k.element.getBoundingClientRect()});_=[k,w===b?y:L];break}default:{_=m;break}}}else m.length?_=m:_=[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 _){let y="width"in L?L:L.element.getBoundingClientRect();const k=IR()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(y.width<k){const S=k-y.width;y=new DOMRect(y.x-S/2,y.y,y.width+S,y.height)}if(y.height<k){const S=k-y.height;y=new DOMRect(y.x,y.y-S/2,y.width,y.height+S)}const w=p<=d||p>u;!a&&!w&&l.push({group:t,groupSize:ac({group:t}),panels:[f,x],separator:"width"in L?void 0:L,rect:y}),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 n8=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)}}},Ba={cursorFlags:0,state:"inactive"};const h2=new n8;function ml(){return Ba}function MR(t){return h2.addListener("change",t)}function $R(t){const e=Ba,s={...Ba};s.cursorFlags=t,Ba=s,h2.emit("change",{prev:e,next:s})}function za(t){const e=Ba;Ba=t,h2.emit("change",{prev:e,next:t})}const OR=t=>t,L9=()=>{},i8=1,r8=2,o8=4,l8=8,sx=3,nx=12;let Qu;function ix(){return Qu===void 0&&(Qu=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Qu=!0)),Qu}function BR({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&&ix()){const o=(t&i8)!==0,l=(t&r8)!==0,a=(t&o8)!==0,c=(t&l8)!==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 ix()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const rx=new WeakMap;function f2(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=rx.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=ml();switch(n.state){case"active":case"hover":{const i=BR({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}}rx.set(t,{prevStyle:e,styleSheet:s})}let or=new Map;const a8=new n8;function zR(t){or=new Map(or),or.delete(t)}function ox(t,e){for(const[s]of or)if(s.id===t)return s}function wo(t,e){for(const[s,n]of or)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function El(){return or}function m2(t,e){return a8.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function Gr(t,e,s){const n=or.get(t);or=new Map(or),or.set(t,e),a8.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function c8(t){const e=ml();let s=!1;return e.state==="active"&&(za({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(f2(t),s=!0,e.hitRegions.forEach(n=>{const i=wo(n.group.id,!0);Gr(n.group,i,{isUserInteraction:!0})}))),s}function lx(t){t.defaultPrevented||c8(t.currentTarget)}function FR(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=t8(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 UR(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function HR(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:dx(t),b:dx(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Gt(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:cx(ax(s.a)),b:cx(ax(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 KR=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function WR(t){const e=getComputedStyle(d8(t)??t).display;return e==="flex"||e==="inline-flex"}function qR(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||WR(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"||KR.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function ax(t){let e=t.length;for(;e--;){const s=t[e];if(Gt(s,"Missing node"),qR(s))return s}return null}function cx(t){return t&&Number(getComputedStyle(t).zIndex)||0}function dx(t){const e=[];for(;t;)e.push(t),t=d8(t);return e}function d8(t){const{parentNode:e}=t;return UR(e)?e.host:e}function GR(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 YR({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!e8(s)||s.contains(t)||t.contains(s))return!0;if(HR(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(GR(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function p2(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=s8(i),l=FR(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&YR({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function JR(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 vn(t,e,s=0){return Math.abs(kn(t)-kn(e))<=s}function Zi(t,e){return vn(t,e)?0:t>e?1:-1}function Ia({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(Zi(n,c)<0)if(o){const d=(i+c)/2;Zi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=kn(n),n}function Jd({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(vn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Gt(u!=null,"Invalid first pivot index"),Gt(h!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?h:u,x=s[g];Gt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:_=0}=x;if(v){const L=a[g];if(Gt(L!=null,`Previous layout not found for panel index ${g}`),vn(L,b)){const y=_-L;Zi(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const g=t<0?u:h,x=s[g];Gt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:_=0}=x;if(v){const L=a[g];if(Gt(L!=null,`Previous layout not found for panel index ${g}`),vn(L,_)){const y=L-b;Zi(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}break}default:{const g=t<0?h:u,x=s[g];Gt(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:_,minSize:L}=x;if(v&&Zi(b,L)<0)if(t>0){const y=L-_,k=y/2,w=b+t;Zi(w,L)<0&&(t=Zi(t,k)<=0?0:y)}else{const y=L-_,k=100-y/2,w=b-t;Zi(w,L)<0&&(t=Zi(100+t,k)>0?0:-y)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const _=a[x];Gt(_!=null,`Previous layout not found for panel index ${x}`);const L=Ia({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:_,size:100})-_;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?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Gt(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,_=Ia({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!vn(b,_)&&(f+=b-_,d[g]=_,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(JR(c,d))return i;{const g=t<0?h:u,x=a[g];Gt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=Ia({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!vn(v,b)){let _=b-v,L=t<0?h:u;for(;L>=0&&L<s.length;){const y=d[L];Gt(y!=null,`Previous layout not found for panel index ${L}`);const k=y+_,w=Ia({overrideDisabledPanels:l,panelConstraints:s[L],prevSize:y,size:k});if(vn(y,w)||(_-=w-y,d[L]=w),vn(_,0))break;t>0?L--:L++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!vn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function pl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Zi(t[s],e[s])!==0)return!1;return!0}function gl({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(!vn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Gt(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];Gt(c!=null,`No layout data found for index ${a}`);const d=n[a];Gt(d!=null,`No layout data found for index ${a}`);const u=Ia({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(o+=d-u,n[a]=u)}if(!vn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Gt(c!=null,`No layout data found for index ${a}`);const d=c+o,u=Ia({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(o-=u-c,n[a]=u,vn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function u8({groupId:t,panelId:e}){const s=()=>{const c=El();for(const[d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,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:u,derivedPanelConstraints:h})=>{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=h[b];return v?.collapsible&&vn(v.collapsedSize,u[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+u[v.id],0);return{...u,[e]:kn(100-x)}}return Jd({delta:g?f-c:c-f,initialLayout:u,panelConstraints:h,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:u,trigger:"imperative-api"})},a=c=>{const d=o();if(c===d)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:h}),b=gl({layout:x,panelConstraints:h});pl(p,b)||Gr(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=o();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=o();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=o();return c&&vn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=ac({group:d}),f=cd({groupSize:h,panelElement:u,styleProp:c}),m=kn(f/h*100);a(m)}}}function ux(t){if(t.defaultPrevented)return;const e=El();p2(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=u8({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function P0(t){const e=El();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 h8({groupId:t}){const e=()=>{const s=El();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=gl({layout:s,panelConstraints:i});return n?a:(pl(a,d)||Gr(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function Ko(t,e){const s=P0(t),n=wo(s.id,!0),i=s.separators.find(u=>u.element===t);Gt(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Gt(o,"Matching panels not found");const l=o.map(u=>s.panels.indexOf(u)),a=h8({groupId:s.id}).getLayout(),c=Jd({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=gl({layout:c,panelConstraints:n.derivedPanelConstraints});pl(a,d)||Gr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function hx(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=P0(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&Ko(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&Ko(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&Ko(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&Ko(e,-5);break}case"End":{t.preventDefault(),Ko(e,100);break}case"Enter":{t.preventDefault();const n=P0(e),i=wo(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Gt(c,"Matching separator not found");const d=a.get(c);Gt(d,"Matching panels not found");const u=d[0],h=o.find(f=>f.panelId===u.id);if(Gt(h,"Panel metadata not found"),h.collapsible){const f=l[u.id],m=h.collapsedSize===f?n.mutableState.expandedPanelSizes[u.id]??h.minSize:h.collapsedSize;Ko(e,m-f)}break}case"F6":{t.preventDefault();const n=P0(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Gt(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(),Ko(e,-100);break}}}function fx(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=El(),s=p2(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)}),za({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function f8({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:u,groupSize:h}=d,{orientation:f,panels:m}=u,{disableCursor:p}=u.mutableState;let g=0;o?f==="horizontal"?g=(e.clientX-o.x)/h*100:g=(e.clientY-o.y)/h*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(u),b=i.get(u);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:_,groupSize:L,layout:y,separatorToPanels:k}=b;if(_&&y&&k){const w=Jd({delta:g,initialLayout:x,panelConstraints:_,pivotIndices:d.panels.map(S=>m.indexOf(S)),prevLayout:y,trigger:"mouse-or-touch"});if(pl(w,y)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?i8:r8;break}case"vertical":{a|=g<0?o8:l8;break}}}else Gr(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:_,groupSize:L,layout:w,separatorToPanels:k})}});let c=0;e.movementX===0?c|=l&sx:c|=a&sx,e.movementY===0?c|=l&nx:c|=a&nx,$R(c),f2(t)}function mx(t){const e=El(),s=ml();s.state==="active"&&f8({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function px(t){if(t.defaultPrevented)return;const e=ml(),s=El();switch(e.state){case"active":{if(t.buttons===0){za({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=wo(n.group.id,!0);Gr(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)}f8({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=p2(t,s);n.length===0?e.state!=="inactive"&&za({cursorFlags:0,state:"inactive"}):za({cursorFlags:0,hitRegions:n,state:"hover"}),f2(t.currentTarget);break}}}function gx(t){t.relatedTarget instanceof HTMLIFrameElement&&ml().state==="hover"&&za({cursorFlags:0,state:"inactive"})}function xx(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||c8(t.currentTarget)&&t.preventDefault()}function bx(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=kn(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=kn((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=ac({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:kn(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function XR(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 ZR({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 h of t.panels){const f=n[h.id]??0;if(h.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=kn(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),o+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),o>0)for(const h of c){const f=n[h]??0;u[h]=kn(f/o*d)}else{const h=kn(d/c.length);for(const f of c)u[f]=h}return u}function eI(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 La=new Map;function tI(t){let e=!0;Gt(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=ac({group:t});if(v===0)return;const _=wo(t.id);if(!_)return;const L=E1(t),y=_.defaultLayoutDeferred?bx(L):_.layout,k=ZR({group:t,nextGroupSize:v,prevGroupSize:_.groupSize,prevLayout:y}),w=gl({layout:k,panelConstraints:L});if(!_.defaultLayoutDeferred&&pl(_.layout,w)&&XR(_.derivedPanelConstraints,L)&&_.groupSize===v)return;Gr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:v,layout:w,separatorToPanels:_.separatorToPanels})}}else QR(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Gt(!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=ac({group:t}),a=E1(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(eI(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??bx(a),h=gl({layout:u,panelConstraints:a}),f=t.element.ownerDocument;La.set(f,(La.get(f)??0)+1);const m=new Map;return s8(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),Gr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Gt(!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",hx)}),La.get(f)===1&&(f.addEventListener("contextmenu",lx,!0),f.addEventListener("dblclick",ux,!0),f.addEventListener("pointerdown",fx,!0),f.addEventListener("pointerleave",mx),f.addEventListener("pointermove",px),f.addEventListener("pointerout",gx),f.addEventListener("pointerup",xx,!0)),function(){e=!1,La.set(f,Math.max(0,(La.get(f)??0)-1)),zR(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",hx)}),La.get(f)||(f.removeEventListener("contextmenu",lx,!0),f.removeEventListener("dblclick",ux,!0),f.removeEventListener("pointerdown",fx,!0),f.removeEventListener("pointerleave",mx),f.removeEventListener("pointermove",px),f.removeEventListener("pointerout",gx),f.removeEventListener("pointerup",xx,!0)),o.disconnect()}}function sI(){const[t,e]=A.useState({}),s=A.useCallback(()=>e({}),[]);return[t,s]}function g2(t){const e=A.useId();return`${t??e}`}const Al=typeof window<"u"?A.useLayoutEffect:A.useEffect;function wd(t){const e=A.useRef(t);return Al(()=>{e.current=t},[t]),A.useCallback((...s)=>e.current?.(...s),[e])}function x2(...t){return wd(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function b2(t){const e=A.useRef({...t});return Al(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const m8=A.createContext(null);function nI(t,e){const s=A.useRef({getLayout:()=>({}),setLayout:OR});A.useImperativeHandle(e,()=>s.current,[]),Al(()=>{Object.assign(s.current,h8({groupId:t}))})}function p8({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=A.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=wd(N=>{pl(p.current.onLayoutChange,N)||(p.current.onLayoutChange=N,c?.(N))}),x=wd((N,V)=>{pl(p.current.onLayoutChanged,N)||(p.current.onLayoutChanged=N,d?.(N,{isUserInteraction:V}))}),b=g2(a),v=A.useRef(null),[_,L]=sI(),y=A.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),k=x2(v,o);nI(b,l);const w=wd((N,V)=>{const T=ml(),E=ox(N),P=wo(N);if(P){let D=!1;return T.state==="active"&&(D=T.hitRegions.some(I=>I.group===E)),{flexGrow:P.layout[V]??1,pointerEvents:D?"none":void 0}}if(s?.[V])return{flexGrow:s?.[V]}}),S=b2({defaultLayout:s,disableCursor:n}),j=A.useMemo(()=>({get disableCursor(){return!!S.disableCursor},getPanelStyles:w,id:b,orientation:u,registerPanel:N=>{const V=y.current;return V.panels=A1(u,[...V.panels,N]),L(),()=>{V.panels=V.panels.filter(T=>T!==N),L()}},registerSeparator:N=>{const V=y.current;return V.separators=A1(u,[...V.separators,N]),L(),()=>{V.separators=V.separators.filter(T=>T!==N),L()}},updatePanelProps:(N,{disabled:V})=>{const T=y.current.panels.find(D=>D.id===N);T&&(T.panelConstraints.disabled=V);const E=ox(b),P=wo(b);E&&P&&Gr(E,{...P,derivedPanelConstraints:E1(E)})},updateSeparatorProps:(N,{disabled:V,disableDoubleClick:T})=>{const E=y.current.separators.find(P=>P.id===N);E&&(E.disabled=V,E.disableDoubleClick=T)}}),[w,b,L,u,S]),C=A.useRef(null);return Al(()=>{const N=v.current;if(N===null)return;const V=y.current;let T;if(S.defaultLayout!==void 0&&Object.keys(S.defaultLayout).length===V.panels.length){T={};for(const B of V.panels){const M=S.defaultLayout[B.id];M!==void 0&&(T[B.id]=M)}}const E={disabled:!!i,element:N,id:b,mutableState:{defaultLayout:T,disableCursor:!!S.disableCursor,expandedPanelSizes:y.current.lastExpandedPanelSizes,layouts:y.current.layouts},orientation:u,panels:V.panels,resizeTargetMinimumSize:V.resizeTargetMinimumSize,separators:V.separators};C.current=E;const P=tI(E),{defaultLayoutDeferred:D,derivedPanelConstraints:I,layout:R}=wo(E.id,!0);!D&&I.length>0&&(g(R),x(R,!1));const $=m2(b,B=>{const{defaultLayoutDeferred:M,derivedPanelConstraints:O,layout:z}=B.next;if(M||O.length===0)return;const U=E.panels.map(({id:K})=>K).join(",");E.mutableState.layouts[U]=z,O.forEach(K=>{if(K.collapsible){const{layout:W}=B.prev??{};if(W){const Y=vn(K.collapsedSize,z[K.panelId]),X=vn(K.collapsedSize,W[K.panelId]);Y&&!X&&(E.mutableState.expandedPanelSizes[K.panelId]=W[K.panelId])}}});const H=ml().state!=="active";g(z),H&&x(z,B.isUserInteraction)});return()=>{C.current=null,P(),$()}},[i,b,x,g,u,_,S]),A.useEffect(()=>{const N=C.current;N&&(N.mutableState.defaultLayout=s,N.mutableState.disableCursor=!!n)}),r.jsx(m8.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:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}p8.displayName="Group";function v2(){const t=A.useContext(m8);return Gt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function iI(t,e){const{id:s}=v2(),n=A.useRef({collapse:L9,expand:L9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:L9});A.useImperativeHandle(e,()=>n.current,[]),Al(()=>{Object.assign(n.current,u8({groupId:s,panelId:t}))})}function g8({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:u="0%",onResize:h,panelRef:f,style:m,...p}){const g=!!c,x=g2(c),b=b2({disabled:o}),v=A.useRef(null),_=x2(v,l),{getPanelStyles:L,id:y,orientation:k,registerPanel:w,updatePanelProps:S}=v2(),j=h!==null,C=wd((E,P,D)=>{h?.(E,c,D)});Al(()=>{const E=v.current;if(E!==null){const P={element:E,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?C:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return w(P)}},[a,s,n,i,j,x,g,d,u,C,w,b]),A.useEffect(()=>{S(x,{disabled:o})},[o,x,S]),iI(x,f);const N=()=>{const E=L(y,x);if(E)return JSON.stringify(E)},V=A.useSyncExternalStore(E=>m2(y,E),N,N);let T;return V?T=JSON.parse(V):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:_,style:{...rI,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})})}g8.displayName="Panel";const rI={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function oI({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,u=[n,n+1];o=gl({layout:Jd({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=gl({layout:Jd({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function x8({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=g2(o),d=b2({disabled:s,disableDoubleClick:n}),[u,h]=A.useState({}),[f,m]=A.useState("inactive"),[p,g]=A.useState(!1),x=A.useRef(null),b=x2(x,i),{disableCursor:v,id:_,orientation:L,registerSeparator:y,updateSeparatorProps:k}=v2(),w=L==="horizontal"?"vertical":"horizontal";Al(()=>{const C=x.current;if(C!==null){const N={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:C,id:c},V=y(N),T=MR(P=>{m(P.next.state!=="inactive"&&P.next.hitRegions.some(D=>D.separator===N)?P.next.state:"inactive")}),E=m2(_,P=>{const{derivedPanelConstraints:D,layout:I,separatorToPanels:R}=P.next,$=R.get(N);if($){const B=$[0],M=$.indexOf(B);h(oI({layout:I,panelConstraints:D,panelId:B.id,panelIndex:M}))}});return()=>{T(),E(),V()}}},[_,c,y,d]),A.useEffect(()=>{k(c,{disabled:s,disableDoubleClick:n})},[s,n,c,k]);let S;s&&!v&&(S="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":w,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.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:S,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}x8.displayName="Separator";function b8(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=re("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(p8,{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 Z0(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(g8,{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 v8(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=re("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(yc,{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(x8,{"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 vx(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function lI(t,e){const s=F.c(8);let n;s[0]!==e?(n=c=>vx(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=fv(t,n);let l;s[2]!==e||s[3]!==i?(l=vx(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 aI=33;function cI(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=lp.sidePanelWidth(),t[0]=e):e=t[0],lI(e,aI)}function P1(){const t=F.c(3),[e,s]=A.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function y8(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 y2(t){const e=y8(t);if(e)throw new Error(e)}function dI(t){try{return JSON.parse(t)}catch{return null}}function uI(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,n=s?dI(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=uI(t);return e===null?null:e}function _8(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 hI(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=_8(s);return!n||!s?null:{number:n,htmlUrl:s}}function yx(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const _x=/[\r\n<>]/,fI=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Su(t){const e=t?.userName?.trim();if(!e||_x.test(e))return null;const s=t?.userEmail?.trim();return!s||_x.test(s)?{userName:e}:fI.test(s)?{userName:e,userEmail:s}:{userName:e}}function mI(t){return t.split(`
3
3
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
4
4
  `).trimEnd()}function pI(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function L8(t,e){const s=Su(e);if(!s)return t;const n=mI(t),i=pI(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[27]=y):y=e[27];let k;return e[28]!==L||e[29]!==h?(k=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,L,y]}),e[28]=L,e[29]=h,e[30]=k):k=e[30],k}function f0(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,u=l?0:a?1:o===1?.8:.55,h=l?10:30-o,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=re("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==u||e[2]!==p||e[3]!==g||e[4]!==h?(x={transform:p,opacity:u,zIndex:h,transitionDuration:"1000ms",pointerEvents:g},e[1]=u,e[2]=p,e[3]=g,e[4]=h,e[5]=x):x=e[5];let b;return e[6]!==i||e[7]!==f||e[8]!==x?(b=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 Kf(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:re("size-2.5 rounded-full",hi)}),o=r.jsx("div",{className:re("size-2.5 rounded-full",hi)}),l=r.jsx("div",{className:re("size-2.5 rounded-full",hi)}),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:re("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",tr)}),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 LJ(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Kf,{}),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:gJ.map(SJ)})})]}),t[1]=s):s=t[1],s}function SJ(t,e){if(e===eS)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:re("relative rounded-md",hi),children:r.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${tS}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function wJ(){const t=F.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Kf,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:re("w-[18%] rounded-md",tr),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=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:re("rounded-md",tr),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),r.jsx("div",{className:re("rounded-md",tr),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function kJ(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Kf,{}),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:vJ.map(jJ)})})]}),t[1]=s):s=t[1],s}function jJ(t,e){return r.jsx("div",{className:re("aspect-square rounded-md",yJ[e]?"bg-chart-2/70":hi),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function CJ(){const t=F.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Kf,{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:re("h-1.5 w-[70%] rounded-sm",hi)}),i=r.jsx("div",{className:re("h-1.5 w-[55%] rounded-sm",hi)}),o=r.jsx("div",{className:re("h-1.5 w-[80%] rounded-sm",hi)}),l=r.jsx("div",{className:re("h-1.5 w-[50%] rounded-sm",hi)}),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:re("h-4 rounded-md",hi)})})]}),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:re("h-1.5 w-[55%] rounded-sm",tr)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=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:re("h-4 w-10 rounded-full",tr)}),r.jsx("div",{className:re("h-4 w-14 rounded-full",tr)})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsxs("div",{className:re("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",tr),children:[r.jsx("div",{className:re("h-1.5 w-[50%] rounded-sm",hi)}),r.jsx("div",{className:re("h-1 w-[75%] rounded-sm",hi)})]}),t[9]=u):u=t[9];let h;return t[10]===Symbol.for("react.memo_cache_sentinel")?(h=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:[u,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[r.jsx("div",{className:re("rounded-md",tr)}),r.jsx("div",{className:re("rounded-md",tr)})]})]})]})]})]})]}),t[10]=h):h=t[10],h}function Wa(t){const e=F.c(52),s=ie();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(_J,{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(Io,{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 _;e[13]!==v?(_=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:v}),e[13]=v,e[14]=_):_=e[14];let L;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(L=(m||p)&&t.connectionsHref&&r.jsx(de,{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 y=t.onRetry;let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(zn,{className:"size-4"}),e[20]=k):k=e[20];let w;e[21]!==s?(w=s("sandbox.stateCard.retry"),e[21]=s,e[22]=w):w=e[22];let S;e[23]!==t.onRetry||e[24]!==w?(S=r.jsxs(de,{variant:"outline",onClick:y,children:[k," ",w]}),e[23]=t.onRetry,e[24]=w,e[25]=S):S=e[25];let j;e[26]!==L||e[27]!==S?(j=r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[L,S]}),e[26]=L,e[27]=S,e[28]=j):j=e[28];let C;return e[29]!==j||e[30]!==b||e[31]!==_?(C=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,_,j]})}),e[29]=j,e[30]=b,e[31]=_,e[32]=C):C=e[32],C}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(WN,{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(fl,{className:"size-4"}),e[42]=d):d=e[42];let u;e[43]!==s?(u=s("sandbox.stateCard.resume"),e[43]=s,e[44]=u):u=e[44];let h;e[45]!==t.onResume||e[46]!==u?(h=r.jsxs(de,{onClick:c,className:"mt-2",children:[d," ",u]}),e[45]=t.onResume,e[46]=u,e[47]=h):h=e[47];let f;return e[48]!==o||e[49]!==a||e[50]!==h?(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,h]})}),e[48]=o,e[49]=a,e[50]=h,e[51]=f):f=e[51],f}function Tg(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function NJ(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 Eg(t){try{return NJ(localStorage.getItem(t))}catch{return null}}function VJ(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function sS(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 Sh(t,e){const n=e.replace(/\\/g,"/").replace(/^(?!\/)/,"/").split("/").map(i=>encodeURIComponent(i).replace(/%3A/gi,":")).join("/");return`${t}://file${n}?windowId=_blank`}const G4="site-links",TJ=/details?page|\bpdp\b/i,EJ=/listingpage|\bplp\b/i;function AJ(t,e,s){const n=new Set;for(const a of s)TJ.test(a)&&n.add("product"),EJ.test(a)&&n.add("category");const i=eh(ko(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 PJ=["rosa","preto","pink","black"];function m0(t,e){const s=e.trim();return s?t(s):PJ.flatMap(n=>t(n))}function DJ(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 nS=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function Ag(t){return t.split("/")[0]??""}function RJ(t){const e=new Set;for(const s of t){const n=Ag(s);nS.has(n)&&e.add(n)}return e}function IJ(t,e){const s=Ag(t);return!nS.has(s)||e.size===0?!0:e.has(s)}const MJ=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>m0(s=>DJ(t,s),e),optionsFromPayload:p0},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>m0(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:p0},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>m0(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:p0},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>m0(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:p0},{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:HJ}];function $J(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of MJ){if(d.kind!==a)continue;const u=n.find(h=>d.test(h)&&IJ(h,s));u&&c.push({cand:d,resolveType:u})}return c.find(d=>s.has(Ag(d.resolveType)))??c[0]},o=(a,c,d)=>({kind:a.kind,id:`${a.kind}:${c}`,resolveType:c,clientFilter:a.clientFilter,isFallback:d,buildRequests:u=>a.buildRequests(c,u),optionsFromPayload:a.optionsFromPayload}),l=[];for(const a of["product","category"]){if(!t.has(a))continue;const c=i(a);c&&l.push(o(c.cand,c.resolveType,!1))}return t.size>0&&l.push(OJ(t.has("category")?"category":"product")),l}function OJ(t){return{kind:t,id:G4,resolveType:G4,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>YJ(e,s)}}function sl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function BJ(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=sl(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=sl(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 iS(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 rS(t){try{return decodeURIComponent(t)}catch{return t}}function zJ(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FJ(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=zJ(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function oS(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=eh(ko(e)),{pattern:o,order:l}=FJ(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?rS(d):null}function p0(t,e){const s=sl(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=sl(l);if(!a)continue;const c=oS(a.url,e.template,e.paramName);if(!c||o.has(c))continue;o.add(c);const d=sl(a.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,h=Array.isArray(a.image)?sl(a.image[0]):null,f=typeof h?.url=="string"?h.url:void 0;i.push({value:c,label:u,image:f})}return i}function UJ(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?rS(s):null}function HJ(t){const e=[],s=new Set,n=(i,o)=>{const l=sl(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...o,a]:o,d=UJ(l.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(l.children))for(const u of l.children)n(u,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const KJ=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 WJ(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function qJ(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 GJ(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 YJ(t,e){const s=[],n=new Set,i=(o,l,a,c)=>{if(s.length>=200)return;const d=oS(o,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&KJ.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:WJ(d),kind:a,image:c}))};for(const{url:o,name:l,image:a}of GJ(t))i(o,l,"product",a);for(const{href:o,text:l}of qJ(t))o.startsWith("/")&&!o.startsWith("//")&&i(o,l,"category");return s}function Yc(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 lS=1e4;function JJ(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 QJ(t,{resolveType:e,props:s}){const n=await fetch(E8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(lS)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function Y4(t,e){const s=await fetch(T8(t,e),{signal:AbortSignal.timeout(lS)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function XJ(t,e,s){const n=e.optionsFromPayload(await Y4(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const o=Ar(s.template,{[s.paramName]:i.value});if(o==="/")return n;try{const l=e.optionsFromPayload(await Y4(t,o),s).filter(a=>a.kind==="product");return iS([n,l])}catch{return n}}function ZJ(t,e,s){return et.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function eQ(t,e,s,n){if(e.homepageLinks)return XJ(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const o=await Promise.allSettled(i.map(a=>QJ(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 iS(l.map(a=>e.optionsFromPayload(a,n)))}function am(t,e,s,n,i){return{queryKey:ZJ(t,e,s),queryFn:()=>eQ(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Jc(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 h;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==o?(h=f=>r.jsxs(Yt,{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(hu,{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:Ar(o,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=o,e[12]=h):h=e[12],d=i.map(h),e[0]=n,e[1]=a,e[2]=c,e[3]=i,e[4]=l,e[5]=o,e[6]=d}else d=e[6];let u;return e[13]!==s||e[14]!==d?(u=r.jsx(gs,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=u):u=e[15],u}function J4(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 tQ(t){const e=F.c(52),{sources:s,template:n,paramName:i,value:o,sandboxRef:l,onCommit:a}=t,c=ie(),[d,u]=A.useState(!1),[h,f]=A.useState(""),[m,p]=A.useState(""),g=A.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=JJ(c),_=[...new Set(s.map(ke=>b[ke.kind].noun))].join(" or ");let L;e[0]!==c||e[1]!==_?(L=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:_}),e[0]=c,e[1]=_,e[2]=L):L=e[2];const y=L,k={template:n,paramName:i};let w;e[3]!==h?(w=(ke,Ne)=>({source:ke,query:Ne,options:ke.clientFilter?Yc(Ne.data??[],h):Ne.data??[]}),e[3]=h,e[4]=w):w=e[4];const S=w,j=s.filter(cQ),C=s.filter(aQ),N=w1({queries:j.map(ke=>am(l,ke,m,k,d))});let V;e[5]!==N||e[6]!==S?(V=(ke,Ne)=>S(ke,N[Ne]),e[5]=N,e[6]=S,e[7]=V):V=e[7];const T=j.map(V),E=T.length===0||T.every(lQ),P=w1({queries:C.map(ke=>am(l,ke,m,k,d&&E))});let D;e[8]!==P||e[9]!==S?(D=(ke,Ne)=>S(ke,P[Ne]),e[8]=P,e[9]=S,e[10]=D):D=e[10];const I=C.map(D),R=E?I:T,$=R.length===1&&R[0]?.source.homepageLinks?R[0]:null,M=$&&!$.query.isLoading&&!$.query.isError?$?.query.data??[]:[],O=Yc(M.filter(oQ),h),z=Yc(M.filter(rQ),h),U=O.length>0&&z.length>0,H=ke=>{u(ke),g.current&&clearTimeout(g.current),f(ke?o:""),p(ke?o:"")};let K;e[11]===Symbol.for("react.memo_cache_sentinel")?(K=ke=>{f(ke),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(ke)},300)},e[11]=K):K=e[11];const W=K,Y=ke=>{a(ke),H(!1)},X=F8(h),ne=Ar(n,{[i]:X}),se=Mt,oe=It,Z="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",J=iQ;let q;e[12]!==x||e[13]!==c?(q=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=q):q=e[14];let G;e[15]!==q?(G=r.jsx(xs,{className:"sr-only",children:r.jsx(Wt,{children:q})}),e[15]=q,e[16]=G):G=e[16];let te;e[17]===Symbol.for("react.memo_cache_sentinel")?(te=r.jsx(hu,{size:16,className:"shrink-0 text-foreground"}),e[17]=te):te=e[17];let le;e[18]!==c?(le=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=le):le=e[19];let ee;e[20]!==x?(ee=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]=ee):ee=e[21];let ae;e[22]!==le||e[23]!==ee?(ae=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[te,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[le," ",ee]})]}),e[22]=le,e[23]=ee,e[24]=ae):ae=e[24];const ue=zi,he=!1,ce="min-h-0 flex-1";let ge;e[25]!==y||e[26]!==h?(ge=r.jsx(yi,{autoFocus:!0,placeholder:y,value:h,onValueChange:W}),e[25]=y,e[26]=h,e[27]=ge):ge=e[27];const Q=_i,me="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ve;e[28]!==c?(ve=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ve):ve=e[29];let we;e[30]!==ve?(we=r.jsx(si,{children:ve}),e[30]=ve,e[31]=we):we=e[31];const ye=X&&r.jsx(gs,{className:"shrink-0",children:r.jsxs(Yt,{value:`__raw__:${X}`,className:"gap-3 py-2",onSelect:()=>Y(X),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(Bo,{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:X,paramLabel:x})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:ne})]})]})}),Le=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(Jc,{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(Jc,{heading:b.product.heading,iconKind:"product",options:z,template:n,paramName:i,keyPrefix:`${$?.source.id}:prod`,onSelect:Y})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:R.map(ke=>{const{source:Ne,query:Fe,options:Ye}=ke,{noun:Ie}=b[Ne.kind];if(Fe.isLoading)return r.jsx(J4,{text:c("sandbox.pathParamPickerChip.loading",{noun:Ie})},Ne.id);if(Fe.isError)return r.jsx(J4,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ne.id);if(Ne.homepageLinks){const Re=Fe.data??[];return r.jsxs(A.Fragment,{children:[r.jsx(Jc,{heading:b.category.heading,iconKind:"category",options:Yc(Re.filter(nQ),h),template:n,paramName:i,keyPrefix:`${Ne.id}:cat`,onSelect:Y}),r.jsx(Jc,{heading:b.product.heading,iconKind:"product",options:Yc(Re.filter(sQ),h),template:n,paramName:i,keyPrefix:`${Ne.id}:prod`,onSelect:Y})]},Ne.id)}return r.jsx(Jc,{heading:R.length>1?b[Ne.kind].heading:void 0,iconKind:Ne.kind,options:Ye,template:n,paramName:i,keyPrefix:Ne.id,onSelect:Y},Ne.id)})});let Ce;e[32]!==Q||e[33]!==we||e[34]!==ye||e[35]!==Le?(Ce=r.jsxs(Q,{className:me,children:[we,ye,Le]}),e[32]=Q,e[33]=we,e[34]=ye,e[35]=Le,e[36]=Ce):Ce=e[36];let Te;e[37]!==ue||e[38]!==ge||e[39]!==Ce?(Te=r.jsxs(ue,{shouldFilter:he,className:ce,children:[ge,Ce]}),e[37]=ue,e[38]=ge,e[39]=Ce,e[40]=Te):Te=e[40];let _e;e[41]!==oe||e[42]!==G||e[43]!==ae||e[44]!==Te||e[45]!==J?(_e=r.jsxs(oe,{className:Z,onClick:J,children:[G,ae,Te]}),e[41]=oe,e[42]=G,e[43]=ae,e[44]=Te,e[45]=J,e[46]=_e):_e=e[46];let Pe;return e[47]!==se||e[48]!==H||e[49]!==d||e[50]!==_e?(Pe=r.jsx(se,{open:d,onOpenChange:H,children:_e}),e[47]=se,e[48]=H,e[49]=d,e[50]=_e,e[51]=Pe):Pe=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:ke=>{ke.stopPropagation(),H(!0)},children:o||x}),Pe]})}function sQ(t){return t.kind==="product"}function nQ(t){return t.kind!=="product"}function iQ(t){return t.stopPropagation()}function rQ(t){return t.kind==="product"}function oQ(t){return t.kind!=="product"}function lQ(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function aQ(t){return t.isFallback}function cQ(t){return!t.isFallback}function dQ(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(uQ);c=w1,a=p.map(g=>am(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 u=c(d),[h,f]=A.useState(!1);if(!h)for(const m of u){if(m.isLoading)break;const p=m.data?.[0];if(p){f(!0),queueMicrotask(()=>l(p.value));break}}return null}function uQ(t){return!t.isFallback}function hQ(t){const e=F.c(31),{name:s,value:n,onCommit:i}=t,o=ie(),[l,a]=A.useState(n),[c,d]=A.useState(!1),u=A.useRef(!1);let h;e[0]!==s||e[1]!==o?(h=s==="*"?o("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=o,e[2]=h):h=e[2];const f=h,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=S=>a(S.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let v;e[10]!==n?(v=S=>{S.key==="Enter"&&S.currentTarget.blur(),S.key==="Escape"&&(u.current=!0,a(n),S.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let _;e[12]!==l||e[13]!==i||e[14]!==n?(_=()=>{if(d(!1),u.current){u.current=!1;return}const S=F8(l);a(S),S!==n&&i(S)},e[12]=l,e[13]=i,e[14]=n,e[15]=_):_=e[15];let L;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==_?(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:fQ,onChange:x,onFocus:b,onKeyDown:v,onBlur:_}),e[16]=l,e[17]=f,e[18]=g,e[19]=v,e[20]=_,e[21]=L):L=e[21];let y;e[22]!==p||e[23]!==L?(y=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]=y):y=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(qN,{size:10}),o("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=o,e[27]=k):k=e[27];let w;return e[28]!==k||e[29]!==y?(w=r.jsxs(r.Fragment,{children:[y,k]}),e[28]=k,e[29]=y,e[30]=w):w=e[30],w}function fQ(t){return t.stopPropagation()}const mQ={loaders:"loader",actions:"action"},aS=new Set(["workflows"]);function cS(t){return mQ[t]}function pQ(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 gQ(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 xQ(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function dS(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")||Y8.has(o)||aS.has(Pg(o))||xQ(o,i))continue;const l=Fo(o,t);if(l.hidden)continue;const a=l.title&&l.title!==o?l.title:ps(o);n.push({resolveType:o,title:a})}return n.sort((o,l)=>o.title.localeCompare(l.title))}function Q4(t,e){return dS(t,e).length}function Pg(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const bQ={deco:"Deco",std:"Deco Standard",website:"Website"};function vQ(t){return bQ[t]??t}function uS(t){const e=Pg(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 hS(t,e,s){const n=[];for(const[i,o]of Object.entries(e)){if(i.includes("/")||Sf(i)||!o||typeof o!="object"||Array.isArray(o))continue;const l=o,a=l.__resolveType;typeof a=="string"&&(Y8.has(a)||aS.has(Pg(a))||pQ(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 fS(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 mS(t){const e=F.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,enabled:l}=t,a=l===void 0?!0:l;let c;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n?(c=et.sandboxRepoDir(s,n,i,o),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==n?(d=async()=>{const f=Yr({orgSlug:s,virtualMcpId:n,branch:i,threadId:o},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=o,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==a||e[11]!==c||e[12]!==d?(u={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=u):u=e[13],Et(u).data??null}const yQ={target:null,editSeoPageKey:null,variantOverride:null};function _Q(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 pS=A.createContext(null);function X4(t){const e=F.c(9),{children:s}=t,[n,i]=A.useReducer(_Q,yQ);let o,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h=>i({type:"select",target:h}),l=h=>i({type:"edit-seo",target:h}),a=()=>i({type:"consume-edit-seo"}),c=h=>i({type:"variant-override",params:h}),e[0]=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 u;return e[6]!==s||e[7]!==d?(u=r.jsx(pS,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=u):u=e[8],u}function gS(){const t=A.use(pS);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}function Dg(t){return(e,s)=>{D8(e),t(e,s)}}const LQ="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function Wf(t){return Ws(t)?.metadata?.fieldDescriptionTooltips??!1}function Rg(t){const e=F.c(9),{description:s,virtualMcpId:n,children:i}=t,o=Wf(n);if(!s||!o)return i;let l;e[0]!==i?(l=A.cloneElement(i,{className:re(i.props.className,LQ)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx(He,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=r.jsx(Ke,{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(We,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Us(t){const e=F.c(17),{htmlFor:s,label:n,description:i,labelClassName:o,virtualMcpId:l}=t;if(!Wf(l)){let u;e[0]!==s||e[1]!==n||e[2]!==o?(u=r.jsx(Bt,{htmlFor:s,className:o,children:n}),e[0]=s,e[1]=n,e[2]=o,e[3]=u):u=e[3];let h;e[4]!==i?(h=i&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=h):h=e[5];let f;return e[6]!==u||e[7]!==h?(f=r.jsxs("div",{className:"space-y-0.5",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==o?(c=r.jsx(Bt,{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(Rg,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}var SQ=vr.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")}}}),wQ=SQ,kQ=20,xS=(t,e=0)=>{const s=[];return!t.children.length||e>kQ||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...xS(n,e+1))}),s},jQ=t=>{if(!t.children.length)return;const e=xS(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}`)})},bS=UC.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&jQ(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",pp(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}}}}),CQ=vr.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()}}}),vS=vr.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()}}}),NQ=vr.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()}}}),yS=vr.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()}}}),VQ=vr.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()}}});vr.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(CQ.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(vS.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(NQ.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(yS.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(VQ.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(bS.configure(this.options.textStyle)),t}});const TQ=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function EQ(t){const e=F.c(30),{editor:s,currentColor:n,open:i,onOpenChange:o}=t,l=ie(),[a,c]=A.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 u=d;let h;e[3]!==s||e[4]!==o?(h=()=>{s.chain().focus().unsetColor().run(),o(!1)},e[3]=s,e[4]=o,e[5]=h):h=e[5];const f=h,m=i||n!==null;let p;e[6]!==l?(p=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=p):p=e[7];let g;e[8]!==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(j1,{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 _;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(_=r.jsx(es,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=_):_=e[18];let L;e[19]!==u||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:TQ.map(k=>r.jsx("button",{type:"button","aria-label":k,"aria-pressed":n===k,onMouseDown:DQ,onClick:()=>u(k),className:re("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:PQ,onChange:k=>c(k.target.value),onBlur:()=>u(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:AQ,onClick:f,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:l("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=u,e[20]=f,e[21]=n,e[22]=a,e[23]=o,e[24]=i,e[25]=l,e[26]=L):L=e[26];let y;return e[27]!==L||e[28]!==_?(y=r.jsxs("div",{className:"relative",children:[_,L]}),e[27]=L,e[28]=_,e[29]=y):y=e[29],y}function AQ(t){return t.preventDefault()}function PQ(t){return t.stopPropagation()}function DQ(t){return t.preventDefault()}const g0=[1,2,3,4,5,6];function RQ(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 IQ=8,MQ=128,$Q=16,Z4=1;function OQ({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o,inline:l=!1}){const a=ie(),c=typeof e=="string"?e:"",d=A.useRef(s);d.current=s;const[u,h]=A.useState(!1),[f,m]=A.useState(!1),p=hp({extensions:[fp.configure({heading:l?!1:{levels:[...g0]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[wQ.configure({types:["heading","paragraph"]})],bS,yS,vS],content:c||"",editorProps:{attributes:{class:re("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:y})=>{const k=y.getHTML(),w=l?RQ(k):k;d.current(w==="<p></p>"||w===""?"":w)}}),g=Ov({editor:p,selector:({editor:y})=>({bold:y?.isActive("bold")??!1,italic:y?.isActive("italic")??!1,underline:y?.isActive("underline")??!1,strike:y?.isActive("strike")??!1,headingLevel:g0.find(k=>y?.isActive("heading",{level:k})??!1)??0,fontSize:y?.getAttributes("textStyle").fontSize??null,color:y?.getAttributes("textStyle").color??null,bulletList:y?.isActive("bulletList")??!1,orderedList:y?.isActive("orderedList")??!1,link:y?.isActive("link")??!1,alignLeft:y?.isActive({textAlign:"left"})??!1,alignCenter:y?.isActive({textAlign:"center"})??!1,alignRight:y?.isActive({textAlign:"right"})??!1,alignJustify:y?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=y=>{const k=p.chain().focus();if(y==="paragraph"){k.setParagraph().run();return}const w=g0.find(S=>`h${S}`===y);w&&k.setHeading({level:w}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,_=Number.isFinite(v)?v:$Q,L=y=>{const k=Math.min(MQ,Math.max(IQ,y));p.chain().focus().setFontSize(`${k}px`).run()};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(Us,{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(es,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:r.jsx(vy,{size:14})}),r.jsx(es,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:r.jsx(yy,{size:14})}),r.jsx(es,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:r.jsx(GN,{size:14})}),r.jsx(es,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:r.jsx(_y,{size:14})}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs(Cs,{value:x,onValueChange:b,children:[r.jsx(Ns,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:y=>y.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:r.jsx(Is,{})}),r.jsxs(Vs,{children:[r.jsx(Pt,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),g0.map(y=>r.jsx(Pt,{value:`h${y}`,children:a("sectionsEditor.richTextField.styleHeading",{level:y})},y))]})]})]}),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(es,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>L(_-Z4),children:r.jsx(jp,{size:14})}),r.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:_}),r.jsx(es,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>L(_+Z4),children:r.jsx($t,{size:14})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(EQ,{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(es,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:r.jsx(i2,{size:14})}),r.jsx(es,{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(ZU,{editor:p,active:g.link,open:u,onOpenChange:h}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(es,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:r.jsx(xV,{size:14})}),r.jsx(es,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:r.jsx(YN,{size:14})}),r.jsx(es,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:r.jsx(JN,{size:14})}),r.jsx(es,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:r.jsx(QN,{size:14})})]})]}),r.jsx(mp,{editor:p})]})]})}const Ma=t=>String(t).padStart(2,"0"),BQ="1900-01-01",zQ="2099-12-31",FQ="1900-01-01T00:00",UQ="2099-12-31T23:59";function HQ(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()}-${Ma(s.getUTCMonth()+1)}-${Ma(s.getUTCDate())}`}function KQ(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function WQ(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ma(e.getMonth()+1)}-${Ma(e.getDate())}T${Ma(e.getHours())}:${Ma(e.getMinutes())}`}function qQ(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function GQ(t){const e=F.c(41),{id:s,withTime:n,value:i,onChange:o,calendarLabel:l}=t,[a,c]=A.useState(!1);let d;e[0]!==n?(d=$=>n?WQ($):HQ($),e[0]=n,e[1]=d):d=e[1];const u=d;let h;e[2]!==n?(h=$=>n?qQ($):KQ($),e[2]=n,e[3]=h):h=e[3];const f=h;let m;e[4]!==u||e[5]!==i?(m=()=>u(i),e[4]=u,e[5]=i,e[6]=m):m=e[6];const[p,g]=A.useState(m),[x,b]=A.useState(i);if(i!==x){b(i);const $=u(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 _=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 y=L;let k;e[12]!==o||e[13]!==y||e[14]!==u||e[15]!==n?(k=$=>{if(!$)return;n&&y?$.setHours(y.getHours(),y.getMinutes(),0,0):$.setHours(0,0,0,0);const B=$.toISOString();g(u(B)),b(B),o(B),c(!1)},e[12]=o,e[13]=y,e[14]=u,e[15]=n,e[16]=k):k=e[16];const w=k,S=n?"datetime-local":"date",j=n?FQ:BQ,C=n?UQ:zQ;let N;e[17]!==u||e[18]!==i?(N=()=>g(u(i)),e[17]=u,e[18]=i,e[19]=N):N=e[19];let V;e[20]!==_||e[21]!==s||e[22]!==p||e[23]!==N||e[24]!==S||e[25]!==j||e[26]!==C?(V=r.jsx(bt,{id:s,type:S,min:j,max:C,value:p,onChange:_,onBlur:N,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=_,e[21]=s,e[22]=p,e[23]=N,e[24]=S,e[25]=j,e[26]=C,e[27]=V):V=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx($r,{className:"h-4 w-4"}),e[28]=T):T=e[28];let E;e[29]!==l?(E=r.jsx(is,{asChild:!0,children:r.jsx(de,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:T})}),e[29]=l,e[30]=E):E=e[30];const P=y??void 0;let D;e[31]!==w||e[32]!==P?(D=r.jsx(rs,{className:"w-auto p-0",align:"end",onCloseAutoFocus:YQ,children:r.jsx(gp,{mode:"single",selected:P,onSelect:w,initialFocus:!0})}),e[31]=w,e[32]=P,e[33]=D):D=e[33];let I;e[34]!==a||e[35]!==E||e[36]!==D?(I=r.jsxs(os,{open:a,onOpenChange:c,children:[E,D]}),e[34]=a,e[35]=E,e[36]=D,e[37]=I):I=e[37];let R;return e[38]!==V||e[39]!==I?(R=r.jsxs("div",{className:"flex gap-1",children:[V,I]}),e[38]=V,e[39]=I,e[40]=R):R=e[40],R}function YQ(t){return t.preventDefault()}function x0(t){const e=F.c(76),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=ie(),d=typeof n=="string"?n:"",u=s.format;if(u==="rich-text"||u==="rich-text-inline"||u==="html"){const v=u==="rich-text-inline";let _;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==a||e[4]!==s||e[5]!==v||e[6]!==n?(_=r.jsx(OQ,{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]=_):_=e[7],_}if(u==="textarea"||u==="markdown"){const v=a?.virtualMcpId;let _;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==v?(_=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=v,e[12]=_):_=e[12];let L;e[13]!==i?(L=w=>i(w.target.value),e[13]=i,e[14]=L):L=e[14];let y;e[15]!==o||e[16]!==d||e[17]!==L?(y=r.jsx(Wr,{id:o,value:d,onChange:L,rows:4}),e[15]=o,e[16]=d,e[17]=L,e[18]=y):y=e[18];let k;return e[19]!==_||e[20]!==y?(k=r.jsxs("div",{className:"space-y-2",children:[_,y]}),e[19]=_,e[20]=y,e[21]=k):k=e[21],k}if(u==="date"||u==="date-time"){const v=a?.virtualMcpId;let _;e[22]!==l||e[23]!==o||e[24]!==s.description||e[25]!==v?(_=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[22]=l,e[23]=o,e[24]=s.description,e[25]=v,e[26]=_):_=e[26];const L=u==="date-time";let y;e[27]!==c?(y=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=y):y=e[28];let k;e[29]!==i||e[30]!==o||e[31]!==d||e[32]!==L||e[33]!==y?(k=r.jsx(GQ,{id:o,withTime:L,value:d,onChange:i,calendarLabel:y}),e[29]=i,e[30]=o,e[31]=d,e[32]=L,e[33]=y,e[34]=k):k=e[34];let w;return e[35]!==_||e[36]!==k?(w=r.jsxs("div",{className:"space-y-2",children:[_,k]}),e[35]=_,e[36]=k,e[37]=w):w=e[37],w}if(u==="color-input"||u==="color"){const v=a?.virtualMcpId;let _;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==v?(_=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=v,e[42]=_):_=e[42];const L=d||"#000000";let y;e[43]!==i?(y=N=>i(N.target.value),e[43]=i,e[44]=y):y=e[44];let k;e[45]!==L||e[46]!==y?(k=r.jsx("input",{type:"color",value:L,onChange:y,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=L,e[46]=y,e[47]=k):k=e[47];let w;e[48]!==i?(w=N=>i(N.target.value),e[48]=i,e[49]=w):w=e[49];let S;e[50]!==o||e[51]!==d||e[52]!==w?(S=r.jsx(bt,{id:o,value:d,onChange:w,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=o,e[51]=d,e[52]=w,e[53]=S):S=e[53];let j;e[54]!==k||e[55]!==S?(j=r.jsxs("div",{className:"flex items-center gap-2",children:[k,S]}),e[54]=k,e[55]=S,e[56]=j):j=e[56];let C;return e[57]!==_||e[58]!==j?(C=r.jsxs("div",{className:"space-y-2",children:[_,j]}),e[57]=_,e[58]=j,e[59]=C):C=e[59],C}const h=a?.virtualMcpId;let f;e[60]!==l||e[61]!==o||e[62]!==s.description||e[63]!==h?(f=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:h}),e[60]=l,e[61]=o,e[62]=s.description,e[63]=h,e[64]=f):f=e[64];const m=u==="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(bt,{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 JQ=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,QQ=/^[+-]?\d*$/;function XQ(t,e){return(e?QQ:JQ).test(t)}function ZQ(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,u]=A.useState(c),[h,f]=A.useState(c);c!==h&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||u(c));const m=a?.virtualMcpId;let p;e[0]!==l||e[1]!==o||e[2]!==s.description||e[3]!==m?(p=r.jsx(Us,{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=_=>{const L=_.target.value,y=s.type==="integer";if(L!==""&&!XQ(L,y))return;u(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(bt,{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 eX(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 u;e[0]!==o||e[1]!==i||e[2]!==l.description||e[3]!==d?(u=r.jsx(Us,{htmlFor:i,label:o,description:l.description,virtualMcpId:d}),e[0]=o,e[1]=i,e[2]=l.description,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=p=>n(p),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==h?(f=r.jsx(pr,{id:i,checked:c,onCheckedChange:h}),e[7]=c,e[8]=i,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==u||e[12]!==f?(m=r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13],m}const Ig="__enum_empty__",_S="__enum_clear__";function Mg(t){return t===""?Ig:String(t)}function tX(t,e){if(t===Ig)return"";const s=e.find(n=>Mg(n)===t);return s!==void 0?s:t}function sX(t,e){if(t!==_S)return tX(t,e)}function nX(t,e){return t==null?e.some(s=>s==="")?Ig:void 0:Mg(t)}function iX(t){return t===""?"":String(t)}function rX(t){const e=F.c(39),{schema:s,value:n,onChange:i,path:o,label:l,required:a,sandbox:c}=t,d=ie();let u;e[0]!==s.enum?(u=s.enum??[],e[0]=s.enum,e[1]=u):u=e[1];const h=u;let f;e[2]!==h||e[3]!==n?(f=nX(n,h),e[2]=h,e[3]=n,e[4]=f):f=e[4];const m=f;let p;e[5]!==h||e[6]!==a?(p=!a&&!h.some(lX),e[5]=h,e[6]=a,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==x?(b=r.jsx(Us,{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]!==h?(v=N=>i(sX(N,h)),e[13]=i,e[14]=h,e[15]=v):v=e[15];let _;e[16]!==d?(_=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=_):_=e[17];let L;e[18]!==_?(L=r.jsx(Is,{placeholder:_}),e[18]=_,e[19]=L):L=e[19];let y;e[20]!==o||e[21]!==L?(y=r.jsx(Ns,{id:o,className:"h-10",children:L}),e[20]=o,e[21]=L,e[22]=y):y=e[22];let k;e[23]!==g||e[24]!==d?(k=g&&r.jsx(Pt,{value:_S,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=k):k=e[25];let w;e[26]!==h?(w=h.map(oX),e[26]=h,e[27]=w):w=e[27];let S;e[28]!==k||e[29]!==w?(S=r.jsxs(Vs,{children:[k,w]}),e[28]=k,e[29]=w,e[30]=S):S=e[30];let j;e[31]!==m||e[32]!==S||e[33]!==v||e[34]!==y?(j=r.jsxs(Cs,{value:m,onValueChange:v,children:[y,S]}),e[31]=m,e[32]=S,e[33]=v,e[34]=y,e[35]=j):j=e[35];let C;return e[36]!==j||e[37]!==b?(C=r.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=C):C=e[38],C}function oX(t){const e=Mg(t);return r.jsx(Pt,{value:e,children:iX(t)},e)}function lX(t){return t===""}const LS={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function SS(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function Td(t){return SS(t)?.variants?.[0]?.rule?.__resolveType===Cc}function e5(t){return{__resolveType:Ao,variants:[{value:t,rule:{__resolveType:Cc}}]}}function wS(t){return Td(t)?SS(t)?.variants?.[0]?.value:t}function $a(t){return Td(t)?wS(t):t}function $g(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Ms(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function aX(t){return t.includes("flags/multivariate")}function cX(t){return ps(t)}function dX(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??cX(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=$g(e.editorValue);o?.includes("/")&&i(o)}return s}function uX(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(pi(o)){const h=e.find(f=>f.resolveType===o);return h?h.resolveType:o}const d=e.find(h=>kx(h.resolveType,o));if(d)return d.resolveType;const u=e.find(h=>h.resolveType===o);if(u)return u.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(u=>u.discriminatorValue===l||u.resolveType===l||kx(u.resolveType,l));if(d)return d.resolveType}let a=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const h=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>i[f]!==void 0).length;h>0&&h>c&&(c=h,a=d.resolveType)}return c>0,a}function t5(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=$g(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=Un(n,e);return i||(n.includes("/")?null:s??null)}function hX(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 kS(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Ms(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function fX(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=$g(s);return n&&aX(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function Og(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:""}const mX=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),pX=5,gX=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function s5(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:gX.format(d)},l=o(n),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function mc(t,e=0){if(!t)return"Default";if(e>pX)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(mX).join(" & "):ps(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return s5(t)??ps(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`:ps(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(" - "):ps(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:ps(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=>mc(a,e+1)).join(` ${l} `)}return ps(s)}default:{const i=s5(t);return i||ps(s)||"Default"}}}function jS(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function CS(t,e){if(e.length===0)return 0;const s=jS(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(u=>!a.has(u)).filter(u=>s[u]!==void 0&&s[u]!==null&&s[u]!=="").length;d>i&&(i=d,n=o)}return n}function xX(t,e){const s=jS(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}function bX(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function vX(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"))??e.find(i=>i.value!=null);if(n&&n.value!=null)return n.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function cm(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(cm);const e=t;if(e.__resolveType){const s=vX(e);return s===void 0?t:cm(s)}return NS(e)}function NS(t){const e={};for(const[s,n]of Object.entries(t))e[s]=cm(n);return e}function yX(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function VS(t){return t==null?"":Array.isArray(t)?t.map(VS).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function wh(t,e){if(!t.includes("{"))return;const s=NS(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return VS(yX(s,a))}).trim()||void 0}function _X(t){return t.replace(/<[^>]*>/g,"").trim()}function LX(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function SX(t){return/^Option \d+$/.test(t)}function wX(t,e){if(e.includes("{"))return wh(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 TS(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=$a(t);const i=kS(n);if(i&&(n=i,n=$a(n)),s?.titleBy){const l=wX(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=CS(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!SX(a)){const c=wh(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=_X(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 o.includes("/matchers/")?mc(n):ps(o);if(s?.title){const l=wh(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function kh(t,e){return t.map((s,n)=>TS(s,n,e))}function ES(t,e,s){return TS(t,e,s)}function kX(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 n5(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=kX(e);if(!s)return;const n=wh(s,t);if(!n)return;const i=Og(n)||n;return bX(i)}function Bg(t){return t===Jr||t===Ao}function qf(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function jh(t,e){const s=t.__resolveType??"";if(!s)return null;if(Ms(s)){const n=t.section??{};return AS(n,e)}if(Bg(s)){const n=t.variants?.[0]?.value;return n?jh(n,e):null}return!pi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:qf(s,e)}function AS(t,e){const s=t.__resolveType??"";if(!s)return null;if(Bg(s)){const n=t.variants?.[0]?.value;return n?jh(n,e):null}return!pi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:qf(s,e)}function PS(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!pi(n)||!Object.hasOwn(e,n))return null;const i=qf(n,e);return i?{blockKey:n,...i}:null}function jX(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock&&!e.isHidden){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return qf(n,s)}if(e.isHidden){const o=(Ms(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,l=o.__resolveType??"",a=Ms(l)?o.section?.__resolveType??l:l;return Bg(a)?null:jh(o,s)}if(e.isLazy||Ms(t.__resolveType)){const n=t.section??{};return AS(n,s)}return jh(t,s)}function Cn(t){return typeof t=="string"?t:t.label}function Gf(t){return typeof t=="object"}function i5(t){return Gf(t)?t.arrayLabel:void 0}function CX(t){return Gf(t)?t.fieldKey:void 0}function r5(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function eu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function _l(t){return t.normalize("NFC").trim()}function NX(t,e){return e.length>0&&_l(Cn(e[0]))===_l(t)?e:[t,...e]}function ss(t,e){return _l(t)===_l(e)}function Ch(t,e){return _l(t).replace(/\s+/g,"").toLowerCase()===_l(e).replace(/\s+/g,"").toLowerCase()}function VX(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||ss(e,t)||s?.arrayKey!=null&&ss(e,s.arrayKey)}function b0(t,e,s,n,i){const o=_l(s);if(t.some(a=>ss(Cn(a),o)||ss(Cn(a),s)))return t;const l={label:s,itemIndex:n};return VX(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function TX(t,e){return t.slice(0,t.length-e.length)}function EX(t,e,s,n){if(s.length===0)return s;const i=s[0];if(Gf(i))return s;const o=n??Ll(t,e),l=Cn(i);return ss(l,o)||ss(l,t)?s.slice(1):s}function Ll(t,e){return e.title??eu(t)}function tu(t,e,s){const n=s[t];if(!n)return eu(t);const i=Ll(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&Ll(l,a)===i})?eu(t):i}function Qfe(t,e){return e.isMultivariateSectionTop?0:t-2}function Xfe(t,e){return e<=0?[]:t.slice(0,e)}function qa(t,e){return t.type==="array"&&t.items||Hf(t)?!0:Array.isArray(e)}function DS(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&&(qa(n)||n.type==="object"&&DS(n,e+1)))return!0}return!1}function RS(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("__")&&RS(n,e+1))return!0;return!1}function AX(t,e,s={}){const n=t.filter(i=>{const o=e[i];if(!o)return!1;if(o.type==="object"&&DS(o))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?RS(l):!1});return n.length>1?new Set(n):new Set}function o5(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function PX(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=ES(t,e);return s===`Item ${e+1}`?void 0:s}function Nh(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=PX(o,i);if(l&&ss(l,e)||Nh(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")&&(Ch(eu(i),e)||Ch(i,e))||Nh(o,e,s,n+1))return!0}return!1}function IS(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=Un(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(qa(c)){const u=tu(a,l,o);if(ss(u,e)||ss(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&IS(d,e,s,n+1))return!0}return!1}function nl(t,e,s,n,i,o){if(n.length===0)return null;const l=Cn(n[0]);for(const p of t){const g=e[p];if(!(!g||!qa(g,s[p]))&&n.some(x=>CX(x)===p))return p}for(const p of t){const g=e[p];if(!g||!qa(g,s[p]))continue;const x=tu(p,t,e);if(ss(l,x)||ss(l,p)||n.some(b=>{if(ss(Cn(b),x)||ss(Cn(b),p))return!0;const v=i5(b);return v!=null&&(ss(v,x)||ss(v,p))}))return p}for(const p of t){const g=e[p];if(!g||!qa(g,s[p]))continue;const x=s[p];if(!Array.isArray(x))continue;if(kh(x,g.items).some(v=>ss(v,l)))return p}let a=null,c=!1,d=null,u=!1;for(const p of t){const g=e[p];if(g?.type!=="object"||!g.properties)continue;const x=Object.keys(g.properties),b=o5(s[p]),v=tu(p,t,e);if((ss(l,v)||ss(l,p))&&nl(x,g.properties,b,n.slice(1),i,o)!=null){a===null?a=p:c=!0;continue}nl(x,g.properties,b,n,i,o)!=null&&(d===null?d=p:u=!0)}if(a!==null)return c?null:a;if(d!==null)return u?null:d;for(const p of t){const g=e[p];if(g?.type!=="inline-union"||!g.inlineUnionBranches?.length)continue;const x=o5(s[p]),b=Ll(p,g);for(const v of g.inlineUnionBranches){const _=v.schema?.properties;if(!_)continue;const L=Object.keys(_);if(nl(L,_,x,n,i,o)||(ss(l,b)||ss(l,p))&&nl(L,_,x,n.slice(1),i,o))return p}}let h=null;const f=[],m=n.map(i5).filter(p=>p!=null);for(const p of t){const g=e[p];if(g?.type!=="block-ref")continue;const x=Ll(p,g);if(l!==x&&l!==p){const b=s[p],_=(i?PS(b,i):null)?.data??b;(Nh(_,l)||m.some(L=>Nh(_,L)||IS(_,L,o)))&&f.push(p);continue}if(n.length>1){const b=s[p];if(b&&typeof b=="object"&&!Array.isArray(b)){const v=Cn(n[1]);if(Object.keys(b).some(L=>!L.startsWith("__")&&(Ch(eu(L),v)||Ch(L,v))))return p}}h||(h=p)}return h||(f.length===1?f[0]:(f.length>1,null))}function DX(t,e,s,n,i,o){return nl(t,e,s,n,i,o)}function RX(t,e,s,n,i,o,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if(nl(a,s.properties,n,i,o,l))return!0;const c=Cn(i[0]);return!ss(c,e)&&!ss(c,t)?!1:i.length>1||nl(a,s.properties,n,i.slice(1),o,l)!==null}function l5(t,e,s,n,i){if(!Gf(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=kh(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&ss(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&&ss(l,s.label)?n:o.findIndex(a=>ss(a,s.label))}function IX(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=l5(s,n,c,i,o);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>ss(Cn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=l5(s,n,a,i,o);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function B9(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===Jr}function MX(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>B9(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>B9(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>B9(s.resolveType)):!1}function $X(t,e){if(e==="global"||e==="sections"||Hf(t))return!0;const s=t.type==="array"?t.items:void 0;return s?MX(s):!1}function a5(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function MS(t){return t.map((e,s)=>({...e,index:s}))}function OX(t,e){if(e===t.length)return t;if(e<t.length)return MS(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 BX(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 zX(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const FX="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",UX="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]",HX="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 c5(t,e){return re("h-6 shrink-0 overflow-hidden",e?FX:t?HX:UX)}function KX(t){const e=F.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(yc,{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 WX(t){const e=F.c(67),{sortableId:s,labelText:n,imageSrc:i,hidden:o,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,u=ie();let h;e[0]!==s?(h={id:s,animateLayoutChanges:JX},e[0]=s,e[1]=h):h=e[1];const{attributes:f,listeners:m,setNodeRef:p,transform:g,isDragging:x}=If(h);let b;e[2]!==g?(b=Ri.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let _;e[4]!==b||e[5]!==v?(_={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=_):_=e[6];const L=_;let y;e[7]!==a?(y=X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),a())},e[7]=a,e[8]=y):y=e[8];const k=x?"cursor-grabbing":"cursor-pointer";let w;e[9]!==k?(w=re("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",k),e[9]=k,e[10]=w):w=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(yc,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=S):S=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 C=o&&"line-through opacity-50";let N;e[14]!==C?(N=re("min-w-0 flex-1 truncate text-sm",C),e[14]=C,e[15]=N):N=e[15];let V;e[16]!==n||e[17]!==N?(V=r.jsx("span",{className:N,children:n}),e[16]=n,e[17]=N,e[18]=V):V=e[18];let T;e[19]!==o||e[20]!==l||e[21]!==u?(T=l&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:re(c5(o===!0,o===!0)),onClick:X=>{X.stopPropagation(),l()},onPointerDown:YX,children:o?r.jsx(yT,{size:14}):r.jsx(jc,{size:14})})}),r.jsx(Ke,{side:"bottom",children:u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=o,e[20]=l,e[21]=u,e[22]=T):T=e[22];let E;e[23]!==n||e[24]!==u?(E=u("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=u,e[25]=E):E=e[25];let P;e[26]!==o?(P=re(c5(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]=P):P=e[27];let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(ei,{size:14}),e[28]=D):D=e[28];let I;e[29]!==E||e[30]!==P?(I=r.jsx(Ut,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":E,className:P,onClick:GX,onPointerDown:qX,children:D})}),e[29]=E,e[30]=P,e[31]=I):I=e[31];let R;e[32]!==c?(R=X=>{X.stopPropagation(),c()},e[32]=c,e[33]=R):R=e[33];let $;e[34]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(an,{size:14}),e[34]=$):$=e[34];let B;e[35]!==u?(B=u("sectionsEditor.arrayField.duplicate"),e[35]=u,e[36]=B):B=e[36];let M;e[37]!==R||e[38]!==B?(M=r.jsxs(Qe,{onClick:R,children:[$,B]}),e[37]=R,e[38]=B,e[39]=M):M=e[39];let O;e[40]!==d?(O=X=>{X.stopPropagation(),d()},e[40]=d,e[41]=O):O=e[41];let z;e[42]===Symbol.for("react.memo_cache_sentinel")?(z=r.jsx(tn,{size:14}),e[42]=z):z=e[42];let U;e[43]!==u?(U=u("sectionsEditor.arrayField.delete"),e[43]=u,e[44]=U):U=e[44];let H;e[45]!==O||e[46]!==U?(H=r.jsxs(Qe,{className:"text-destructive focus:text-destructive",onClick:O,children:[z,U]}),e[45]=O,e[46]=U,e[47]=H):H=e[47];let K;e[48]!==M||e[49]!==H?(K=r.jsxs(Ht,{align:"end",children:[M,H]}),e[48]=M,e[49]=H,e[50]=K):K=e[50];let W;e[51]!==I||e[52]!==K?(W=r.jsxs(Ft,{children:[I,K]}),e[51]=I,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]!==V||e[61]!==T||e[62]!==W||e[63]!==y||e[64]!==w||e[65]!==j?(Y=r.jsxs("div",{ref:p,style:L,...f,...m,role:"button",tabIndex:0,onClick:a,onKeyDown:y,className:w,title:n,children:[S,j,V,T,W]}),e[54]=f,e[55]=n,e[56]=m,e[57]=a,e[58]=p,e[59]=L,e[60]=V,e[61]=T,e[62]=W,e[63]=y,e[64]=w,e[65]=j,e[66]=Y):Y=e[66],Y}function qX(t){return t.stopPropagation()}function GX(t){return t.stopPropagation()}function YX(t){return t.stopPropagation()}function JX(){return!1}function QX(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=Un(o,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=Un(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function XX(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function v0({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:o=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:u,containerResolveType:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=ie(),b=Wf(g?.virtualMcpId),v=Array.isArray(e)?e:[],_=t.items,L=XX(n),y={arrayKey:L,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(_?.titleBy||_?.inlineUnionBranches?.length)},k=$X(t,L),w=!k&&_?.type==="object",[S,j]=A.useState(null),C=IX(i,o,v,_,S,L),N=C?.index??null;C===null?S!==null&&j(null):C.index!==S&&j(C.index);const[V,T]=A.useState(()=>a5(v.length)),[E,P]=A.useState(null),[D,I]=A.useState(n),[R,$]=A.useState(v.length),B=A.useRef(!1),M=A.useRef(null);D!==n?(I(n),$(v.length),T(a5(v.length)),j(null)):R!==v.length&&($(v.length),T(ae=>OX(ae,v.length)));const O=(ae,ue)=>ES($a(ae),ue,_),z=ae=>{if(B.current)return;const ue=O(v[ae],ae);j(ae),l?.(b0(o,i,ue,ae,y))},U=ae=>{const ue=[...v,ae];s(ue);const he=ue.length-1;j(he);const ce=O(ae,he);l?.(b0(o,i,ce,he,y))},H=()=>{const ae=_?.type,ue=_?.default!==void 0?_.default:ae==="object"?{}:ae==="block-ref"?(()=>{const Q=_?.anyOfRefs?.[0]?.resolveType;return typeof Q!="string"||kd(Q)?{}:{__resolveType:Q}})():ae==="number"||ae==="integer"?0:ae==="boolean"?!1:ae==="array"?[]:"",he=[...v,ue];s(he);const ce=he.length-1;j(ce);const ge=O(ue,ce);l?.(b0(o,i,ge,ce,y))},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 ue=v[ae],he=typeof structuredClone=="function"?structuredClone(ue):JSON.parse(JSON.stringify(ue??null)),ce=[...v.slice(0,ae+1),he,...v.slice(ae+1)];s(ce),T(ge=>BX(ge,ae))},Y=ae=>{const ue=v[ae],he=[...v];he[ae]=Td(ue)?wS(ue):e5(ue),s(he)},X=ae=>{s(v.filter((ue,he)=>he!==ae)),T(ue=>zX(ue,ae))},ne=(ae,ue)=>{const he=[...v];if(he[ae]=Td(v[ae])?e5(ue):ue,s(he),ae===N&&C){const ce=O(v[ae],ae),ge=O(he[ae],ae);if(M.current={path:n,index:ae,label:ge},ce!==ge){const Q=[...o];Q[C.crumbIndex]=r5(o[C.crumbIndex],ge,ae),l?.(Q)}}},se=Vu(gr(Rl,{activationConstraint:{distance:8}}),gr(Dl,{coordinateGetter:Mf})),oe=V.map(ae=>ae.id),Z=ae=>{P(String(ae.active.id))},J=ae=>{P(null);const{active:ue,over:he}=ae;if(!he||ue.id===he.id)return;const ce=oe.indexOf(String(ue.id)),ge=oe.indexOf(String(he.id));ce===-1||ge===-1||(T(Q=>MS(bl([...Q],ce,ge))),s(bl([...v],ce,ge)),B.current=!0,requestAnimationFrame(()=>{B.current=!1}))},q=()=>{P(null)},G=E?V.find(ae=>ae.id===E):null,te=G!=null?v[G.index]:void 0,le=G!=null&&te!==void 0?kh(v,_)[G.index]:null,ee=G!=null&&te!==void 0?n5($a(te),_):void 0;if(N!==null&&N<v.length){const ae=$a(v[N]),ue=QX(ae,_,c,h,L),he=()=>{if(!C)return b0(o,i,O(ae,N),N,y);const ce=o.slice(0,C.crumbIndex+1),ge=M.current,Q=ge?.path===n&&ge.index===N?ge.label:O(ae,N);return ce[C.crumbIndex]=r5(ce[C.crumbIndex],Q,N),ce};return r.jsx("div",{className:"min-w-0",children:ue?.type==="object"&&ue.properties?r.jsx(Ui,{schema:ue,value:ae,onChange:ce=>ne(N,ce),basePath:`${n}.${N}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:ce=>{l?.([...he(),...ce])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):ue?Sl({schema:ue,value:ae,onChange:ce=>ne(N,ce),path:`${n}.${N}`,required:!0,label:ue.title&&!ue.title.includes("{{")?ue.title:O(ae,N),breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:ce=>{l?.([...he(),...ce])},meta:c,decofile:d,onSaveReferencedBlock:u,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(Rg,{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:re(E&&"cursor-grabbing"),children:r.jsxs(Eu,{sensors:se,collisionDetection:H2,onDragStart:Z,onDragEnd:J,onDragCancel:q,children:[r.jsx(Rf,{items:oe,strategy:Df,children:r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const ae=kh(v,_);return V.map(ue=>{const he=v[ue.index];if(he===void 0)return null;const ce=ae[ue.index]??O(he,ue.index),ge=n5($a(he),_);return r.jsx(WX,{sortableId:ue.id,labelText:ce,imageSrc:ge,hidden:Td(he),onToggleHidden:w?()=>Y(ue.index):void 0,onOpen:()=>z(ue.index),onDuplicate:()=>W(ue.index),onRemove:()=>X(ue.index)},ue.id)})})()})}),Bn.createPortal(r.jsx(Pf,{dropAnimation:LS,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(KX,{labelText:le,imageSrc:ee})}):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($t,{size:14}),x(k?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function ZX(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==a?(b=a===void 0?[]:a,e[0]=a,e[1]=b):b=e[1];const v=b,[_,L]=A.useState(!1),y=Wf(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 w=k;if(!s.properties)return null;let S;e[4]!==v||e[5]!==h||e[6]!==u||e[7]!==w||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?(S=r.jsx(Ui,{schema:s,value:w,onChange:i,basePath:o,breadcrumbPath:v,onBreadcrumbChange:c,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=v,e[5]=h,e[6]=u,e[7]=w,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]=S):S=e[17];const j=S;if(d)return j;let C;e[18]!==o?(C=o.split(".").pop()??o,e[18]=o,e[19]=C):C=e[19];const N=C;let V;e[20]!==v||e[21]!==h||e[22]!==N||e[23]!==l||e[24]!==u||e[25]!==w||e[26]!==s?(V=RX(N,l,s,w,v,h,u),e[20]=v,e[21]=h,e[22]=N,e[23]=l,e[24]=u,e[25]=w,e[26]=s,e[27]=V):V=e[27];const E=_||V,P=`${o}-fields`;let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=()=>L(eZ),e[28]=D):D=e[28];let I;e[29]!==E?(I=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:E?r.jsx(Qt,{size:16}):r.jsx(dn,{size:16})}),e[29]=E,e[30]=I):I=e[30];const R=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 B;e[33]!==s.description||e[34]!==$||e[35]!==R?(B=r.jsx(Rg,{description:s.description,virtualMcpId:R,children:$}),e[33]=s.description,e[34]=$,e[35]=R,e[36]=B):B=e[36];let M;e[37]!==P||e[38]!==E||e[39]!==B||e[40]!==I?(M=r.jsxs("button",{type:"button","aria-expanded":E,"aria-controls":P,onClick:D,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[I,B]}),e[37]=P,e[38]=E,e[39]=B,e[40]=I,e[41]=M):M=e[41];let O;e[42]!==s.description||e[43]!==y?(O=!y&&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]=y,e[44]=O):O=e[44];let z;e[45]!==P||e[46]!==j||e[47]!==E?(z=E&&r.jsx("div",{id:P,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=P,e[46]=j,e[47]=E,e[48]=z):z=e[48];let U;return e[49]!==M||e[50]!==O||e[51]!==z?(U=r.jsxs("div",{className:"min-w-0 space-y-2",children:[M,O,z]}),e[49]=M,e[50]=O,e[51]=z,e[52]=U):U=e[52],U}function eZ(t){return!t}function Zfe(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 e9e(t){return structuredClone(t)}function t9e(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function $S(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 zg(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 Fg(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,u]=A.useState(a),[h,f]=A.useState(s);s!==h&&(f(s),s&&u(a));let m;e[0]!==c||e[1]!==n?(m=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 z=d.trim();!z||c||await l(z)},e[3]=d,e[4]=c,e[5]=l,e[6]=g):g=e[6];const x=g,b=ie();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let _;e[9]!==v?(_=r.jsx(Wt,{children:v}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==b?(L=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=L):L=e[12];let y;e[13]!==L?(y=r.jsx(Fn,{children:L}),e[13]=L,e[14]=y):y=e[14];let k;e[15]!==_||e[16]!==y?(k=r.jsxs(xs,{children:[_,y]}),e[15]=_,e[16]=y,e[17]=k):k=e[17];let w;e[18]!==b?(w=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=w):w=e[19];let S;e[20]!==w?(S=r.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:w}),e[20]=w,e[21]=S):S=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=O=>u(O.target.value),e[22]=j):j=e[22];let C;e[23]!==b?(C=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=C):C=e[24];let N;e[25]!==d||e[26]!==c||e[27]!==C?(N=r.jsx(bt,{id:"block-id",value:d,onChange:j,placeholder:C,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=C,e[28]=N):N=e[28];let V;e[29]!==S||e[30]!==N?(V=r.jsxs("div",{className:"py-4 space-y-2",children:[S,N]}),e[29]=S,e[30]=N,e[31]=V):V=e[31];let T;e[32]!==n?(T=()=>n(!1),e[32]=n,e[33]=T):T=e[33];let E;e[34]!==b?(E=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=E):E=e[35];let P;e[36]!==c||e[37]!==T||e[38]!==E?(P=r.jsx(de,{type:"button",variant:"outline",onClick:T,disabled:c,children:E}),e[36]=c,e[37]=T,e[38]=E,e[39]=P):P=e[39];let D;e[40]!==d||e[41]!==c?(D=!d.trim()||c,e[40]=d,e[41]=c,e[42]=D):D=e[42];let I;e[43]!==c||e[44]!==b?(I=c?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=I):I=e[45];let R;e[46]!==D||e[47]!==I?(R=r.jsx(de,{type:"submit",disabled:D,children:I}),e[46]=D,e[47]=I,e[48]=R):R=e[48];let $;e[49]!==P||e[50]!==R?($=r.jsxs(Zn,{children:[P,R]}),e[49]=P,e[50]=R,e[51]=$):$=e[51];let B;e[52]!==x||e[53]!==V||e[54]!==$||e[55]!==k?(B=r.jsx(It,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:x,children:[k,V,$]})}),e[52]=x,e[53]=V,e[54]=$,e[55]=k,e[56]=B):B=e[56];let M;return e[57]!==p||e[58]!==s||e[59]!==B?(M=r.jsx(Mt,{open:s,onOpenChange:p,children:B}),e[57]=p,e[58]=s,e[59]=B,e[60]=M):M=e[60],M}function tZ(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 sZ(t){const e=F.c(13),{blockKey:s}=t,n=ie();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Hn,{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(He,{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(Ke,{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(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function nZ(t){const e=F.c(36),{path:s,open:n,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:u}=t,h=ie(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=re("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=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(Qt,{size:16}):r.jsx(dn,{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(sZ,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let _;e[11]!==b||e[12]!==v?(_=r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=_):_=e[13];let L;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==_?(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,_]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=_,e[19]=L):L=e[19];let y;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(y=(d||u)&&r.jsxs(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":h("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:r.jsx(ei,{size:16})})}),r.jsxs(Ht,{align:"end",className:"w-48",children:[c&&d&&r.jsxs(Qe,{onClick:d,children:[r.jsx(Or,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.detach")]}),!c&&u&&r.jsxs(Qe,{onClick:u,children:[r.jsx(Hn,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=y):y=e[24];let k;e[25]!==L||e[26]!==y?(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,y]}),e[25]=L,e[26]=y,e[27]=k):k=e[27];let w;e[28]!==f||e[29]!==l||e[30]!==n?(w=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]=w):w=e[31];let S;return e[32]!==k||e[33]!==w||e[34]!==p?(S=r.jsxs("div",{className:p,children:[k,w]}),e[32]=k,e[33]=w,e[34]=p,e[35]=S):S=e[35],S}function d5(t){const e=F.c(42),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=ie(),x=(s.anyOfRefs??[]).filter(oZ),b=u&&n?PS(n,u):null,v=b?.data??n,_=b?null:kS(v),L=_??v,y=dX(x,{savedBlockKey:b?.blockKey,editorValue:v}),k=y.length>0?uX(v,y,b?.blockKey):y[0]?.resolveType??"",S=s.type==="block-ref"&&y.some(rZ);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 C=j;let N;e[3]!==a?(N=a??[],e[3]=a,e[4]=N):N=e[4];const V=N,T=S&&V.length>0&&Cn(V[0])===C,E=T?V.slice(1):V,P=T?se=>{c?.([C,...se])}:c,[D,I]=A.useState(k),[R,$]=A.useState(k);R!==k&&($(k),I(k));const[B,M]=A.useState(()=>fX(v,b?.blockKey)),[O,z]=A.useState(!1);if(y.length>0){const se=D||k;let oe;e[5]!==se?(oe=Te=>Te.resolveType===se,e[5]=se,e[6]=oe):oe=e[6];const Z=y.find(oe),J=t5(v,d,Z?.schema),q=hX(J??Z?.schema??null,s.discriminatorKey),G=s.discriminatorKey,te=Te=>{I(Te);const _e=y.find(Ie=>Ie.resolveType===Te),Pe=t5(v,d,_e?.schema),ke=new Set(Object.keys((Pe??_e?.schema)?.properties??{})),Ne=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Fe=Object.fromEntries(Object.entries(Ne).filter(Ie=>{const[Re]=Ie;return ke.has(Re)})),Ye={...tZ(_e?.schema),...Fe};if(G){const Ie=_e?.discriminatorValue??Te;i({...Ye,[G]:Ie});return}if(kd(Te)){i(Ye);return}i({...Ye,__resolveType:Te})};let le;e[7]!==se||e[8]!==G||e[9]!==i?(le=Te=>{if(G||!kd(se)||Te===null||typeof Te!="object"||Array.isArray(Te)){i(Te);return}const{__resolveType:_e,...Pe}=Te;i(Pe)},e[7]=se,e[8]=G,e[9]=i,e[10]=le):le=e[10];const ee=le,ae=q?.properties?r.jsx(Ui,{schema:q,value:L,onChange:Te=>{if(b&&h){h(b.blockKey,Te);return}if(_){i({...v,section:Te});return}ee(Te)},basePath:o,breadcrumbPath:E,onBreadcrumbChange:P,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(S&&ae&&E.length>0){let Te;return e[11]!==ae?(Te=r.jsx("div",{className:"min-w-0",children:ae}),e[11]=ae,e[12]=Te):Te=e[12],Te}let ue;e[13]!==o?(ue=o.includes("."),e[13]=o,e[14]=ue):ue=e[14];const he=ue,ce=b?()=>{const{name:Te,..._e}=b.data;i(_e)}:void 0,ge=!b&&!_&&!!h&&S&&!kd(se)&&se.includes("/"),Q=L&&typeof L=="object"&&!Array.isArray(L)?L:{},me=Te=>{if(!h)return;const _e=Te.trim(),Pe=u?zg(_e,u):null;if(Pe){pe.error(Pe);return}h(_e,{...Q,__resolveType:se,name:_e}),i({__resolveType:_e}),z(!1),pe.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:_e}))},ve=f?.virtualMcpId;let we;e[15]!==l||e[16]!==o||e[17]!==s.description||e[18]!==ve?(we=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:ve}),e[15]=l,e[16]=o,e[17]=s.description,e[18]=ve,e[19]=we):we=e[19];let ye;e[20]!==g?(ye=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=ye):ye=e[21];let Le;e[22]!==ye?(Le=r.jsx(Is,{placeholder:ye}),e[22]=ye,e[23]=Le):Le=e[23];let Ce;return e[24]!==o||e[25]!==Le?(Ce=r.jsx(Ns,{id:o,children:Le}),e[24]=o,e[25]=Le,e[26]=Ce):Ce=e[26],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[we,r.jsxs(Cs,{value:se||void 0,onValueChange:te,children:[Ce,r.jsx(Vs,{children:y.map(iZ)})]})]}),ae&&(S?r.jsx(nZ,{path:o,open:B,onOpenChange:M,title:g(he?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:ae,nestedBlockRef:he,globalBlockKey:b?.blockKey,onDetach:ce,onMakeGlobal:ge?()=>z(!0):void 0}):ae),ge&&r.jsx(Fg,{open:O,onOpenChange:z,defaultBlockId:$S(ps(se)),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(Us,{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=se=>i(se.target.value),e[32]=i,e[33]=W):W=e[33];const Y=s.description??"";let X;e[34]!==o||e[35]!==K||e[36]!==W||e[37]!==Y?(X=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]=X):X=e[38];let ne;return e[39]!==H||e[40]!==X?(ne=r.jsxs("div",{className:"space-y-1.5",children:[H,X]}),e[39]=H,e[40]=X,e[41]=ne):ne=e[41],ne}function iZ(t){const e=t.title&&!t.title.includes("/")?t.title:R1(t.resolveType)??ps(t.resolveType);return r.jsx(Pt,{value:t.resolveType,children:e},t.resolveType)}function rZ(t){return t.resolveType.includes("/")&&!kd(t.resolveType)}function oZ(t){return t.resolveType!==""}const z9=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function lZ(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=z9(i,"id");if(!l)continue;const a=z9(i,"viewBox"),c=z9(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 aZ(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return lZ(await e.text())}function cZ(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 dZ(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 uZ(t,e){return t.length>0?t:e}function hZ(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function fZ({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 OS(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 mZ(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function pZ(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return OS(t.icon,e)}async function gZ(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 cZ(a)}function u5(t){const e=F.c(9),{option:s,className:n,fg:i}=t;let o;e[0]!==i||e[1]!==s?(o=pZ(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=re("shrink-0",a,n),e[3]=n,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=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 xZ(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=ie(),d=s.options,u=a?.previewUrl,[h,f]=A.useState(!1),[m,p]=A.useState(""),[g,x]=A.useState(""),b=A.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=ee=>{p(ee),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(ee)},300)},e[0]=v):v=e[0];const _=v,L=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",y=typeof n=="string"?n:"",k=s.format==="icon-select";let w;e[1]!==g||e[2]!==d||e[3]!==L?(w=et.sandboxInvoke(L,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=L,e[4]=w):w=e[4];let S;e[5]!==g||e[6]!==d||e[7]!==u?(S=()=>gZ(u,d,g||void 0),e[5]=g,e[6]=d,e[7]=u,e[8]=S):S=e[8];const j=!!u&&!!d&&(h||!!y);let C;e[9]!==w||e[10]!==S||e[11]!==j?(C={queryKey:w,queryFn:S,enabled:j,staleTime:6e4,retry:1},e[9]=w,e[10]=S,e[11]=j,e[12]=C):C=e[12];const N=Et(C),V=N.data??[];let T;e[13]!==L?(T=et.sandboxSprite(L),e[13]=L,e[14]=T):T=e[14];let E;e[15]!==u||e[16]!==a?(E=()=>aZ(P8({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,threadId:a.threadId,previewUrl:u},"/sprites.svg")),e[15]=u,e[16]=a,e[17]=E):E=e[17];const P=k&&!!a&&(h||!!y)&&(!d||N.isFetched&&V.length===0);let D;e[18]!==T||e[19]!==E||e[20]!==P?(D={queryKey:T,queryFn:E,enabled:P,staleTime:3e5,retry:1},e[18]=T,e[19]=E,e[20]=P,e[21]=D):D=e[21];const I=Et(D),R=dZ(s.enum),$=I.data??{},B=mZ(),M=Object.fromEntries(Object.entries($).map(ee=>{const[ae,ue]=ee;return[ae,OS(ue,B)]})),O=k&&Object.keys(M).length>0?R.map(ee=>({...ee,previewSrc:M[ee.value]})):R,z=uZ(V,O),U=hZ(z,m);let H;e[22]!==y?(H=ee=>ee.value===y,e[22]=y,e[23]=H):H=e[23];const K=z.find(H),W=m.trim(),Y=N.isFetched&&!N.isFetching&&m===g,X=fZ({loaderPath:d,isIconSelect:k,enumFallbackCount:R.length,trimmedSearch:W,optionValues:z.map(bZ),optionsSettled:Y});if((!u||!d)&&R.length===0){const ee=a?.virtualMcpId;let ae;e[24]!==l||e[25]!==o||e[26]!==s.description||e[27]!==ee?(ae=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:ee}),e[24]=l,e[25]=o,e[26]=s.description,e[27]=ee,e[28]=ae):ae=e[28];let ue;e[29]!==i?(ue=ge=>i(ge.target.value),e[29]=i,e[30]=ue):ue=e[30];let he;e[31]!==y||e[32]!==o||e[33]!==ue?(he=r.jsx(bt,{id:o,type:"text",value:y,onChange:ue}),e[31]=y,e[32]=o,e[33]=ue,e[34]=he):he=e[34];let ce;return e[35]!==ae||e[36]!==he?(ce=r.jsxs("div",{className:"space-y-2",children:[ae,he]}),e[35]=ae,e[36]=he,e[37]=ce):ce=e[37],ce}const se=a?.virtualMcpId;let oe;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==se?(oe=r.jsx(Us,{htmlFor:o,label:l,description:s.description,virtualMcpId:se}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=se,e[42]=oe):oe=e[42];const Z=K?r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(u5,{option:K,className:"h-6 w-6",fg:B}),r.jsx("span",{className:"truncate",children:K.label??K.value})]}):y?r.jsx("span",{className:"truncate",children:y}):r.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=r.jsx(ff,{className:"size-4 shrink-0 opacity-50"}),e[43]=J):J=e[43];let q;e[44]!==h||e[45]!==Z?(q=r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":h,className:"h-10 w-full justify-between font-normal",children:[Z,J]})}),e[44]=h,e[45]=Z,e[46]=q):q=e[46];let G;e[47]===Symbol.for("react.memo_cache_sentinel")?(G={width:"var(--radix-popover-trigger-width)"},e[47]=G):G=e[47];let te;e[48]!==c?(te=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=te):te=e[49];let le;return e[50]!==m||e[51]!==te?(le=r.jsx(yi,{placeholder:te,className:"h-9",value:m,onValueChange:_}),e[50]=m,e[51]=te,e[52]=le):le=e[52],r.jsxs("div",{className:"space-y-2",children:[oe,r.jsxs(os,{open:h,onOpenChange:f,children:[q,r.jsx(rs,{className:"p-0",style:G,children:r.jsxs(zi,{shouldFilter:!1,children:[le,r.jsxs(_i,{children:[!X&&r.jsx(si,{children:N.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),r.jsx(gs,{children:U.map(ee=>r.jsxs(Yt,{value:ee.value,className:"cursor-pointer",onSelect:()=>{i(ee.value===y?"":ee.value),f(!1)},children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(u5,{option:ee,className:re(ee.image?"h-9 w-9":"h-6 w-6"),fg:B}),r.jsx("span",{className:"truncate",children:ee.label??ee.value})]}),r.jsx(Rt,{className:re("ml-auto size-4 shrink-0",y===ee.value?"opacity-100":"opacity-0")})]},ee.value))}),X&&r.jsx(gs,{children:r.jsx(Yt,{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 bZ(t){return t.value}function BS(t){const e=F.c(17),{org:s}=qe(),n=$s();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=l6,l=et.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 h=>{const{pageParam:f}=h;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 u;return e[13]!==l||e[14]!==c||e[15]!==d?(u={queryKey:l,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:vZ},e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],a(u)}function vZ(t){return t.nextCursor??void 0}function Yf(){const t=F.c(2),{org:e}=qe();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(yZ);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],Rs(s)}function yZ(){return""}function _Z(){const t=F.c(8),{org:e}=qe(),s=$s(),n=bs();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:et.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],Rs(l)}function Ug(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function zS(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function Vh(t){const e=t.split("/");return e[e.length-1]??t}function FS(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const Jf="file-picker:last-config-id";function US(t){const e=F.c(31),s=ie(),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(Wt,{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(Fn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.jsxs(xs,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==s?(u=b=>{const{error:v}=b;return r.jsx(LZ,{error:v??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=u):u=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(vt,{className:"h-64 w-full"}),e[14]=h):h=e[14];let f;e[15]!==t?(f=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=f):f=e[16];let m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(m=r.jsx(A.Suspense,{fallback:h,children:r.jsx(SZ,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==u?(p=r.jsx(Fs,{fallback:u,children:m}),e[21]=m,e[22]=u,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=r.jsxs(It,{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(Mt,{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 LZ(t){const e=F.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(cn,{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 SZ(t){const e=F.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,o=Hy();if(o.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(jZ,{}),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(F9,{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(F9,{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(Jf):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 u;e[17]!==o?(u=o.map(wZ),e[17]=o,e[18]=u):u=e[18];let h;e[19]!==u?(h=r.jsx(pu,{className:"self-start",children:u}),e[19]=u,e[20]=h):h=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(rl,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:r.jsx(F9,{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]!==h||e[30]!==f?(m=r.jsxs(_c,{defaultValue:d,onValueChange:kZ,className:"min-h-0 flex-1 flex flex-col",children:[h,f]}),e[28]=d,e[29]=h,e[30]=f,e[31]=m):m=e[31],m}function wZ(t){return r.jsx(cr,{value:t.id,children:t.name},t.id)}function kZ(t){typeof window<"u"&&window.localStorage.setItem(Jf,t)}function jZ(){const t=F.c(12),e=ie();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(ti,{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 F9({config:t,mode:e,onSelect:s}){const n=ie(),[i,o]=A.useState(""),l=pf(i,300),a=BS({configId:t.id,search:l,imageOnly:e==="image"}),c=Yf(),[d,u]=A.useState(!1),h=A.useRef(null),f=e==="image"?"image/*":void 0;async function m(w){if(!w)return;const S=Array.from(w);if(S.length===0)return;let j=null;const C=[];for(const N of S)try{const V=await c.mutateAsync({configId:t.id,file:N});j??=V.publicUrl}catch(V){C.push(`${N.name} (${V instanceof Error?V.message:"upload failed"})`)}await a.refetch(),C.length>0&&pe.error(C.length===S.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:C.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:C.join("; ")})),j&&s(j)}function p(w){w.preventDefault(),u(!0)}function g(){u(!1)}function x(w){w.preventDefault(),w.stopPropagation(),u(!1),m(w.dataTransfer.files)}const v=(a.data?.pages??[]).flatMap(w=>w.items),_=v.filter(w=>e==="image"?Ug(w.key):!0),L=l.trim(),y=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:()=>h.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:re("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",d&&"border-primary bg-primary/5",c.isPending&&"opacity-60 pointer-events-none"),children:[r.jsx(ti,{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:h,type:"file",accept:f,multiple:!0,className:"hidden",onChange:w=>{const S=Array.from(w.target.files??[]);w.target.value="",m(S)}})]}),y?r.jsx(hf,{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:[_.length===0?L?r.jsx(VZ,{query:L}):e==="image"&&v.length>0?r.jsx(NZ,{}):r.jsx(CZ,{}):e==="image"?r.jsx(TZ,{items:_,onSelect:s}):r.jsx(EZ,{items:_,onSelect:s}),a.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(de,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function CZ(){const t=F.c(12),e=ie();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(Ei,{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 NZ(){const t=F.c(12),e=ie();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(Ei,{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 VZ(t){const e=F.c(13),{query:s}=t,n=ie();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(Ei,{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 TZ(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(HS,{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 EZ(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(HS,{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 HS(t){const e=F.c(58),{item:s,variant:n,onSelect:i}=t;let o;e[0]!==s.key?(o=zS(s.key),e[0]=s.key,e[1]=o):o=e[1];const l=o;if(n==="image"){let _;e[2]!==s.publicUrl||e[3]!==i?(_=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=_):_=e[4];let 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:AZ}),e[5]=s.key,e[6]=s.publicUrl,e[7]=L):L=e[7];let y;e[8]!==s.key||e[9]!==_||e[10]!==L?(y=r.jsx("button",{type:"button",onClick:_,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:L}),e[8]=s.key,e[9]=_,e[10]=L,e[11]=y):y=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 w;e[14]!==s||e[15]!==i?(w=r.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:r.jsx(h5,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=w):w=e[16];let S;e[17]!==s.key?(S=Vh(s.key),e[17]=s.key,e[18]=S):S=e[18];let j;e[19]!==S?(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:S})}),e[19]=S,e[20]=j):j=e[20];let C;return e[21]!==y||e[22]!==k||e[23]!==w||e[24]!==j?(C=r.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[y,k,w,j]}),e[21]=y,e[22]=k,e[23]=w,e[24]=j,e[25]=C):C=e[25],C}let a;e[26]!==s.publicUrl||e[27]!==i?(a=()=>i(s.publicUrl),e[26]=s.publicUrl,e[27]=i,e[28]=a):a=e[28];let c;e[29]!==s.key?(c=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:Ug(s.key)?r.jsx(Ei,{size:16,className:"text-muted-foreground"}):r.jsx(Ti,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=Vh(s.key),e[31]=s.key,e[32]=d):d=e[32];let u;e[33]!==d?(u=r.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=u):u=e[34];let h;e[35]!==s.key?(h=r.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=h):h=e[36];let f;e[37]!==u||e[38]!==h?(f=r.jsxs("div",{className:"min-w-0 flex-1",children:[u,h]}),e[37]=u,e[38]=h,e[39]=f):f=e[39];let m;e[40]!==l?(m=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=FS(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(h5,{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 AZ(t){t.target.style.display="none"}function h5(t){const e=F.c(39),{item:s,onSelect:n}=t,i=ie(),[o,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(C){C.preventDefault(),C.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{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 u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(n2,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Ut,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:RZ,"aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==s.publicUrl||e[9]!==n?(f=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Rt,{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(Qe,{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(Rt,{size:14}):r.jsx(an,{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(Qe,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const _=s.publicUrl;let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(yn,{size:14}),e[26]=L):L=e[26];let y;e[27]!==i?(y=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=y):y=e[28];let k;e[29]!==s.publicUrl||e[30]!==y?(k=r.jsx(Qe,{asChild:!0,children:r.jsxs("a",{href:_,target:"_blank",rel:"noreferrer",onClick:PZ,children:[L,y]})}),e[29]=s.publicUrl,e[30]=y,e[31]=k):k=e[31];let w;e[32]!==v||e[33]!==k||e[34]!==g?(w=r.jsxs(Ht,{align:"end",onClick:DZ,children:[g,v,k]}),e[32]=v,e[33]=k,e[34]=g,e[35]=w):w=e[35];let S;return e[36]!==w||e[37]!==h?(S=r.jsxs(Ft,{children:[h,w]}),e[36]=w,e[37]=h,e[38]=S):S=e[38],S}function PZ(t){return t.stopPropagation()}function DZ(t){return t.stopPropagation()}function RZ(t){return t.stopPropagation()}function KS(){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(ti,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function WS(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function qS(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const IZ=["low","medium","high","original"];function GS(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function YS(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=MZ(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 JS(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 u=d.indexOf("=");return(u>=0?d.slice(0,u):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${a}${c.length?`?${c.join("&")}`:""}${i}`}function MZ(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 $Z(t){if(!t)return;const e=YS(t,"quality");return GS(e)?e:void 0}function OZ(t,e){return JS(t,"quality",e)}function BZ(t){return t?YS(t,"muted")!=="false":!0}function zZ(t,e){return JS(t,"muted",e?void 0:"false")}function QS(t){const e=F.c(36),{value:s,onChange:n,showMuted:i}=t,o=i===void 0?!1:i,l=ie(),a=A.useId();let c;e[0]!==s?(c=$Z(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==s?(u=BZ(s),e[2]=s,e[3]=u):u=e[3];const h=u;let f;e[4]!==l?(f=l("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=l,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(n2,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=r.jsx(is,{asChild:!0,children:r.jsx(de,{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(Bt,{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(OZ(s,GS(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=IZ.map(FZ),e[16]=_):_=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:_}),e[17]=v,e[18]=b,e[19]=L):L=e[19];let y;e[20]!==L||e[21]!==x?(y=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,L]}),e[20]=L,e[21]=x,e[22]=y):y=e[22];let k;e[23]!==h||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(Bt,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),r.jsx(pr,{id:a,checked:h,onCheckedChange:j=>n(zZ(s,j))})]}),e[23]=h,e[24]=a,e[25]=n,e[26]=o,e[27]=l,e[28]=s,e[29]=k):k=e[29];let w;e[30]!==y||e[31]!==k?(w=r.jsx(rs,{align:"end",className:"w-auto min-w-52 p-3",children:r.jsxs("div",{className:"flex flex-col gap-3",children:[y,k]})}),e[30]=y,e[31]=k,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==p?(S=r.jsxs(os,{children:[p,w]}),e[33]=w,e[34]=p,e[35]=S):S=e[35],S}function FZ(t){return r.jsx(Hd,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function XS(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function f5(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 UZ(t){const e=F.c(81),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=ie(),d=s.format==="video-uri",u=Og(n),[h,f]=A.useState(!1),[m,p]=A.useState(!1),g=u?WS(u):"",x=g?qS(g):"",b=e2(),v=Yf();let _;e[0]!==b.data?.configs?(_=b.data?.configs??[],e[0]=b.data?.configs,e[1]=_):_=e[1];const L=a?.siteSlug;let y;e[2]!==_||e[3]!==L?(y=jf(_,L),e[2]=_,e[3]=L,e[4]=y):y=e[4];const k=y;let w;e[5]!==b.data?.configs||e[6]!==d||e[7]!==k?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==v?(w=async function(J){if(!J)return;let q=Array.from(J);if(q.length===0)return;if(d&&(q=q.filter(HZ),q.length===0)){pe.error(c("sectionsEditor.fileField.videoFileError"));return}const G=XS(b.data?.configs??[],k?.id,typeof window<"u"?window.localStorage.getItem(Jf):null);if(!G){f(!0);return}try{const te=await v.mutateAsync({configId:G,file:q[0]});i(te.publicUrl),q.length>1&&pe.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:q[0].name}))}catch(te){const le=te;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]=w):w=e[12];const S=w;let j;e[13]!==p?(j=function(J){J.preventDefault(),J.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const C=j;let N;e[15]!==p?(N=function(J){J.currentTarget===J.target&&p(!1)},e[15]=p,e[16]=N):N=e[16];const V=N;let T;e[17]!==S||e[18]!==p?(T=function(J){J.preventDefault(),J.stopPropagation(),p(!1),S(J.dataTransfer.files)},e[17]=S,e[18]=p,e[19]=T):T=e[19];const E=T,P=a?.virtualMcpId;let D;e[20]!==l||e[21]!==o||e[22]!==s.description||e[23]!==P?(D=r.jsx("div",{className:"min-w-0",children:r.jsx(Us,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:P})}),e[20]=l,e[21]=o,e[22]=s.description,e[23]=P,e[24]=D):D=e[24];const I=m&&"border-primary ring-2 ring-primary/30",R=v.isPending&&"pointer-events-none opacity-60";let $;e[25]!==I||e[26]!==R?($=re("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",I,R),e[25]=I,e[26]=R,e[27]=$):$=e[27];let B;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==u||e[33]!==c||e[34]!==v.isPending?(B=u?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:u,preload:"metadata",className:"h-full w-full object-contain"},u),r.jsx(KS,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(C3,{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(f5,{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(Ti,{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:u})]}),r.jsx(f5,{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(C3,{size:20}):r.jsx(Ti,{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]=u,e[33]=c,e[34]=v.isPending,e[35]=B):B=e[35];let M;e[36]!==m||e[37]!==c?(M=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]=M):M=e[38];let O;e[39]!==V||e[40]!==C||e[41]!==E||e[42]!==$||e[43]!==B||e[44]!==M?(O=r.jsxs("div",{onDragOver:C,onDragLeave:V,onDrop:E,className:$,children:[B,M]}),e[39]=V,e[40]=C,e[41]=E,e[42]=$,e[43]=B,e[44]=M,e[45]=O):O=e[45];let z;e[46]!==i?(z=Z=>i(Z.target.value),e[46]=i,e[47]=z):z=e[47];let U;e[48]!==o||e[49]!==u||e[50]!==z?(U=r.jsx(bt,{id:o,type:"url",value:u,onChange:z,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=o,e[49]=u,e[50]=z,e[51]=U):U=e[51];let H;e[52]!==f||e[53]!==u||e[54]!==c?(H=!u&&r.jsxs(de,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[r.jsx(ti,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=u,e[54]=c,e[55]=H):H=e[55];let K;e[56]!==d||e[57]!==i||e[58]!==u?(K=d&&u&&r.jsx(QS,{value:u,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=u,e[59]=K):K=e[59];let W;e[60]!==i||e[61]!==u||e[62]!==c?(W=u&&r.jsx(de,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:r.jsx(tn,{size:14})}),e[60]=i,e[61]=u,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 X;e[69]!==i?(X=Z=>i(Z),e[69]=i,e[70]=X):X=e[70];const ne=k?.id??null;let se;e[71]!==h||e[72]!==f||e[73]!==X||e[74]!==ne?(se=r.jsx(US,{open:h,onOpenChange:f,mode:"any",onSelect:X,lockedConfigId:ne}),e[71]=h,e[72]=f,e[73]=X,e[74]=ne,e[75]=se):se=e[75];let oe;return e[76]!==O||e[77]!==Y||e[78]!==se||e[79]!==D?(oe=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[D,O,Y,se]}),e[76]=O,e[77]=Y,e[78]=se,e[79]=D,e[80]=oe):oe=e[80],oe}function HZ(t){return t.type.startsWith("video/")}const KZ=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function WZ(t){const e=F.c(86),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=ie(),d=Og(n),[u,h]=A.useState(!1),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(!1),v=d?WS(d):"",_=v?qS(v):"",L=e2(),y=Yf();let k;e[0]!==L.data?.configs?(k=L.data?.configs??[],e[0]=L.data?.configs,e[1]=k):k=e[1];const w=a?.siteSlug;let S;e[2]!==k||e[3]!==w?(S=jf(k,w),e[2]=k,e[3]=w,e[4]=S):S=e[4];const j=S;let C;e[5]!==i||e[6]!==b||e[7]!==g?(C=function(ee){g(!1),b(!1),i(ee)},e[5]=i,e[6]=b,e[7]=g,e[8]=C):C=e[8];const N=C;let V;e[9]!==L.data?.configs||e[10]!==j?.id||e[11]!==h||e[12]!==N||e[13]!==c||e[14]!==y?(V=async function(ee){if(!ee)return;const ae=Array.from(ee).filter(qZ);if(ae.length===0){pe.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const ue=XS(L.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(Jf):null);if(!ue){h(!0);return}try{const he=await y.mutateAsync({configId:ue,file:ae[0]});N(he.publicUrl),ae.length>1&&pe.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:ae[0].name}))}catch(he){const ce=he;pe.error(ce instanceof Error?ce.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=L.data?.configs,e[10]=j?.id,e[11]=h,e[12]=N,e[13]=c,e[14]=y,e[15]=V):V=e[15];const T=V;let E;e[16]!==m?(E=function(ee){ee.preventDefault(),ee.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=E):E=e[17];const P=E;let D;e[18]!==m?(D=function(ee){ee.currentTarget===ee.target&&m(!1)},e[18]=m,e[19]=D):D=e[19];const I=D;let R;e[20]!==T||e[21]!==m?(R=function(ee){ee.preventDefault(),ee.stopPropagation(),m(!1),T(ee.dataTransfer.files)},e[20]=T,e[21]=m,e[22]=R):R=e[22];const $=R,B=a?.virtualMcpId;let M;e[23]!==l||e[24]!==o||e[25]!==s.description||e[26]!==B?(M=r.jsx("div",{className:"min-w-0",children:r.jsx(Us,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:B})}),e[23]=l,e[24]=o,e[25]=s.description,e[26]=B,e[27]=M):M=e[27];const O=f&&"border-primary ring-2 ring-primary/30",z=y.isPending&&"pointer-events-none opacity-60";let U;e[28]!==O||e[29]!==z?(U=re("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",O,z),e[28]=O,e[29]=z,e[30]=U):U=e[30];let H;e[31]!==_||e[32]!==v||e[33]!==x||e[34]!==p||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==h||e[39]!==d||e[40]!==c||e[41]!==y.isPending?(H=d?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>h(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&r.jsx("img",{src:d,alt:l,className:re("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[r.jsx(Ei,{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(KS,{})]}),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}),_&&r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:_})]})]}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[r.jsx(Ei,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:y.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]=_,e[32]=v,e[33]=x,e[34]=p,e[35]=l,e[36]=b,e[37]=g,e[38]=h,e[39]=d,e[40]=c,e[41]=y.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]!==I||e[47]!==P||e[48]!==$||e[49]!==U||e[50]!==H||e[51]!==K?(W=r.jsxs("div",{onDragOver:P,onDragLeave:I,onDrop:$,className:U,children:[H,K]}),e[46]=I,e[47]=P,e[48]=$,e[49]=U,e[50]=H,e[51]=K,e[52]=W):W=e[52];let Y;e[53]!==N?(Y=le=>N(le.target.value),e[53]=N,e[54]=Y):Y=e[54];let X;e[55]!==c?(X=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=X):X=e[56];let ne;e[57]!==o||e[58]!==d||e[59]!==Y||e[60]!==X?(ne=r.jsx(bt,{id:o,type:"url",value:d,onChange:Y,placeholder:X,className:"h-9 min-w-0 flex-1"}),e[57]=o,e[58]=d,e[59]=Y,e[60]=X,e[61]=ne):ne=e[61];let se;e[62]!==h||e[63]!==d||e[64]!==c?(se=!d&&r.jsxs(de,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[r.jsx(ti,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=h,e[63]=d,e[64]=c,e[65]=se):se=e[65];let oe;e[66]!==N||e[67]!==d||e[68]!==c?(oe=d&&r.jsxs(r.Fragment,{children:[r.jsx(QS,{value:d,onChange:N}),r.jsx(de,{type:"button",variant:"ghost",size:"sm",onClick:()=>N(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:r.jsx(tn,{size:14})})]}),e[66]=N,e[67]=d,e[68]=c,e[69]=oe):oe=e[69];let Z;e[70]!==ne||e[71]!==se||e[72]!==oe?(Z=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[ne,se,oe]}),e[70]=ne,e[71]=se,e[72]=oe,e[73]=Z):Z=e[73];let J;e[74]!==N?(J=le=>N(le),e[74]=N,e[75]=J):J=e[75];const q=j?.id??null;let G;e[76]!==u||e[77]!==h||e[78]!==J||e[79]!==q?(G=r.jsx(US,{open:u,onOpenChange:h,mode:"image",onSelect:J,lockedConfigId:q}),e[76]=u,e[77]=h,e[78]=J,e[79]=q,e[80]=G):G=e[80];let te;return e[81]!==M||e[82]!==W||e[83]!==Z||e[84]!==G?(te=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[M,W,Z,G]}),e[81]=M,e[82]=W,e[83]=Z,e[84]=G,e[85]=te):te=e[85],te}function qZ(t){return KZ.has(t.type||"")}const GZ="0 0 1080 1080",YZ="matrix(1 0 0 1 540 540)",Hg=[{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 JZ({selected:t,onSelect:e}){const s=ie(),[n,i]=A.useState(GZ),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(u=>u===d?u: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:YZ,children:Hg.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:re("cursor-pointer stroke-background outline-none transition-colors [stroke-width:1] [vector-effect:non-scaling-stroke]","hover:fill-primary/50 focus-visible:fill-primary/50",a?"fill-primary":"fill-muted-foreground/40")})},l.code)})})})}const QZ=[{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"}],XZ="BR";function ZZ(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 eee(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 tee(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function m5(t){const e=F.c(37),{id:s,options:n,value:i,placeholder:o,emptyMessage:l,onChange:a}=t,[c,d]=A.useState(!1);let u;if(e[0]!==n||e[1]!==i){let w;e[3]!==i?(w=S=>S.value===i,e[3]=i,e[4]=w):w=e[4],u=n.find(w),e[0]=n,e[1]=i,e[2]=u}else u=e[2];const h=u;let f;e[5]!==o||e[6]!==h?(f=h?r.jsx("span",{className:"truncate",children:h.label}):r.jsx("span",{className:"text-muted-foreground",children:o}),e[5]=o,e[6]=h,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(ff,{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(is,{asChild:!0,children:r.jsxs(de,{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(yi,{placeholder:o,className:"h-9"}),e[14]=o,e[15]=x):x=e[15];let b;e[16]!==l?(b=r.jsx(si,{children:l}),e[16]=l,e[17]=b):b=e[17];let v;if(e[18]!==a||e[19]!==n||e[20]!==i){let w;e[22]!==a||e[23]!==i?(w=S=>r.jsxs(Yt,{value:`${S.label} ${S.value}`,onSelect:()=>{a(S.value===i?"":S.value),d(!1)},children:[r.jsx("span",{className:"truncate",children:S.label}),r.jsx(Rt,{className:re("ml-auto size-4 shrink-0",i===S.value?"opacity-100":"opacity-0")})]},S.value),e[22]=a,e[23]=i,e[24]=w):w=e[24],v=n.map(w),e[18]=a,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let _;e[25]!==v?(_=r.jsx(gs,{children:v}),e[25]=v,e[26]=_):_=e[26];let L;e[27]!==b||e[28]!==_?(L=r.jsxs(_i,{children:[b,_]}),e[27]=b,e[28]=_,e[29]=L):L=e[29];let y;e[30]!==L||e[31]!==x?(y=r.jsx(rs,{className:"p-0",style:g,children:r.jsxs(zi,{children:[x,L]})}),e[30]=L,e[31]=x,e[32]=y):y=e[32];let k;return e[33]!==c||e[34]!==y||e[35]!==p?(k=r.jsxs(os,{open:c,onOpenChange:d,children:[p,y]}),e[33]=c,e[34]=y,e[35]=p,e[36]=k):k=e[36],k}const see=QZ.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),nee=Hg.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function ZS(t){const e=F.c(66),{schema:s,value:n,onChange:i,path:o,sandbox:l}=t,a=ie();let c;e[0]!==n?(c=eee(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:u,regionCode:h,country:f}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==a?(g=p.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==a?(b=p.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const v=b;let _;e[10]!==p.city?.title||e[11]!==a?(_=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=_):_=e[12];const L=_;let y;e[13]!==d||e[14]!==i?(y=j=>{i(tee(d,j))},e[13]=d,e[14]=i,e[15]=y):y=e[15];const k=y,w=f===XZ;let S;if(e[16]!==u||e[17]!==L||e[18]!==f||e[19]!==x||e[20]!==k||e[21]!==w||e[22]!==o||e[23]!==h||e[24]!==v||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==h?(j=U=>U.code===h,e[30]=h,e[31]=j):j=e[31];const C=Hg.find(j),N=`${o}.country`;let V;e[32]!==s.title||e[33]!==a?(V=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=V):V=e[34];const T=l?.virtualMcpId;let E;e[35]!==s.description||e[36]!==V||e[37]!==T||e[38]!==N?(E=r.jsx(Us,{htmlFor:N,label:V,description:s.description,virtualMcpId:T}),e[35]=s.description,e[36]=V,e[37]=T,e[38]=N,e[39]=E):E=e[39];const P=`${o}.country`;let D;e[40]!==x||e[41]!==P?(D=r.jsx(Bt,{htmlFor:P,className:"text-xs",children:x}),e[40]=x,e[41]=P,e[42]=D):D=e[42];const I=`${o}.country`;let R;e[43]!==a?(R=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=R):R=e[44];let $;e[45]!==a?($=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=$):$=e[46];let B;e[47]!==k?(B=U=>k({country:U,regionCode:"",city:""}),e[47]=k,e[48]=B):B=e[48];let M;e[49]!==f||e[50]!==I||e[51]!==R||e[52]!==$||e[53]!==B?(M=r.jsx(m5,{id:I,options:see,value:f,placeholder:R,emptyMessage:$,onChange:B}),e[49]=f,e[50]=I,e[51]=R,e[52]=$,e[53]=B,e[54]=M):M=e[54];let O;e[55]!==D||e[56]!==M?(O=r.jsxs("div",{className:"space-y-1.5",children:[D,M]}),e[55]=D,e[56]=M,e[57]=O):O=e[57];let z;e[58]!==f||e[59]!==k||e[60]!==w||e[61]!==o||e[62]!==h||e[63]!==v||e[64]!==a?(z=f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Bt,{htmlFor:`${o}.regionCode`,className:"text-xs",children:v}),w?r.jsxs("div",{className:"space-y-2",children:[r.jsx(JZ,{selected:h,onSelect:U=>k({regionCode:U===h?"":U,city:""})}),r.jsx(m5,{id:`${o}.regionCode`,options:nee,value:h,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>k({regionCode:U,city:""})})]}):r.jsxs(r.Fragment,{children:[r.jsx(bt,{id:`${o}.regionCode`,type:"text",value:h,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]=w,e[61]=o,e[62]=h,e[63]=v,e[64]=a,e[65]=z):z=e[65],S=r.jsxs("div",{className:"space-y-4",children:[E,O,z,f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Bt,{htmlFor:`${o}.city`,className:"text-xs",children:L}),r.jsx(bt,{id:`${o}.city`,type:"text",value:u,placeholder:w&&C?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:C.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]=u,e[17]=L,e[18]=f,e[19]=x,e[20]=k,e[21]=w,e[22]=o,e[23]=h,e[24]=v,e[25]=l?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=a,e[29]=S}else S=e[29];return S}function iee(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 ree(t){const e=F.c(52),s=ie(),{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=CS(i,c.map(oee)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const u=d,[h,f]=A.useState(u),[m,p]=A.useState(u);m!==u&&(p(u),f(u));const g=Math.min(h,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==o?(b=R=>{const $=Number(R);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 _;e[7]!==x?(_=x?iee(x):null,e[7]=x,e[8]=_):_=e[8];const L=_;let y;if(e[9]!==x?.schema?.properties||e[10]!==i){let R;e[12]!==x?.schema?.properties?(R=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=R):R=e[13],y=xX(i,Object.keys(R)),e[9]=x?.schema?.properties,e[10]=i,e[11]=y}else y=e[11];const k=y;let w;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(w=a&&r.jsx(Us,{htmlFor:l,label:a,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=a,e[15]=l,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=w):w=e[18];const S=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let C;e[21]!==j?(C=r.jsx(Is,{placeholder:j}),e[21]=j,e[22]=C):C=e[22];let N;e[23]!==l||e[24]!==C?(N=r.jsx(Ns,{id:l,children:C}),e[23]=l,e[24]=C,e[25]=N):N=e[25];let V;if(e[26]!==c||e[27]!==s){let R;e[29]!==s?(R=($,B)=>r.jsx(Pt,{value:String(B),children:LX($.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:B+1})},$.title),e[29]=s,e[30]=R):R=e[30],V=c.map(R),e[26]=c,e[27]=s,e[28]=V}else V=e[28];let T;e[31]!==V?(T=r.jsx(Vs,{children:V}),e[31]=V,e[32]=T):T=e[32];let E;e[33]!==v||e[34]!==T||e[35]!==S||e[36]!==N?(E=r.jsxs(Cs,{value:S,onValueChange:v,children:[N,T]}),e[33]=v,e[34]=T,e[35]=S,e[36]=N,e[37]=E):E=e[37];let P;e[38]!==E||e[39]!==w?(P=r.jsxs("div",{className:"space-y-1.5",children:[w,E]}),e[38]=E,e[39]=w,e[40]=P):P=e[40];let D;e[41]!==x||e[42]!==L||e[43]!==o||e[44]!==l||e[45]!==k||e[46]!==t||e[47]!==i?(D=x&&(ZZ(x.schema?.properties)?r.jsx(ZS,{...t,schema:x.schema,onChange:R=>o({...k,...R,...x.discriminators??{}})}):L?r.jsx(Ui,{schema:L,value:i,onChange:R=>o({...R,...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]=D):D=e[48];let I;return e[49]!==P||e[50]!==D?(I=r.jsxs("div",{className:"space-y-3",children:[P,D]}),e[49]=P,e[50]=D,e[51]=I):I=e[51],I}function oee(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const lee={lat:-21.9,lng:-41.42},dm=1e5;let y0=null;function aee(t){return y0||(y0=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)}),y0)}function cee(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:dm}}function dee({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o}){const l=Bj().googleMapsApiKey,a=A.useRef(s);a.current=s;const c=A.useRef(cee(e)),[d,u]=A.useState(null),h=A.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return aee(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:lee,v=x?.radius??dm,_=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:_,center:b,radius:v});p.circle=L;const y=()=>{const w=L.getCenter(),S=L.getRadius();w&&a.current(`${w.lat()},${w.lng()},${S}`)},k=w=>{w&&p.listeners.push(w)};k(_.addListener("click",w=>{w.latLng&&(L.setCenter({lat:w.latLng.lat(),lng:w.latLng.lng()}),L.getRadius()||L.setRadius(dm),y())})),k(L.addListener("radius_changed",y)),k(L.addListener("dragend",y))},g=>{p.disposed||u(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return h.current||(h.current=f),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Us,{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:h.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 uee="oklch(0.65 0.15 160)",hee="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)]",ew="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)]",s9e="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 p5(t){return t.map(e=>e.label).join(`
540
- `)}function g5(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function fee(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 mee(t){return t.map((e,s)=>({...e,index:s}))}function tw(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:o,onDuplicate:l,onDelete:a}=t,c=ie(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=re("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=r.jsx(yc,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Or,{className:"h-4 w-4 shrink-0",style:{color:uee}}),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(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{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:gee,onPointerDown:pee,children:r.jsx(ei,{size:14})})}),r.jsxs(Ht,{align:"end",children:[o&&r.jsxs(Qe,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(Sy,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(Qe,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(an,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(Qe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(tn,{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]!==h||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function pee(t){return t.stopPropagation()}function gee(t){return t.stopPropagation()}function xee(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:bee},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=If(d);let g;e[2]!==m?(g=Ri.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let _;e[7]!==o?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=_):_=e[8];const L=p?"cursor-grabbing":"cursor-grab",y=n?ew:hee;let k;e[9]!==L||e[10]!==y?(k=re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,y),e[9]=L,e[10]=y,e[11]=k):k=e[11];let w;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(w=r.jsx(tw,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=w):w=e[17];let S;return e[18]!==u||e[19]!==h||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==_||e[24]!==k||e[25]!==w?(S=r.jsx("div",{ref:f,style:v,...u,...h,onClick:o,onKeyDown:_,className:k,children:w}),e[18]=u,e[19]=h,e[20]=o,e[21]=f,e[22]=v,e[23]=_,e[24]=k,e[25]=w,e[26]=S):S=e[26],S}function bee(){return!1}function vee(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=ie(),m=n.length>1;let p;e[0]!==n?(p=()=>g5(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=A.useState(p),[b,v]=A.useState(null),[_,L]=A.useState(s),[y,k]=A.useState(n.length);let w;e[2]!==n?(w=()=>p5(n),e[2]=n,e[3]=w):w=e[3];const[S,j]=A.useState(w),C=A.useRef(!1),N=p5(n);_!==s?(L(s),k(n.length),j(N),x(g5(n))):(y!==n.length||S!==N)&&(k(n.length),j(N),x(he=>fee(he,n)));let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V={activationConstraint:{distance:8}},e[4]=V):V=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:Mf},e[5]=T):T=e[5];const E=Vu(gr(Rl,V),gr(Dl,T));let P;e[6]!==g?(P=g.map(yee),e[6]=g,e[7]=P):P=e[7];const D=P;let I;e[8]!==g?(I=he=>{const ce=String(he.active.id);v(g.find(ge=>ge.id===ce)??null)},e[8]=g,e[9]=I):I=e[9];const R=I;let $;e[10]!==D||e[11]!==u?($=he=>{v(null);const{active:ce,over:ge}=he;if(!ge||ce.id===ge.id)return;const Q=D.indexOf(String(ce.id)),me=D.indexOf(String(ge.id));Q===-1||me===-1||(x(ve=>mee(bl([...ve],Q,me))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),u(Q,me))},e[10]=D,e[11]=u,e[12]=$):$=e[12];const B=$;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const O=M;let z,U,H,K,W,Y,X,ne,se,oe,Z,J,q;if(e[14]!==m||e[15]!==g||e[16]!==D||e[17]!==B||e[18]!==R||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==E||e[27]!==f){const he=Ye=>{C.current||o(Ye)};Z="space-y-1 border-b p-2";let ce;e[41]!==f?(ce=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ce):ce=e[42];let ge;e[43]!==ce?(ge=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[43]=ce,e[44]=ge):ge=e[44];let Q;e[45]!==f?(Q=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=Q):Q=e[46];let me;e[47]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx($t,{size:14}),e[47]=me):me=e[47];let ve;e[48]!==h||e[49]!==Q?(ve=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":Q,className:"size-6",onClick:h,children:me})}),e[48]=h,e[49]=Q,e[50]=ve):ve=e[50];let we;e[51]!==f?(we=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=we):we=e[52];let ye;e[53]!==we?(ye=r.jsx(Ke,{children:we}),e[53]=we,e[54]=ye):ye=e[54];let Le;e[55]!==ve||e[56]!==ye?(Le=r.jsxs(We,{children:[ve,ye]}),e[55]=ve,e[56]=ye,e[57]=Le):Le=e[57];let Ce;e[58]!==f?(Ce=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ce):Ce=e[59];let Te;e[60]===Symbol.for("react.memo_cache_sentinel")?(Te=r.jsx(tn,{size:14}),e[60]=Te):Te=e[60];let _e;e[61]!==d||e[62]!==Ce?(_e=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":Ce,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Te})}),e[61]=d,e[62]=Ce,e[63]=_e):_e=e[63];let Pe;e[64]!==f?(Pe=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Pe):Pe=e[65];let ke;e[66]!==Pe?(ke=r.jsx(Ke,{children:Pe}),e[66]=Pe,e[67]=ke):ke=e[67];let Ne;e[68]!==_e||e[69]!==ke?(Ne=r.jsxs(We,{children:[_e,ke]}),e[68]=_e,e[69]=ke,e[70]=Ne):Ne=e[70];let Fe;e[71]!==Le||e[72]!==Ne?(Fe=r.jsxs("div",{className:"flex items-center gap-0.5",children:[Le,Ne]}),e[71]=Le,e[72]=Ne,e[73]=Fe):Fe=e[73],e[74]!==ge||e[75]!==Fe?(J=r.jsxs("div",{className:"flex items-center justify-between",children:[ge,Fe]}),e[74]=ge,e[75]=Fe,e[76]=J):J=e[76],U=Eu,Y=E,X=H2,ne=R,se=B,oe=O,z=Rf,K=D,W=Df,q="space-y-0.5",H=g.map(Ye=>r.jsx(xee,{entry:Ye,selected:Ye.index===i,canDelete:m,onSelect:()=>he(Ye.index),onRename:l?()=>l(Ye.index):void 0,onDuplicate:()=>a(Ye.index),onDelete:()=>c(Ye.index)},Ye.id)),e[14]=m,e[15]=g,e[16]=D,e[17]=B,e[18]=R,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=E,e[27]=f,e[28]=z,e[29]=U,e[30]=H,e[31]=K,e[32]=W,e[33]=Y,e[34]=X,e[35]=ne,e[36]=se,e[37]=oe,e[38]=Z,e[39]=J,e[40]=q}else z=e[28],U=e[29],H=e[30],K=e[31],W=e[32],Y=e[33],X=e[34],ne=e[35],se=e[36],oe=e[37],Z=e[38],J=e[39],q=e[40];let G;e[77]!==H||e[78]!==q?(G=r.jsx("div",{className:q,children:H}),e[77]=H,e[78]=q,e[79]=G):G=e[79];let te;e[80]!==z||e[81]!==K||e[82]!==W||e[83]!==G?(te=r.jsx(z,{items:K,strategy:W,children:G}),e[80]=z,e[81]=K,e[82]=W,e[83]=G,e[84]=te):te=e[84];let le;e[85]!==b||e[86]!==m?(le=b?r.jsx("div",{className:re("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ew),children:r.jsx(tw,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ee;e[88]!==le?(ee=Bn.createPortal(r.jsx(Pf,{dropAnimation:LS,children:le}),document.body),e[88]=le,e[89]=ee):ee=e[89];let ae;e[90]!==U||e[91]!==Y||e[92]!==X||e[93]!==ne||e[94]!==se||e[95]!==oe||e[96]!==te||e[97]!==ee?(ae=r.jsxs(U,{sensors:Y,collisionDetection:X,onDragStart:ne,onDragEnd:se,onDragCancel:oe,children:[te,ee]}),e[90]=U,e[91]=Y,e[92]=X,e[93]=ne,e[94]=se,e[95]=oe,e[96]=te,e[97]=ee,e[98]=ae):ae=e[98];let ue;return e[99]!==Z||e[100]!==J||e[101]!==ae?(ue=r.jsxs("div",{className:Z,children:[J,ae]}),e[99]=Z,e[100]=J,e[101]=ae,e[102]=ue):ue=e[102],ue}function yee(t){return t.id}const _ee=[[/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"]],Lee={"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 U9(t){return Tl(t)!==void 0}function Kg(t,e){if(e){if(U9(e))return e;const s=Lee[e];if(s&&U9(s))return s}for(const[s,n]of _ee)if(s.test(t)&&U9(n))return n;return"FilterLines"}function See(t){return Tl(t)??o2}function H9(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=See(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 u;e[2]!==c||e[3]!==i?(u=re("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=r.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function n9e(t,e){return CY(t,e).map(s=>{const n=e[s.blockKey]??{},i=$L(TY(s.blockKey),e,t);return{blockKey:s.blockKey,title:xl(s.blockKey,n),description:mc(i),iconName:Kg(s.matcherResolveType)}})}const sw="Users03";function wee(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function kee(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=Fo(l,t);s.push({resolveType:l,title:a.title??ps(l),description:a.description,iconName:Kg(l,a.icon)})}return s}function jee(t,e){if(!t)return sw;const s=e.find(n=>n.resolveType===t);return s?s.iconName:Kg(t)}function Cee(t){const e=F.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=A.useState(!1),f=ie(),p=(i?d.find(J=>J.blockKey===i):void 0)?.iconName??jee(s,o),g=Tl(p);let x;e[0]!==a||e[1]!==h?(x=J=>{a(J),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=J=>{c?.(J),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const _=v;let L;e[6]!==h?(L=()=>h(!0),e[6]=h,e[7]=L):L=e[7];let y;e[8]!==g?(y=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=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 w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Qt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=w):w=e[12];let S;e[13]!==L||e[14]!==y||e[15]!==k?(S=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:[y,k,w]}),e[13]=L,e[14]=y,e[15]=k,e[16]=S):S=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let C;e[19]!==f?(C=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=C):C=e[20];let N;e[21]!==f?(N=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=N):N=e[22];let V;e[23]!==N?(V=r.jsx(yi,{placeholder:N}),e[23]=N,e[24]=V):V=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let E;e[27]!==T?(E=r.jsx(si,{children:T}),e[27]=T,e[28]=E):E=e[28];let P;e[29]!==f?(P=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=P):P=e[30];let D;e[31]!==f?(D=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=D):D=e[32];const I=`${P} ${D}`;let R;e[33]!==b?(R=()=>b(""),e[33]=b,e[34]=R):R=e[34];const $=!s&&!i&&"bg-accent/60";let B;e[35]!==$?(B=re("gap-2.5",$),e[35]=$,e[36]=B):B=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(H9,{iconName:sw,size:"sm"}),e[37]=M):M=e[37];let O;e[38]!==f?(O=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=O):O=e[39];let z;e[40]!==O?(z=r.jsx("span",{className:"text-sm",children:O}),e[40]=O,e[41]=z):z=e[41];let U;e[42]!==f?(U=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=U):U=e[43];let H;e[44]!==U?(H=r.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=H):H=e[45];let K;e[46]!==z||e[47]!==H?(K=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[z,H]}),e[46]=z,e[47]=H,e[48]=K):K=e[48];let W;e[49]!==I||e[50]!==R||e[51]!==B||e[52]!==K?(W=r.jsxs(Yt,{value:I,onSelect:R,className:B,children:[M,K]}),e[49]=I,e[50]=R,e[51]=B,e[52]=K,e[53]=W):W=e[53];let Y;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==o){let J;e[59]!==i||e[60]!==s||e[61]!==b?(J=q=>r.jsxs(Yt,{value:`${q.title} ${q.resolveType} ${q.description??""}`,onSelect:()=>b(q.resolveType),className:re("gap-2.5",!i&&s===q.resolveType&&"bg-accent/60"),children:[r.jsx(H9,{iconName:q.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:q.title}),q.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:q.description})]})]},q.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=J):J=e[62],Y=o.map(J),e[54]=i,e[55]=s,e[56]=b,e[57]=o,e[58]=Y}else Y=e[58];let X;e[63]!==W||e[64]!==Y?(X=r.jsxs(gs,{children:[W,Y]}),e[63]=W,e[64]=Y,e[65]=X):X=e[65];let ne;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(ne=d.length>0&&r.jsx(gs,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(J=>r.jsxs(Yt,{value:`${J.title} ${J.blockKey} ${J.description??""}`,onSelect:()=>_(J.blockKey),className:re("gap-2.5",i===J.blockKey&&"bg-accent/60"),children:[r.jsx(H9,{iconName:J.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:J.title}),J.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=ne):ne=e[70];let se;e[71]!==E||e[72]!==X||e[73]!==ne?(se=r.jsxs(_i,{children:[E,X,ne]}),e[71]=E,e[72]=X,e[73]=ne,e[74]=se):se=e[74];let oe;e[75]!==u||e[76]!==h||e[77]!==C||e[78]!==V||e[79]!==se||e[80]!==j?(oe=r.jsxs(MT,{open:u,onOpenChange:h,title:j,description:C,className:"sm:max-w-lg",filter:wee,children:[V,se]}),e[75]=u,e[76]=h,e[77]=C,e[78]=V,e[79]=se,e[80]=j,e[81]=oe):oe=e[81];let Z;return e[82]!==oe||e[83]!==S?(Z=r.jsxs(r.Fragment,{children:[S,oe]}),e[82]=oe,e[83]=S,e[84]=Z):Z=e[84],Z}const Nee="website/sections/Rendering/Lazy.tsx";function Th(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Wg(t){if(!Th(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Ms(e)}function Vee(t){return t!=null}function um(t){if(t==null)return t;if(Wg(t)){const e=t.section;return e==null?null:Th(e)?e:{}}return Th(t)?t:void 0}function Tee(t,e){return t===null?null:Wg(e)?{...e,section:t}:t}function i9e(t){return{__resolveType:t}}function r9e(t,e){if(!Vee(e))return null;if(t){const s=um(e)??{};return{__resolveType:Nee,section:s}}return Wg(e)?um(e)??null:Th(e)?e:null}const Eee="General";function pc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function nw(t,e){return t===Po?Eee:e}function iw(t){const e=sh(t),s=new Set,n=[];for(const i of e)pc(i.resolveType)&&(pi(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:nw(i.resolveType,i.title),description:i.description})));return n}function qg(t){const e=th(t),s=Un(e,t),n=iw(s?.properties?.seo);return n.length>0?n:Aee(t)}function Aee(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const o of Object.keys(i)){if(!pc(o))continue;const l=o.split("/").pop()?.replace(/\.tsx?$/,"")??o;s.push({resolveType:o,title:nw(o,l)})}return s}function rw(t){const e=qg(t),s=e.find(n=>n.resolveType===Po);return s?s.resolveType:e[0]?.resolveType??Po}function ow(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Un(s,t),i=iw(n?.properties?.seo);if(i.length>0)return i}return qg(t)}function Pee(t,e){const s=ow(t,e),n=s.find(i=>i.resolveType===Po);return n?n.resolveType:s[0]?.resolveType??rw(t)}function Dee(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:rw(t)}function Ree(t,e,s){const n=s.__resolveType;return typeof n=="string"&&pc(n)?n:Pee(t,e)}const Iee=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),Po="website/sections/Seo/SeoV2.tsx",Mee=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function Ed(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function $ee(t){return typeof t.__resolveType=="string"&&pc(t.__resolveType)?!0:Mee.some(e=>e in t)}function Oee(t,e){for(const[s,n]of Object.entries(t)){if(!Ed(n))continue;const i=n,o=i.__resolveType;if(typeof o=="string"&&Iee.has(o))continue;const l=i.seo;if(Ed(l)){const a=l;if($ee(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Ree(e,i,a):typeof a.__resolveType=="string"&&pc(a.__resolveType)?a.__resolveType:Po}}}for(const[s,n]of Object.entries(t)){if(!Ed(n))continue;const i=n;if(typeof i.__resolveType=="string"&&pc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Bee(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function o9e(t,e,s){if(e.kind==="site"){const c=Oee(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?ow(s,c.blockData):void 0,build:d=>Bee(c,d)}:null}const n=t[e.pageKey];if(!Ed(n))return null;const i=n,o=i.seo,l=um(o),a=l&&Ed(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:o,seoResolveType:s?Dee(s,a):typeof a?.__resolveType=="string"?a.__resolveType:Po,seoTypeOptions:s?qg(s):void 0,build:c=>({...i,seo:c===null?null:Tee(c,o)})}}const Gg=["type","title","description","canonical","favicon","image","themeColor"],zee=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Fee=["jsonLD","title","description","noIndexing","configJsonLD"];function lw(t){return t===Po||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Uee(t){switch(t){case"general":return Gg;case"pdp":return zee;case"plp":return Fee;default:return null}}function aw(t,e){const s=Uee(lw(e));if(!s||!t.properties)return t;const n={};for(const i of s){const o=t.properties[i];o&&(n[i]=o)}return{...t,properties:n}}function Hee(){return Gg.filter(t=>t!=="type")}function Kee(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Wee(t,e){return t[e]===void 0}function qee(t){const e=F.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:o,formResetKey:l}=t,a=ie(),d=aw(s,Po).properties??{},u=Hee();let h;e[0]!==o?(h=!!o&&Object.keys(o).length>0,e[0]=o,e[1]=h):h=e[1];const f=h,[m,p]=A.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=A.useState(g);m!==l&&(p(l),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:Wee(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const _=v;let L;e[6]!==i||e[7]!==o||e[8]!==n?(L=(j,C)=>{b(V=>({...V,[j]:C}));const N={...n};if(C)delete N[j];else{const V=o?.[j];N[j]=V??(j==="type"?"website":"")}i(N)},e[6]=i,e[7]=o,e[8]=n,e[9]=L):L=e[9];const y=L,k="min-w-0 space-y-6",w=Gg.map(j=>{const C=d[j];if(!C)return null;const N=f&&u.includes(j),V=N&&_(j),T=V?o?.[j]??n[j]:n[j],E=C.title??Kee(j);return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:re(V&&"pointer-events-none opacity-60"),children:Sl({schema:C,value:T,onChange:P=>{V||i({...n,[j]:P})},path:j,label:E,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:Gee})}),N&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pr,{id:`seo-use-default-${j}`,checked:V,onCheckedChange:P=>y(j,P)}),r.jsx(Bt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let S;return e[10]!==l||e[11]!==w?(S=r.jsx("div",{className:k,children:w},l),e[10]=l,e[11]=w,e[12]=S):S=e[12],S}function Gee(){}function Yee(t){const e=F.c(18),{schema:s,resolveType:n,value:i,formResetKey:o,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(lw(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==o||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=r.jsx(qee,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:o}),e[2]=o,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let u;e[8]!==n||e[9]!==s?(u=aw(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??Jee;let p;return e[12]!==h||e[13]!==o||e[14]!==l||e[15]!==m||e[16]!==i?(p=r.jsx(Ui,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},o),e[12]=h,e[13]=o,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Jee(){}function Qee(t){const e=F.c(16),{schema:s,value:n,onChange:i,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=ie();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.length>0&&r.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[r.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:r.jsx(y1,{className:"size-3.5"})}),h.map((x,b)=>{const v=b===h.length-1,_=Cn(x);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:_,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==o||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=r.jsx(Ui,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=o,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=r.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function l9e(t){const e=F.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:o,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const _=v;let L;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==o||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(L=s&&n?u?r.jsx(Yee,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:o,onBreadcrumbChange:l,siteDefaultSeo:h}):r.jsx(Ui,{schema:s,value:n,onChange:o,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=o,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=L):L=e[16];const y=L;let k;e[17]!==c||e[18]!==y?(k=y??r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=k):k=e[19];let w;return e[20]!==d||e[21]!==k?(w=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:[d,k]})}),e[20]=d,e[21]=k,e[22]=w):w=e[22],w}const a9e="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function c9e(t,e){return aJ(t,e,mc)}function d9e(t){const e=F.c(19),{pageKey:s,initialName:n,initialPath:i,onFieldChange:o}=t,l=ie(),[a,c]=A.useState(n),[d,u]=A.useState(i),[h,f]=A.useState(s);h!==s&&(f(s),c(n),u(i));let m;e[0]!==o?(m=L=>{c(L.target.value),o("name",L.target.value)},e[0]=o,e[1]=m):m=e[1];let p;e[2]!==l?(p=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[2]=l,e[3]=p):p=e[3];let g;e[4]!==a||e[5]!==m||e[6]!==p?(g=r.jsx("input",{type:"text",value:a,onChange:m,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:p}),e[4]=a,e[5]=m,e[6]=p,e[7]=g):g=e[7];let x;e[8]!==o?(x=L=>{u(L.target.value),o("path",L.target.value)},e[8]=o,e[9]=x):x=e[9];let b;e[10]!==l?(b=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[10]=l,e[11]=b):b=e[11];let v;e[12]!==d||e[13]!==x||e[14]!==b?(v=r.jsx("input",{type:"text",value:d,onChange:x,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:b}),e[12]=d,e[13]=x,e[14]=b,e[15]=v):v=e[15];let _;return e[16]!==g||e[17]!==v?(_=r.jsxs("div",{className:"space-y-1",children:[g,v]}),e[16]=g,e[17]=v,e[18]=_):_=e[18],_}function u9e(t){const e=F.c(13),{onClick:s}=t,n=ie();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(vu,{size:14}),e[2]=o):o=e[2];let l;e[3]!==s||e[4]!==i?(l=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:o})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=r.jsx(Ke,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=r.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const x5=new WeakMap;function Xee(t,e){let s=x5.get(e);s||(s=new Map,x5.set(e,s));let n=s.get(t);return n===void 0&&(n=Un(t,e),s.set(t,n)),n}function Zee(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function ete(t,e){return{__resolveType:e,variants:[{rule:dc(),value:structuredClone(t)},{rule:dc(),value:structuredClone(t)}]}}function tte(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>Vg(n.rule));return s?s.value:e[e.length-1]?.value}function ste(t){const e=[...t.variants],s=e[e.length-1],n={rule:dc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function nte(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function ite(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function rte(t,e,s){return e<t?t-1:Math.min(t,s-1)}function ote(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 lte(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function b5(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const v5=new WeakMap;function ate(t){let e=v5.get(t);return e||(e=kee(t),v5.set(t,e)),e}function cw(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=ie(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=A.useState(0);if(!Zee(l)){let B;e[0]!==o?(B=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=B):B=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(vu,{size:14}),e[2]=M):M=e[2];let O;e[3]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=O):O=e[4];let z;return e[5]!==O?(z=r.jsx(Ke,{children:O}),e[5]=O,e[6]=z):z=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":B,onClick:()=>{a(ete(l,s)),h(0)},children:M})}),z]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==o?(g=(B,M)=>({index:M,label:mc(B.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},_=v.__resolveType??"",L=b?.value,y=c?ate(c):[],k=_&&c?Xee(_,c):null,{__resolveType:w,...S}=v,j=()=>{a(tte(f)),h(0)},C=()=>{const B=ste(f);a(B),h(B.variants.length-1)},N=B=>{const M=nte(f,B);M&&(a(M),h(rte(p,B,M.variants.length)))},V=B=>{const M=ite(f,B);a(M),h(B+1)},T=(B,M)=>{const O=ote(f,B,M);a(O),p===B&&h(M)},E=B=>{const M=B?EY(B,c):{__resolveType:M8};a(b5(f,p,M))},P=B=>{const M=B,O=_?{...M,__resolveType:_}:{...M};a(b5(f,p,O))},D=B=>{a(lte(f,p,B))},I=`${d}-${f.__resolveType}`;let R;e[9]!==o?(R=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=R):R=e[10];let $;return e[11]!==R?($=r.jsx(Bt,{className:"text-xs text-muted-foreground",children:R}),e[11]=R,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(vee,{listKey:I,variants:x,selectedIndex:p,onSelect:h,onDuplicate:V,onDelete:N,onRemoveAll:j,onReorder:T,onAdd:C}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(Cee,{currentRt:_,currentLabel:mc(v),matchers:y,onSelect:E}),k&&r.jsx("div",{className:"pt-1",children:r.jsx(Qee,{schema:k,value:S,onChange:P,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${_}`)})]}),n({...i,value:L,onChange:D})]})]})}const cte="website/loaders/secret.ts";function Ad(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 dte(){return{__resolveType:cte,name:"",encrypted:""}}function ute(t){const{value:e,...s}=t;return s}function K9(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=ie();if(typeof n=="string"||n==null&&!Ad(n)){const C=typeof n=="string"?n:"",N=a?.virtualMcpId;let V;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==N?(V=r.jsx(Us,{htmlFor:l,label:o,description:s.description,virtualMcpId:N}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=N,e[4]=V):V=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let E;e[7]!==i?(E=I=>i(I.target.value),e[7]=i,e[8]=E):E=e[8];let P;e[9]!==l||e[10]!==C||e[11]!==T||e[12]!==E?(P=r.jsx(bt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:E,className:"h-10"}),e[9]=l,e[10]=C,e[11]=T,e[12]=E,e[13]=P):P=e[13];let D;return e[14]!==V||e[15]!==P?(D=r.jsxs("div",{className:"space-y-2",children:[V,P]}),e[14]=V,e[15]=P,e[16]=D):D=e[16],D}let d;e[17]!==n?(d=Ad(n)?n:dte(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx(Us,{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]!==u||e[27]!==i?(v=C=>i({...u,name:C.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let _;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(_=r.jsx(bt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=_):_=e[33];const L=`${l}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let k;e[37]!==u||e[38]!==f||e[39]!==i?(k=C=>{const N=C.target.value;if(!N){i(f?ute(u):u);return}i({...u,value:N})},e[37]=u,e[38]=f,e[39]=i,e[40]=k):k=e[40];let w;e[41]!==y||e[42]!==k||e[43]!==L?(w=r.jsx(bt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:k,className:"h-10"}),e[41]=y,e[42]=k,e[43]=L,e[44]=w):w=e[44];let S;e[45]!==f||e[46]!==c?(S=f&&r.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=S):S=e[47];let j;return e[48]!==w||e[49]!==S||e[50]!==g||e[51]!==_?(j=r.jsxs("div",{className:"space-y-2",children:[g,_,w,S]}),e[48]=w,e[49]=S,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function hte(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 u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(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 u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function fte(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 mte=new Set(["__resolveType","@type"]);function pte(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 gte(t){if(Hf(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 y5(t){if(t.type==="array"&&t.items)return t;const e=t.items??gte(t);return e?{...t,type:"array",items:e}:null}function xte(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 dw(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=Un(n,s);return i?r.jsx(Ui,{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 Sl(t){const{schema:e,value:s}=t;if(Lh(s)){const l=rJ(s),a=y5(e);if(l!==null&&a)return r.jsx(v0,{...t,schema:a,value:l,onChange:c=>t.onChange(oJ(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&Hf(e)){const l=y5(e);if(l)return r.jsx(v0,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Lh(s)&&e.type==="block-ref"){const l=hte(e,s)??fte(s);if(l){const a={...e,type:"array",items:l};return r.jsx(v0,{...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(pte(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=u=>Sl({...u,schema:c});return r.jsx(cw,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(d5,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(ree,{...t},t.path);if(e.format==="image-uri")return r.jsx(WZ,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(UZ,{...t},t.path);if(e.format==="map")return r.jsx(dee,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(xZ,{...t},t.path);if(e.format==="location")return r.jsx(ZS,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(rX,{...t},t.path);if(e.type==="anyOf")return r.jsx(d5,{...t},t.path);if(Ad(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(K9,{...t},t.path);if(!e.format&&!e.enum){const l=dw(t);if(l)return l}const n=s??xte(e.type,e.default);if(n==null)return Ad(s)?r.jsx(K9,{...t},t.path):null;if(Ad(n))return r.jsx(K9,{...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(v0,{...i},t.path);switch(o){case"boolean":return r.jsx(eX,{...i},t.path);case"number":case"integer":return r.jsx(ZQ,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(x0,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(x0,{...i},t.path):r.jsx(x0,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(ZX,{...i},t.path):null;default:return r.jsx(x0,{...i},t.path)}}function bte(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Sl({...t,schema:e});const s=dw(t);return s||Sl(e?{...t,schema:e}:t)}function Ui({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=ie(),p=t.properties;if(!p)return t.type==="inline-union"?Sl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}):null;if(iJ(e)&&p.variants){const V=p.variants.items?.properties?.value;return r.jsx(cw,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:T=>bte(T,V)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(V=>!mte.has(V)&&p[V]?.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=(V,T)=>{if(T===void 0){const{[V]:E,...P}=g;s(P);return}s({...g,[V]:T})},_=typeof g.__resolveType=="string"?g.__resolveType:void 0,L=x.filter(V=>{const T=p[V];return T!=null&&qa(T,g[V])}).length>1,y=AX(x,p,g),k=i.length>0?DX(x,p,g,i,a,l):null,w=k?p[k]:null,S=k&&w?[k]:x,j=k&&w?EX(k,w,i,tu(k,x,p)):i,C=TX(i,j),N=C.length>0&&o?V=>o([...C,...V]):o;return r.jsx("div",{className:"min-w-0 space-y-6",children:S.map(V=>{const T=p[V];if(!T)return null;const E=n?`${n}.${V}`:V,P=tu(V,x,p),D=Ll(V,T),$=(C.length===0&&x.some(B=>{const M=p[B];return B!==V&&M!=null&&Ll(B,M)===D})||C.length===0&&y.has(V))&&N?B=>N(NX(P,B)):N;return Sl({schema:T,value:g[V],onChange:B=>v(V,B),path:E,label:P,required:b.has(V),breadcrumbPath:j,onBreadcrumbChange:$,hasSiblingDrillDownFields:L,focused:k===V,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:_,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function vte(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(cn,{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(ft,{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(Rt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const _5=3e4;function yte(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 _te(t,{resolveType:e,props:s}){let n;try{n=await fetch(E8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(_5)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${_5/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 Lte(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>_te(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function uw({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=Ls()?.taskId??null,g=ie(),x=eo(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=Un(a.resolveType,i),_=!v&&bM(a.resolveType,i),L=_?vM(c):null,y=v??L,[k,w]=A.useState(c),[S,j]=A.useState([]),[C,N]=A.useState(0),[V,T]=A.useState(!1),[E,P]=A.useState(null),[D,I]=A.useState(!1),[R,$]=A.useState(!1),[B,M]=A.useState(!1),O=E!==null,{save:z,flush:U,isPending:H}=KL({orgSlug:t,virtualMcpId:e,branch:s}),K=Lte({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});A.useEffect(()=>()=>{U()},[]);const W=cS(l),Y=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,X={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},ne=le=>{w(le),a.mode==="saved"&&z(a.blockKey,{__resolveType:a.resolveType,...le})},se=()=>{O?(P(null),T(!1),N(le=>le+1)):P(JSON.stringify(k,null,2))},oe=le=>{const ee=le??"";try{const ae=JSON.parse(ee);if(ae&&typeof ae=="object"&&!Array.isArray(ae)){T(!1),ne(ae);return}T(!0)}catch{T(!0)}},Z=async le=>{const ee=zg(le,o);if(ee){pe.error(ee);return}await u(le,{__resolveType:a.resolveType,...k}),I(!1)},J=()=>{$(!0),K.mutate({resolveType:a.resolveType,props:k})},q=()=>{n&&window.open(yte(n,a.resolveType,k,Date.now()),"_blank","noopener")},G=[a.title,...S],te=le=>{j(S.slice(0,le)),N(ee=>ee+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(de,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:r.jsx(nf,{size:14})}),r.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:G.map((le,ee)=>{const ae=ee===G.length-1,ue=Cn(le);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ee>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>te(ee),title:ue,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ae?"font-medium text-foreground":"text-muted-foreground"),children:ue})]},`${ue}-${ee}`)})}),a.mode==="saved"&&r.jsx(vte,{isPending:H,isError:!1}),m&&r.jsxs(de,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:K.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:W}),children:[K.isPending?r.jsx(ft,{size:14,className:"animate-spin"}):r.jsx(fl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:W}),children:r.jsx(wp,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:W})})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:O?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:se,"aria-label":g(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":O,children:O?r.jsx(_s,{size:14}):r.jsx(zo,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g(O?"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"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:W}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:Y,singular:W})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:re("relative min-h-0 flex-1",R&&B&&"hidden"),children:[r.jsx($o,{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:[L&&y===L&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:W})}),y?r.jsx(Ui,{schema:y,value:k,onChange:le=>ne(le),basePath:"",breadcrumbPath:S,onBreadcrumbChange:j,meta:i,decofile:o,onSaveReferencedBlock:h,sandbox:X},C):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:W}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:W})})]})})}),E!==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:g("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(yu,{language:"json",height:"100%",code:E,onChange:oe,onSave:le=>{oe(le),U()}})})]})]}),R&&r.jsx(Ste,{singular:W,result:{isPending:K.isPending,error:K.error,data:K.data,hasRun:K.status!=="idle"},expanded:B,onToggleExpand:()=>M(le=>!le),onOpenInNewTab:n?q:void 0,onClose:()=>{$(!1),M(!1)}})]}),r.jsx(Fg,{open:D,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:Z})]})}function Ste(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,onOpenInNewTab:l,onClose:a}=t,c=ie();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=re("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=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(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(yn,{size:14})})}),r.jsx(Ke,{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(XN,{size:14}):r.jsx(by,{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(He,{asChild:!0,children:r.jsx(de,{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 _;e[22]!==i||e[23]!==c?(_=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=_):_=e[24];let L;e[25]!==_?(L=r.jsx(Ke,{side:"bottom",children:_}),e[25]=_,e[26]=L):L=e[26];let y;e[27]!==L||e[28]!==v?(y=r.jsxs(We,{children:[v,L]}),e[27]=L,e[28]=v,e[29]=y):y=e[29];let k;e[30]!==c?(k=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=k):k=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(_s,{size:14}),e[32]=w):w=e[32];let S;e[33]!==a||e[34]!==k?(S=r.jsx(de,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":k,children:w}),e[33]=a,e[34]=k,e[35]=S):S=e[35];let j;e[36]!==y||e[37]!==S||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,S]}),e[36]=y,e[37]=S,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=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]=C):C=e[42];let N;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(N=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(ft,{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(yu,{language:"json",height:"100%",code:u,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]=u,e[47]=s,e[48]=c,e[49]=N):N=e[49];let V;return e[50]!==C||e[51]!==N||e[52]!==f?(V=r.jsxs("div",{className:f,children:[C,N]}),e[50]=C,e[51]=N,e[52]=f,e[53]=V):V=e[53],V}function wte(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,blockKey:c}=t,d=ie();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=Du(u);let f;e[4]!==h?(f=Dg((y,k)=>h.mutate({blockKey:y,data:k})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=fS(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 y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let k;return e[11]!==y?(k=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=k):k=e[12],k}const v=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let L;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==o||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==v||e[26]!==_||e[27]!==n?(L=r.jsx(uw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:h.isPending,onCreate:kte,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]=h.isPending,e[24]=m,e[25]=v,e[26]=_,e[27]=n,e[28]=L):L=e[28],L}async function kte(){}const jte="https://github.com/decocms/blocks";function Cte(){const t=F.c(14),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(ZN,{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(yn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(de,{size:"sm",asChild:!0,children:r.jsxs("a",{href:jte,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(To,{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 Nte(t){const e=F.c(15),{source:s,onRetry:n}=t,i=ie();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(cn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let u;e[8]!==n||e[9]!==d?(u=r.jsx(de,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=r.jsx(To,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}function Qr(){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(ft,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Vte=A.lazy(()=>Tn(()=>import("./sections-editor-DYATNkxM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.SectionsEditor})));function L5(t){const e=F.c(47),{virtualMcpId:s,externalSelection:n}=t,i=n===void 0?null:n,{org:o}=qe(),{currentBranch:l,taskId:a}=sn(),c=ni(),d=Pl(),u=gS(),h=c.lifecycle.phase==="running",f=d.previewUrl;let m;e[0]!==l||e[1]!==o||e[2]!==f||e[3]!==a||e[4]!==s?(m=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,threadId:a??null,previewUrl:f}:null,e[0]=l,e[1]=o,e[2]=f,e[3]=a,e[4]=s,e[5]=m):m=e[5];const p=m;let g;e[6]!==h?(g={fetchEnabled:h},e[6]=h,e[7]=g):g=e[7];const x=_f(p,g);let b;e[8]!==h?(b={fetchEnabled:h},e[8]=h,e[9]=b):b=e[9];const v=Lf(p,b),_=BL({lifecyclePhase:c.lifecycle.phase,decofile:yh(x),meta:yh(v),hasEditableContent:kf(x.data,v.data),fastPreviewActive:En(s).runtime==="cms"});if(_.kind==="loading"){let I;return e[10]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Qr,{}),e[10]=I):I=e[10],I}if(_.kind==="empty"){let I;return e[11]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Cte,{}),e[11]=I):I=e[11],I}if(_.kind==="error"){let I;e[12]!==x||e[13]!==d||e[14]!==v||e[15]!==_.source?(I=()=>{if(_.source==="sandbox"){d.retry();return}Promise.all([x.refetch(),v.refetch()])},e[12]=x,e[13]=d,e[14]=v,e[15]=_.source,e[16]=I):I=e[16];const R=I;let $;return e[17]!==R||e[18]!==_.source?($=r.jsx(Nte,{source:_.source,onRetry:R}),e[17]=R,e[18]=_.source,e[19]=$):$=e[19],$}const L=u.state.target;if(L?.kind==="loader"&&x.data&&v.data){const I=l??"",R=f??null;let $;return e[20]!==x.data||e[21]!==v.data||e[22]!==o.slug||e[23]!==I||e[24]!==R||e[25]!==L.key||e[26]!==s?($=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(wte,{orgSlug:o.slug,virtualMcpId:s,branch:I,previewUrl:R,meta:v.data,decofile:x.data,blockKey:L.key})}),e[20]=x.data,e[21]=v.data,e[22]=o.slug,e[23]=I,e[24]=R,e[25]=L.key,e[26]=s,e[27]=$):$=e[27],$}let y;e[28]!==l||e[29]!==o.slug||e[30]!==L||e[31]!==s?(y=L||!l?null:Eg(Tg(o.slug,s,l)),e[28]=l,e[29]=o.slug,e[30]=L,e[31]=s,e[32]=y):y=e[32];const k=y;let w="/",S=null,j=null;L?.kind==="page"?(w=L.path,S=L.key):L?.kind==="section"?j=L.key:k&&(w=k.path,S=k.pageKey);const C=S?`page:${S}`:j?`section:${j}`:`path:${w}`;let N;e[33]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),e[33]=N):N=e[33];const V=l??"",T=f??void 0,E=j?null:i,P=!!S&&u.state.editSeoPageKey===S;let D;return e[34]!==j||e[35]!==S||e[36]!==w||e[37]!==C||e[38]!==o.slug||e[39]!==P||e[40]!==V||e[41]!==T||e[42]!==E||e[43]!==s||e[44]!==u.consumeEditSeo||e[45]!==u.setVariantOverride?(D=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(A.Suspense,{fallback:N,children:r.jsx(Vte,{orgSlug:o.slug,virtualMcpId:s,branch:V,previewReady:!0,previewUrl:T,currentPath:w,activePageBlockKey:S,activeGlobalBlockKey:j,externalSelection:E,initialEditSeo:P,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride},C)})}),e[34]=j,e[35]=S,e[36]=w,e[37]=C,e[38]=o.slug,e[39]=P,e[40]=V,e[41]=T,e[42]=E,e[43]=s,e[44]=u.consumeEditSeo,e[45]=u.setVariantOverride,e[46]=D):D=e[46],D}function Tte(t,e){return t===e?"preview":e}function Ete(t){return t.cmsDefaultOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const Ate="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",Pte="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",Dte=500,Rte={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},S5=1,W9=["desktop","mobile","tablet"],w5={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function k5(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Ite(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 _0(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function q9(t,e){try{return new URL(t,e).href}catch{return null}}function Mte(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),o=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return o.at(-1)===s?a=Math.max(a,95):o.includes(s)&&(a=Math.max(a,90)),a}function $te(t){const{onOpen:e}=t,[s,n]=A.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function Ote(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Bte({virtualMcpId:t}){const e=ie(),s=cf(),n=Ro(),i=wY(),o=zt(),{currentBranch:l,taskId:a}=sn(),c=gS(),d=xe=>{o({to:".",search:Ae=>({...Ae,main:xe}),replace:!0})},[u,h]=A.useState("preview"),[f,m]=A.useState(!1),[p,g]=A.useState("desktop"),[x,b]=A.useState(null),[v,_]=A.useState(null),L=A.useRef(null),y=A.useRef(null),[k,w]=A.useState({width:0,height:0}),[S,j]=A.useState(null),[C,N]=A.useState(!1),[V,T]=A.useState(""),E=A.useRef(null),[P,D]=A.useState(!1),[I,R]=A.useState(),[$,B]=A.useState(null),[M,O]=A.useState(null),[z,U]=A.useState(null),[H,K]=A.useState("/"),[W,Y]=A.useState(null),[X,ne]=A.useState({}),[se,oe]=A.useState(!1),Z=A.useRef(null),J=()=>{oe(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>oe(!1),15e3)},q=()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),oe(!1)},{org:G}=qe(),te=ni(),le=Pl(),ee=le.vmEntry,ae=le.previewUrl,ue=te.lifecycle.phase,he=ue==="running",ce=ee?.sandboxProviderKind==="user-desktop",ge=mS({orgSlug:G.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:ce&&he&&!!t&&!!l}),Q=ce?ge:null,me=eo(),ve=me?.entity?.id===t?vp(me.entity.metadata):null,we=En(t),ye=me?.entity?.id===t&&we.runtime==="cms",Le=we.projectDefault==="cms",Ce=MY({sandboxUrl:ae,previewServerUrl:ve,fastPreviewActive:ye}),Te=t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:ae}:null,_e=_f(Te,{fetchEnabled:he}),Pe=Lf(Te,{fetchEnabled:he}),ke=_e.data,Ne=Pe.data,Fe=`${t}:${l??""}`,[Ye,Ie]=A.useState(null),Re=BL({lifecyclePhase:ue,decofile:yh(_e),meta:yh(Pe),hasEditableContent:kf(ke,Ne),fastPreviewActive:ye,frameworkKnownMissing:Ye===Fe});Re.kind==="empty"&&Re.reason==="framework-missing"&&Ye!==Fe&&Ie(Fe);const Oe=Re.kind==="content",tt=t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l}:null,it=UY(tt),nt=ke?ih(ke).sort((xe,Ae)=>xe.name.localeCompare(Ae.name)):[],ot=ke&&Ne?M2(ke,Ne):[],Me=ke&&Ne?hS(Ne,ke,"loaders"):[],lt=ko,gt=V?(()=>{const xe=V.toLowerCase();return nt.map(Ae=>({page:Ae,score:Mte(Ae.name,Ae.path,xe)})).filter(({score:Ae})=>Ae>0).sort((Ae,St)=>St.score-Ae.score||Ae.page.path.length-St.page.path.length).map(({page:Ae})=>Ae)})():nt,Xe=ot.filter(xe=>{if(!V)return!0;const Ae=V.toLowerCase();return xe.name.toLowerCase().includes(Ae)||xe.key.toLowerCase().includes(Ae)||xe.resolveType.toLowerCase().includes(Ae)}),be=Me.filter(xe=>{if(!V)return!0;const Ae=V.toLowerCase();return xe.title.toLowerCase().includes(Ae)||xe.key.toLowerCase().includes(Ae)||xe.resolveType.toLowerCase().includes(Ae)}),Ue=M?Me.find(xe=>xe.key===M)??null:null,Ze=$||M?null:I1(nt,H,W),ht=$?$.name:Ue?.title??Ze?.name,st=Ze?.key??null,wt=Ze?.path??null,dt=(st?X[st]:void 0)??{},Lt=Ar(H,dt),De={};if(he&&ae&&Ne&&ke){const xe=gQ(Ne,"loaders"),Ae=st?ke[st]:void 0,St=BJ(Ae,ke,Es=>xe.has(Es)),Vt=RJ(St);for(const Es of eh(H)){if(Es.type!=="param")continue;const xn=AJ(H,Es.name,St),Gs=$J(xn,xe,Vt);Gs.length>0&&(De[Es.name]=Gs)}}const rt=t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,yt=ke&&st?XL(ke,st,0):[],ut=ke?qL(yt,ke):[],at=ut.map(xe=>xe.isSavedBlock?xe.label:""),fe=ut.map(xe=>xe.isSavedBlock?"global":xe.isMultivariate?"variant":"normal"),Ve=yt.map(xe=>om(xe,ke??{})),Be=A.useRef(null),Se=A.useRef(null),ct=te.status.state==="paused",mt=te.phase,Xt=sS({claimPhase:mt,lifecycle:te.lifecycle}),Dt=le.previewState,rn=le.userStopped,ii=(me?.entity?.id===t?me.entity.metadata?.ui?.layout?.cmsDefaultOpen:null)??!1,ri=Cg(G.slug,t??"",l??""),{url:ws}=UL(ye&&t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l,previewServerUrl:ve??null,path:Lt}:null),_n=Le&&we.runtime==="sandbox",_t=hY({previewState:Dt,progressStatus:Xt.status,previewServerUrl:ve,fastPreviewActive:ye,fastPreviewReady:!!ws,codingSession:_n}),ks=_t.mode!=="none",qs=_t.mode==="production"&&_t.iframeBase?_0(_t.iframeBase):null,Ln=!s,Ts=_t.mode==="production"?qs:_0(ae),ts=Ite(_t.mode==="sandbox"?O9(k5(z??q9(Lt,_t.iframeBase)??_t.iframeBase,p),c.state.variantOverride??[]):_t.mode==="production"&&Ln?O9(k5(FL(z??ws??q9(Lt,_t.iframeBase)??_t.iframeBase,_t.showWakingPill?IY:null),p),c.state.variantOverride??[]):null);A.useEffect(()=>{},[s,qs,S]);const un="sandbox.preview.openInNewTab",In=ws??(_t.iframeBase?q9(Lt,_t.iframeBase):null),oi=_t.mode==="production"?In?O9(In,c.state.variantOverride??[]):null:ts??_t.iframeBase,Sn=async()=>{const xe=oi;if(xe){window.open(xe,"_blank","noopener");return}},hn=t&&l?Tg(G.slug,t,l):null,fn=xe=>{hn&&VJ(hn,xe)},Ot=c.state.target;A.useEffect(()=>{if(!(!Ot||!Ce||!Ne))if(Ot.kind==="page"){const xe=X[Ot.key]??{};Se.current=Ar(Ot.path,xe),B(null),O(null),U(null),Y(Ot.key),K(Ot.path),fn({path:Ot.path,pageKey:Ot.key,params:xe})}else if(Ot.kind==="loader")Se.current=null,B(null),O(Ot.key),U(null);else{const xe=ot.find(Ae=>Ae.key===Ot.key);if(xe){Se.current=null;const Ae=th(Ne);O(null),B(xe),U(U4(Ce,Ae,xe.key))}}},[Ot,Ce,Ne,X]),A.useEffect(()=>{!st||wt===null||Ot?.kind==="page"&&Ot.key===st&&Ot.path===wt||c.selectTarget({kind:"page",key:st,path:wt})},[st,wt,Ot]);const[mn,li]=A.useState(null);if(Dt.kind==="iframe"&&mn!==Dt.previewUrl){const xe=mn!==null;li(Dt.previewUrl);const Ae=hn?Eg(hn):null;if(Ae){if(Se.current=Ar(Ae.path,Ae.params),K(Ae.path),Y(Ae.pageKey),U(null),B(null),O(null),Ae.pageKey&&Object.keys(Ae.params).length>0){const St=Ae.pageKey;ne(Vt=>({...Vt,[St]:Ae.params}))}}else xe&&(Se.current=null,K("/"),U(null),Y(null),B(null),O(null))}Be.current=ts;const Mn=gY({iframeRef:L,src:_t.mode==="sandbox"?ts:null,active:_t.mode==="sandbox"}),Ee=A.useRef(null);A.useEffect(()=>{if(!ws||!ts||Ee.current===ws)return;Ee.current=ws;const xe=L.current;xe&&xe.getAttribute("src")!==ts&&(J(),xe.src=ts)},[ws,ts]);const pt=!!t&&!!l&&!te.notFound&&!rn&&!ct&&(mt?.kind==="ready"||ue!=="idle"),kt=_t.mode!=="sandbox"&&u==="visual"?"preview":u;A.useEffect(()=>{const xe=Ts;if(!xe)return;const Ae=St=>{if(St.origin===xe){if(St.data?.type==="visual-editor::element-clicked"){const Vt=WY.safeParse(St.data.payload);Vt.success&&b(Vt.data)}else if(St.data?.type==="cms-editor::section-clicked"){const Vt=YY.safeParse(St.data.payload);Vt.success&&_({index:Vt.data.sectionIndex,seq:Vt.data.clickSeq})}}};return window.addEventListener("message",Ae),()=>window.removeEventListener("message",Ae)},[Ts]),A.useEffect(()=>{if(!C)return;const xe=Ae=>{E.current?.contains(Ae.target)||(N(!1),T(""))};return document.addEventListener("pointerdown",xe),()=>document.removeEventListener("pointerdown",xe)},[C]);const us=()=>{const xe=L.current?.contentWindow,Ae=_0(ae);!xe||!Ae||xe.postMessage({type:"visual-editor::activate",script:qY},Ae)},pn=()=>{const xe=L.current?.contentWindow,Ae=_0(ae);!xe||!Ae||xe.postMessage({type:"visual-editor::deactivate"},Ae)},gn=()=>{const xe=L.current?.contentWindow,Ae=Ts;!xe||!Ae||(xe.postMessage(_t.mode==="production"?{type:"editor::inject",args:{script:W4}}:{type:"visual-editor::activate",script:W4},Ae),xe.postMessage({type:"cms-editor::set-labels",labels:at,kinds:fe,keys:Ve},Ae))},to=()=>{const xe=L.current?.contentWindow,Ae=Ts;!xe||!Ae||xe.postMessage({type:"cms-editor::deactivate"},Ae)},ai=xe=>{const Ae=u;!n&&xe!==Ae&&(xe==="blocks"?y.current?.resize("30%"):y.current?.collapse()),h(xe),b(null),_(null),xe!=="blocks"&&O(null),Ae==="visual"&&pn(),xe==="visual"&&us(),Ae==="blocks"&&xe!=="blocks"&&to(),xe==="blocks"&&gn()},Bu=xe=>{m(!0),ai(Tte(u,xe))},so=Ete({cmsDefaultOpen:ii,blocksReady:Oe,autoOpenResolved:f,editingMode:u}),no=()=>{m(!0),ai("blocks")},io=()=>{if(!L.current||!ts)return;J();const xe=L.current;xe.src=ts};KM(()=>{const xe=L.current;if(!xe)return;J();const Ae=document.activeElement,St=xe.tabIndex;xe.tabIndex=-1,xe.style.pointerEvents="none",xe.blur(),Ote(xe,Be.current);let Vt;const Es=()=>{clearTimeout(Vt),xe.tabIndex=St,xe.style.pointerEvents="";const xn=document.activeElement;(!xn||xn===document.body||xn===xe)&&Ae?.focus(),xe.removeEventListener("load",Es)};xe.addEventListener("load",Es),Vt=setTimeout(Es,3e3)});const $c=()=>{const xe=W9.indexOf(p);g(W9[(xe+1)%W9.length])},ro=async()=>{let xe=null;try{xe=L.current?.contentWindow?.location?.href??null}catch{}const Ae=xe??ts??ae;if(Ae)try{await navigator.clipboard.writeText(Ae),pe.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{pe.error(e("sandbox.preview.failedToCopyUrl"))}},oo=xY({iframeBase:_t.iframeBase,resolvedPath:Lt,activeGlobalSectionName:$?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Hi=xe=>{const Ae=X[xe.key]??{},St=Ar(xe.path,Ae);($||lt(St)!==lt(Lt))&&J(),Se.current=St,B(null),O(null),U(null),_(null),Y(xe.key),K(xe.path),fn({path:xe.path,pageKey:xe.key,params:Ae}),c.selectTarget({kind:"page",key:xe.key,path:xe.path})},Ki=(xe,Ae)=>{if(!st)return;const St=st,Vt={...dt,[xe]:Ae};Se.current=Ar(H,Vt),ne(Es=>({...Es,[St]:Vt})),fn({path:H,pageKey:St,params:Vt})},lo=xe=>{if(!Ce||!Ne){pe.error(e("sandbox.preview.previewMetadataNotReady"));return}J(),Se.current=null;const Ae=th(Ne),St=U4(Ce,Ae,xe.key);B(xe),O(null),U(St),_(null),c.selectTarget({kind:"section",key:xe.key})},ao=xe=>{B(null),O(xe.key),U(null),ai("blocks"),c.selectTarget({kind:"loader",key:xe.key})},Oc=async({name:xe,path:Ae,templateKey:St})=>{if(!t||!l)return;const Vt=D2(Ae);if(Vt){R(Vt);return}const Es=Ae.trim().startsWith("/")?Ae.trim():`/${Ae.trim()}`;if(nt.some(Gs=>lt(Gs.path)===lt(Es))){R(e("sandbox.preview.pageAlreadyExists",{path:Es}));return}let xn;if(St&&(xn=ke?.[St],!xn)){R(e("sandbox.preview.templateNoLongerExists"));return}R(void 0);try{const Gs=await it.mutateAsync({name:xe,path:Es,template:xn});D(!1),pe.success(e("sandbox.preview.pageCreated",{name:xe})),await wc(Dte),Hi({key:Gs.key,name:Gs.name,path:Gs.path}),ai("blocks")}catch(Gs){R(Gs instanceof Error?Gs.message:e("sandbox.preview.failedToCreatePage"))}},Wi=ks&&(pt||_t.mode==="production"),yr=u==="blocks",_r=JY({showPreviewToolbar:Wi,blocksState:Re}),qi=_r?r.jsx(jg,{title:e("sandbox.preview.cms"),tooltip:e(yr?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:eV},active:yr,onClick:()=>Bu("blocks"),testId:"preview-blocks-toggle",dataTour:jo.edit}):null,Lr=Wi?r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{onClick:io,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(zn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),_r&&r.jsxs("div",{ref:E,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:[$&&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(Hr,{size:11}),"Global"]}),Ue&&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(Xa,{size:11}),e("sandbox.preview.loaderBadge")]}),r.jsx("span",{className:re("text-[13px] font-medium text-foreground",ht==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ht??oo}),!$&&!M&&ht!=null&&H&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:eh(H).map((xe,Ae)=>{if(xe.type==="text")return r.jsx("span",{className:re(Ae===0?"min-w-0 truncate":"shrink-0"),children:xe.text},`text-${Ae}`);const St=De[xe.name];return St&&rt?r.jsx(tQ,{sources:St,template:H,paramName:xe.name,value:dt[xe.name]??"",sandboxRef:rt,onCommit:Vt=>Ki(xe.name,Vt)},`${st}:${xe.name}`):r.jsx(hQ,{name:xe.name,value:dt[xe.name]??"",onCommit:Vt=>Ki(xe.name,Vt)},`${st}:${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(Qt,{size:12,className:re("shrink-0 text-muted-foreground transition-transform",C&&"rotate-180")})})]}),C&&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(mf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:V,onChange:xe=>T(xe.target.value),onKeyDown:xe=>{if(xe.key!=="Enter")return;const Ae=V.trim();if(!Ae)return;const St=gt.find(Vt=>lt(Vt.path)===lt(Ae));St&&(xe.preventDefault(),N(!1),T(""),Hi(St))},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),T(""),R(void 0),D(!0)},children:[r.jsx($t,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),gt.length===0&&Xe.length===0&&be.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:nt.length===0&&ot.length===0&&Me.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[gt.length>0&&r.jsx("div",{className:"p-1.5",children:gt.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:Ae=>{Ae.preventDefault(),N(!1),T(""),Hi(xe)},children:[r.jsx(Or,{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))}),Xe.length>0&&r.jsxs("div",{className:re("p-1.5",gt.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")}),Xe.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:Ae=>{Ae.preventDefault(),N(!1),T(""),lo(xe)},children:[r.jsx(Hr,{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))]}),be.length>0&&r.jsxs("div",{className:re("p-1.5",(gt.length>0||Xe.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")}),be.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:Ae=>{Ae.preventDefault(),N(!1),T(""),ao(xe)},children:[r.jsx(Xa,{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(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{"aria-label":e(un),onClick:()=>{Sn()},children:r.jsx(yn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e(un)})]})]}):null,co=Wi?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[qi,qi&&r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Lr]}):null,Gi=Wi?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(ei,{size:14})})}),r.jsxs(Ht,{align:"end",className:"w-44",children:[r.jsxs(Qe,{onClick:ro,children:[r.jsx(an,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),ke&&Ne&&r.jsxs(r.Fragment,{children:[r.jsx(dr,{}),st&&r.jsxs(Qe,{onClick:()=>{c.editSeo({kind:"page",key:st,path:H}),ai("blocks")},children:[r.jsx(Np,{size:14}),e("sandbox.preview.editSeo")]}),st&&r.jsxs(Qe,{onClick:()=>{try{d(bN(YI(st)))}catch{pe.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx(zo,{size:14}),e("sandbox.preview.viewJson")]})]}),Q&&r.jsxs(r.Fragment,{children:[r.jsx(dr,{}),r.jsxs(Qe,{onClick:()=>window.open(Sh("vscode",Q)),children:[r.jsx("img",{src:Ate,alt:"VSCode",width:14,height:14}),e("sandbox.preview.openInVscode")]}),r.jsxs(Qe,{onClick:()=>window.open(Sh("cursor",Q)),children:[r.jsx("img",{src:Pte,alt:"Cursor",width:14,height:14}),e("sandbox.preview.openInCursor")]})]}),r.jsx(dr,{}),r.jsxs(Qe,{onClick:()=>cY(e),children:[r.jsx(tV,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Bc=_t.mode==="sandbox",Li=Rte[p],Si=p==="desktop"&&(k.width===0||k.width>=Li.width+2*S5),Sr=Si?1:Math.min(k.width>0?k.width/(Li.width+2*S5):1,1),uo=Si?{width:"100%",height:"100%"}:{width:`${Li.width}px`,height:k.height>0?`${k.height/Sr}px`:`${Li.height}px`,transform:`scale(${Sr})`,transformOrigin:"top center"},wr=ks?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:[Bc&&r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{onClick:()=>Bu("visual"),"aria-pressed":u==="visual","aria-label":e("sandbox.preview.visualEditor"),active:u==="visual",className:"rounded-full","data-tour":jo.visualEditor,children:r.jsx(N3,{size:16})})}),r.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{onClick:$c,"aria-label":e(w5[p]),className:"rounded-full","data-tour":jo.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&r.jsx(sV,{size:16}),p==="tablet"&&r.jsx(nV,{size:16}),p==="desktop"&&r.jsx(iV,{size:16})]},p)})}),r.jsx(Ke,{side:"top",children:e(w5[p])})]})]})}):null,ho=(n||!!M)&&kt==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[so&&r.jsx($te,{onOpen:no}),rt&&Object.entries(De).map(([xe,Ae])=>(dt[xe]??"")===""?r.jsx(dQ,{sources:Ae,template:H,paramName:xe,sandboxRef:rt,onFill:St=>Ki(xe,St)},`${st}:${xe}`):null),i?r.jsxs(r.Fragment,{children:[Wi&&r.jsx(LY,{children:co}),r.jsx(SY,{children:Gi})]}):(Wi||Gi)&&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:qi}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Lr}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:Gi})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:ho?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(L5,{virtualMcpId:t,externalSelection:v}),n&&wr]}):r.jsxs(b8,{orientation:"horizontal",disabled:kt!=="blocks",children:[r.jsx(Z0,{ref:y,id:"preview-blocks-editor",defaultSize:kt==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:kt==="blocks"&&r.jsx(L5,{virtualMcpId:t,externalSelection:v})}),kt==="blocks"&&r.jsx(v8,{withHandle:!0}),r.jsx(Z0,{id:"preview-canvas",defaultSize:kt==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:xe=>{if(!xe)return;const Ae=()=>w(Vt=>Vt.width===xe.clientWidth&&Vt.height===xe.clientHeight?Vt:{width:xe.clientWidth,height:xe.clientHeight});Ae();const St=new ResizeObserver(Ae);return St.observe(xe),()=>St.disconnect()},className:re("h-full relative overflow-hidden flex justify-center",ks&&!Si&&"bg-muted/30"),children:[(se||ri)&&ks&&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"})}),_t.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Wa,{kind:"starting",progress:Xt,claimPhase:mt})}),Dt.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Wa,{kind:"suspended",onResume:le.resume})}),Dt.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Wa,{kind:"errored",error:Dt.error,onRetry:le.retry,connectionsHref:`/${G.slug}/settings/connections`})}),_t.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(ft,{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")})]})]}),kt==="visual"&&!x&&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(N3,{size:12}),e("sandbox.preview.clickElementToAsk")]}),kt==="visual"&&x&&r.jsx(fJ,{element:x,onDismiss:()=>b(null)}),wr,ks&&ts&&r.jsx("div",{className:re("shrink-0",!Si&&"border-x border-border bg-background shadow-sm"),style:uo,children:r.jsx("iframe",{ref:L,src:ts,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Mn.handleError,onLoad:()=>{if(Mn.handleLoad(),q(),_t.mode!=="sandbox"){_t.mode==="production"&&!_t.showWakingPill&&u==="blocks"&&gn();return}if(Je("vm_preview_loaded",{view_mode:u,vm_id:ee?.sandboxHandle??null}),!$)try{const xe=L.current?.contentWindow?.location?.pathname;if(!xe)return;const Ae=Se.current;if(Ae!==null&&(Se.current=null,lt(xe)!==lt(Ae))||lt(xe)===lt(Lt))return;K(xe),fn({path:xe,pageKey:W,params:dt})}catch{}u==="visual"&&us(),u==="blocks"&&gn()}},_t.iframeBase)})]})})]})}),r.jsx(KY,{open:P,onOpenChange:D,isPending:it.isPending,error:I,templates:nt,onSubmit:Oc})]})}function zte(t){const e=F.c(22),{virtualMcpId:s}=t,n=ie(),i=Ws(s),{activeTask:o,taskId:l,currentBranch:a}=sn(),c=a7(l),[d,u]=A.useState(!1);if(c7({threadId:l,sandboxBranch:o?.branch??a,agentHasRepo:en(i?.metadata),threadHasRepo:en(c)||en(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(Vn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>u(!0),b=r.jsx(Vn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let _;e[9]!==v?(_=r.jsxs(de,{onClick:x,children:[b,v]}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==_?(L=r.jsx(To,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=L):L=e[14];let y;e[15]!==d?(y=r.jsx(t2,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let k;return e[17]!==L||e[18]!==y?(k=r.jsxs(r.Fragment,{children:[L,y]}),e[17]=L,e[18]=y,e[19]=k):k=e[19],k}let f;return e[20]!==s?(f=r.jsx(Bte,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const Fte="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",Ute="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",Hte=A.lazy(()=>Tn(()=>import("./file-explorer-ws1ucCZl.js"),__vite__mapDeps([152,1,2,23,24,25,26,27,28,29,30,31,32,33,34,6,22,35,36,37,38,39,7,40,8,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,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,110,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.FileExplorer})));function Kte(t){const e=F.c(23),{openPath:s}=t,n=ie(),i=eo(),{org:o}=qe(),{currentBranch:l,taskId:a}=sn(),c=i?.entity?.id??null,d=Pl(),u=ni(),h=d.vmEntry,f=u.lifecycle.phase==="running",m=h?.sandboxProviderKind==="user-desktop",p=c??"",g=l??"",x=a??null,b=m&&f&&!!c&&!!l;let v;e[0]!==o.slug||e[1]!==p||e[2]!==g||e[3]!==x||e[4]!==b?(v={orgSlug:o.slug,virtualMcpId:p,branch:g,threadId:x,enabled:b},e[0]=o.slug,e[1]=p,e[2]=g,e[3]=x,e[4]=b,e[5]=v):v=e[5];const _=mS(v),L=m?_:null;if(!c||!l){let C;e[6]!==n?(C=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=C):C=e[7];let N;return e[8]!==C?(N=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:C}),e[8]=C,e[9]=N):N=e[9],N}let y;e[10]!==L||e[11]!==n?(y=L&&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(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInVscode"),onClick:()=>window.open(Sh("vscode",L)),children:r.jsx("img",{src:Fte,alt:"VSCode",width:14,height:14})})}),r.jsx(Ke,{side:"bottom",children:n("mainPanelTabs.codeTab.openInVscode")})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInCursor"),onClick:()=>window.open(Sh("cursor",L)),children:r.jsx("img",{src:Ute,alt:"Cursor",width:14,height:14})})}),r.jsx(Ke,{side:"bottom",children:n("mainPanelTabs.codeTab.openInCursor")})]})]})}),e[10]=L,e[11]=n,e[12]=y):y=e[12];let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=k):k=e[13];const w=a??null;let S;e[14]!==l||e[15]!==s||e[16]!==o.slug||e[17]!==w||e[18]!==c?(S=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(A.Suspense,{fallback:k,children:r.jsx(Hte,{orgSlug:o.slug,virtualMcpId:c,branch:l,threadId:w,openPath:s})})}),e[14]=l,e[15]=s,e[16]=o.slug,e[17]=w,e[18]=c,e[19]=S):S=e[19];let j;return e[20]!==y||e[21]!==S?(j=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[y,S]}),e[20]=y,e[21]=S,e[22]=j):j=e[22],j}function Wte(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 qte(t,e,s){return typeof t!="string"?null:Wte(Un(t,e),s)}function hw(t,e,s){if(!e||typeof t!="string")return!1;const n=qte(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Gte({orgSlug:t,virtualMcpId:e,branch:s}){const n=bs(),i=Ls()?.taskId??null,o=ku(e),l=En(e).runtime==="cms";return Rs({mutationKey:S2(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await V8({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return k2(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:Pu({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=wu(o,j2(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():w2(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=et.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:et.liveMeta(t,e,s)})}})}function ja(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 Qf(t,e){return`${t}-${e}`}function fw(t,e){return`site/apps/${t}/${e}.ts`}function mw(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 Yte(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Jte(t){return t==="local"?"Custom":"Installed"}function pw(t,e,s){const n=new Set([Qf(t,e),e].map(o=>o.toLowerCase())),i=fw(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 Qte(t,e){const s=t.vendor.alias,n=t.name,i=pw(s,n,e);return{id:Qf(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:fw(s,n),blockKey:i,installed:i!==null}}function Xte(t,e,s){if(t===I2)return null;const n=mw(t);if(!n)return null;const{vendor:i,app:o}=n,l=pw(i,o,s),a=Fo(t,e);return{id:Qf(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 Zte(t,e,s){const n=e.__resolveType;if(typeof n!="string"||uc(t,e)||!z8(n))return null;const i=mw(n)??Yte(t);if(!i)return null;const o=Fo(n,s),{vendor:l,app:a}=i;return{id:Qf(l,a),app:a,vendor:l,title:o.title??rh(t,e,s),description:o.description??"",category:Jte(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function ese(t,e,s){const n=new Map;for(const o of t){const l=Qte(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=Xte(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=Zte(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(tse)}function tse(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function sse(){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 nse(t,e,s){const n=F.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=et.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:sse,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Et(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?ese(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function ise(t){const e=F.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=t,l=ie();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 u=s==="pages";let h;e[6]!==n.pages||e[7]!==o||e[8]!==d||e[9]!==u?(h=r.jsx(Wn,{id:"pages",icon:Or,label:d,count:n.pages,active:u,onSelect:o}),e[6]=n.pages,e[7]=o,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(Wn,{id:"sections",icon:Hr,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(Wn,{id:"apps",icon:r6,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 _=s==="redirects";let L;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==_?(L=r.jsx(Wn,{id:"redirects",icon:wy,label:v,count:n.redirects,active:_,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=_,e[31]=L):L=e[31];let y;e[32]!==l?(y=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=y):y=e[33];const k=s==="loaders";let w;e[34]!==n.loaders||e[35]!==o||e[36]!==y||e[37]!==k?(w=r.jsx(Wn,{id:"loaders",icon:Xa,label:y,count:n.loaders,active:k,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=y,e[37]=k,e[38]=w):w=e[38];let S;e[39]!==l?(S=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=S):S=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==o||e[43]!==S||e[44]!==j?(C=r.jsx(Wn,{id:"actions",icon:qr,label:S,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=S,e[44]=j,e[45]=C):C=e[45];let N;e[46]!==l?(N=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=N):N=e[47];const V=s==="site";let T;e[48]!==o||e[49]!==N||e[50]!==V?(T=r.jsx(Wn,{id:"site",icon:Lp,label:N,active:V,onSelect:o}),e[48]=o,e[49]=N,e[50]=V,e[51]=T):T=e[51];let E;e[52]!==l?(E=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=E):E=e[53];const P=s==="seo";let D;e[54]!==o||e[55]!==E||e[56]!==P?(D=r.jsx(Wn,{id:"seo",icon:Np,label:E,active:P,onSelect:o}),e[54]=o,e[55]=E,e[56]=P,e[57]=D):D=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const R=s==="calendar";let $;e[60]!==o||e[61]!==I||e[62]!==R?($=r.jsx(Wn,{id:"calendar",icon:$r,label:I,active:R,onSelect:o}),e[60]=o,e[61]=I,e[62]=R,e[63]=$):$=e[63];let B;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(B=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(Qa,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(Wn,{id:"posts",icon:Ti,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(Wn,{id:"authors",icon:s2,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(Wn,{id:"categories",icon:ef,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o}),r.jsx(Wn,{id:"post-schedule",icon:vV,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",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]=B):B=e[71];let M;e[72]!==b||e[73]!==L||e[74]!==w||e[75]!==C||e[76]!==T||e[77]!==D||e[78]!==$||e[79]!==B||e[80]!==h||e[81]!==p?(M=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,L,w,C,T,D,$,B]}),e[72]=b,e[73]=L,e[74]=w,e[75]=C,e[76]=T,e[77]=D,e[78]=$,e[79]=B,e[80]=h,e[81]=p,e[82]=M):M=e[82];let O;return e[83]!==c||e[84]!==M?(O=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=O):O=e[85],O}function Wn(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 u;e[3]!==d?(u=re("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=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:re("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]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function rse(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=sS({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(Wa,{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(Wa,{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(Wa,{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 ose=new Set(["clone-failed","install-failed","start-failed","crashed"]);function lse(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&&!ose.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function j5(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 ase(t,e){const s=ko,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 cse(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 dse(t){const e=Ng(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function use(t,e){return HL(t,e)}const hse=1e3;function fse(t,e){for(let s=0;s<hse;s++){const n=Ng(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const mse={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},pse={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},gse={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function xse(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=ie(),[p,g]=A.useState(i),[x,b]=A.useState(o),[v,_]=A.useState(Co),[L,y]=A.useState(null),[k,w]=A.useState(s);s!==k&&(w(s),s&&(g(i),b(o),_(Co),y(null)));const S=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=ue=>{!ue&&!f&&(y(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const C=j;let N;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==S||e[8]!==v||e[9]!==d?(N=async ue=>{ue.preventDefault();const he=p.trim(),ce=x.trim();if(!he||!ce||f)return;const ge=D2(ce);if(ge){y(ge);return}const Q=d?.({name:he,path:ce});if(Q){y(Q);return}y(null),await u({name:he,path:ce,templateKey:S&&v!==Co?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=S,e[8]=v,e[9]=d,e[10]=N):N=e[10];const V=N,T=L??a,E=mse[n];let P;e[11]!==m||e[12]!==E?(P=m(E),e[11]=m,e[12]=E,e[13]=P):P=e[13];let D;e[14]!==P?(D=r.jsx(xs,{children:r.jsx(Wt,{children:P})}),e[14]=P,e[15]=D):D=e[15];let I;e[16]!==f||e[17]!==S||e[18]!==m||e[19]!==v||e[20]!==c?(I=S&&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(WL,{id:"page-form-template",value:v,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=S,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let R;e[22]!==m?(R=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=R):R=e[23];let $;e[24]!==R?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:R}),e[24]=R,e[25]=$):$=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=ue=>g(ue.target.value),e[26]=B):B=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let O;e[29]!==f||e[30]!==p||e[31]!==M?(O=r.jsx(bt,{id:"page-form-name",value:p,onChange:B,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=O):O=e[32];let z;e[33]!==O||e[34]!==$?(z=r.jsxs("div",{className:"space-y-1.5",children:[$,O]}),e[33]=O,e[34]=$,e[35]=z):z=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=ue=>b(ue.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(bt,{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 X;e[47]!==H||e[48]!==Y?(X=r.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[47]=H,e[48]=Y,e[49]=X):X=e[49];let ne;e[50]!==T?(ne=T&&r.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=ne):ne=e[51];let se;e[52]!==z||e[53]!==X||e[54]!==ne||e[55]!==I?(se=r.jsxs("div",{className:"space-y-4 py-4",children:[I,z,X,ne]}),e[52]=z,e[53]=X,e[54]=ne,e[55]=I,e[56]=se):se=e[56];let oe;e[57]!==h?(oe=()=>h(!1),e[57]=h,e[58]=oe):oe=e[58];let Z;e[59]!==m?(Z=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=Z):Z=e[60];let J;e[61]!==f||e[62]!==oe||e[63]!==Z?(J=r.jsx(de,{type:"button",variant:"outline",onClick:oe,disabled:f,children:Z}),e[61]=f,e[62]=oe,e[63]=Z,e[64]=J):J=e[64];let q;e[65]!==f||e[66]!==p||e[67]!==x?(q=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=q):q=e[68];let G;e[69]!==f||e[70]!==n||e[71]!==m?(G=f?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),m(gse[n])]}):m(pse[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=G):G=e[72];let te;e[73]!==q||e[74]!==G?(te=r.jsx(de,{type:"submit",disabled:q,children:G}),e[73]=q,e[74]=G,e[75]=te):te=e[75];let le;e[76]!==J||e[77]!==te?(le=r.jsxs(Zn,{children:[J,te]}),e[76]=J,e[77]=te,e[78]=le):le=e[78];let ee;e[79]!==V||e[80]!==se||e[81]!==le||e[82]!==D?(ee=r.jsx(It,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:V,children:[D,se,le]})}),e[79]=V,e[80]=se,e[81]=le,e[82]=D,e[83]=ee):ee=e[83];let ae;return e[84]!==C||e[85]!==s||e[86]!==ee?(ae=r.jsx(Mt,{open:s,onOpenChange:C,children:ee}),e[84]=C,e[85]=s,e[86]=ee,e[87]=ae):ae=e[87],ae}function bse(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=ie(),[u,h]=A.useState(i),[f,m]=A.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=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]!==u||e[5]!==l?(x=async K=>{K.preventDefault();const W=u.trim();!W||c||await l(W)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let _;e[9]!==v?(_=r.jsx(Wt,{children:v}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let y;e[13]!==L?(y=r.jsx(Fn,{children:L}),e[13]=L,e[14]=y):y=e[14];let k;e[15]!==_||e[16]!==y?(k=r.jsxs(xs,{children:[_,y]}),e[15]=_,e[16]=y,e[17]=k):k=e[17];let w;e[18]!==d?(w=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=w):w=e[19];let S;e[20]!==w?(S=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:w}),e[20]=w,e[21]=S):S=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=K=>h(K.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==u?(C=r.jsx(bt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=C):C=e[25];let N;e[26]!==S||e[27]!==C?(N=r.jsxs("div",{className:"space-y-1.5",children:[S,C]}),e[26]=S,e[27]=C,e[28]=N):N=e[28];let V;e[29]!==d?(V=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=V):V=e[30];let T;e[31]!==V?(T=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:V}),e[31]=V,e[32]=T):T=e[32];let E;e[33]!==n?(E=r.jsx(bt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=E):E=e[34];let P;e[35]!==T||e[36]!==E?(P=r.jsxs("div",{className:"space-y-1.5",children:[T,E]}),e[35]=T,e[36]=E,e[37]=P):P=e[37];let D;e[38]!==N||e[39]!==P?(D=r.jsxs("div",{className:"space-y-4 py-4",children:[N,P]}),e[38]=N,e[39]=P,e[40]=D):D=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,e[42]=I):I=e[42];let R;e[43]!==d?(R=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=R):R=e[44];let $;e[45]!==c||e[46]!==I||e[47]!==R?($=r.jsx(de,{type:"button",variant:"outline",onClick:I,disabled:c,children:R}),e[45]=c,e[46]=I,e[47]=R,e[48]=$):$=e[48];let B;e[49]!==c||e[50]!==u?(B=!u.trim()||c,e[49]=c,e[50]=u,e[51]=B):B=e[51];let M;e[52]!==c||e[53]!==d?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let O;e[55]!==B||e[56]!==M?(O=r.jsx(de,{type:"submit",disabled:B,children:M}),e[55]=B,e[56]=M,e[57]=O):O=e[57];let z;e[58]!==$||e[59]!==O?(z=r.jsxs(Zn,{children:[$,O]}),e[58]=$,e[59]=O,e[60]=z):z=e[60];let U;e[61]!==b||e[62]!==D||e[63]!==z||e[64]!==k?(U=r.jsx(It,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[k,D,z]})}),e[61]=b,e[62]=D,e[63]=z,e[64]=k,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=r.jsx(Mt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function vse(t){const e=F.c(7),{type:s}=t,n=CM[s];let i;e[0]!==n?(i=r.jsx(He,{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(Ke,{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(We,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const G9={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Yg=["posts","authors","categories"],Pd={posts:"post",authors:"author",categories:"category"};function Dd(t){return Yg.includes(t)}const Jg={posts:"post",authors:"author",categories:"category"},gw={posts:G9.post,authors:G9.author,categories:G9.category},yse=Object.fromEntries(Object.entries(gw).map(([t,e])=>[e,t]));function _se(t){return typeof t=="string"?yse[t]??null:null}function Do(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function cs(t){return typeof t=="string"?t:""}function Lse(t,e){switch(t){case"posts":return{label:cs(e.title)||"Untitled post",subtitle:cs(e.slug)};case"authors":return{label:cs(e.name)||"Unnamed author",subtitle:cs(e.email)};case"categories":return{label:cs(e.name)||"Unnamed category",subtitle:cs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function xw(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Do(n);if(!i)continue;const o=_se(i.__resolveType);if(!o)continue;const l=Do(i[Jg[o]])??{},{label:a,subtitle:c}=Lse(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of Yg)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function Sse(t,e){return xw(t)[e]}function su(t,e){return Sse(t,e).map(s=>({key:s.key,payload:md(Do(t[s.key])??void 0,e)}))}const C5=Object.freeze({});function md(t,e){return t?Do(t[Jg[e]])??C5:C5}function Ca(t,e,s){return{name:t,__resolveType:gw[e],[Jg[e]]:s}}function h9e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:cs(Do(f)?.[s]),l=f=>typeof f=="string"?f:cs(Do(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>cs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>cs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:cs(m.name)||cs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||o(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function wl(t){return Array.isArray(t)?t:[]}function Fr(t){if(typeof t=="string")return t;const e=Do(t);return e?cs(e.slug):""}function wse(t){if(typeof t=="string")return t;const e=Do(t);return e?cs(e.email):""}function bw(t){const e=[];return cs(t.title).trim()||e.push("Title"),cs(t.slug).trim()||e.push("Slug"),wl(t.categories).map(Fr).filter(Boolean).length===0&&e.push("Category"),cs(t.excerpt).trim()||e.push("Excerpt"),cs(t.image).trim()||e.push("Cover image"),e}const vw=8;function yw(t){const e=cs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function f9e(t,e){return e!=="published"||yw(t)==="published"?!1:bw(t).length>0}function kse(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,vw).toISOString()}function m9e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=cs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?kse(s):n}}function _w(t){return su(t,"posts").map(({key:e,payload:s})=>({key:e,title:cs(s.title)||"Untitled post",slug:cs(s.slug),date:cs(s.date),scheduledDatetime:cs(s.scheduledDatetime),categorySlugs:wl(s.categories).map(Fr).filter(Boolean),authorEmails:wl(s.authors).map(wse).filter(Boolean),missing:bw(s),status:yw(s)}))}function jse(t,e){const s=wl(t.categories);return s.some(n=>Fr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Cse(t,e){const s=wl(t.categories);return s.length===1&&Fr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function p9e(t,e,s){const n=wl(t.categories);if(!n.some(a=>Fr(a)===e))return t;const i=n.map(a=>{const c=Fr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=Fr(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function Nse(t,e){const s=wl(t.categories);return s.some(n=>Fr(n)===e)?{...t,categories:s.filter(n=>Fr(n)!==e)}:t}function N5(t){return{...t,dateModified:new Date().toISOString()}}function hm(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 Y9(t,e){const s=`collections/blog/${e}/${hm(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Lw(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${hm(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-${hm(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Vse={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"}},V5="Box";function Tse(t){return t.startsWith("site/")?"site":"app"}function Ese(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Qc(...t){for(const e of t)if(e!==void 0)return e}function g9e(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(!Dse(o)||e.has(o))continue;e.add(o);const l=Fo(o,t),a=Ase(o),c=Vse[a],d=Tse(o),u=(d==="site"?Qc(l.title,c?.title):Qc(c?.title,l.title))??a,h=d==="site"?Qc(l.description,c?.description):Qc(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Ese(f)?f:void 0,p=m!==void 0?c?.iconName??V5:Qc(f,c?.iconName)??V5;s.push({resolveType:o,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function Ase(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Pse=["blog/sections/blocks/","site/sections/Blog/Post/"];function Dse(t){return Pse.some(e=>t.startsWith(e))}const x9e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],b9e=["January","February","March","April","May","June","July","August","September","October","November","December"],Sw=1440*60*1e3;function ll(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function v9e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function y9e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Eh(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function fm(t,e){return Math.round((ll(t).getTime()-ll(e).getTime())/Sw)}function Rse(t){const e=(t.getTime()-ll(t).getTime())/Sw;return Math.min(Math.max(e,0),1)}function T5(t,e){return fm(t,e)+Rse(t)}function _9e(t){const e=Eh(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let o=0;o<7;o++)i.push(Eh(e,n*7+o));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function L9e(t,e){const s=ll(t[0]),n=Eh(s,7),i=s.getTime(),o=n.getTime(),l=[];for(const d of e){const u=ll(d.start),h=ll(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?Eh(n,-1):h,p=fm(f,s),g=fm(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),o),v=T5(new Date(x),s),_=Math.max(T5(new Date(b),s)-v,0);_<=0||l.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:_})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function Ah(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const ww=/^(\d{4})-(\d{2})-(\d{2})$/;function Ph(t){const e=t.trim();if(!e)return null;const s=ww.exec(e);if(s){const i=Number(s[1]),o=Number(s[2])-1,l=Number(s[3]),a=new Date(i,o,l);return a.getMonth()===o&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:ll(n)}function Ise(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),vw);return{...Lw("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Ah(t)}}function Mse(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(ww.test(e))return Ph(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function $se(t,e){const s=Mse(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Ah(s)&&(i.date=Ah(n)),i}function Ose(t){return Ph(t.scheduledDatetime)??Ph(t.date)}function S9e(t){const e=new Map,s=[];for(const i of t){const o={post:i,scheduled:Ph(i.scheduledDatetime)!==null},l=Ose(i);if(!l){s.push(o);continue}const a=Ah(l),c=e.get(a);c?c.push(o):e.set(a,[o])}const n=(i,o)=>Number(o.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(o.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const Bse="0.161.0",zse="0.162.0",w9e="deno task update";function E5(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function A5(t,e){const s=E5(t),n=E5(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const o=s[i]-n[i];if(o!==0)return o}return 0}const kw=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Fse(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=kw.exec(s)?.[1];if(n)return n}return null}function Use(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=kw.exec(n)?.[1];if(i)return i}return null}function Hse(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Fse(t.denoJson)??Use(t.meta);return!e||A5(e,Bse)<0?{kind:"outdated",version:e}:A5(e,zse)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function k9e(t){return t.kind==="publish-only"||t.kind==="full"}function j9e(t){return t.kind==="full"}function Kse(t){const e=F.c(16),s=Ws(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=ku(t.virtualMcpId),i=Ls()?.taskId??null;let o;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(o=et.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=o):o=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await C2({...t,threadId:i},wu(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==o||e[9]!==l||e[10]!==a?(c={queryKey:o,queryFn:l,enabled:a,staleTime:3e5},e[8]=o,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Et(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=Hse({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Wse({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=ie(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=A.useState(!1),[h,f]=A.useState(c),[m,p]=A.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async _=>{if(!i||m)return;let L;try{L=JSON.parse(_)}catch{pe.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(L),pe.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){pe.error(o("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{p(!1)}};return r.jsx(Mt,{open:t,onOpenChange:e,children:r.jsxs(It,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(xs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx(Wt,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(de,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(vi,{size:12}):r.jsx(an,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(de,{size:"sm",onClick:()=>v(h),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(yu,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{v(_)}})})]})})}function ki(t){const e=F.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let _;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(_=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(Ke,{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:re("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:re("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:T2}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=_):_=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]!==y?(k=re("group relative flex min-w-0 items-center rounded-md transition-colors",y),e[6]=y,e[7]=k):k=e[7];let w;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(w=u&&r.jsx("span",{className:re("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:qse,children:r.jsx(Sc,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=w):w=e[13];const S=m&&!l&&"text-destructive";let j;e[14]!==S?(j=re("block truncate text-sm font-medium",S),e[14]=S,e[15]=j):j=e[15];let C;e[16]!==j||e[17]!==i?(C=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=C):C=e[18];const N=l?"text-accent-foreground/70":"text-muted-foreground";let V;e[19]!==N?(V=re("block truncate text-xs",N),e[19]=N,e[20]=V):V=e[20];let T;e[21]!==o||e[22]!==V?(T=r.jsx("span",{className:V,children:o}),e[21]=o,e[22]=V,e[23]=T):T=e[23];let E;e[24]!==T||e[25]!==C?(E=r.jsxs("span",{className:"min-w-0 flex-1",children:[C,T]}),e[24]=T,e[25]=C,e[26]=E):E=e[26];let P;e[27]!==l||e[28]!==m||e[29]!==p?(P=m&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx("span",{className:re("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(cn,{size:14})})}),p&&r.jsx(Ke,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=P):P=e[30];let D;e[31]!==x||e[32]!==L||e[33]!==E||e[34]!==P||e[35]!==d?(D=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,E,P,d]}),e[31]=x,e[32]=L,e[33]=E,e[34]=P,e[35]=d,e[36]=D):D=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&r.jsx("div",{className:re("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let R;return e[40]!==D||e[41]!==I||e[42]!==k||e[43]!==w?(R=r.jsxs("div",{className:k,children:[w,D,I]}),e[40]=D,e[41]=I,e[42]=k,e[43]=w,e[44]=R):R=e[44],R}function qse(t){return t.stopPropagation()}function _o(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 Gse={loaders:Xa,actions:qr},Yse={loaders:"Loaders",actions:"Actions"},Jse={analytics:lT,blog:Qa,commerce:Zp,site:rV,website:Hn};function Qse(t,e){return e===0?Jse[t.toLowerCase()]??Kr:Kr}function L0(t,e){return e===0?vQ(t):t}function Xse(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c}=t,d=ie();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u),[m,p]=A.useState(null),[g,x]=A.useState(""),[b,v]=A.useState(one),[_,L]=A.useState(c);_!==c&&(L(c),f([]),p(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{v(H=>{const K=new Set(H);return K.has(U)?K.delete(U):K.add(U),K})},e[1]=y):y=e[1];const k=y;let w;e[2]!==i||e[3]!==s||e[4]!==n?(w={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=w):w=e[5];const S=Du(w);let j;e[6]!==S?(j=Dg((U,H)=>S.mutate({blockKey:U,data:H})),e[6]=S,e[7]=j):j=e[7];const C=j;let N;e[8]!==c?(N=cS(c),e[8]=c,e[9]=N):N=e[9];const V=N,T=Gse[c];let E,P,D,I,R,$,B;if(e[10]!==T||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==o||e[19]!==S||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==V||e[24]!==d||e[25]!==n){D=Symbol.for("react.early_return_sentinel");e:{const U=[...hS(l,a,c).map(rne),...dS(l,c).map(ine)],H=g.trim().toLowerCase(),K=H.length>0,W=K?U.filter(_e=>_e.title.toLowerCase().includes(H)||_e.resolveType.toLowerCase().includes(H)):[],Y=new Map,X=[],ne=new Map;if(!K){for(const _e of U){const Pe=_e.folderPath;if(!(Pe.length<h.length)&&h.every((ke,Ne)=>Pe[Ne]===ke))if(Pe.length===h.length)if(_e.savedKey!==void 0){const ke=ne.get(_e.resolveType);ke?ke.push(_e):ne.set(_e.resolveType,[_e])}else X.push(_e);else{const ke=Pe[h.length],Ne=Y.get(ke)??{count:0,savedCount:0};_e.savedKey!==void 0?Ne.savedCount=Ne.savedCount+1:Ne.count=Ne.count+1,Y.set(ke,Ne)}}X.sort(nne);for(const _e of ne.values())_e.sort(sne)}const se=[...ne.entries()].filter(_e=>{const[Pe]=_e;return!X.some(ke=>ke.resolveType===Pe)}).flatMap(tne).sort(ene);let oe;e[33]!==h?(oe=(_e,Pe)=>L0(_e.name,h.length).localeCompare(L0(Pe.name,h.length)),e[33]=h,e[34]=oe):oe=e[34];const Z=[...Y.entries()].map(Zse).sort(oe);let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=_e=>{p(_e.savedKey!==void 0?{mode:"saved",key:_e.savedKey}:{mode:"available",resolveType:_e.resolveType,title:_e.title})},e[35]=J):J=e[35];const q=J;let G;e[36]!==S||e[37]!==V||e[38]!==d?(G=async(_e,Pe)=>{await S.mutateAsync({blockKey:_e,data:Pe}),pe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:V,blockId:_e})),p({mode:"saved",key:_e})},e[36]=S,e[37]=V,e[38]=d,e[39]=G):G=e[39];const te=G;let le;e[40]!==a||e[41]!==m?(le=lne(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ee=le;if(ee){const _e=`${ee.mode}:${ee.mode==="saved"?ee.blockKey:ee.resolveType}`;let Pe;e[43]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>p(null),e[43]=Pe):Pe=e[43];let ke;e[44]!==i||e[45]!==a||e[46]!==te||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==S.isPending||e[52]!==C||e[53]!==_e||e[54]!==ee.editorTarget||e[55]!==ee.initialValue||e[56]!==n?(ke=r.jsx(uw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:ee.editorTarget,initialValue:ee.initialValue,isCreating:S.isPending,onCreate:te,onSaveReferencedBlock:C,onBack:Pe},_e),e[44]=i,e[45]=a,e[46]=te,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=S.isPending,e[52]=C,e[53]=_e,e[54]=ee.editorTarget,e[55]=ee.initialValue,e[56]=n,e[57]=ke):ke=e[57],D=ke;break e}B="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 ue;e[60]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>f([]),e[60]=ue):ue=e[60];const he=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ce;e[61]!==he?(ce=re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",he),e[61]=he,e[62]=ce):ce=e[62];const ge=Yse[c];let Q;e[63]!==ce||e[64]!==ge?(Q=r.jsx("button",{type:"button",onClick:ue,className:ce,children:ge}),e[63]=ce,e[64]=ge,e[65]=Q):Q=e[65];let me;e[66]!==h?(me=h.map((_e,Pe)=>{const ke=Pe===h.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Pe+1)),className:re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ke?"font-medium text-foreground":"text-muted-foreground"),children:L0(_e,Pe)})]},`${_e}-${Pe}`)}),e[66]=h,e[67]=me):me=e[67];let ve;e[68]!==ae||e[69]!==Q||e[70]!==me?(ve=r.jsxs("nav",{"aria-label":ae,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Q,me]}),e[68]=ae,e[69]=Q,e[70]=me,e[71]=ve):ve=e[71];let we;e[72]===Symbol.for("react.memo_cache_sentinel")?(we=r.jsx(mf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=we):we=e[72];let ye;e[73]===Symbol.for("react.memo_cache_sentinel")?(ye=_e=>x(_e.target.value),e[73]=ye):ye=e[73];let Le;e[74]!==c||e[75]!==d?(Le=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Le):Le=e[76];let Ce;e[77]!==c||e[78]!==d?(Ce=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ce):Ce=e[79];let Te;e[80]!==g||e[81]!==Le||e[82]!==Ce?(Te=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[we,r.jsx("input",{type:"text",value:g,onChange:ye,placeholder:Le,"aria-label":Ce,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Le,e[82]=Ce,e[83]=Te):Te=e[83],e[84]!==ve||e[85]!==Te?(P=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ve,Te]}),e[84]=ve,e[85]=Te,e[86]=P):P=e[86],E=$o,$="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",R=K?W.length===0?r.jsx(_o,{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(_e=>r.jsx(ki,{icon:T,accent:_e.savedKey!==void 0?"global":void 0,title:_e.title,subtitle:_e.resolveType,active:!1,onClick:()=>q(_e)},_e.savedKey??_e.resolveType))}):Z.length===0&&X.length===0&&se.length===0?r.jsx(_o,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[Z.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:Z.map(_e=>{const Pe=Qse(_e.name,h.length);return r.jsxs("button",{type:"button",onClick:()=>f([...h,_e.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(Pe,{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:L0(_e.name,h.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[_e.count," ",_e.count===1?V:c,_e.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:_e.savedCount})]})]})]})]},_e.name)})}),(X.length>0||se.length>0)&&r.jsxs("div",{className:re("flex flex-col gap-1",Z.length>0&&"mt-4"),children:[X.map(_e=>{const Pe=ne.get(_e.resolveType)??[],ke=b.has(_e.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(ki,{icon:T,title:_e.title,subtitle:_e.resolveType,active:!1,onClick:()=>q(_e)}),Pe.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>k(_e.resolveType),"aria-expanded":ke,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:T2},children:[ke?r.jsx(Qt,{size:12,className:"shrink-0"}):r.jsx(dn,{size:12,className:"shrink-0"}),d(ke?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Pe.length,")"]}),ke&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Pe.map(Ne=>r.jsx(ki,{icon:T,accent:"global",title:Ne.title,subtitle:Ne.resolveType,active:!1,onClick:()=>q(Ne)},Ne.savedKey))})]})]},_e.resolveType)}),se.map(_e=>r.jsx(ki,{icon:T,accent:"global",title:_e.title,subtitle:_e.resolveType,active:!1,onClick:()=>q(_e)},_e.savedKey))]})]})}e[10]=T,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=o,e[19]=S,e[20]=C,e[21]=g,e[22]=m,e[23]=V,e[24]=d,e[25]=n,e[26]=E,e[27]=P,e[28]=D,e[29]=I,e[30]=R,e[31]=$,e[32]=B}else E=e[26],P=e[27],D=e[28],I=e[29],R=e[30],$=e[31],B=e[32];if(D!==Symbol.for("react.early_return_sentinel"))return D;let M;e[87]!==I||e[88]!==R?(M=r.jsx("div",{className:I,children:R}),e[87]=I,e[88]=R,e[89]=M):M=e[89];let O;e[90]!==E||e[91]!==M||e[92]!==$?(O=r.jsx(E,{className:$,children:M}),e[90]=E,e[91]=M,e[92]=$,e[93]=O):O=e[93];let z;return e[94]!==P||e[95]!==O||e[96]!==B?(z=r.jsxs("div",{className:B,children:[P,O]}),e[94]=P,e[95]=O,e[96]=B,e[97]=z):z=e[97],z}function Zse(t){const[e,s]=t;return{name:e,...s}}function ene(t,e){return t.title.localeCompare(e.title)}function tne(t){const[,e]=t;return e}function sne(t,e){return t.title.localeCompare(e.title)}function nne(t,e){return t.title.localeCompare(e.title)}function ine(t){return{resolveType:t.resolveType,title:t.title,folderPath:uS(t.resolveType)}}function rne(t){return{resolveType:t.resolveType,title:t.title,folderPath:uS(t.resolveType),savedKey:t.key}}function one(){return new Set}function lne(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}=fS(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function ane(t){const e=F.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=ie(),g=eo(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,_]=A.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[y,k]=A.useState(L),[w,S]=A.useState(0),[j,C]=A.useState(!1);let N;e[2]!==l||e[3]!==c?(N=Un(c,l),e[2]=l,e[3]=c,e[4]=N):N=e[4];const V=N,T=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,E=Ls()?.taskId??null,P=o??void 0;let D;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==P||e[9]!==E||e[10]!==n?(D={orgSlug:s,virtualMcpId:n,branch:i,threadId:E,previewUrl:P,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=P,e[9]=E,e[10]=n,e[11]=D):D=e[11];const I=D;let R,$,B,M,O,z,U,H;if(e[12]!==a||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const ce=[d,...y],ge=me=>{k(y.slice(0,me)),S(cne)};let Q;e[26]!==a||e[27]!==v||e[28]!==f?(Q=async me=>{const ve=zg(me,a);if(ve){pe.error(ve);return}await f(me,v),C(!1)},e[26]=a,e[27]=v,e[28]=f,e[29]=Q):Q=e[29],R=Q,M="flex h-full w-full min-w-0",B="flex min-w-0 flex-1 flex-col",$="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(O=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=O):O=e[31],z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ce.map((me,ve)=>{const we=ve===ce.length-1,ye=Cn(me);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ve>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>ge(ve),title:ye,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:ye})]},`${ye}-${ve}`)}),e[12]=a,e[13]=y,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=R,e[19]=$,e[20]=B,e[21]=M,e[22]=O,e[23]=z,e[24]=U,e[25]=H}else R=e[18],$=e[19],B=e[20],M=e[21],O=e[22],z=e[23],U=e[24],H=e[25];let K;e[32]!==O||e[33]!==z||e[34]!==U?(K=r.jsx("nav",{"aria-label":O,className:z,children:U}),e[32]=O,e[33]=z,e[34]=U,e[35]=K):K=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=()=>C(!0),e[36]=W):W=e[36];let Y;e[37]!==p?(Y=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=Y):Y=e[38];let X;e[39]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx(wp,{size:14}),e[39]=X):X=e[39];let ne;e[40]!==h||e[41]!==Y?(ne=r.jsx(He,{asChild:!0,children:r.jsx(de,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:W,"aria-label":Y,children:X})}),e[40]=h,e[41]=Y,e[42]=ne):ne=e[42];let se;e[43]!==p?(se=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=se):se=e[44];let oe;e[45]!==se?(oe=r.jsx(Ke,{side:"bottom",children:se}),e[45]=se,e[46]=oe):oe=e[46];let Z;e[47]!==ne||e[48]!==oe?(Z=r.jsxs(We,{children:[ne,oe]}),e[47]=ne,e[48]=oe,e[49]=Z):Z=e[49];let J;e[50]!==K||e[51]!==Z||e[52]!==H?(J=r.jsxs("div",{className:H,children:[K,Z]}),e[50]=K,e[51]=Z,e[52]=H,e[53]=J):J=e[53];const q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",G=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:T});let te;e[54]!==G?(te=r.jsx("p",{className:q,children:G}),e[54]=G,e[55]=te):te=e[55];let le;e[56]!==$||e[57]!==J||e[58]!==te?(le=r.jsxs("div",{className:$,children:[J,te]}),e[56]=$,e[57]=J,e[58]=te,e[59]=le):le=e[59];let ee;e[60]!==a||e[61]!==y||e[62]!==w||e[63]!==v||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==V||e[68]!==p?(ee=r.jsx($o,{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:V?r.jsx(Ui,{schema:V,value:v,onChange:ce=>_(ce),basePath:"",breadcrumbPath:y,onBreadcrumbChange:k,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},w):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=y,e[62]=w,e[63]=v,e[64]=l,e[65]=m,e[66]=I,e[67]=V,e[68]=p,e[69]=ee):ee=e[69];let ae;e[70]!==B||e[71]!==le||e[72]!==ee?(ae=r.jsxs("div",{className:B,children:[le,ee]}),e[70]=B,e[71]=le,e[72]=ee,e[73]=ae):ae=e[73];let ue;e[74]!==u||e[75]!==R||e[76]!==h||e[77]!==j?(ue=r.jsx(Fg,{open:j,onOpenChange:C,defaultBlockId:u,isPending:h,onSubmit:R}),e[74]=u,e[75]=R,e[76]=h,e[77]=j,e[78]=ue):ue=e[78];let he;return e[79]!==M||e[80]!==ae||e[81]!==ue?(he=r.jsxs("div",{className:M,children:[ae,ue]}),e[79]=M,e[80]=ae,e[81]=ue,e[82]=he):he=e[82],he}function cne(t){return t+1}var dne=Object.prototype.toString,Rc=Array.isArray||function(e){return dne.call(e)==="[object Array]"};function Qg(t){return typeof t=="function"}function une(t){return Rc(t)?"array":typeof t}function J9(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function P5(t,e){return t!=null&&typeof t=="object"&&e in t}function hne(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var fne=RegExp.prototype.test;function mne(t,e){return fne.call(t,e)}var pne=/\S/;function gne(t){return!mne(pne,t)}var xne={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function bne(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return xne[s]})}var vne=/\s*/,yne=/\s+/,D5=/\s*=/,_ne=/\s*\}/,Lne=/#|\^|\/|>|\{|&|=|!/;function Sne(t,e){if(!t)return[];var s=!1,n=[],i=[],o=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;o.length;)delete i[o.pop()];else o=[];l=!1,a=!1}var h,f,m;function p(S){if(typeof S=="string"&&(S=S.split(yne,2)),!Rc(S)||S.length!==2)throw new Error("Invalid tags: "+S);h=new RegExp(J9(S[0])+"\\s*"),f=new RegExp("\\s*"+J9(S[1])),m=new RegExp("\\s*"+J9("}"+S[1]))}p(e||$i.tags);for(var g=new Ru(t),x,b,v,_,L,y;!g.eos();){if(x=g.pos,v=g.scanUntil(h),v)for(var k=0,w=v.length;k<w;++k)_=v.charAt(k),gne(_)?(o.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
540
+ `)}function g5(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function fee(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 mee(t){return t.map((e,s)=>({...e,index:s}))}function tw(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:o,onDuplicate:l,onDelete:a}=t,c=ie(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=re("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=r.jsx(yc,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Or,{className:"h-4 w-4 shrink-0",style:{color:uee}}),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(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{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:gee,onPointerDown:pee,children:r.jsx(ei,{size:14})})}),r.jsxs(Ht,{align:"end",children:[o&&r.jsxs(Qe,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(Sy,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(Qe,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(an,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(Qe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(tn,{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]!==h||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function pee(t){return t.stopPropagation()}function gee(t){return t.stopPropagation()}function xee(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:bee},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=If(d);let g;e[2]!==m?(g=Ri.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let _;e[7]!==o?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=_):_=e[8];const L=p?"cursor-grabbing":"cursor-grab",y=n?ew:hee;let k;e[9]!==L||e[10]!==y?(k=re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,y),e[9]=L,e[10]=y,e[11]=k):k=e[11];let w;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(w=r.jsx(tw,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=w):w=e[17];let S;return e[18]!==u||e[19]!==h||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==_||e[24]!==k||e[25]!==w?(S=r.jsx("div",{ref:f,style:v,...u,...h,onClick:o,onKeyDown:_,className:k,children:w}),e[18]=u,e[19]=h,e[20]=o,e[21]=f,e[22]=v,e[23]=_,e[24]=k,e[25]=w,e[26]=S):S=e[26],S}function bee(){return!1}function vee(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=ie(),m=n.length>1;let p;e[0]!==n?(p=()=>g5(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=A.useState(p),[b,v]=A.useState(null),[_,L]=A.useState(s),[y,k]=A.useState(n.length);let w;e[2]!==n?(w=()=>p5(n),e[2]=n,e[3]=w):w=e[3];const[S,j]=A.useState(w),C=A.useRef(!1),N=p5(n);_!==s?(L(s),k(n.length),j(N),x(g5(n))):(y!==n.length||S!==N)&&(k(n.length),j(N),x(he=>fee(he,n)));let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V={activationConstraint:{distance:8}},e[4]=V):V=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:Mf},e[5]=T):T=e[5];const E=Vu(gr(Rl,V),gr(Dl,T));let P;e[6]!==g?(P=g.map(yee),e[6]=g,e[7]=P):P=e[7];const D=P;let I;e[8]!==g?(I=he=>{const ce=String(he.active.id);v(g.find(ge=>ge.id===ce)??null)},e[8]=g,e[9]=I):I=e[9];const R=I;let $;e[10]!==D||e[11]!==u?($=he=>{v(null);const{active:ce,over:ge}=he;if(!ge||ce.id===ge.id)return;const Q=D.indexOf(String(ce.id)),me=D.indexOf(String(ge.id));Q===-1||me===-1||(x(ve=>mee(bl([...ve],Q,me))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),u(Q,me))},e[10]=D,e[11]=u,e[12]=$):$=e[12];const B=$;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const O=M;let z,U,H,K,W,Y,X,ne,se,oe,Z,J,q;if(e[14]!==m||e[15]!==g||e[16]!==D||e[17]!==B||e[18]!==R||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==E||e[27]!==f){const he=Ye=>{C.current||o(Ye)};Z="space-y-1 border-b p-2";let ce;e[41]!==f?(ce=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ce):ce=e[42];let ge;e[43]!==ce?(ge=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[43]=ce,e[44]=ge):ge=e[44];let Q;e[45]!==f?(Q=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=Q):Q=e[46];let me;e[47]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx($t,{size:14}),e[47]=me):me=e[47];let ve;e[48]!==h||e[49]!==Q?(ve=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":Q,className:"size-6",onClick:h,children:me})}),e[48]=h,e[49]=Q,e[50]=ve):ve=e[50];let we;e[51]!==f?(we=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=we):we=e[52];let ye;e[53]!==we?(ye=r.jsx(Ke,{children:we}),e[53]=we,e[54]=ye):ye=e[54];let Le;e[55]!==ve||e[56]!==ye?(Le=r.jsxs(We,{children:[ve,ye]}),e[55]=ve,e[56]=ye,e[57]=Le):Le=e[57];let Ce;e[58]!==f?(Ce=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ce):Ce=e[59];let Te;e[60]===Symbol.for("react.memo_cache_sentinel")?(Te=r.jsx(tn,{size:14}),e[60]=Te):Te=e[60];let _e;e[61]!==d||e[62]!==Ce?(_e=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":Ce,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Te})}),e[61]=d,e[62]=Ce,e[63]=_e):_e=e[63];let Pe;e[64]!==f?(Pe=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Pe):Pe=e[65];let ke;e[66]!==Pe?(ke=r.jsx(Ke,{children:Pe}),e[66]=Pe,e[67]=ke):ke=e[67];let Ne;e[68]!==_e||e[69]!==ke?(Ne=r.jsxs(We,{children:[_e,ke]}),e[68]=_e,e[69]=ke,e[70]=Ne):Ne=e[70];let Fe;e[71]!==Le||e[72]!==Ne?(Fe=r.jsxs("div",{className:"flex items-center gap-0.5",children:[Le,Ne]}),e[71]=Le,e[72]=Ne,e[73]=Fe):Fe=e[73],e[74]!==ge||e[75]!==Fe?(J=r.jsxs("div",{className:"flex items-center justify-between",children:[ge,Fe]}),e[74]=ge,e[75]=Fe,e[76]=J):J=e[76],U=Eu,Y=E,X=H2,ne=R,se=B,oe=O,z=Rf,K=D,W=Df,q="space-y-0.5",H=g.map(Ye=>r.jsx(xee,{entry:Ye,selected:Ye.index===i,canDelete:m,onSelect:()=>he(Ye.index),onRename:l?()=>l(Ye.index):void 0,onDuplicate:()=>a(Ye.index),onDelete:()=>c(Ye.index)},Ye.id)),e[14]=m,e[15]=g,e[16]=D,e[17]=B,e[18]=R,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=E,e[27]=f,e[28]=z,e[29]=U,e[30]=H,e[31]=K,e[32]=W,e[33]=Y,e[34]=X,e[35]=ne,e[36]=se,e[37]=oe,e[38]=Z,e[39]=J,e[40]=q}else z=e[28],U=e[29],H=e[30],K=e[31],W=e[32],Y=e[33],X=e[34],ne=e[35],se=e[36],oe=e[37],Z=e[38],J=e[39],q=e[40];let G;e[77]!==H||e[78]!==q?(G=r.jsx("div",{className:q,children:H}),e[77]=H,e[78]=q,e[79]=G):G=e[79];let te;e[80]!==z||e[81]!==K||e[82]!==W||e[83]!==G?(te=r.jsx(z,{items:K,strategy:W,children:G}),e[80]=z,e[81]=K,e[82]=W,e[83]=G,e[84]=te):te=e[84];let le;e[85]!==b||e[86]!==m?(le=b?r.jsx("div",{className:re("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ew),children:r.jsx(tw,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ee;e[88]!==le?(ee=Bn.createPortal(r.jsx(Pf,{dropAnimation:LS,children:le}),document.body),e[88]=le,e[89]=ee):ee=e[89];let ae;e[90]!==U||e[91]!==Y||e[92]!==X||e[93]!==ne||e[94]!==se||e[95]!==oe||e[96]!==te||e[97]!==ee?(ae=r.jsxs(U,{sensors:Y,collisionDetection:X,onDragStart:ne,onDragEnd:se,onDragCancel:oe,children:[te,ee]}),e[90]=U,e[91]=Y,e[92]=X,e[93]=ne,e[94]=se,e[95]=oe,e[96]=te,e[97]=ee,e[98]=ae):ae=e[98];let ue;return e[99]!==Z||e[100]!==J||e[101]!==ae?(ue=r.jsxs("div",{className:Z,children:[J,ae]}),e[99]=Z,e[100]=J,e[101]=ae,e[102]=ue):ue=e[102],ue}function yee(t){return t.id}const _ee=[[/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"]],Lee={"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 U9(t){return Tl(t)!==void 0}function Kg(t,e){if(e){if(U9(e))return e;const s=Lee[e];if(s&&U9(s))return s}for(const[s,n]of _ee)if(s.test(t)&&U9(n))return n;return"FilterLines"}function See(t){return Tl(t)??o2}function H9(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=See(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 u;e[2]!==c||e[3]!==i?(u=re("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=r.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function n9e(t,e){return CY(t,e).map(s=>{const n=e[s.blockKey]??{},i=$L(TY(s.blockKey),e,t);return{blockKey:s.blockKey,title:xl(s.blockKey,n),description:mc(i),iconName:Kg(s.matcherResolveType)}})}const sw="Users03";function wee(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function kee(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=Fo(l,t);s.push({resolveType:l,title:a.title??ps(l),description:a.description,iconName:Kg(l,a.icon)})}return s}function jee(t,e){if(!t)return sw;const s=e.find(n=>n.resolveType===t);return s?s.iconName:Kg(t)}function Cee(t){const e=F.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=A.useState(!1),f=ie(),p=(i?d.find(J=>J.blockKey===i):void 0)?.iconName??jee(s,o),g=Tl(p);let x;e[0]!==a||e[1]!==h?(x=J=>{a(J),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=J=>{c?.(J),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const _=v;let L;e[6]!==h?(L=()=>h(!0),e[6]=h,e[7]=L):L=e[7];let y;e[8]!==g?(y=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=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 w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Qt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=w):w=e[12];let S;e[13]!==L||e[14]!==y||e[15]!==k?(S=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:[y,k,w]}),e[13]=L,e[14]=y,e[15]=k,e[16]=S):S=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let C;e[19]!==f?(C=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=C):C=e[20];let N;e[21]!==f?(N=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=N):N=e[22];let V;e[23]!==N?(V=r.jsx(yi,{placeholder:N}),e[23]=N,e[24]=V):V=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let E;e[27]!==T?(E=r.jsx(si,{children:T}),e[27]=T,e[28]=E):E=e[28];let P;e[29]!==f?(P=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=P):P=e[30];let D;e[31]!==f?(D=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=D):D=e[32];const I=`${P} ${D}`;let R;e[33]!==b?(R=()=>b(""),e[33]=b,e[34]=R):R=e[34];const $=!s&&!i&&"bg-accent/60";let B;e[35]!==$?(B=re("gap-2.5",$),e[35]=$,e[36]=B):B=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(H9,{iconName:sw,size:"sm"}),e[37]=M):M=e[37];let O;e[38]!==f?(O=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=O):O=e[39];let z;e[40]!==O?(z=r.jsx("span",{className:"text-sm",children:O}),e[40]=O,e[41]=z):z=e[41];let U;e[42]!==f?(U=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=U):U=e[43];let H;e[44]!==U?(H=r.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=H):H=e[45];let K;e[46]!==z||e[47]!==H?(K=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[z,H]}),e[46]=z,e[47]=H,e[48]=K):K=e[48];let W;e[49]!==I||e[50]!==R||e[51]!==B||e[52]!==K?(W=r.jsxs(Yt,{value:I,onSelect:R,className:B,children:[M,K]}),e[49]=I,e[50]=R,e[51]=B,e[52]=K,e[53]=W):W=e[53];let Y;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==o){let J;e[59]!==i||e[60]!==s||e[61]!==b?(J=q=>r.jsxs(Yt,{value:`${q.title} ${q.resolveType} ${q.description??""}`,onSelect:()=>b(q.resolveType),className:re("gap-2.5",!i&&s===q.resolveType&&"bg-accent/60"),children:[r.jsx(H9,{iconName:q.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:q.title}),q.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:q.description})]})]},q.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=J):J=e[62],Y=o.map(J),e[54]=i,e[55]=s,e[56]=b,e[57]=o,e[58]=Y}else Y=e[58];let X;e[63]!==W||e[64]!==Y?(X=r.jsxs(gs,{children:[W,Y]}),e[63]=W,e[64]=Y,e[65]=X):X=e[65];let ne;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(ne=d.length>0&&r.jsx(gs,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(J=>r.jsxs(Yt,{value:`${J.title} ${J.blockKey} ${J.description??""}`,onSelect:()=>_(J.blockKey),className:re("gap-2.5",i===J.blockKey&&"bg-accent/60"),children:[r.jsx(H9,{iconName:J.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:J.title}),J.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=ne):ne=e[70];let se;e[71]!==E||e[72]!==X||e[73]!==ne?(se=r.jsxs(_i,{children:[E,X,ne]}),e[71]=E,e[72]=X,e[73]=ne,e[74]=se):se=e[74];let oe;e[75]!==u||e[76]!==h||e[77]!==C||e[78]!==V||e[79]!==se||e[80]!==j?(oe=r.jsxs(MT,{open:u,onOpenChange:h,title:j,description:C,className:"sm:max-w-lg",filter:wee,children:[V,se]}),e[75]=u,e[76]=h,e[77]=C,e[78]=V,e[79]=se,e[80]=j,e[81]=oe):oe=e[81];let Z;return e[82]!==oe||e[83]!==S?(Z=r.jsxs(r.Fragment,{children:[S,oe]}),e[82]=oe,e[83]=S,e[84]=Z):Z=e[84],Z}const Nee="website/sections/Rendering/Lazy.tsx";function Th(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Wg(t){if(!Th(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Ms(e)}function Vee(t){return t!=null}function um(t){if(t==null)return t;if(Wg(t)){const e=t.section;return e==null?null:Th(e)?e:{}}return Th(t)?t:void 0}function Tee(t,e){return t===null?null:Wg(e)?{...e,section:t}:t}function i9e(t){return{__resolveType:t}}function r9e(t,e){if(!Vee(e))return null;if(t){const s=um(e)??{};return{__resolveType:Nee,section:s}}return Wg(e)?um(e)??null:Th(e)?e:null}const Eee="General";function pc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function nw(t,e){return t===Po?Eee:e}function iw(t){const e=sh(t),s=new Set,n=[];for(const i of e)pc(i.resolveType)&&(pi(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:nw(i.resolveType,i.title),description:i.description})));return n}function qg(t){const e=th(t),s=Un(e,t),n=iw(s?.properties?.seo);return n.length>0?n:Aee(t)}function Aee(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const o of Object.keys(i)){if(!pc(o))continue;const l=o.split("/").pop()?.replace(/\.tsx?$/,"")??o;s.push({resolveType:o,title:nw(o,l)})}return s}function rw(t){const e=qg(t),s=e.find(n=>n.resolveType===Po);return s?s.resolveType:e[0]?.resolveType??Po}function ow(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Un(s,t),i=iw(n?.properties?.seo);if(i.length>0)return i}return qg(t)}function Pee(t,e){const s=ow(t,e),n=s.find(i=>i.resolveType===Po);return n?n.resolveType:s[0]?.resolveType??rw(t)}function Dee(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:rw(t)}function Ree(t,e,s){const n=s.__resolveType;return typeof n=="string"&&pc(n)?n:Pee(t,e)}const Iee=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),Po="website/sections/Seo/SeoV2.tsx",Mee=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function Ed(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function $ee(t){return typeof t.__resolveType=="string"&&pc(t.__resolveType)?!0:Mee.some(e=>e in t)}function Oee(t,e){for(const[s,n]of Object.entries(t)){if(!Ed(n))continue;const i=n,o=i.__resolveType;if(typeof o=="string"&&Iee.has(o))continue;const l=i.seo;if(Ed(l)){const a=l;if($ee(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Ree(e,i,a):typeof a.__resolveType=="string"&&pc(a.__resolveType)?a.__resolveType:Po}}}for(const[s,n]of Object.entries(t)){if(!Ed(n))continue;const i=n;if(typeof i.__resolveType=="string"&&pc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Bee(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function o9e(t,e,s){if(e.kind==="site"){const c=Oee(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?ow(s,c.blockData):void 0,build:d=>Bee(c,d)}:null}const n=t[e.pageKey];if(!Ed(n))return null;const i=n,o=i.seo,l=um(o),a=l&&Ed(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:o,seoResolveType:s?Dee(s,a):typeof a?.__resolveType=="string"?a.__resolveType:Po,seoTypeOptions:s?qg(s):void 0,build:c=>({...i,seo:c===null?null:Tee(c,o)})}}const Gg=["type","title","description","canonical","favicon","image","themeColor"],zee=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Fee=["jsonLD","title","description","noIndexing","configJsonLD"];function lw(t){return t===Po||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Uee(t){switch(t){case"general":return Gg;case"pdp":return zee;case"plp":return Fee;default:return null}}function aw(t,e){const s=Uee(lw(e));if(!s||!t.properties)return t;const n={};for(const i of s){const o=t.properties[i];o&&(n[i]=o)}return{...t,properties:n}}function Hee(){return Gg.filter(t=>t!=="type")}function Kee(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Wee(t,e){return t[e]===void 0}function qee(t){const e=F.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:o,formResetKey:l}=t,a=ie(),d=aw(s,Po).properties??{},u=Hee();let h;e[0]!==o?(h=!!o&&Object.keys(o).length>0,e[0]=o,e[1]=h):h=e[1];const f=h,[m,p]=A.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=A.useState(g);m!==l&&(p(l),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:Wee(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const _=v;let L;e[6]!==i||e[7]!==o||e[8]!==n?(L=(j,C)=>{b(V=>({...V,[j]:C}));const N={...n};if(C)delete N[j];else{const V=o?.[j];N[j]=V??(j==="type"?"website":"")}i(N)},e[6]=i,e[7]=o,e[8]=n,e[9]=L):L=e[9];const y=L,k="min-w-0 space-y-6",w=Gg.map(j=>{const C=d[j];if(!C)return null;const N=f&&u.includes(j),V=N&&_(j),T=V?o?.[j]??n[j]:n[j],E=C.title??Kee(j);return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:re(V&&"pointer-events-none opacity-60"),children:Sl({schema:C,value:T,onChange:P=>{V||i({...n,[j]:P})},path:j,label:E,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:Gee})}),N&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pr,{id:`seo-use-default-${j}`,checked:V,onCheckedChange:P=>y(j,P)}),r.jsx(Bt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let S;return e[10]!==l||e[11]!==w?(S=r.jsx("div",{className:k,children:w},l),e[10]=l,e[11]=w,e[12]=S):S=e[12],S}function Gee(){}function Yee(t){const e=F.c(18),{schema:s,resolveType:n,value:i,formResetKey:o,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(lw(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==o||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=r.jsx(qee,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:o}),e[2]=o,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let u;e[8]!==n||e[9]!==s?(u=aw(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??Jee;let p;return e[12]!==h||e[13]!==o||e[14]!==l||e[15]!==m||e[16]!==i?(p=r.jsx(Ui,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},o),e[12]=h,e[13]=o,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Jee(){}function Qee(t){const e=F.c(16),{schema:s,value:n,onChange:i,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=ie();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.length>0&&r.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[r.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:r.jsx(y1,{className:"size-3.5"})}),h.map((x,b)=>{const v=b===h.length-1,_=Cn(x);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:_,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==o||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=r.jsx(Ui,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=o,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=r.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function l9e(t){const e=F.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:o,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const _=v;let L;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==o||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(L=s&&n?u?r.jsx(Yee,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:o,onBreadcrumbChange:l,siteDefaultSeo:h}):r.jsx(Ui,{schema:s,value:n,onChange:o,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=o,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=L):L=e[16];const y=L;let k;e[17]!==c||e[18]!==y?(k=y??r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=k):k=e[19];let w;return e[20]!==d||e[21]!==k?(w=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:[d,k]})}),e[20]=d,e[21]=k,e[22]=w):w=e[22],w}const a9e="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function c9e(t,e){return aJ(t,e,mc)}function d9e(t){const e=F.c(19),{pageKey:s,initialName:n,initialPath:i,onFieldChange:o}=t,l=ie(),[a,c]=A.useState(n),[d,u]=A.useState(i),[h,f]=A.useState(s);h!==s&&(f(s),c(n),u(i));let m;e[0]!==o?(m=L=>{c(L.target.value),o("name",L.target.value)},e[0]=o,e[1]=m):m=e[1];let p;e[2]!==l?(p=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[2]=l,e[3]=p):p=e[3];let g;e[4]!==a||e[5]!==m||e[6]!==p?(g=r.jsx("input",{type:"text",value:a,onChange:m,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:p}),e[4]=a,e[5]=m,e[6]=p,e[7]=g):g=e[7];let x;e[8]!==o?(x=L=>{u(L.target.value),o("path",L.target.value)},e[8]=o,e[9]=x):x=e[9];let b;e[10]!==l?(b=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[10]=l,e[11]=b):b=e[11];let v;e[12]!==d||e[13]!==x||e[14]!==b?(v=r.jsx("input",{type:"text",value:d,onChange:x,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:b}),e[12]=d,e[13]=x,e[14]=b,e[15]=v):v=e[15];let _;return e[16]!==g||e[17]!==v?(_=r.jsxs("div",{className:"space-y-1",children:[g,v]}),e[16]=g,e[17]=v,e[18]=_):_=e[18],_}function u9e(t){const e=F.c(13),{onClick:s}=t,n=ie();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(vu,{size:14}),e[2]=o):o=e[2];let l;e[3]!==s||e[4]!==i?(l=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:o})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=r.jsx(Ke,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=r.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const x5=new WeakMap;function Xee(t,e){let s=x5.get(e);s||(s=new Map,x5.set(e,s));let n=s.get(t);return n===void 0&&(n=Un(t,e),s.set(t,n)),n}function Zee(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function ete(t,e){return{__resolveType:e,variants:[{rule:dc(),value:structuredClone(t)},{rule:dc(),value:structuredClone(t)}]}}function tte(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>Vg(n.rule));return s?s.value:e[e.length-1]?.value}function ste(t){const e=[...t.variants],s=e[e.length-1],n={rule:dc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function nte(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function ite(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function rte(t,e,s){return e<t?t-1:Math.min(t,s-1)}function ote(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 lte(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function b5(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const v5=new WeakMap;function ate(t){let e=v5.get(t);return e||(e=kee(t),v5.set(t,e)),e}function cw(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=ie(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=A.useState(0);if(!Zee(l)){let B;e[0]!==o?(B=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=B):B=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(vu,{size:14}),e[2]=M):M=e[2];let O;e[3]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=O):O=e[4];let z;return e[5]!==O?(z=r.jsx(Ke,{children:O}),e[5]=O,e[6]=z):z=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":B,onClick:()=>{a(ete(l,s)),h(0)},children:M})}),z]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==o?(g=(B,M)=>({index:M,label:mc(B.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},_=v.__resolveType??"",L=b?.value,y=c?ate(c):[],k=_&&c?Xee(_,c):null,{__resolveType:w,...S}=v,j=()=>{a(tte(f)),h(0)},C=()=>{const B=ste(f);a(B),h(B.variants.length-1)},N=B=>{const M=nte(f,B);M&&(a(M),h(rte(p,B,M.variants.length)))},V=B=>{const M=ite(f,B);a(M),h(B+1)},T=(B,M)=>{const O=ote(f,B,M);a(O),p===B&&h(M)},E=B=>{const M=B?EY(B,c):{__resolveType:M8};a(b5(f,p,M))},P=B=>{const M=B,O=_?{...M,__resolveType:_}:{...M};a(b5(f,p,O))},D=B=>{a(lte(f,p,B))},I=`${d}-${f.__resolveType}`;let R;e[9]!==o?(R=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=R):R=e[10];let $;return e[11]!==R?($=r.jsx(Bt,{className:"text-xs text-muted-foreground",children:R}),e[11]=R,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(vee,{listKey:I,variants:x,selectedIndex:p,onSelect:h,onDuplicate:V,onDelete:N,onRemoveAll:j,onReorder:T,onAdd:C}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(Cee,{currentRt:_,currentLabel:mc(v),matchers:y,onSelect:E}),k&&r.jsx("div",{className:"pt-1",children:r.jsx(Qee,{schema:k,value:S,onChange:P,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${_}`)})]}),n({...i,value:L,onChange:D})]})]})}const cte="website/loaders/secret.ts";function Ad(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 dte(){return{__resolveType:cte,name:"",encrypted:""}}function ute(t){const{value:e,...s}=t;return s}function K9(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=ie();if(typeof n=="string"||n==null&&!Ad(n)){const C=typeof n=="string"?n:"",N=a?.virtualMcpId;let V;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==N?(V=r.jsx(Us,{htmlFor:l,label:o,description:s.description,virtualMcpId:N}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=N,e[4]=V):V=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let E;e[7]!==i?(E=I=>i(I.target.value),e[7]=i,e[8]=E):E=e[8];let P;e[9]!==l||e[10]!==C||e[11]!==T||e[12]!==E?(P=r.jsx(bt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:E,className:"h-10"}),e[9]=l,e[10]=C,e[11]=T,e[12]=E,e[13]=P):P=e[13];let D;return e[14]!==V||e[15]!==P?(D=r.jsxs("div",{className:"space-y-2",children:[V,P]}),e[14]=V,e[15]=P,e[16]=D):D=e[16],D}let d;e[17]!==n?(d=Ad(n)?n:dte(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx(Us,{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]!==u||e[27]!==i?(v=C=>i({...u,name:C.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let _;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(_=r.jsx(bt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=_):_=e[33];const L=`${l}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let k;e[37]!==u||e[38]!==f||e[39]!==i?(k=C=>{const N=C.target.value;if(!N){i(f?ute(u):u);return}i({...u,value:N})},e[37]=u,e[38]=f,e[39]=i,e[40]=k):k=e[40];let w;e[41]!==y||e[42]!==k||e[43]!==L?(w=r.jsx(bt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:k,className:"h-10"}),e[41]=y,e[42]=k,e[43]=L,e[44]=w):w=e[44];let S;e[45]!==f||e[46]!==c?(S=f&&r.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=S):S=e[47];let j;return e[48]!==w||e[49]!==S||e[50]!==g||e[51]!==_?(j=r.jsxs("div",{className:"space-y-2",children:[g,_,w,S]}),e[48]=w,e[49]=S,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function hte(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 u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(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 u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function fte(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 mte=new Set(["__resolveType","@type"]);function pte(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 gte(t){if(Hf(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 y5(t){if(t.type==="array"&&t.items)return t;const e=t.items??gte(t);return e?{...t,type:"array",items:e}:null}function xte(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 dw(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=Un(n,s);return i?r.jsx(Ui,{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 Sl(t){const{schema:e,value:s}=t;if(Lh(s)){const l=rJ(s),a=y5(e);if(l!==null&&a)return r.jsx(v0,{...t,schema:a,value:l,onChange:c=>t.onChange(oJ(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&Hf(e)){const l=y5(e);if(l)return r.jsx(v0,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Lh(s)&&e.type==="block-ref"){const l=hte(e,s)??fte(s);if(l){const a={...e,type:"array",items:l};return r.jsx(v0,{...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(pte(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=u=>Sl({...u,schema:c});return r.jsx(cw,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(d5,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(ree,{...t},t.path);if(e.format==="image-uri")return r.jsx(WZ,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(UZ,{...t},t.path);if(e.format==="map")return r.jsx(dee,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(xZ,{...t},t.path);if(e.format==="location")return r.jsx(ZS,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(rX,{...t},t.path);if(e.type==="anyOf")return r.jsx(d5,{...t},t.path);if(Ad(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(K9,{...t},t.path);if(!e.format&&!e.enum){const l=dw(t);if(l)return l}const n=s??xte(e.type,e.default);if(n==null)return Ad(s)?r.jsx(K9,{...t},t.path):null;if(Ad(n))return r.jsx(K9,{...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(v0,{...i},t.path);switch(o){case"boolean":return r.jsx(eX,{...i},t.path);case"number":case"integer":return r.jsx(ZQ,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(x0,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(x0,{...i},t.path):r.jsx(x0,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(ZX,{...i},t.path):null;default:return r.jsx(x0,{...i},t.path)}}function bte(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Sl({...t,schema:e});const s=dw(t);return s||Sl(e?{...t,schema:e}:t)}function Ui({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=ie(),p=t.properties;if(!p)return t.type==="inline-union"?Sl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}):null;if(iJ(e)&&p.variants){const V=p.variants.items?.properties?.value;return r.jsx(cw,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:T=>bte(T,V)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(V=>!mte.has(V)&&p[V]?.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=(V,T)=>{if(T===void 0){const{[V]:E,...P}=g;s(P);return}s({...g,[V]:T})},_=typeof g.__resolveType=="string"?g.__resolveType:void 0,L=x.filter(V=>{const T=p[V];return T!=null&&qa(T,g[V])}).length>1,y=AX(x,p,g),k=i.length>0?DX(x,p,g,i,a,l):null,w=k?p[k]:null,S=k&&w?[k]:x,j=k&&w?EX(k,w,i,tu(k,x,p)):i,C=TX(i,j),N=C.length>0&&o?V=>o([...C,...V]):o;return r.jsx("div",{className:"min-w-0 space-y-6",children:S.map(V=>{const T=p[V];if(!T)return null;const E=n?`${n}.${V}`:V,P=tu(V,x,p),D=Ll(V,T),$=(C.length===0&&x.some(B=>{const M=p[B];return B!==V&&M!=null&&Ll(B,M)===D})||C.length===0&&y.has(V))&&N?B=>N(NX(P,B)):N;return Sl({schema:T,value:g[V],onChange:B=>v(V,B),path:E,label:P,required:b.has(V),breadcrumbPath:j,onBreadcrumbChange:$,hasSiblingDrillDownFields:L,focused:k===V,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:_,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function vte(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(cn,{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(ft,{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(Rt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const _5=3e4;function yte(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 _te(t,{resolveType:e,props:s}){let n;try{n=await fetch(E8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(_5)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${_5/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 Lte(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>_te(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function uw({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=Ls()?.taskId??null,g=ie(),x=eo(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=Un(a.resolveType,i),_=!v&&bM(a.resolveType,i),L=_?vM(c):null,y=v??L,[k,w]=A.useState(c),[S,j]=A.useState([]),[C,N]=A.useState(0),[V,T]=A.useState(!1),[E,P]=A.useState(null),[D,I]=A.useState(!1),[R,$]=A.useState(!1),[B,M]=A.useState(!1),O=E!==null,{save:z,flush:U,isPending:H}=KL({orgSlug:t,virtualMcpId:e,branch:s}),K=Lte({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});A.useEffect(()=>()=>{U()},[]);const W=cS(l),Y=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,X={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},ne=le=>{w(le),a.mode==="saved"&&z(a.blockKey,{__resolveType:a.resolveType,...le})},se=()=>{O?(P(null),T(!1),N(le=>le+1)):P(JSON.stringify(k,null,2))},oe=le=>{const ee=le??"";try{const ae=JSON.parse(ee);if(ae&&typeof ae=="object"&&!Array.isArray(ae)){T(!1),ne(ae);return}T(!0)}catch{T(!0)}},Z=async le=>{const ee=zg(le,o);if(ee){pe.error(ee);return}await u(le,{__resolveType:a.resolveType,...k}),I(!1)},J=()=>{$(!0),K.mutate({resolveType:a.resolveType,props:k})},q=()=>{n&&window.open(yte(n,a.resolveType,k,Date.now()),"_blank","noopener")},G=[a.title,...S],te=le=>{j(S.slice(0,le)),N(ee=>ee+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(de,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:r.jsx(nf,{size:14})}),r.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:G.map((le,ee)=>{const ae=ee===G.length-1,ue=Cn(le);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ee>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>te(ee),title:ue,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ae?"font-medium text-foreground":"text-muted-foreground"),children:ue})]},`${ue}-${ee}`)})}),a.mode==="saved"&&r.jsx(vte,{isPending:H,isError:!1}),m&&r.jsxs(de,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:K.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:W}),children:[K.isPending?r.jsx(ft,{size:14,className:"animate-spin"}):r.jsx(fl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:W}),children:r.jsx(wp,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:W})})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:O?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:se,"aria-label":g(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":O,children:O?r.jsx(_s,{size:14}):r.jsx(zo,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g(O?"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"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:W}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:Y,singular:W})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:re("relative min-h-0 flex-1",R&&B&&"hidden"),children:[r.jsx($o,{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:[L&&y===L&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:W})}),y?r.jsx(Ui,{schema:y,value:k,onChange:le=>ne(le),basePath:"",breadcrumbPath:S,onBreadcrumbChange:j,meta:i,decofile:o,onSaveReferencedBlock:h,sandbox:X},C):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:W}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:W})})]})})}),E!==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:g("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(yu,{language:"json",height:"100%",code:E,onChange:oe,onSave:le=>{oe(le),U()}})})]})]}),R&&r.jsx(Ste,{singular:W,result:{isPending:K.isPending,error:K.error,data:K.data,hasRun:K.status!=="idle"},expanded:B,onToggleExpand:()=>M(le=>!le),onOpenInNewTab:n?q:void 0,onClose:()=>{$(!1),M(!1)}})]}),r.jsx(Fg,{open:D,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:Z})]})}function Ste(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,onOpenInNewTab:l,onClose:a}=t,c=ie();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=re("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=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(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(yn,{size:14})})}),r.jsx(Ke,{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(XN,{size:14}):r.jsx(by,{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(He,{asChild:!0,children:r.jsx(de,{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 _;e[22]!==i||e[23]!==c?(_=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=_):_=e[24];let L;e[25]!==_?(L=r.jsx(Ke,{side:"bottom",children:_}),e[25]=_,e[26]=L):L=e[26];let y;e[27]!==L||e[28]!==v?(y=r.jsxs(We,{children:[v,L]}),e[27]=L,e[28]=v,e[29]=y):y=e[29];let k;e[30]!==c?(k=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=k):k=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(_s,{size:14}),e[32]=w):w=e[32];let S;e[33]!==a||e[34]!==k?(S=r.jsx(de,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":k,children:w}),e[33]=a,e[34]=k,e[35]=S):S=e[35];let j;e[36]!==y||e[37]!==S||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,S]}),e[36]=y,e[37]=S,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=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]=C):C=e[42];let N;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(N=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(ft,{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(yu,{language:"json",height:"100%",code:u,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]=u,e[47]=s,e[48]=c,e[49]=N):N=e[49];let V;return e[50]!==C||e[51]!==N||e[52]!==f?(V=r.jsxs("div",{className:f,children:[C,N]}),e[50]=C,e[51]=N,e[52]=f,e[53]=V):V=e[53],V}function wte(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,blockKey:c}=t,d=ie();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=Du(u);let f;e[4]!==h?(f=Dg((y,k)=>h.mutate({blockKey:y,data:k})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=fS(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 y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let k;return e[11]!==y?(k=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=k):k=e[12],k}const v=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let L;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==o||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==v||e[26]!==_||e[27]!==n?(L=r.jsx(uw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:h.isPending,onCreate:kte,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]=h.isPending,e[24]=m,e[25]=v,e[26]=_,e[27]=n,e[28]=L):L=e[28],L}async function kte(){}const jte="https://github.com/decocms/blocks";function Cte(){const t=F.c(14),e=ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(ZN,{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(yn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(de,{size:"sm",asChild:!0,children:r.jsxs("a",{href:jte,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(To,{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 Nte(t){const e=F.c(15),{source:s,onRetry:n}=t,i=ie();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(cn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let u;e[8]!==n||e[9]!==d?(u=r.jsx(de,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=r.jsx(To,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}function Qr(){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(ft,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Vte=A.lazy(()=>Tn(()=>import("./sections-editor-Cj6XZcig.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.SectionsEditor})));function L5(t){const e=F.c(47),{virtualMcpId:s,externalSelection:n}=t,i=n===void 0?null:n,{org:o}=qe(),{currentBranch:l,taskId:a}=sn(),c=ni(),d=Pl(),u=gS(),h=c.lifecycle.phase==="running",f=d.previewUrl;let m;e[0]!==l||e[1]!==o||e[2]!==f||e[3]!==a||e[4]!==s?(m=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,threadId:a??null,previewUrl:f}:null,e[0]=l,e[1]=o,e[2]=f,e[3]=a,e[4]=s,e[5]=m):m=e[5];const p=m;let g;e[6]!==h?(g={fetchEnabled:h},e[6]=h,e[7]=g):g=e[7];const x=_f(p,g);let b;e[8]!==h?(b={fetchEnabled:h},e[8]=h,e[9]=b):b=e[9];const v=Lf(p,b),_=BL({lifecyclePhase:c.lifecycle.phase,decofile:yh(x),meta:yh(v),hasEditableContent:kf(x.data,v.data),fastPreviewActive:En(s).runtime==="cms"});if(_.kind==="loading"){let I;return e[10]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Qr,{}),e[10]=I):I=e[10],I}if(_.kind==="empty"){let I;return e[11]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Cte,{}),e[11]=I):I=e[11],I}if(_.kind==="error"){let I;e[12]!==x||e[13]!==d||e[14]!==v||e[15]!==_.source?(I=()=>{if(_.source==="sandbox"){d.retry();return}Promise.all([x.refetch(),v.refetch()])},e[12]=x,e[13]=d,e[14]=v,e[15]=_.source,e[16]=I):I=e[16];const R=I;let $;return e[17]!==R||e[18]!==_.source?($=r.jsx(Nte,{source:_.source,onRetry:R}),e[17]=R,e[18]=_.source,e[19]=$):$=e[19],$}const L=u.state.target;if(L?.kind==="loader"&&x.data&&v.data){const I=l??"",R=f??null;let $;return e[20]!==x.data||e[21]!==v.data||e[22]!==o.slug||e[23]!==I||e[24]!==R||e[25]!==L.key||e[26]!==s?($=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(wte,{orgSlug:o.slug,virtualMcpId:s,branch:I,previewUrl:R,meta:v.data,decofile:x.data,blockKey:L.key})}),e[20]=x.data,e[21]=v.data,e[22]=o.slug,e[23]=I,e[24]=R,e[25]=L.key,e[26]=s,e[27]=$):$=e[27],$}let y;e[28]!==l||e[29]!==o.slug||e[30]!==L||e[31]!==s?(y=L||!l?null:Eg(Tg(o.slug,s,l)),e[28]=l,e[29]=o.slug,e[30]=L,e[31]=s,e[32]=y):y=e[32];const k=y;let w="/",S=null,j=null;L?.kind==="page"?(w=L.path,S=L.key):L?.kind==="section"?j=L.key:k&&(w=k.path,S=k.pageKey);const C=S?`page:${S}`:j?`section:${j}`:`path:${w}`;let N;e[33]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),e[33]=N):N=e[33];const V=l??"",T=f??void 0,E=j?null:i,P=!!S&&u.state.editSeoPageKey===S;let D;return e[34]!==j||e[35]!==S||e[36]!==w||e[37]!==C||e[38]!==o.slug||e[39]!==P||e[40]!==V||e[41]!==T||e[42]!==E||e[43]!==s||e[44]!==u.consumeEditSeo||e[45]!==u.setVariantOverride?(D=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(A.Suspense,{fallback:N,children:r.jsx(Vte,{orgSlug:o.slug,virtualMcpId:s,branch:V,previewReady:!0,previewUrl:T,currentPath:w,activePageBlockKey:S,activeGlobalBlockKey:j,externalSelection:E,initialEditSeo:P,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride},C)})}),e[34]=j,e[35]=S,e[36]=w,e[37]=C,e[38]=o.slug,e[39]=P,e[40]=V,e[41]=T,e[42]=E,e[43]=s,e[44]=u.consumeEditSeo,e[45]=u.setVariantOverride,e[46]=D):D=e[46],D}function Tte(t,e){return t===e?"preview":e}function Ete(t){return t.cmsDefaultOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const Ate="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",Pte="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",Dte=500,Rte={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},S5=1,W9=["desktop","mobile","tablet"],w5={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function k5(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Ite(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 _0(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function q9(t,e){try{return new URL(t,e).href}catch{return null}}function Mte(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),o=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return o.at(-1)===s?a=Math.max(a,95):o.includes(s)&&(a=Math.max(a,90)),a}function $te(t){const{onOpen:e}=t,[s,n]=A.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function Ote(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Bte({virtualMcpId:t}){const e=ie(),s=cf(),n=Ro(),i=wY(),o=zt(),{currentBranch:l,taskId:a}=sn(),c=gS(),d=xe=>{o({to:".",search:Ae=>({...Ae,main:xe}),replace:!0})},[u,h]=A.useState("preview"),[f,m]=A.useState(!1),[p,g]=A.useState("desktop"),[x,b]=A.useState(null),[v,_]=A.useState(null),L=A.useRef(null),y=A.useRef(null),[k,w]=A.useState({width:0,height:0}),[S,j]=A.useState(null),[C,N]=A.useState(!1),[V,T]=A.useState(""),E=A.useRef(null),[P,D]=A.useState(!1),[I,R]=A.useState(),[$,B]=A.useState(null),[M,O]=A.useState(null),[z,U]=A.useState(null),[H,K]=A.useState("/"),[W,Y]=A.useState(null),[X,ne]=A.useState({}),[se,oe]=A.useState(!1),Z=A.useRef(null),J=()=>{oe(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>oe(!1),15e3)},q=()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),oe(!1)},{org:G}=qe(),te=ni(),le=Pl(),ee=le.vmEntry,ae=le.previewUrl,ue=te.lifecycle.phase,he=ue==="running",ce=ee?.sandboxProviderKind==="user-desktop",ge=mS({orgSlug:G.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:ce&&he&&!!t&&!!l}),Q=ce?ge:null,me=eo(),ve=me?.entity?.id===t?vp(me.entity.metadata):null,we=En(t),ye=me?.entity?.id===t&&we.runtime==="cms",Le=we.projectDefault==="cms",Ce=MY({sandboxUrl:ae,previewServerUrl:ve,fastPreviewActive:ye}),Te=t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:ae}:null,_e=_f(Te,{fetchEnabled:he}),Pe=Lf(Te,{fetchEnabled:he}),ke=_e.data,Ne=Pe.data,Fe=`${t}:${l??""}`,[Ye,Ie]=A.useState(null),Re=BL({lifecyclePhase:ue,decofile:yh(_e),meta:yh(Pe),hasEditableContent:kf(ke,Ne),fastPreviewActive:ye,frameworkKnownMissing:Ye===Fe});Re.kind==="empty"&&Re.reason==="framework-missing"&&Ye!==Fe&&Ie(Fe);const Oe=Re.kind==="content",tt=t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l}:null,it=UY(tt),nt=ke?ih(ke).sort((xe,Ae)=>xe.name.localeCompare(Ae.name)):[],ot=ke&&Ne?M2(ke,Ne):[],Me=ke&&Ne?hS(Ne,ke,"loaders"):[],lt=ko,gt=V?(()=>{const xe=V.toLowerCase();return nt.map(Ae=>({page:Ae,score:Mte(Ae.name,Ae.path,xe)})).filter(({score:Ae})=>Ae>0).sort((Ae,St)=>St.score-Ae.score||Ae.page.path.length-St.page.path.length).map(({page:Ae})=>Ae)})():nt,Xe=ot.filter(xe=>{if(!V)return!0;const Ae=V.toLowerCase();return xe.name.toLowerCase().includes(Ae)||xe.key.toLowerCase().includes(Ae)||xe.resolveType.toLowerCase().includes(Ae)}),be=Me.filter(xe=>{if(!V)return!0;const Ae=V.toLowerCase();return xe.title.toLowerCase().includes(Ae)||xe.key.toLowerCase().includes(Ae)||xe.resolveType.toLowerCase().includes(Ae)}),Ue=M?Me.find(xe=>xe.key===M)??null:null,Ze=$||M?null:I1(nt,H,W),ht=$?$.name:Ue?.title??Ze?.name,st=Ze?.key??null,wt=Ze?.path??null,dt=(st?X[st]:void 0)??{},Lt=Ar(H,dt),De={};if(he&&ae&&Ne&&ke){const xe=gQ(Ne,"loaders"),Ae=st?ke[st]:void 0,St=BJ(Ae,ke,Es=>xe.has(Es)),Vt=RJ(St);for(const Es of eh(H)){if(Es.type!=="param")continue;const xn=AJ(H,Es.name,St),Gs=$J(xn,xe,Vt);Gs.length>0&&(De[Es.name]=Gs)}}const rt=t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,yt=ke&&st?XL(ke,st,0):[],ut=ke?qL(yt,ke):[],at=ut.map(xe=>xe.isSavedBlock?xe.label:""),fe=ut.map(xe=>xe.isSavedBlock?"global":xe.isMultivariate?"variant":"normal"),Ve=yt.map(xe=>om(xe,ke??{})),Be=A.useRef(null),Se=A.useRef(null),ct=te.status.state==="paused",mt=te.phase,Xt=sS({claimPhase:mt,lifecycle:te.lifecycle}),Dt=le.previewState,rn=le.userStopped,ii=(me?.entity?.id===t?me.entity.metadata?.ui?.layout?.cmsDefaultOpen:null)??!1,ri=Cg(G.slug,t??"",l??""),{url:ws}=UL(ye&&t&&l?{orgSlug:G.slug,virtualMcpId:t,branch:l,previewServerUrl:ve??null,path:Lt}:null),_n=Le&&we.runtime==="sandbox",_t=hY({previewState:Dt,progressStatus:Xt.status,previewServerUrl:ve,fastPreviewActive:ye,fastPreviewReady:!!ws,codingSession:_n}),ks=_t.mode!=="none",qs=_t.mode==="production"&&_t.iframeBase?_0(_t.iframeBase):null,Ln=!s,Ts=_t.mode==="production"?qs:_0(ae),ts=Ite(_t.mode==="sandbox"?O9(k5(z??q9(Lt,_t.iframeBase)??_t.iframeBase,p),c.state.variantOverride??[]):_t.mode==="production"&&Ln?O9(k5(FL(z??ws??q9(Lt,_t.iframeBase)??_t.iframeBase,_t.showWakingPill?IY:null),p),c.state.variantOverride??[]):null);A.useEffect(()=>{},[s,qs,S]);const un="sandbox.preview.openInNewTab",In=ws??(_t.iframeBase?q9(Lt,_t.iframeBase):null),oi=_t.mode==="production"?In?O9(In,c.state.variantOverride??[]):null:ts??_t.iframeBase,Sn=async()=>{const xe=oi;if(xe){window.open(xe,"_blank","noopener");return}},hn=t&&l?Tg(G.slug,t,l):null,fn=xe=>{hn&&VJ(hn,xe)},Ot=c.state.target;A.useEffect(()=>{if(!(!Ot||!Ce||!Ne))if(Ot.kind==="page"){const xe=X[Ot.key]??{};Se.current=Ar(Ot.path,xe),B(null),O(null),U(null),Y(Ot.key),K(Ot.path),fn({path:Ot.path,pageKey:Ot.key,params:xe})}else if(Ot.kind==="loader")Se.current=null,B(null),O(Ot.key),U(null);else{const xe=ot.find(Ae=>Ae.key===Ot.key);if(xe){Se.current=null;const Ae=th(Ne);O(null),B(xe),U(U4(Ce,Ae,xe.key))}}},[Ot,Ce,Ne,X]),A.useEffect(()=>{!st||wt===null||Ot?.kind==="page"&&Ot.key===st&&Ot.path===wt||c.selectTarget({kind:"page",key:st,path:wt})},[st,wt,Ot]);const[mn,li]=A.useState(null);if(Dt.kind==="iframe"&&mn!==Dt.previewUrl){const xe=mn!==null;li(Dt.previewUrl);const Ae=hn?Eg(hn):null;if(Ae){if(Se.current=Ar(Ae.path,Ae.params),K(Ae.path),Y(Ae.pageKey),U(null),B(null),O(null),Ae.pageKey&&Object.keys(Ae.params).length>0){const St=Ae.pageKey;ne(Vt=>({...Vt,[St]:Ae.params}))}}else xe&&(Se.current=null,K("/"),U(null),Y(null),B(null),O(null))}Be.current=ts;const Mn=gY({iframeRef:L,src:_t.mode==="sandbox"?ts:null,active:_t.mode==="sandbox"}),Ee=A.useRef(null);A.useEffect(()=>{if(!ws||!ts||Ee.current===ws)return;Ee.current=ws;const xe=L.current;xe&&xe.getAttribute("src")!==ts&&(J(),xe.src=ts)},[ws,ts]);const pt=!!t&&!!l&&!te.notFound&&!rn&&!ct&&(mt?.kind==="ready"||ue!=="idle"),kt=_t.mode!=="sandbox"&&u==="visual"?"preview":u;A.useEffect(()=>{const xe=Ts;if(!xe)return;const Ae=St=>{if(St.origin===xe){if(St.data?.type==="visual-editor::element-clicked"){const Vt=WY.safeParse(St.data.payload);Vt.success&&b(Vt.data)}else if(St.data?.type==="cms-editor::section-clicked"){const Vt=YY.safeParse(St.data.payload);Vt.success&&_({index:Vt.data.sectionIndex,seq:Vt.data.clickSeq})}}};return window.addEventListener("message",Ae),()=>window.removeEventListener("message",Ae)},[Ts]),A.useEffect(()=>{if(!C)return;const xe=Ae=>{E.current?.contains(Ae.target)||(N(!1),T(""))};return document.addEventListener("pointerdown",xe),()=>document.removeEventListener("pointerdown",xe)},[C]);const us=()=>{const xe=L.current?.contentWindow,Ae=_0(ae);!xe||!Ae||xe.postMessage({type:"visual-editor::activate",script:qY},Ae)},pn=()=>{const xe=L.current?.contentWindow,Ae=_0(ae);!xe||!Ae||xe.postMessage({type:"visual-editor::deactivate"},Ae)},gn=()=>{const xe=L.current?.contentWindow,Ae=Ts;!xe||!Ae||(xe.postMessage(_t.mode==="production"?{type:"editor::inject",args:{script:W4}}:{type:"visual-editor::activate",script:W4},Ae),xe.postMessage({type:"cms-editor::set-labels",labels:at,kinds:fe,keys:Ve},Ae))},to=()=>{const xe=L.current?.contentWindow,Ae=Ts;!xe||!Ae||xe.postMessage({type:"cms-editor::deactivate"},Ae)},ai=xe=>{const Ae=u;!n&&xe!==Ae&&(xe==="blocks"?y.current?.resize("30%"):y.current?.collapse()),h(xe),b(null),_(null),xe!=="blocks"&&O(null),Ae==="visual"&&pn(),xe==="visual"&&us(),Ae==="blocks"&&xe!=="blocks"&&to(),xe==="blocks"&&gn()},Bu=xe=>{m(!0),ai(Tte(u,xe))},so=Ete({cmsDefaultOpen:ii,blocksReady:Oe,autoOpenResolved:f,editingMode:u}),no=()=>{m(!0),ai("blocks")},io=()=>{if(!L.current||!ts)return;J();const xe=L.current;xe.src=ts};KM(()=>{const xe=L.current;if(!xe)return;J();const Ae=document.activeElement,St=xe.tabIndex;xe.tabIndex=-1,xe.style.pointerEvents="none",xe.blur(),Ote(xe,Be.current);let Vt;const Es=()=>{clearTimeout(Vt),xe.tabIndex=St,xe.style.pointerEvents="";const xn=document.activeElement;(!xn||xn===document.body||xn===xe)&&Ae?.focus(),xe.removeEventListener("load",Es)};xe.addEventListener("load",Es),Vt=setTimeout(Es,3e3)});const $c=()=>{const xe=W9.indexOf(p);g(W9[(xe+1)%W9.length])},ro=async()=>{let xe=null;try{xe=L.current?.contentWindow?.location?.href??null}catch{}const Ae=xe??ts??ae;if(Ae)try{await navigator.clipboard.writeText(Ae),pe.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{pe.error(e("sandbox.preview.failedToCopyUrl"))}},oo=xY({iframeBase:_t.iframeBase,resolvedPath:Lt,activeGlobalSectionName:$?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Hi=xe=>{const Ae=X[xe.key]??{},St=Ar(xe.path,Ae);($||lt(St)!==lt(Lt))&&J(),Se.current=St,B(null),O(null),U(null),_(null),Y(xe.key),K(xe.path),fn({path:xe.path,pageKey:xe.key,params:Ae}),c.selectTarget({kind:"page",key:xe.key,path:xe.path})},Ki=(xe,Ae)=>{if(!st)return;const St=st,Vt={...dt,[xe]:Ae};Se.current=Ar(H,Vt),ne(Es=>({...Es,[St]:Vt})),fn({path:H,pageKey:St,params:Vt})},lo=xe=>{if(!Ce||!Ne){pe.error(e("sandbox.preview.previewMetadataNotReady"));return}J(),Se.current=null;const Ae=th(Ne),St=U4(Ce,Ae,xe.key);B(xe),O(null),U(St),_(null),c.selectTarget({kind:"section",key:xe.key})},ao=xe=>{B(null),O(xe.key),U(null),ai("blocks"),c.selectTarget({kind:"loader",key:xe.key})},Oc=async({name:xe,path:Ae,templateKey:St})=>{if(!t||!l)return;const Vt=D2(Ae);if(Vt){R(Vt);return}const Es=Ae.trim().startsWith("/")?Ae.trim():`/${Ae.trim()}`;if(nt.some(Gs=>lt(Gs.path)===lt(Es))){R(e("sandbox.preview.pageAlreadyExists",{path:Es}));return}let xn;if(St&&(xn=ke?.[St],!xn)){R(e("sandbox.preview.templateNoLongerExists"));return}R(void 0);try{const Gs=await it.mutateAsync({name:xe,path:Es,template:xn});D(!1),pe.success(e("sandbox.preview.pageCreated",{name:xe})),await wc(Dte),Hi({key:Gs.key,name:Gs.name,path:Gs.path}),ai("blocks")}catch(Gs){R(Gs instanceof Error?Gs.message:e("sandbox.preview.failedToCreatePage"))}},Wi=ks&&(pt||_t.mode==="production"),yr=u==="blocks",_r=JY({showPreviewToolbar:Wi,blocksState:Re}),qi=_r?r.jsx(jg,{title:e("sandbox.preview.cms"),tooltip:e(yr?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:eV},active:yr,onClick:()=>Bu("blocks"),testId:"preview-blocks-toggle",dataTour:jo.edit}):null,Lr=Wi?r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{onClick:io,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(zn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),_r&&r.jsxs("div",{ref:E,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:[$&&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(Hr,{size:11}),"Global"]}),Ue&&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(Xa,{size:11}),e("sandbox.preview.loaderBadge")]}),r.jsx("span",{className:re("text-[13px] font-medium text-foreground",ht==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ht??oo}),!$&&!M&&ht!=null&&H&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:eh(H).map((xe,Ae)=>{if(xe.type==="text")return r.jsx("span",{className:re(Ae===0?"min-w-0 truncate":"shrink-0"),children:xe.text},`text-${Ae}`);const St=De[xe.name];return St&&rt?r.jsx(tQ,{sources:St,template:H,paramName:xe.name,value:dt[xe.name]??"",sandboxRef:rt,onCommit:Vt=>Ki(xe.name,Vt)},`${st}:${xe.name}`):r.jsx(hQ,{name:xe.name,value:dt[xe.name]??"",onCommit:Vt=>Ki(xe.name,Vt)},`${st}:${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(Qt,{size:12,className:re("shrink-0 text-muted-foreground transition-transform",C&&"rotate-180")})})]}),C&&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(mf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:V,onChange:xe=>T(xe.target.value),onKeyDown:xe=>{if(xe.key!=="Enter")return;const Ae=V.trim();if(!Ae)return;const St=gt.find(Vt=>lt(Vt.path)===lt(Ae));St&&(xe.preventDefault(),N(!1),T(""),Hi(St))},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),T(""),R(void 0),D(!0)},children:[r.jsx($t,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),gt.length===0&&Xe.length===0&&be.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:nt.length===0&&ot.length===0&&Me.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[gt.length>0&&r.jsx("div",{className:"p-1.5",children:gt.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:Ae=>{Ae.preventDefault(),N(!1),T(""),Hi(xe)},children:[r.jsx(Or,{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))}),Xe.length>0&&r.jsxs("div",{className:re("p-1.5",gt.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")}),Xe.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:Ae=>{Ae.preventDefault(),N(!1),T(""),lo(xe)},children:[r.jsx(Hr,{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))]}),be.length>0&&r.jsxs("div",{className:re("p-1.5",(gt.length>0||Xe.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")}),be.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:Ae=>{Ae.preventDefault(),N(!1),T(""),ao(xe)},children:[r.jsx(Xa,{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(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{"aria-label":e(un),onClick:()=>{Sn()},children:r.jsx(yn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e(un)})]})]}):null,co=Wi?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[qi,qi&&r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Lr]}):null,Gi=Wi?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(ei,{size:14})})}),r.jsxs(Ht,{align:"end",className:"w-44",children:[r.jsxs(Qe,{onClick:ro,children:[r.jsx(an,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),ke&&Ne&&r.jsxs(r.Fragment,{children:[r.jsx(dr,{}),st&&r.jsxs(Qe,{onClick:()=>{c.editSeo({kind:"page",key:st,path:H}),ai("blocks")},children:[r.jsx(Np,{size:14}),e("sandbox.preview.editSeo")]}),st&&r.jsxs(Qe,{onClick:()=>{try{d(bN(YI(st)))}catch{pe.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx(zo,{size:14}),e("sandbox.preview.viewJson")]})]}),Q&&r.jsxs(r.Fragment,{children:[r.jsx(dr,{}),r.jsxs(Qe,{onClick:()=>window.open(Sh("vscode",Q)),children:[r.jsx("img",{src:Ate,alt:"VSCode",width:14,height:14}),e("sandbox.preview.openInVscode")]}),r.jsxs(Qe,{onClick:()=>window.open(Sh("cursor",Q)),children:[r.jsx("img",{src:Pte,alt:"Cursor",width:14,height:14}),e("sandbox.preview.openInCursor")]})]}),r.jsx(dr,{}),r.jsxs(Qe,{onClick:()=>cY(e),children:[r.jsx(tV,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Bc=_t.mode==="sandbox",Li=Rte[p],Si=p==="desktop"&&(k.width===0||k.width>=Li.width+2*S5),Sr=Si?1:Math.min(k.width>0?k.width/(Li.width+2*S5):1,1),uo=Si?{width:"100%",height:"100%"}:{width:`${Li.width}px`,height:k.height>0?`${k.height/Sr}px`:`${Li.height}px`,transform:`scale(${Sr})`,transformOrigin:"top center"},wr=ks?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:[Bc&&r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{onClick:()=>Bu("visual"),"aria-pressed":u==="visual","aria-label":e("sandbox.preview.visualEditor"),active:u==="visual",className:"rounded-full","data-tour":jo.visualEditor,children:r.jsx(N3,{size:16})})}),r.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(yo,{onClick:$c,"aria-label":e(w5[p]),className:"rounded-full","data-tour":jo.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&r.jsx(sV,{size:16}),p==="tablet"&&r.jsx(nV,{size:16}),p==="desktop"&&r.jsx(iV,{size:16})]},p)})}),r.jsx(Ke,{side:"top",children:e(w5[p])})]})]})}):null,ho=(n||!!M)&&kt==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[so&&r.jsx($te,{onOpen:no}),rt&&Object.entries(De).map(([xe,Ae])=>(dt[xe]??"")===""?r.jsx(dQ,{sources:Ae,template:H,paramName:xe,sandboxRef:rt,onFill:St=>Ki(xe,St)},`${st}:${xe}`):null),i?r.jsxs(r.Fragment,{children:[Wi&&r.jsx(LY,{children:co}),r.jsx(SY,{children:Gi})]}):(Wi||Gi)&&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:qi}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Lr}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:Gi})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:ho?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(L5,{virtualMcpId:t,externalSelection:v}),n&&wr]}):r.jsxs(b8,{orientation:"horizontal",disabled:kt!=="blocks",children:[r.jsx(Z0,{ref:y,id:"preview-blocks-editor",defaultSize:kt==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:kt==="blocks"&&r.jsx(L5,{virtualMcpId:t,externalSelection:v})}),kt==="blocks"&&r.jsx(v8,{withHandle:!0}),r.jsx(Z0,{id:"preview-canvas",defaultSize:kt==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:xe=>{if(!xe)return;const Ae=()=>w(Vt=>Vt.width===xe.clientWidth&&Vt.height===xe.clientHeight?Vt:{width:xe.clientWidth,height:xe.clientHeight});Ae();const St=new ResizeObserver(Ae);return St.observe(xe),()=>St.disconnect()},className:re("h-full relative overflow-hidden flex justify-center",ks&&!Si&&"bg-muted/30"),children:[(se||ri)&&ks&&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"})}),_t.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Wa,{kind:"starting",progress:Xt,claimPhase:mt})}),Dt.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Wa,{kind:"suspended",onResume:le.resume})}),Dt.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Wa,{kind:"errored",error:Dt.error,onRetry:le.retry,connectionsHref:`/${G.slug}/settings/connections`})}),_t.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(ft,{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")})]})]}),kt==="visual"&&!x&&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(N3,{size:12}),e("sandbox.preview.clickElementToAsk")]}),kt==="visual"&&x&&r.jsx(fJ,{element:x,onDismiss:()=>b(null)}),wr,ks&&ts&&r.jsx("div",{className:re("shrink-0",!Si&&"border-x border-border bg-background shadow-sm"),style:uo,children:r.jsx("iframe",{ref:L,src:ts,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Mn.handleError,onLoad:()=>{if(Mn.handleLoad(),q(),_t.mode!=="sandbox"){_t.mode==="production"&&!_t.showWakingPill&&u==="blocks"&&gn();return}if(Je("vm_preview_loaded",{view_mode:u,vm_id:ee?.sandboxHandle??null}),!$)try{const xe=L.current?.contentWindow?.location?.pathname;if(!xe)return;const Ae=Se.current;if(Ae!==null&&(Se.current=null,lt(xe)!==lt(Ae))||lt(xe)===lt(Lt))return;K(xe),fn({path:xe,pageKey:W,params:dt})}catch{}u==="visual"&&us(),u==="blocks"&&gn()}},_t.iframeBase)})]})})]})}),r.jsx(KY,{open:P,onOpenChange:D,isPending:it.isPending,error:I,templates:nt,onSubmit:Oc})]})}function zte(t){const e=F.c(22),{virtualMcpId:s}=t,n=ie(),i=Ws(s),{activeTask:o,taskId:l,currentBranch:a}=sn(),c=a7(l),[d,u]=A.useState(!1);if(c7({threadId:l,sandboxBranch:o?.branch??a,agentHasRepo:en(i?.metadata),threadHasRepo:en(c)||en(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(Vn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>u(!0),b=r.jsx(Vn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let _;e[9]!==v?(_=r.jsxs(de,{onClick:x,children:[b,v]}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==_?(L=r.jsx(To,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=L):L=e[14];let y;e[15]!==d?(y=r.jsx(t2,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let k;return e[17]!==L||e[18]!==y?(k=r.jsxs(r.Fragment,{children:[L,y]}),e[17]=L,e[18]=y,e[19]=k):k=e[19],k}let f;return e[20]!==s?(f=r.jsx(Bte,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const Fte="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",Ute="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",Hte=A.lazy(()=>Tn(()=>import("./file-explorer-BCiGm1Z3.js"),__vite__mapDeps([152,1,2,23,24,25,26,27,28,29,30,31,32,33,34,6,22,35,36,37,38,39,7,40,8,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,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,110,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.FileExplorer})));function Kte(t){const e=F.c(23),{openPath:s}=t,n=ie(),i=eo(),{org:o}=qe(),{currentBranch:l,taskId:a}=sn(),c=i?.entity?.id??null,d=Pl(),u=ni(),h=d.vmEntry,f=u.lifecycle.phase==="running",m=h?.sandboxProviderKind==="user-desktop",p=c??"",g=l??"",x=a??null,b=m&&f&&!!c&&!!l;let v;e[0]!==o.slug||e[1]!==p||e[2]!==g||e[3]!==x||e[4]!==b?(v={orgSlug:o.slug,virtualMcpId:p,branch:g,threadId:x,enabled:b},e[0]=o.slug,e[1]=p,e[2]=g,e[3]=x,e[4]=b,e[5]=v):v=e[5];const _=mS(v),L=m?_:null;if(!c||!l){let C;e[6]!==n?(C=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=C):C=e[7];let N;return e[8]!==C?(N=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:C}),e[8]=C,e[9]=N):N=e[9],N}let y;e[10]!==L||e[11]!==n?(y=L&&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(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInVscode"),onClick:()=>window.open(Sh("vscode",L)),children:r.jsx("img",{src:Fte,alt:"VSCode",width:14,height:14})})}),r.jsx(Ke,{side:"bottom",children:n("mainPanelTabs.codeTab.openInVscode")})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInCursor"),onClick:()=>window.open(Sh("cursor",L)),children:r.jsx("img",{src:Ute,alt:"Cursor",width:14,height:14})})}),r.jsx(Ke,{side:"bottom",children:n("mainPanelTabs.codeTab.openInCursor")})]})]})}),e[10]=L,e[11]=n,e[12]=y):y=e[12];let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=k):k=e[13];const w=a??null;let S;e[14]!==l||e[15]!==s||e[16]!==o.slug||e[17]!==w||e[18]!==c?(S=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(A.Suspense,{fallback:k,children:r.jsx(Hte,{orgSlug:o.slug,virtualMcpId:c,branch:l,threadId:w,openPath:s})})}),e[14]=l,e[15]=s,e[16]=o.slug,e[17]=w,e[18]=c,e[19]=S):S=e[19];let j;return e[20]!==y||e[21]!==S?(j=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[y,S]}),e[20]=y,e[21]=S,e[22]=j):j=e[22],j}function Wte(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 qte(t,e,s){return typeof t!="string"?null:Wte(Un(t,e),s)}function hw(t,e,s){if(!e||typeof t!="string")return!1;const n=qte(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Gte({orgSlug:t,virtualMcpId:e,branch:s}){const n=bs(),i=Ls()?.taskId??null,o=ku(e),l=En(e).runtime==="cms";return Rs({mutationKey:S2(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await V8({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return k2(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:Pu({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=wu(o,j2(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():w2(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=et.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:et.liveMeta(t,e,s)})}})}function ja(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 Qf(t,e){return`${t}-${e}`}function fw(t,e){return`site/apps/${t}/${e}.ts`}function mw(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 Yte(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Jte(t){return t==="local"?"Custom":"Installed"}function pw(t,e,s){const n=new Set([Qf(t,e),e].map(o=>o.toLowerCase())),i=fw(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 Qte(t,e){const s=t.vendor.alias,n=t.name,i=pw(s,n,e);return{id:Qf(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:fw(s,n),blockKey:i,installed:i!==null}}function Xte(t,e,s){if(t===I2)return null;const n=mw(t);if(!n)return null;const{vendor:i,app:o}=n,l=pw(i,o,s),a=Fo(t,e);return{id:Qf(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 Zte(t,e,s){const n=e.__resolveType;if(typeof n!="string"||uc(t,e)||!z8(n))return null;const i=mw(n)??Yte(t);if(!i)return null;const o=Fo(n,s),{vendor:l,app:a}=i;return{id:Qf(l,a),app:a,vendor:l,title:o.title??rh(t,e,s),description:o.description??"",category:Jte(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function ese(t,e,s){const n=new Map;for(const o of t){const l=Qte(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=Xte(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=Zte(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(tse)}function tse(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function sse(){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 nse(t,e,s){const n=F.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=et.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:sse,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Et(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?ese(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function ise(t){const e=F.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=t,l=ie();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 u=s==="pages";let h;e[6]!==n.pages||e[7]!==o||e[8]!==d||e[9]!==u?(h=r.jsx(Wn,{id:"pages",icon:Or,label:d,count:n.pages,active:u,onSelect:o}),e[6]=n.pages,e[7]=o,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(Wn,{id:"sections",icon:Hr,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(Wn,{id:"apps",icon:r6,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 _=s==="redirects";let L;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==_?(L=r.jsx(Wn,{id:"redirects",icon:wy,label:v,count:n.redirects,active:_,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=_,e[31]=L):L=e[31];let y;e[32]!==l?(y=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=y):y=e[33];const k=s==="loaders";let w;e[34]!==n.loaders||e[35]!==o||e[36]!==y||e[37]!==k?(w=r.jsx(Wn,{id:"loaders",icon:Xa,label:y,count:n.loaders,active:k,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=y,e[37]=k,e[38]=w):w=e[38];let S;e[39]!==l?(S=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=S):S=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==o||e[43]!==S||e[44]!==j?(C=r.jsx(Wn,{id:"actions",icon:qr,label:S,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=S,e[44]=j,e[45]=C):C=e[45];let N;e[46]!==l?(N=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=N):N=e[47];const V=s==="site";let T;e[48]!==o||e[49]!==N||e[50]!==V?(T=r.jsx(Wn,{id:"site",icon:Lp,label:N,active:V,onSelect:o}),e[48]=o,e[49]=N,e[50]=V,e[51]=T):T=e[51];let E;e[52]!==l?(E=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=E):E=e[53];const P=s==="seo";let D;e[54]!==o||e[55]!==E||e[56]!==P?(D=r.jsx(Wn,{id:"seo",icon:Np,label:E,active:P,onSelect:o}),e[54]=o,e[55]=E,e[56]=P,e[57]=D):D=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const R=s==="calendar";let $;e[60]!==o||e[61]!==I||e[62]!==R?($=r.jsx(Wn,{id:"calendar",icon:$r,label:I,active:R,onSelect:o}),e[60]=o,e[61]=I,e[62]=R,e[63]=$):$=e[63];let B;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(B=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(Qa,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(Wn,{id:"posts",icon:Ti,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(Wn,{id:"authors",icon:s2,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(Wn,{id:"categories",icon:ef,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o}),r.jsx(Wn,{id:"post-schedule",icon:vV,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",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]=B):B=e[71];let M;e[72]!==b||e[73]!==L||e[74]!==w||e[75]!==C||e[76]!==T||e[77]!==D||e[78]!==$||e[79]!==B||e[80]!==h||e[81]!==p?(M=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,L,w,C,T,D,$,B]}),e[72]=b,e[73]=L,e[74]=w,e[75]=C,e[76]=T,e[77]=D,e[78]=$,e[79]=B,e[80]=h,e[81]=p,e[82]=M):M=e[82];let O;return e[83]!==c||e[84]!==M?(O=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=O):O=e[85],O}function Wn(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 u;e[3]!==d?(u=re("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=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:re("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]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function rse(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=sS({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(Wa,{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(Wa,{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(Wa,{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 ose=new Set(["clone-failed","install-failed","start-failed","crashed"]);function lse(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&&!ose.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function j5(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 ase(t,e){const s=ko,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 cse(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 dse(t){const e=Ng(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function use(t,e){return HL(t,e)}const hse=1e3;function fse(t,e){for(let s=0;s<hse;s++){const n=Ng(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const mse={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},pse={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},gse={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function xse(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=ie(),[p,g]=A.useState(i),[x,b]=A.useState(o),[v,_]=A.useState(Co),[L,y]=A.useState(null),[k,w]=A.useState(s);s!==k&&(w(s),s&&(g(i),b(o),_(Co),y(null)));const S=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=ue=>{!ue&&!f&&(y(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const C=j;let N;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==S||e[8]!==v||e[9]!==d?(N=async ue=>{ue.preventDefault();const he=p.trim(),ce=x.trim();if(!he||!ce||f)return;const ge=D2(ce);if(ge){y(ge);return}const Q=d?.({name:he,path:ce});if(Q){y(Q);return}y(null),await u({name:he,path:ce,templateKey:S&&v!==Co?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=S,e[8]=v,e[9]=d,e[10]=N):N=e[10];const V=N,T=L??a,E=mse[n];let P;e[11]!==m||e[12]!==E?(P=m(E),e[11]=m,e[12]=E,e[13]=P):P=e[13];let D;e[14]!==P?(D=r.jsx(xs,{children:r.jsx(Wt,{children:P})}),e[14]=P,e[15]=D):D=e[15];let I;e[16]!==f||e[17]!==S||e[18]!==m||e[19]!==v||e[20]!==c?(I=S&&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(WL,{id:"page-form-template",value:v,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=S,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let R;e[22]!==m?(R=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=R):R=e[23];let $;e[24]!==R?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:R}),e[24]=R,e[25]=$):$=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=ue=>g(ue.target.value),e[26]=B):B=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let O;e[29]!==f||e[30]!==p||e[31]!==M?(O=r.jsx(bt,{id:"page-form-name",value:p,onChange:B,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=O):O=e[32];let z;e[33]!==O||e[34]!==$?(z=r.jsxs("div",{className:"space-y-1.5",children:[$,O]}),e[33]=O,e[34]=$,e[35]=z):z=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=ue=>b(ue.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(bt,{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 X;e[47]!==H||e[48]!==Y?(X=r.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[47]=H,e[48]=Y,e[49]=X):X=e[49];let ne;e[50]!==T?(ne=T&&r.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=ne):ne=e[51];let se;e[52]!==z||e[53]!==X||e[54]!==ne||e[55]!==I?(se=r.jsxs("div",{className:"space-y-4 py-4",children:[I,z,X,ne]}),e[52]=z,e[53]=X,e[54]=ne,e[55]=I,e[56]=se):se=e[56];let oe;e[57]!==h?(oe=()=>h(!1),e[57]=h,e[58]=oe):oe=e[58];let Z;e[59]!==m?(Z=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=Z):Z=e[60];let J;e[61]!==f||e[62]!==oe||e[63]!==Z?(J=r.jsx(de,{type:"button",variant:"outline",onClick:oe,disabled:f,children:Z}),e[61]=f,e[62]=oe,e[63]=Z,e[64]=J):J=e[64];let q;e[65]!==f||e[66]!==p||e[67]!==x?(q=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=q):q=e[68];let G;e[69]!==f||e[70]!==n||e[71]!==m?(G=f?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),m(gse[n])]}):m(pse[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=G):G=e[72];let te;e[73]!==q||e[74]!==G?(te=r.jsx(de,{type:"submit",disabled:q,children:G}),e[73]=q,e[74]=G,e[75]=te):te=e[75];let le;e[76]!==J||e[77]!==te?(le=r.jsxs(Zn,{children:[J,te]}),e[76]=J,e[77]=te,e[78]=le):le=e[78];let ee;e[79]!==V||e[80]!==se||e[81]!==le||e[82]!==D?(ee=r.jsx(It,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:V,children:[D,se,le]})}),e[79]=V,e[80]=se,e[81]=le,e[82]=D,e[83]=ee):ee=e[83];let ae;return e[84]!==C||e[85]!==s||e[86]!==ee?(ae=r.jsx(Mt,{open:s,onOpenChange:C,children:ee}),e[84]=C,e[85]=s,e[86]=ee,e[87]=ae):ae=e[87],ae}function bse(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=ie(),[u,h]=A.useState(i),[f,m]=A.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=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]!==u||e[5]!==l?(x=async K=>{K.preventDefault();const W=u.trim();!W||c||await l(W)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let _;e[9]!==v?(_=r.jsx(Wt,{children:v}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let y;e[13]!==L?(y=r.jsx(Fn,{children:L}),e[13]=L,e[14]=y):y=e[14];let k;e[15]!==_||e[16]!==y?(k=r.jsxs(xs,{children:[_,y]}),e[15]=_,e[16]=y,e[17]=k):k=e[17];let w;e[18]!==d?(w=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=w):w=e[19];let S;e[20]!==w?(S=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:w}),e[20]=w,e[21]=S):S=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=K=>h(K.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==u?(C=r.jsx(bt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=C):C=e[25];let N;e[26]!==S||e[27]!==C?(N=r.jsxs("div",{className:"space-y-1.5",children:[S,C]}),e[26]=S,e[27]=C,e[28]=N):N=e[28];let V;e[29]!==d?(V=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=V):V=e[30];let T;e[31]!==V?(T=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:V}),e[31]=V,e[32]=T):T=e[32];let E;e[33]!==n?(E=r.jsx(bt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=E):E=e[34];let P;e[35]!==T||e[36]!==E?(P=r.jsxs("div",{className:"space-y-1.5",children:[T,E]}),e[35]=T,e[36]=E,e[37]=P):P=e[37];let D;e[38]!==N||e[39]!==P?(D=r.jsxs("div",{className:"space-y-4 py-4",children:[N,P]}),e[38]=N,e[39]=P,e[40]=D):D=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,e[42]=I):I=e[42];let R;e[43]!==d?(R=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=R):R=e[44];let $;e[45]!==c||e[46]!==I||e[47]!==R?($=r.jsx(de,{type:"button",variant:"outline",onClick:I,disabled:c,children:R}),e[45]=c,e[46]=I,e[47]=R,e[48]=$):$=e[48];let B;e[49]!==c||e[50]!==u?(B=!u.trim()||c,e[49]=c,e[50]=u,e[51]=B):B=e[51];let M;e[52]!==c||e[53]!==d?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let O;e[55]!==B||e[56]!==M?(O=r.jsx(de,{type:"submit",disabled:B,children:M}),e[55]=B,e[56]=M,e[57]=O):O=e[57];let z;e[58]!==$||e[59]!==O?(z=r.jsxs(Zn,{children:[$,O]}),e[58]=$,e[59]=O,e[60]=z):z=e[60];let U;e[61]!==b||e[62]!==D||e[63]!==z||e[64]!==k?(U=r.jsx(It,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[k,D,z]})}),e[61]=b,e[62]=D,e[63]=z,e[64]=k,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=r.jsx(Mt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function vse(t){const e=F.c(7),{type:s}=t,n=CM[s];let i;e[0]!==n?(i=r.jsx(He,{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(Ke,{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(We,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const G9={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Yg=["posts","authors","categories"],Pd={posts:"post",authors:"author",categories:"category"};function Dd(t){return Yg.includes(t)}const Jg={posts:"post",authors:"author",categories:"category"},gw={posts:G9.post,authors:G9.author,categories:G9.category},yse=Object.fromEntries(Object.entries(gw).map(([t,e])=>[e,t]));function _se(t){return typeof t=="string"?yse[t]??null:null}function Do(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function cs(t){return typeof t=="string"?t:""}function Lse(t,e){switch(t){case"posts":return{label:cs(e.title)||"Untitled post",subtitle:cs(e.slug)};case"authors":return{label:cs(e.name)||"Unnamed author",subtitle:cs(e.email)};case"categories":return{label:cs(e.name)||"Unnamed category",subtitle:cs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function xw(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Do(n);if(!i)continue;const o=_se(i.__resolveType);if(!o)continue;const l=Do(i[Jg[o]])??{},{label:a,subtitle:c}=Lse(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of Yg)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function Sse(t,e){return xw(t)[e]}function su(t,e){return Sse(t,e).map(s=>({key:s.key,payload:md(Do(t[s.key])??void 0,e)}))}const C5=Object.freeze({});function md(t,e){return t?Do(t[Jg[e]])??C5:C5}function Ca(t,e,s){return{name:t,__resolveType:gw[e],[Jg[e]]:s}}function h9e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:cs(Do(f)?.[s]),l=f=>typeof f=="string"?f:cs(Do(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>cs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>cs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:cs(m.name)||cs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||o(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function wl(t){return Array.isArray(t)?t:[]}function Fr(t){if(typeof t=="string")return t;const e=Do(t);return e?cs(e.slug):""}function wse(t){if(typeof t=="string")return t;const e=Do(t);return e?cs(e.email):""}function bw(t){const e=[];return cs(t.title).trim()||e.push("Title"),cs(t.slug).trim()||e.push("Slug"),wl(t.categories).map(Fr).filter(Boolean).length===0&&e.push("Category"),cs(t.excerpt).trim()||e.push("Excerpt"),cs(t.image).trim()||e.push("Cover image"),e}const vw=8;function yw(t){const e=cs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function f9e(t,e){return e!=="published"||yw(t)==="published"?!1:bw(t).length>0}function kse(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,vw).toISOString()}function m9e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=cs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?kse(s):n}}function _w(t){return su(t,"posts").map(({key:e,payload:s})=>({key:e,title:cs(s.title)||"Untitled post",slug:cs(s.slug),date:cs(s.date),scheduledDatetime:cs(s.scheduledDatetime),categorySlugs:wl(s.categories).map(Fr).filter(Boolean),authorEmails:wl(s.authors).map(wse).filter(Boolean),missing:bw(s),status:yw(s)}))}function jse(t,e){const s=wl(t.categories);return s.some(n=>Fr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Cse(t,e){const s=wl(t.categories);return s.length===1&&Fr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function p9e(t,e,s){const n=wl(t.categories);if(!n.some(a=>Fr(a)===e))return t;const i=n.map(a=>{const c=Fr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=Fr(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function Nse(t,e){const s=wl(t.categories);return s.some(n=>Fr(n)===e)?{...t,categories:s.filter(n=>Fr(n)!==e)}:t}function N5(t){return{...t,dateModified:new Date().toISOString()}}function hm(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 Y9(t,e){const s=`collections/blog/${e}/${hm(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Lw(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${hm(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-${hm(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Vse={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"}},V5="Box";function Tse(t){return t.startsWith("site/")?"site":"app"}function Ese(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Qc(...t){for(const e of t)if(e!==void 0)return e}function g9e(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(!Dse(o)||e.has(o))continue;e.add(o);const l=Fo(o,t),a=Ase(o),c=Vse[a],d=Tse(o),u=(d==="site"?Qc(l.title,c?.title):Qc(c?.title,l.title))??a,h=d==="site"?Qc(l.description,c?.description):Qc(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Ese(f)?f:void 0,p=m!==void 0?c?.iconName??V5:Qc(f,c?.iconName)??V5;s.push({resolveType:o,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function Ase(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Pse=["blog/sections/blocks/","site/sections/Blog/Post/"];function Dse(t){return Pse.some(e=>t.startsWith(e))}const x9e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],b9e=["January","February","March","April","May","June","July","August","September","October","November","December"],Sw=1440*60*1e3;function ll(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function v9e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function y9e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Eh(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function fm(t,e){return Math.round((ll(t).getTime()-ll(e).getTime())/Sw)}function Rse(t){const e=(t.getTime()-ll(t).getTime())/Sw;return Math.min(Math.max(e,0),1)}function T5(t,e){return fm(t,e)+Rse(t)}function _9e(t){const e=Eh(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let o=0;o<7;o++)i.push(Eh(e,n*7+o));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function L9e(t,e){const s=ll(t[0]),n=Eh(s,7),i=s.getTime(),o=n.getTime(),l=[];for(const d of e){const u=ll(d.start),h=ll(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?Eh(n,-1):h,p=fm(f,s),g=fm(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),o),v=T5(new Date(x),s),_=Math.max(T5(new Date(b),s)-v,0);_<=0||l.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:_})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function Ah(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const ww=/^(\d{4})-(\d{2})-(\d{2})$/;function Ph(t){const e=t.trim();if(!e)return null;const s=ww.exec(e);if(s){const i=Number(s[1]),o=Number(s[2])-1,l=Number(s[3]),a=new Date(i,o,l);return a.getMonth()===o&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:ll(n)}function Ise(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),vw);return{...Lw("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Ah(t)}}function Mse(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(ww.test(e))return Ph(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function $se(t,e){const s=Mse(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Ah(s)&&(i.date=Ah(n)),i}function Ose(t){return Ph(t.scheduledDatetime)??Ph(t.date)}function S9e(t){const e=new Map,s=[];for(const i of t){const o={post:i,scheduled:Ph(i.scheduledDatetime)!==null},l=Ose(i);if(!l){s.push(o);continue}const a=Ah(l),c=e.get(a);c?c.push(o):e.set(a,[o])}const n=(i,o)=>Number(o.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(o.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const Bse="0.161.0",zse="0.162.0",w9e="deno task update";function E5(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function A5(t,e){const s=E5(t),n=E5(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const o=s[i]-n[i];if(o!==0)return o}return 0}const kw=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Fse(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=kw.exec(s)?.[1];if(n)return n}return null}function Use(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=kw.exec(n)?.[1];if(i)return i}return null}function Hse(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Fse(t.denoJson)??Use(t.meta);return!e||A5(e,Bse)<0?{kind:"outdated",version:e}:A5(e,zse)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function k9e(t){return t.kind==="publish-only"||t.kind==="full"}function j9e(t){return t.kind==="full"}function Kse(t){const e=F.c(16),s=Ws(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=ku(t.virtualMcpId),i=Ls()?.taskId??null;let o;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(o=et.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=o):o=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await C2({...t,threadId:i},wu(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==o||e[9]!==l||e[10]!==a?(c={queryKey:o,queryFn:l,enabled:a,staleTime:3e5},e[8]=o,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Et(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=Hse({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Wse({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=ie(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=A.useState(!1),[h,f]=A.useState(c),[m,p]=A.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async _=>{if(!i||m)return;let L;try{L=JSON.parse(_)}catch{pe.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(L),pe.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){pe.error(o("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{p(!1)}};return r.jsx(Mt,{open:t,onOpenChange:e,children:r.jsxs(It,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(xs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx(Wt,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(de,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(vi,{size:12}):r.jsx(an,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(de,{size:"sm",onClick:()=>v(h),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(yu,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{v(_)}})})]})})}function ki(t){const e=F.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let _;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(_=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(Ke,{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:re("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:re("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:T2}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=_):_=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]!==y?(k=re("group relative flex min-w-0 items-center rounded-md transition-colors",y),e[6]=y,e[7]=k):k=e[7];let w;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(w=u&&r.jsx("span",{className:re("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:qse,children:r.jsx(Sc,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=w):w=e[13];const S=m&&!l&&"text-destructive";let j;e[14]!==S?(j=re("block truncate text-sm font-medium",S),e[14]=S,e[15]=j):j=e[15];let C;e[16]!==j||e[17]!==i?(C=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=C):C=e[18];const N=l?"text-accent-foreground/70":"text-muted-foreground";let V;e[19]!==N?(V=re("block truncate text-xs",N),e[19]=N,e[20]=V):V=e[20];let T;e[21]!==o||e[22]!==V?(T=r.jsx("span",{className:V,children:o}),e[21]=o,e[22]=V,e[23]=T):T=e[23];let E;e[24]!==T||e[25]!==C?(E=r.jsxs("span",{className:"min-w-0 flex-1",children:[C,T]}),e[24]=T,e[25]=C,e[26]=E):E=e[26];let P;e[27]!==l||e[28]!==m||e[29]!==p?(P=m&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx("span",{className:re("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(cn,{size:14})})}),p&&r.jsx(Ke,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=P):P=e[30];let D;e[31]!==x||e[32]!==L||e[33]!==E||e[34]!==P||e[35]!==d?(D=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,E,P,d]}),e[31]=x,e[32]=L,e[33]=E,e[34]=P,e[35]=d,e[36]=D):D=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&r.jsx("div",{className:re("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let R;return e[40]!==D||e[41]!==I||e[42]!==k||e[43]!==w?(R=r.jsxs("div",{className:k,children:[w,D,I]}),e[40]=D,e[41]=I,e[42]=k,e[43]=w,e[44]=R):R=e[44],R}function qse(t){return t.stopPropagation()}function _o(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 Gse={loaders:Xa,actions:qr},Yse={loaders:"Loaders",actions:"Actions"},Jse={analytics:lT,blog:Qa,commerce:Zp,site:rV,website:Hn};function Qse(t,e){return e===0?Jse[t.toLowerCase()]??Kr:Kr}function L0(t,e){return e===0?vQ(t):t}function Xse(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c}=t,d=ie();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u),[m,p]=A.useState(null),[g,x]=A.useState(""),[b,v]=A.useState(one),[_,L]=A.useState(c);_!==c&&(L(c),f([]),p(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{v(H=>{const K=new Set(H);return K.has(U)?K.delete(U):K.add(U),K})},e[1]=y):y=e[1];const k=y;let w;e[2]!==i||e[3]!==s||e[4]!==n?(w={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=w):w=e[5];const S=Du(w);let j;e[6]!==S?(j=Dg((U,H)=>S.mutate({blockKey:U,data:H})),e[6]=S,e[7]=j):j=e[7];const C=j;let N;e[8]!==c?(N=cS(c),e[8]=c,e[9]=N):N=e[9];const V=N,T=Gse[c];let E,P,D,I,R,$,B;if(e[10]!==T||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==o||e[19]!==S||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==V||e[24]!==d||e[25]!==n){D=Symbol.for("react.early_return_sentinel");e:{const U=[...hS(l,a,c).map(rne),...dS(l,c).map(ine)],H=g.trim().toLowerCase(),K=H.length>0,W=K?U.filter(_e=>_e.title.toLowerCase().includes(H)||_e.resolveType.toLowerCase().includes(H)):[],Y=new Map,X=[],ne=new Map;if(!K){for(const _e of U){const Pe=_e.folderPath;if(!(Pe.length<h.length)&&h.every((ke,Ne)=>Pe[Ne]===ke))if(Pe.length===h.length)if(_e.savedKey!==void 0){const ke=ne.get(_e.resolveType);ke?ke.push(_e):ne.set(_e.resolveType,[_e])}else X.push(_e);else{const ke=Pe[h.length],Ne=Y.get(ke)??{count:0,savedCount:0};_e.savedKey!==void 0?Ne.savedCount=Ne.savedCount+1:Ne.count=Ne.count+1,Y.set(ke,Ne)}}X.sort(nne);for(const _e of ne.values())_e.sort(sne)}const se=[...ne.entries()].filter(_e=>{const[Pe]=_e;return!X.some(ke=>ke.resolveType===Pe)}).flatMap(tne).sort(ene);let oe;e[33]!==h?(oe=(_e,Pe)=>L0(_e.name,h.length).localeCompare(L0(Pe.name,h.length)),e[33]=h,e[34]=oe):oe=e[34];const Z=[...Y.entries()].map(Zse).sort(oe);let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=_e=>{p(_e.savedKey!==void 0?{mode:"saved",key:_e.savedKey}:{mode:"available",resolveType:_e.resolveType,title:_e.title})},e[35]=J):J=e[35];const q=J;let G;e[36]!==S||e[37]!==V||e[38]!==d?(G=async(_e,Pe)=>{await S.mutateAsync({blockKey:_e,data:Pe}),pe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:V,blockId:_e})),p({mode:"saved",key:_e})},e[36]=S,e[37]=V,e[38]=d,e[39]=G):G=e[39];const te=G;let le;e[40]!==a||e[41]!==m?(le=lne(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ee=le;if(ee){const _e=`${ee.mode}:${ee.mode==="saved"?ee.blockKey:ee.resolveType}`;let Pe;e[43]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>p(null),e[43]=Pe):Pe=e[43];let ke;e[44]!==i||e[45]!==a||e[46]!==te||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==S.isPending||e[52]!==C||e[53]!==_e||e[54]!==ee.editorTarget||e[55]!==ee.initialValue||e[56]!==n?(ke=r.jsx(uw,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:ee.editorTarget,initialValue:ee.initialValue,isCreating:S.isPending,onCreate:te,onSaveReferencedBlock:C,onBack:Pe},_e),e[44]=i,e[45]=a,e[46]=te,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=S.isPending,e[52]=C,e[53]=_e,e[54]=ee.editorTarget,e[55]=ee.initialValue,e[56]=n,e[57]=ke):ke=e[57],D=ke;break e}B="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 ue;e[60]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>f([]),e[60]=ue):ue=e[60];const he=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ce;e[61]!==he?(ce=re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",he),e[61]=he,e[62]=ce):ce=e[62];const ge=Yse[c];let Q;e[63]!==ce||e[64]!==ge?(Q=r.jsx("button",{type:"button",onClick:ue,className:ce,children:ge}),e[63]=ce,e[64]=ge,e[65]=Q):Q=e[65];let me;e[66]!==h?(me=h.map((_e,Pe)=>{const ke=Pe===h.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Pe+1)),className:re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ke?"font-medium text-foreground":"text-muted-foreground"),children:L0(_e,Pe)})]},`${_e}-${Pe}`)}),e[66]=h,e[67]=me):me=e[67];let ve;e[68]!==ae||e[69]!==Q||e[70]!==me?(ve=r.jsxs("nav",{"aria-label":ae,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Q,me]}),e[68]=ae,e[69]=Q,e[70]=me,e[71]=ve):ve=e[71];let we;e[72]===Symbol.for("react.memo_cache_sentinel")?(we=r.jsx(mf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=we):we=e[72];let ye;e[73]===Symbol.for("react.memo_cache_sentinel")?(ye=_e=>x(_e.target.value),e[73]=ye):ye=e[73];let Le;e[74]!==c||e[75]!==d?(Le=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Le):Le=e[76];let Ce;e[77]!==c||e[78]!==d?(Ce=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ce):Ce=e[79];let Te;e[80]!==g||e[81]!==Le||e[82]!==Ce?(Te=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[we,r.jsx("input",{type:"text",value:g,onChange:ye,placeholder:Le,"aria-label":Ce,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Le,e[82]=Ce,e[83]=Te):Te=e[83],e[84]!==ve||e[85]!==Te?(P=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ve,Te]}),e[84]=ve,e[85]=Te,e[86]=P):P=e[86],E=$o,$="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",R=K?W.length===0?r.jsx(_o,{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(_e=>r.jsx(ki,{icon:T,accent:_e.savedKey!==void 0?"global":void 0,title:_e.title,subtitle:_e.resolveType,active:!1,onClick:()=>q(_e)},_e.savedKey??_e.resolveType))}):Z.length===0&&X.length===0&&se.length===0?r.jsx(_o,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[Z.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:Z.map(_e=>{const Pe=Qse(_e.name,h.length);return r.jsxs("button",{type:"button",onClick:()=>f([...h,_e.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(Pe,{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:L0(_e.name,h.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[_e.count," ",_e.count===1?V:c,_e.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:_e.savedCount})]})]})]})]},_e.name)})}),(X.length>0||se.length>0)&&r.jsxs("div",{className:re("flex flex-col gap-1",Z.length>0&&"mt-4"),children:[X.map(_e=>{const Pe=ne.get(_e.resolveType)??[],ke=b.has(_e.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(ki,{icon:T,title:_e.title,subtitle:_e.resolveType,active:!1,onClick:()=>q(_e)}),Pe.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>k(_e.resolveType),"aria-expanded":ke,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:T2},children:[ke?r.jsx(Qt,{size:12,className:"shrink-0"}):r.jsx(dn,{size:12,className:"shrink-0"}),d(ke?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Pe.length,")"]}),ke&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Pe.map(Ne=>r.jsx(ki,{icon:T,accent:"global",title:Ne.title,subtitle:Ne.resolveType,active:!1,onClick:()=>q(Ne)},Ne.savedKey))})]})]},_e.resolveType)}),se.map(_e=>r.jsx(ki,{icon:T,accent:"global",title:_e.title,subtitle:_e.resolveType,active:!1,onClick:()=>q(_e)},_e.savedKey))]})]})}e[10]=T,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=o,e[19]=S,e[20]=C,e[21]=g,e[22]=m,e[23]=V,e[24]=d,e[25]=n,e[26]=E,e[27]=P,e[28]=D,e[29]=I,e[30]=R,e[31]=$,e[32]=B}else E=e[26],P=e[27],D=e[28],I=e[29],R=e[30],$=e[31],B=e[32];if(D!==Symbol.for("react.early_return_sentinel"))return D;let M;e[87]!==I||e[88]!==R?(M=r.jsx("div",{className:I,children:R}),e[87]=I,e[88]=R,e[89]=M):M=e[89];let O;e[90]!==E||e[91]!==M||e[92]!==$?(O=r.jsx(E,{className:$,children:M}),e[90]=E,e[91]=M,e[92]=$,e[93]=O):O=e[93];let z;return e[94]!==P||e[95]!==O||e[96]!==B?(z=r.jsxs("div",{className:B,children:[P,O]}),e[94]=P,e[95]=O,e[96]=B,e[97]=z):z=e[97],z}function Zse(t){const[e,s]=t;return{name:e,...s}}function ene(t,e){return t.title.localeCompare(e.title)}function tne(t){const[,e]=t;return e}function sne(t,e){return t.title.localeCompare(e.title)}function nne(t,e){return t.title.localeCompare(e.title)}function ine(t){return{resolveType:t.resolveType,title:t.title,folderPath:uS(t.resolveType)}}function rne(t){return{resolveType:t.resolveType,title:t.title,folderPath:uS(t.resolveType),savedKey:t.key}}function one(){return new Set}function lne(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}=fS(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function ane(t){const e=F.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=ie(),g=eo(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,_]=A.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[y,k]=A.useState(L),[w,S]=A.useState(0),[j,C]=A.useState(!1);let N;e[2]!==l||e[3]!==c?(N=Un(c,l),e[2]=l,e[3]=c,e[4]=N):N=e[4];const V=N,T=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,E=Ls()?.taskId??null,P=o??void 0;let D;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==P||e[9]!==E||e[10]!==n?(D={orgSlug:s,virtualMcpId:n,branch:i,threadId:E,previewUrl:P,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=P,e[9]=E,e[10]=n,e[11]=D):D=e[11];const I=D;let R,$,B,M,O,z,U,H;if(e[12]!==a||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const ce=[d,...y],ge=me=>{k(y.slice(0,me)),S(cne)};let Q;e[26]!==a||e[27]!==v||e[28]!==f?(Q=async me=>{const ve=zg(me,a);if(ve){pe.error(ve);return}await f(me,v),C(!1)},e[26]=a,e[27]=v,e[28]=f,e[29]=Q):Q=e[29],R=Q,M="flex h-full w-full min-w-0",B="flex min-w-0 flex-1 flex-col",$="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(O=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=O):O=e[31],z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ce.map((me,ve)=>{const we=ve===ce.length-1,ye=Cn(me);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ve>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>ge(ve),title:ye,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:ye})]},`${ye}-${ve}`)}),e[12]=a,e[13]=y,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=R,e[19]=$,e[20]=B,e[21]=M,e[22]=O,e[23]=z,e[24]=U,e[25]=H}else R=e[18],$=e[19],B=e[20],M=e[21],O=e[22],z=e[23],U=e[24],H=e[25];let K;e[32]!==O||e[33]!==z||e[34]!==U?(K=r.jsx("nav",{"aria-label":O,className:z,children:U}),e[32]=O,e[33]=z,e[34]=U,e[35]=K):K=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=()=>C(!0),e[36]=W):W=e[36];let Y;e[37]!==p?(Y=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=Y):Y=e[38];let X;e[39]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx(wp,{size:14}),e[39]=X):X=e[39];let ne;e[40]!==h||e[41]!==Y?(ne=r.jsx(He,{asChild:!0,children:r.jsx(de,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:W,"aria-label":Y,children:X})}),e[40]=h,e[41]=Y,e[42]=ne):ne=e[42];let se;e[43]!==p?(se=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=se):se=e[44];let oe;e[45]!==se?(oe=r.jsx(Ke,{side:"bottom",children:se}),e[45]=se,e[46]=oe):oe=e[46];let Z;e[47]!==ne||e[48]!==oe?(Z=r.jsxs(We,{children:[ne,oe]}),e[47]=ne,e[48]=oe,e[49]=Z):Z=e[49];let J;e[50]!==K||e[51]!==Z||e[52]!==H?(J=r.jsxs("div",{className:H,children:[K,Z]}),e[50]=K,e[51]=Z,e[52]=H,e[53]=J):J=e[53];const q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",G=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:T});let te;e[54]!==G?(te=r.jsx("p",{className:q,children:G}),e[54]=G,e[55]=te):te=e[55];let le;e[56]!==$||e[57]!==J||e[58]!==te?(le=r.jsxs("div",{className:$,children:[J,te]}),e[56]=$,e[57]=J,e[58]=te,e[59]=le):le=e[59];let ee;e[60]!==a||e[61]!==y||e[62]!==w||e[63]!==v||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==V||e[68]!==p?(ee=r.jsx($o,{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:V?r.jsx(Ui,{schema:V,value:v,onChange:ce=>_(ce),basePath:"",breadcrumbPath:y,onBreadcrumbChange:k,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},w):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=y,e[62]=w,e[63]=v,e[64]=l,e[65]=m,e[66]=I,e[67]=V,e[68]=p,e[69]=ee):ee=e[69];let ae;e[70]!==B||e[71]!==le||e[72]!==ee?(ae=r.jsxs("div",{className:B,children:[le,ee]}),e[70]=B,e[71]=le,e[72]=ee,e[73]=ae):ae=e[73];let ue;e[74]!==u||e[75]!==R||e[76]!==h||e[77]!==j?(ue=r.jsx(Fg,{open:j,onOpenChange:C,defaultBlockId:u,isPending:h,onSubmit:R}),e[74]=u,e[75]=R,e[76]=h,e[77]=j,e[78]=ue):ue=e[78];let he;return e[79]!==M||e[80]!==ae||e[81]!==ue?(he=r.jsxs("div",{className:M,children:[ae,ue]}),e[79]=M,e[80]=ae,e[81]=ue,e[82]=he):he=e[82],he}function cne(t){return t+1}var dne=Object.prototype.toString,Rc=Array.isArray||function(e){return dne.call(e)==="[object Array]"};function Qg(t){return typeof t=="function"}function une(t){return Rc(t)?"array":typeof t}function J9(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function P5(t,e){return t!=null&&typeof t=="object"&&e in t}function hne(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var fne=RegExp.prototype.test;function mne(t,e){return fne.call(t,e)}var pne=/\S/;function gne(t){return!mne(pne,t)}var xne={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function bne(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return xne[s]})}var vne=/\s*/,yne=/\s+/,D5=/\s*=/,_ne=/\s*\}/,Lne=/#|\^|\/|>|\{|&|=|!/;function Sne(t,e){if(!t)return[];var s=!1,n=[],i=[],o=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;o.length;)delete i[o.pop()];else o=[];l=!1,a=!1}var h,f,m;function p(S){if(typeof S=="string"&&(S=S.split(yne,2)),!Rc(S)||S.length!==2)throw new Error("Invalid tags: "+S);h=new RegExp(J9(S[0])+"\\s*"),f=new RegExp("\\s*"+J9(S[1])),m=new RegExp("\\s*"+J9("}"+S[1]))}p(e||$i.tags);for(var g=new Ru(t),x,b,v,_,L,y;!g.eos();){if(x=g.pos,v=g.scanUntil(h),v)for(var k=0,w=v.length;k<w;++k)_=v.charAt(k),gne(_)?(o.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
541
541
  `&&(u(),c="",d=0,s=!1);if(!g.scan(h))break;if(l=!0,b=g.scan(Lne)||"name",g.scan(vne),b==="="?(v=g.scanUntil(D5),g.scan(D5),g.scanUntil(f)):b==="{"?(v=g.scanUntil(m),g.scan(_ne),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(y=n.pop(),!y)throw new Error('Unopened section "'+v+'" at '+x);if(y[1]!==v)throw new Error('Unclosed section "'+y[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&p(v)}if(u(),y=n.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+g.pos);return kne(wne(i))}function wne(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 kne(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 Ru(t){this.string=t,this.tail=t,this.pos=0}Ru.prototype.eos=function(){return this.tail===""};Ru.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};Ru.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 gc(t,e){this.view=t,this.cache={".":this.view},this.parent=e}gc.prototype.push=function(e){return new gc(e,this)};gc.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=P5(o,l[a])||hne(o,l[a])),o=o[l[a++]];else o=i.view[e],c=P5(i.view,e);if(c){n=o;break}i=i.parent}s[e]=n}return Qg(n)&&(n=n.call(this.view)),n};function Pn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Pn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Pn.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||$i.tags).join(":"),o=typeof n<"u",l=o?n.get(i):void 0;return l==null&&(l=Sne(e,s),o&&n.set(i,l)),l};Pn.prototype.render=function(e,s,n,i){var o=this.getConfigTags(i),l=this.parse(e,o),a=s instanceof gc?s:new gc(s,void 0);return this.renderTokens(l,a,n,e,i)};Pn.prototype.renderTokens=function(e,s,n,i,o){for(var l="",a,c,d,u=0,h=e.length;u<h;++u)d=void 0,a=e[u],c=a[0],c==="#"?d=this.renderSection(a,s,n,i,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};Pn.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(Rc(c))for(var u=0,h=c.length;u<h;++u)a+=this.renderTokens(e[4],s.push(c[u]),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(Qg(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}};Pn.prototype.renderInverted=function(e,s,n,i,o){var l=s.lookup(e[1]);if(!l||Rc(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,o)};Pn.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
- `)};Pn.prototype.renderPartial=function(e,s,n,i){if(n){var o=this.getConfigTags(i),l=Qg(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,o);return this.renderTokens(h,s,n,u,i)}}};Pn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Pn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||$i.escape,o=s.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===$i.escape?String(o):i(o)};Pn.prototype.rawValue=function(e){return e[1]};Pn.prototype.getConfigTags=function(e){return Rc(e)?e:e&&typeof e=="object"?e.tags:void 0};Pn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Rc(e))return e.escape};var $i={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){nu.templateCache=t},get templateCache(){return nu.templateCache}},nu=new Pn;$i.clearCache=function(){return nu.clearCache()};$i.parse=function(e,s){return nu.parse(e,s)};$i.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+une(e)+'" was given as the first argument for mustache#render(template, view, partials)');return nu.render(e,s,n,i)};$i.escape=bne;$i.Scanner=Ru;$i.Context=gc;$i.Writer=Pn;function jne(t,e){const s={__resolveType:t},n=qL([s],e)[0];return n?jX(s,n,e):null}function Cne({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=ie(),d=eo(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=A.useState(()=>jne(l,o)),[f,m]=A.useState(h?.data??{}),[p,g]=A.useState([]),[x,b]=A.useState(0),[v,_]=A.useState(!1),[L,y]=A.useState(null),k=L!==null,{save:w,flush:S}=KL({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?Un(h.resolveType,i):null,C=o[l],N=C?xl(l,C):l,V=Ls()?.taskId??null,T={orgSlug:t,virtualMcpId:e,branch:s,threadId:V,previewUrl:n??void 0,siteSlug:u},E=$=>{m($),w(l,$)},P=()=>{k?(y(null),_(!1),b($=>$+1)):y(JSON.stringify(f,null,2))},D=$=>{const B=$??"";try{const M=JSON.parse(B);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),E(M);return}_(!0)}catch{_(!0)}},I=[N,...p],R=$=>{g(p.slice(0,$)),b(B=>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:T2},"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:I.map(($,B)=>{const M=B===I.length-1,O=Cn($);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[B>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>R(B),title:O,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:O})]},`${O}-${B}`)})}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:P,"aria-label":c(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?r.jsx(_s,{size:14}):r.jsx(zo,{size:14})})}),r.jsx(Ke,{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($o,{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(Ui,{schema:j,value:f,onChange:$=>E($),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:T},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(yu,{language:"json",height:"100%",code:L,onChange:D,onSave:$=>{D($),S()}})})]})]})]})})}function Nne(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=ie();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(_o,{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=$S(s.title),e[7]=s.title,e[8]=v):v=e[8];let _;e[9]!==u||e[10]!==s.resolveType?(_=(y,k)=>u(s.resolveType,y,k),e[9]=u,e[10]=s.resolveType,e[11]=_):_=e[11];let L;return e[12]!==o||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==i?(L=r.jsx(ane,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:_,onSaveReferencedBlock:h},g),e[12]=o,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=_,e[24]=i,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==o||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=r.jsx(Cne,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=o,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const R5="__all__",I5={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Vne={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},M0={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},M5="status:";function $5(t){if(!t.startsWith(M5))return null;const e=t.slice(M5.length);return e in M0?e:null}const O5=A.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 u;n[6]!==l||n[7]!==d?(u=re("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=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(Qt,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=r.jsxs(de,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function Xg(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 Tne(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:o,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=ie();let p;if(e[0]!==s||e[1]!==o){let ee;e[3]!==o?(ee=ae=>ae.slug===o,e[3]=o,e[4]=ee):ee=e[4],p=s.find(ee),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 ee;e[8]!==l?(ee=ae=>ae.email===l,e[8]=l,e[9]=ee):ee=e[9],x=n.find(ee),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(o||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(_=g?.name??b?.name??m(a?M0[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=_):_=e[14];const L=_,y=o?`cat:${o}`:l?`author:${l}`:a?`status:${a}`:R5;let k;e[15]!==u||e[16]!==d||e[17]!==h?(k=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=k):k=e[18];const w=k;let S;e[19]!==w||e[20]!==u||e[21]!==d||e[22]!==h?(S=ee=>{ee.startsWith("cat:")?(u(null),h(null),d(ee.slice(4))):ee.startsWith("author:")?(d(null),h(null),u(ee.slice(7))):$5(ee)?(d(null),u(null),h($5(ee))):w()},e[19]=w,e[20]=u,e[21]=d,e[22]=h,e[23]=S):S=e[23];const j=S;let C;e[24]!==L||e[25]!==v?(C=r.jsx(Ut,{asChild:!0,children:r.jsx(O5,{icon:oV,active:v,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=v,e[26]=C):C=e[26];let N;e[27]!==m?(N=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=N):N=e[28];let V;e[29]!==N?(V=r.jsx(Fc,{children:N}),e[29]=N,e[30]=V):V=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let E;e[33]!==T?(E=r.jsx(Nn,{value:R5,children:T}),e[33]=T,e[34]=E):E=e[34];let P;e[35]!==m?(P=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=P):P=e[36];let D;e[37]!==P?(D=r.jsx(Fc,{className:"text-muted-foreground/70",children:P}),e[37]=P,e[38]=D):D=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(M0),e[39]=I):I=e[39];let R;e[40]!==i||e[41]!==m?(R=I.map(ee=>r.jsxs(Nn,{value:`status:${ee}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(M0[ee])}),r.jsx(Xg,{count:i[ee]})]},`status:${ee}`)),e[40]=i,e[41]=m,e[42]=R):R=e[42];let $;e[43]!==s.length||e[44]!==m?($=s.length>0&&r.jsx(Fc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=$):$=e[45];let B;e[46]!==s?(B=s.map(Ane),e[46]=s,e[47]=B):B=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&r.jsx(Fc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let O;e[51]!==n?(O=n.map(Ene),e[51]=n,e[52]=O):O=e[52];let z;e[53]!==y||e[54]!==j||e[55]!==E||e[56]!==D||e[57]!==R||e[58]!==$||e[59]!==B||e[60]!==M||e[61]!==O?(z=r.jsxs(hl,{value:y,onValueChange:j,children:[E,D,R,$,B,M,O]}),e[53]=y,e[54]=j,e[55]=E,e[56]=D,e[57]=R,e[58]=$,e[59]=B,e[60]=M,e[61]=O,e[62]=z):z=e[62];let U;e[63]!==z||e[64]!==V?(U=r.jsxs(Ht,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[V,z]}),e[63]=z,e[64]=V,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=r.jsxs(Ft,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let K;e[69]!==w||e[70]!==v||e[71]!==m?(K=v&&r.jsx(Pne,{label:m("sandbox.postToolbar.clearFilter"),onClick:w}),e[69]=w,e[70]=v,e[71]=m,e[72]=K):K=e[72];const W=Vne[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 X;e[76]!==Y?(X=r.jsx(Ut,{asChild:!0,children:r.jsx(O5,{icon:lV,active:!0,value:Y})}),e[76]=Y,e[77]=X):X=e[77];let ne;e[78]!==m?(ne=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=ne):ne=e[79];let se;e[80]!==ne?(se=r.jsx(Fc,{children:ne}),e[80]=ne,e[81]=se):se=e[81];let oe;e[82]!==f?(oe=ee=>f(ee),e[82]=f,e[83]=oe):oe=e[83];let Z;e[84]===Symbol.for("react.memo_cache_sentinel")?(Z=Object.keys(I5),e[84]=Z):Z=e[84];let J;e[85]!==m?(J=Z.map(ee=>r.jsx(Nn,{value:ee,children:m(I5[ee])},ee)),e[85]=m,e[86]=J):J=e[86];let q;e[87]!==c||e[88]!==oe||e[89]!==J?(q=r.jsx(hl,{value:c,onValueChange:oe,children:J}),e[87]=c,e[88]=oe,e[89]=J,e[90]=q):q=e[90];let G;e[91]!==se||e[92]!==q?(G=r.jsxs(Ht,{align:"end",className:"w-44",children:[se,q]}),e[91]=se,e[92]=q,e[93]=G):G=e[93];let te;e[94]!==X||e[95]!==G?(te=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(Ft,{children:[X,G]})}),e[94]=X,e[95]=G,e[96]=te):te=e[96];let le;return e[97]!==H||e[98]!==K||e[99]!==te?(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,te]}),e[97]=H,e[98]=K,e[99]=te,e[100]=le):le=e[100],le}function Ene(t){return r.jsxs(Nn,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(Xg,{count:t.count})]},`author:${t.email}`)}function Ane(t){return r.jsxs(Nn,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(Xg,{count:t.count})]},`cat:${t.slug}`)}function Pne(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 Dne(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,o=ie();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(He,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Rne,children:r.jsx(Sc,{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 u;e[13]!==d?(u=r.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=r.jsxs(We,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function Rne(t){return t.stopPropagation()}function Ine(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=ie();let c;e[0]!==n||e[1]!==i?(c=r.jsx(Dne,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(tn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==h||e[13]!==f?(p=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:o,"aria-label":f,children:m})}),e[11]=o,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=r.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(We,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(_s,{size:14}),e[24]=_):_=e[24];let L;e[25]!==l||e[26]!==v?(L=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:_})}),e[25]=l,e[26]=v,e[27]=L):L=e[27];let y;e[28]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=y):y=e[29];let k;e[30]!==y?(k=r.jsx(Ke,{side:"bottom",children:y}),e[30]=y,e[31]=k):k=e[31];let w;e[32]!==L||e[33]!==k?(w=r.jsxs(We,{children:[L,k]}),e[32]=L,e[33]=k,e[34]=w):w=e[34];let S;e[35]!==b||e[36]!==w?(S=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,w]}),e[35]=b,e[36]=w,e[37]=S):S=e[37];let j;return e[38]!==c||e[39]!==S||e[40]!==u?(j=r.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,S]}),e[38]=c,e[39]=S,e[40]=u,e[41]=j):j=e[41],j}function Xc(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,onViewJson:l,onDelete:a}=t,c=ie();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(ei,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=r.jsx(Ut,{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:Mne,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(Qe,{onClick:n,children:[r.jsx(Tp,{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(Qe,{onClick:s,children:[r.jsx(an,{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(dr,{}),r.jsxs(Qe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(vu,{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(dr,{}),o&&r.jsxs(Qe,{onClick:o,children:[r.jsx(Np,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(Qe,{onClick:l,children:[r.jsx(zo,{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(dr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(tn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let _;e[22]!==a||e[23]!==v?(_=r.jsxs(Qe,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=_):_=e[24];let L;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=r.jsxs(Ht,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let y;return e[31]!==L||e[32]!==h?(y=r.jsxs(Ft,{children:[h,L]}),e[31]=L,e[32]=h,e[33]=y):y=e[33],y}function Mne(t){return t.stopPropagation()}function $ne(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function One(t){const e=new Map;for(const s of t){const n=$ne(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 B5(t){const e=F.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=re("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=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 z5=A.lazy(()=>Tn(()=>import("./app-editor-CCEPa5_q.js"),__vite__mapDeps([153,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,35,68,69,22,37,23,24,25,26,27,28,29,30,31,32,33,34,36,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,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,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.AppEditor}))),Bne=A.lazy(()=>Tn(()=>import("./post-editor-pLSbc6mp.js"),__vite__mapDeps([154,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,24,50,23,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,97,96,155,129,133,130,131,108,105,101,126,156,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,98,157,158,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,99,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.PostEditor}))),zne=A.lazy(()=>Tn(()=>import("./record-editor-BiTWcS2C.js"),__vite__mapDeps([159,1,2,97,96,69,6,22,37,126,157,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,7,40,8,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,158,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,68,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,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.RecordEditor}))),Fne=A.lazy(()=>Tn(()=>import("./category-editor-BrklTiAF.js"),__vite__mapDeps([160,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,29,23,24,25,26,27,28,30,31,32,33,34,22,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,110,97,96,156,130,131,108,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,98,157,158,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.CategoryEditor}))),Une=A.lazy(()=>Tn(()=>import("./bulk-category-panel-Crj0FXFd.js"),__vite__mapDeps([161,1,2,23,24,25,26,27,28,29,30,31,32,33,34,6,22,35,36,37,38,39,7,40,8,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,96,69,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,68,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,97,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.BulkCategoryPanel}))),Hne=A.lazy(()=>Tn(()=>import("./sections-editor-DYATNkxM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.SectionsEditor}))),Kne=A.lazy(()=>Tn(()=>import("./seo-editor-BqjKMW9L.js"),__vite__mapDeps([162,1,2,35,23,24,25,26,27,28,29,30,31,32,33,34,6,22,36,37,38,39,7,40,8,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,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,100,101,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,99,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.SeoEditor}))),Wne=A.lazy(()=>Tn(()=>import("./variant-calendar-OvwXqvaE.js"),__vite__mapDeps([163,1,2,23,24,25,26,27,28,29,30,31,32,33,34,6,22,35,36,37,38,39,7,40,8,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,96,68,69,70,71,72,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,97,98,101,164,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,99,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.VariantCalendar}))),qne=A.lazy(()=>Tn(()=>import("./post-calendar-hEguUc5o.js"),__vite__mapDeps([165,1,2,24,33,23,25,26,27,28,29,30,31,32,34,6,22,35,36,37,38,39,7,40,8,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,166,68,69,70,71,72,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.PostCalendar}))),Gne=A.lazy(()=>Tn(()=>import("./redirect-editor-feQIS-ih.js"),__vite__mapDeps([167,1,2,133,6,97,96,69,22,37,158,26,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,68,23,24,25,27,28,29,30,31,32,33,34,35,36,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,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,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.RedirectEditor})));function Yne(t){const e=F.c(20),{deepLinkPage:s}=t,n=eo(),{currentBranch:i}=sn(),{org:o}=qe(),l=n?.entity?.id??null,a=ni(),c=Pl(),{runtime:d,previewServerUrl:u}=En(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=lse({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${o.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=r.jsx(rse,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(_o,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==o.slug||e[17]!==p||e[18]!==l?(g=r.jsx(Qne,{orgSlug:o.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=o.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const F5=2e3,Jne=15;function U5(t,e,s,n){return typeof e!="string"||s&&(hw(e,s,n)||t.state.dataUpdateCount>=Jne)?!1:F5}function Qne({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:o,devServerReady:l,sandboxWarming:a}){const c=ie(),d=Ls()?.taskId??null,u={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:h,isLoading:f}=_f(u,{fetchEnabled:l}),[m,p]=A.useState("pages"),[g,x]=A.useState(null),[b,v]=A.useState(null),_=!!(o?.pageId||o?.path||o?.pathTemplate),[L,y]=A.useState(!1);if(_&&!L&&g===null&&h){y(!0);const fe=PM(ih(h),o??{});fe&&(p("pages"),x({collection:"pages",key:fe.key,path:fe.path}))}const[k,w]=A.useState(""),[S,j]=A.useState(null),[C,N]=A.useState(null),[V,T]=A.useState(null),[E,P]=A.useState("date-desc"),[D,I]=A.useState(()=>new Set),[R,$]=A.useState(null),B=()=>{I(new Set),$(null)},M=fe=>{x(fe),v(null)},[O,z]=A.useState(m);O!==m&&(z(m),w(""),j(null),N(null),T(null),P("date-desc"),I(new Set),$(null));const{data:U,isLoading:H,isFetching:K}=Lf(u,{fetchEnabled:l,refetchInterval:fe=>{const Ve=fe.state.data;if(m==="apps"&&g&&g.collection==="apps"){const Be=h?.[g.key];return U5(fe,typeof Be?.__resolveType=="string"?Be.__resolveType:void 0,Ve)}if(m==="site"&&h){const Be=Ve?M1(h,Ve):null,Se=h.site,ct=Be?.resolveType??(typeof Se?.__resolveType=="string"?Se.__resolveType:void 0);return U5(fe,ct,Ve,["seo"])}return!1}}),W=(fe,Ve)=>!hw(fe,U,Ve)&&(H||K),{catalog:Y,isLoading:X}=nse(U??void 0,h??void 0,{enabled:m==="apps"}),ne=Kse({orgSlug:t,virtualMcpId:e,branch:s,meta:U}),se=Du(u),oe=Gte(u),[Z,J]=A.useState(null),[q,G]=A.useState(),[te,le]=A.useState(null),[ee,ae]=A.useState(null),[ue,he]=A.useState(null),ce=!h||!U;if(f||H||ce&&a)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})});if(ce)return r.jsx(_o,{title:"Could not load site data."});const ge=ih(h).sort((fe,Ve)=>fe.name.localeCompare(Ve.name)),Q=Q8(h).sort((fe,Ve)=>fe.from.localeCompare(Ve.from)),me=M2(h,U),ve=m==="sections"?wM(U):[],we=M1(h,U),ye=xw(h),Le=Yg.some(fe=>ye[fe].length>0),Ce=Dd(m)?ye[m]:[],Te=(Le?su(h,"categories"):[]).map(({key:fe,payload:Ve})=>{const Be=typeof Ve.slug=="string"?Ve.slug:"",Se=typeof Ve.name=="string"?Ve.name:"";return{slug:Be||fe,name:Se||Be||fe}}).filter(fe=>fe.slug).sort((fe,Ve)=>fe.name.localeCompare(Ve.name)),_e=m==="posts"&&(D.size>0||R!==null),Pe=_e?_w(h).filter(fe=>D.has(fe.key)):[],ke=Q4(U,"loaders"),Ne=Q4(U,"actions");if(!kf(h,U)&&!Le&&ke===0&&Ne===0)return r.jsx(_o,{icon:cn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Fe={pages:ge.length,sections:me.length,apps:Y.length,loaders:ke,actions:Ne,redirects:Q.length,posts:ye.posts.length,authors:ye.authors.length,categories:ye.categories.length},Ye=new Set(ge.map(fe=>ko(fe.path))),Ie=new Set(ge.map(fe=>fe.name)),Re=new Set(me.map(fe=>fe.name)),Oe=async fe=>{const Ve=h[fe.key];if(!Ve)return;const Be=QL(h,fe.key),Se=XL(h,fe.key,Math.max(0,Be-1)),ct=cJ(Ve.sections,Se);if(ct)try{await se.mutateAsync({blockKey:fe.key,data:{...Ve,sections:ct}}),pe.success(`Variant added to "${fe.name}"`),x({collection:"pages",key:fe.key,path:fe.path})}catch(mt){pe.error(mt instanceof Error?mt.message:"Could not add variant")}},tt=()=>{G(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=fe=>{G(void 0),J({mode:"duplicate",sourceKey:fe.key,initialName:j5(Ie,fe.name),initialPath:ase(Ye,fe.path)})},nt=fe=>{G(void 0),J({mode:"rename",sourceKey:fe.key,initialName:fe.name,initialPath:fe.path})},ot=async fe=>{if(!Z)return;const{mode:Ve,sourceKey:Be}=Z;try{if(Ve==="create"){let Se;if(fe.templateKey){const mt=h[fe.templateKey];if(!mt)throw new Error("Selected template no longer exists.");Se={...mt,name:fe.name,path:fe.path}}else Se=use(fe.name,fe.path);const ct=fse(h,fe.name);await se.mutateAsync({blockKey:ct,data:Se}),pe.success(`Created "${fe.name}"`),x({collection:"pages",key:ct,path:fe.path})}else if(Ve==="duplicate"&&Be){const Se=h[Be];if(!Se)throw new Error("Source page not found");const{key:ct,data:mt}=dse({source:Se,pages:ge,newName:fe.name,newPath:fe.path});await se.mutateAsync({blockKey:ct,data:mt}),pe.success(`Duplicated as "${fe.name}"`),x({collection:"pages",key:ct,path:fe.path})}else if(Ve==="rename"&&Be){const Se=h[Be];if(!Se)throw new Error("Page not found");const ct={...Se,name:fe.name,path:fe.path};await se.mutateAsync({blockKey:Be,data:ct}),pe.success("Page updated"),g?.collection==="pages"&&g.key===Be&&x({collection:"pages",key:Be,path:fe.path})}J(null)}catch(Se){G(Se instanceof Error?Se.message:"Save failed")}},Me=({path:fe})=>{if(!Z)return null;const Ve=ko(fe);return(Z.mode==="rename"?ko(Z.initialPath):null)!==Ve&&Ye.has(Ve)?`A page with path "${fe}" already exists.`:null},lt=async(fe,Ve,Be)=>{await se.mutateAsync({blockKey:Ve,data:{...Be,name:Ve,__resolveType:fe}}),pe.success(c("sandbox.contentBrowser.createdSection",{name:Ve})),x({collection:"sections",key:Ve})},gt=Dg((fe,Ve)=>se.mutate({blockKey:fe,data:Ve})),Xe=async fe=>{const Ve=h[fe.key];if(!Ve){pe.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Be=cse(h,fe.key),Se=j5(Re,fe.name),ct={...Ve,name:Se};try{await se.mutateAsync({blockKey:Be,data:ct}),pe.success(c("sandbox.contentBrowser.duplicatedSection",{name:fe.name})),x({collection:"sections",key:Be})}catch(mt){pe.error(mt instanceof Error?mt.message:c("sandbox.contentBrowser.duplicateFailed"))}},be=async fe=>{if(!te)return;const Ve=h[te];if(!Ve){pe.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await se.mutateAsync({blockKey:te,data:{...Ve,name:fe}}),pe.success(c("sandbox.contentBrowser.sectionRenamed")),le(null)}catch(Be){pe.error(Be instanceof Error?Be.message:c("sandbox.contentBrowser.renameFailed"))}},Ue=async()=>{const fe="/redirect-from",Ve=AM(h,fe),Be=VM({from:fe,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await se.mutateAsync({blockKey:Ve,data:Be}),pe.success("Created redirect"),x({collection:"redirects",key:Ve})}catch(Se){pe.error(Se instanceof Error?Se.message:"Could not create redirect")}},Ze=async fe=>{const Ve=Y9(h,fe),Be=Ca(Ve,fe,Lw(fe));try{await se.mutateAsync({blockKey:Ve,data:Be}),pe.success(`Created ${Pd[fe]}`),x({collection:fe,key:Ve})}catch(Se){pe.error(Se instanceof Error?Se.message:"Could not create")}},ht=async fe=>{const Ve=Y9(h,"posts"),Be=Ca(Ve,"posts",Ise(fe));try{await se.mutateAsync({blockKey:Ve,data:Be}),pe.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),z("posts"),x({collection:"posts",key:Ve}),v(null)}catch(Se){pe.error(Se instanceof Error?Se.message:c("sandbox.postCalendar.couldNotCreate"))}},st=async(fe,Ve)=>{const Be=h[fe],Se=Be?$se(md(Be,"posts"),Ve):null;if(!Se){pe.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await se.mutateAsync({blockKey:fe,data:Ca(fe,"posts",Se)})}catch(ct){pe.error(ct instanceof Error?ct.message:c("sandbox.postCalendar.couldNotReschedule"))}},wt=async fe=>{const Ve=h[fe.key];if(!Ve){pe.error("Record not found.");return}const Be=Y9(h,fe.kind),Se=fe.kind==="posts"?"title":"name",ct={...structuredClone(md(Ve,fe.kind)),[Se]:`${fe.label} (copy)`};try{await se.mutateAsync({blockKey:Be,data:Ca(Be,fe.kind,ct)}),pe.success(`Duplicated "${fe.label}"`),x({collection:fe.kind,key:Be})}catch(mt){pe.error(mt instanceof Error?mt.message:"Duplicate failed")}},dt=fe=>{I(Ve=>{const Be=new Set(Ve);return Be.has(fe)?Be.delete(fe):Be.add(fe),Be})},Lt=fe=>{p("posts"),z("posts"),x(null),v(null),w(""),j(null),N(null),T(null),P("date-desc"),I(new Set),$(fe||null)},De=async(fe,Ve)=>{const Be=[...D];let Se=0;for(const ct of Be){const mt=h[ct],Xt=md(mt,"posts"),Dt=fe==="add"?jse(Xt,Ve):Cse(Xt,Ve);Dt!==Xt&&(await se.mutateAsync({blockKey:ct,data:Ca(ct,"posts",N5(Dt))}),Se+=1)}return Se},rt=async(fe,Ve)=>{const Be=D.size;try{const Se=await De(fe,Ve),ct=fe==="add"?"Added to":"Moved",mt=Be-Se;pe.success(`${ct} ${Se} ${Se===1?"post":"posts"}`+(mt>0?` (${mt} already set)`:"")),B()}catch(Se){pe.error(Se instanceof Error?Se.message:"Bulk update failed")}},yt=async()=>{if(ee)try{if(ee.kind==="blog-bulk"){for(const Se of ee.keys)await oe.mutateAsync({blockKey:Se});pe.success(`Deleted ${ee.count} ${ee.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&ee.keys.includes(g.key)&&x(null),B(),ae(null);return}const{kind:fe,key:Ve,label:Be}=ee;if(fe==="blog"){if(ee.blogKind==="categories"){const Se=md(h[Ve],"categories").slug,ct=typeof Se=="string"?Se:"";if(ct)for(const{key:mt,payload:Xt}of su(h,"posts")){const Dt=Nse(Xt,ct);Dt!==Xt&&await se.mutateAsync({blockKey:mt,data:Ca(mt,"posts",N5(Dt))})}}await oe.mutateAsync({blockKey:Ve})}else await oe.mutateAsync({blockKey:Ve});pe.success(`Deleted "${Be}"`),g&&g.collection!=="available-section"&&g.key===Ve&&x(null),ae(null)}catch(fe){pe.error(fe instanceof Error?fe.message:"Delete failed")}},ut=oe.isPending||se.isPending,at=ee?.kind==="blog"?Pd[ee.blogKind]:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"}`:ee?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[r.jsx(ise,{active:m,counts:Fe,showBlog:Le,onSelect:fe=>{p(fe),x(null),v(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&r.jsx(Xne,{activeCollection:m,pages:ge,redirects:Q,sections:me,availableSections:ve,appCatalog:Y,appCatalogLoading:X,blogEntries:Ce,decofile:h,searchQuery:k,onSearchChange:w,postCategoryFilter:S,postAuthorFilter:C,postStatusFilter:V,postSort:E,onPostCategoryFilterChange:fe=>{j(fe),I(new Set)},onPostAuthorFilterChange:fe=>{N(fe),I(new Set)},onPostStatusFilterChange:fe=>{T(fe),I(new Set)},onPostSortChange:P,selectedPostKeys:D,postBulkPanelOpen:_e,onTogglePostSelect:dt,onSelectAllPosts:fe=>I(new Set(fe)),onClearPostSelection:()=>I(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>ae({kind:"blog-bulk",keys:[...D],count:D.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?tt():m==="redirects"?Ue():Dd(m)&&Ze(m)},onDuplicatePage:it,onRenamePage:nt,onAddPageVariant:Oe,onDeletePage:fe=>ae({kind:"page",key:fe.key,label:fe.name}),onEditPageSeo:fe=>{const Ve={collection:"pages",key:fe.key,path:fe.path};x(Ve),v(fe.key)},onViewPageJson:fe=>he(fe.key),onDuplicateSection:Xe,onRenameSection:fe=>le(fe.key),onDeleteSection:fe=>ae({kind:"section",key:fe.key,label:fe.name}),onDeleteRedirect:fe=>ae({kind:"redirect",key:fe.key,label:fe.from||fe.key}),onDuplicateBlog:wt,onDeleteBlog:fe=>ae({kind:"blog",blogKind:fe.kind,key:fe.key,label:fe.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?r.jsx(Xse,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,kind:m}):r.jsx(A.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),children:m==="calendar"?r.jsx(Wne,{decofile:h}):m==="post-schedule"?r.jsx(qne,{decofile:h,support:ne,isCreating:se.isPending,onCreate:fe=>{ht(fe)},onReschedule:(fe,Ve)=>{st(fe,Ve)},onSelect:fe=>{p("posts"),z("posts"),x({collection:"posts",key:fe}),v(null)}}):m==="site"?we?r.jsx(z5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:we.key,block:h[we.key],decofile:h,meta:U,title:"Site",excludeFields:["seo"],schemaPending:W(we.resolveType,["seo"]),previewBaseUrl:n},`site:${we.key}`):r.jsx(_o,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?r.jsx(Kne,{orgSlug:t,virtualMcpId:e,branch:s,decofile:h,meta:U,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?r.jsx(Nne,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,isCreating:se.isPending,onCreateAvailable:lt,onSaveReferencedBlock:gt}):_e?r.jsx(Une,{posts:Pe,categories:Te,initialSlug:R,isPending:se.isPending,onApply:(fe,Ve)=>{rt(fe,Ve)},onClose:B},R??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?r.jsx(z5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:n,schemaPending:W(typeof h[g.key]?.__resolveType=="string"?String(h[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?r.jsx(Bne,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:i},`post:${g.key}`):g.collection==="categories"?r.jsx(Fne,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,onManagePosts:Lt,onOpenPost:fe=>{p("posts"),z("posts"),x({collection:"posts",key:fe}),v(null)},previewBaseUrl:i},`category:${g.key}`):g.collection==="authors"?r.jsx(zne,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:h[g.key]},`authors:${g.key}`):g.collection==="redirects"?r.jsx(Gne,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key]},`redirect:${g.key}`):r.jsx(Hne,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>v(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):r.jsx(_o,{title:`Select ${Dd(m)?`a ${Pd[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),Z&&r.jsx(xse,{open:!!Z,mode:Z.mode,initialName:Z.initialName,initialPath:Z.initialPath,isPending:se.isPending,error:q,templates:ge,validate:Me,onSubmit:ot,onOpenChange:fe=>{fe||(J(null),G(void 0))}}),te&&r.jsx(bse,{open:!!te,blockKey:te,initialName:me.find(fe=>fe.key===te)?.name??te,isPending:se.isPending,onSubmit:be,onOpenChange:fe=>{fe||le(null)}}),ue&&r.jsx(Wse,{open:!!ue,onOpenChange:fe=>{fe||he(null)},pageKey:ue,decofile:h,onSave:fe=>se.mutateAsync({blockKey:ue,data:fe})}),r.jsx(ec,{open:!!ee,onOpenChange:fe=>{!fe&&!ut&&ae(null)},children:r.jsxs(tc,{children:[r.jsxs(sc,{children:[r.jsx(nc,{children:`Delete ${at}?`}),r.jsx(ic,{children:ee?.kind==="section"?`"${ee.label}" will be removed. Pages that still reference it will lose this section.`:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ee?`"${ee.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(rc,{children:[r.jsx(oc,{disabled:ut,children:"Cancel"}),r.jsx(lc,{onClick:fe=>{fe.preventDefault(),yt()},disabled:ut,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ut?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function Xne(t){const e=F.c(82),{activeCollection:s,pages:n,redirects:i,sections:o,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:_,onPostSortChange:L,selectedPostKeys:y,postBulkPanelOpen:k,onTogglePostSelect:w,onSelectAllPosts:S,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:N,selection:V,onSelect:T,onCreate:E,onDuplicatePage:P,onRenamePage:D,onAddPageVariant:I,onDeletePage:R,onEditPageSeo:$,onViewPageJson:B,onDuplicateSection:M,onRenameSection:O,onDeleteSection:z,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:K}=t;let W,Y,X,ne,se,oe,Z;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==I||e[7]!==N||e[8]!==j||e[9]!==E||e[10]!==K||e[11]!==R||e[12]!==U||e[13]!==z||e[14]!==H||e[15]!==P||e[16]!==M||e[17]!==$||e[18]!==C||e[19]!==v||e[20]!==b||e[21]!==L||e[22]!==_||e[23]!==D||e[24]!==O||e[25]!==f||e[26]!==T||e[27]!==S||e[28]!==w||e[29]!==B||e[30]!==n||e[31]!==p||e[32]!==k||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==o||e[39]!==y||e[40]!==V){const te=h.toLowerCase(),le=n.filter(be=>!te||be.name.toLowerCase().includes(te)||be.path.toLowerCase().includes(te)),ee=i.filter(be=>!te||be.from.toLowerCase().includes(te)||be.to.toLowerCase().includes(te)),ae=o.filter(be=>!te||be.name.toLowerCase().includes(te)||be.key.toLowerCase().includes(te)||be.resolveType.toLowerCase().includes(te)),ue=l.filter(be=>!te||be.title.toLowerCase().includes(te)||be.resolveType.toLowerCase().includes(te)||(be.description?.toLowerCase().includes(te)??!1)),he=One(ae),ce=a.filter(be=>!te||be.title.toLowerCase().includes(te)||be.app.toLowerCase().includes(te)||be.vendor.toLowerCase().includes(te)||be.category.toLowerCase().includes(te)),ge=d.filter(be=>!te||be.label.toLowerCase().includes(te)||be.subtitle.toLowerCase().includes(te)),Q=s==="posts",me=sie,ve=Q?_w(u):[],we=new Map,ye=new Map,Le={published:0,scheduled:0,draft:0};for(const be of ve)Le[be.status]=Le[be.status]+1;for(const be of ve){for(const Ue of be.categorySlugs)we.set(Ue,(we.get(Ue)??0)+1);for(const Ue of be.authorEmails)ye.set(Ue,(ye.get(Ue)??0)+1)}const Ce=(Q?su(u,"categories"):[]).map(be=>{const{key:Ue,payload:Ze}=be,ht=me(Ze.slug)||Ue;return{slug:ht,name:me(Ze.name)||me(Ze.slug)||Ue,count:we.get(ht)??0}}).filter(tie),Te=(Q?su(u,"authors"):[]).map(be=>{const{key:Ue,payload:Ze}=be,ht=me(Ze.email);return{email:ht,name:me(Ze.name)||me(Ze.email)||Ue,count:ye.get(ht)??0}}).filter(eie);let _e;e[48]!==m?(_e=be=>!m||be.categorySlugs.includes(m),e[48]=m,e[49]=_e):_e=e[49];let Pe;e[50]!==p?(Pe=be=>!p||be.authorEmails.includes(p),e[50]=p,e[51]=Pe):Pe=e[51];let ke;e[52]!==g?(ke=be=>!g||be.status===g,e[52]=g,e[53]=ke):ke=e[53];let Ne;e[54]!==x?(Ne=(be,Ue)=>{if(x==="az")return be.title.localeCompare(Ue.title);if(x==="za")return Ue.title.localeCompare(be.title);const Ze=be.date.localeCompare(Ue.date);return x==="date-asc"?Ze:-Ze},e[54]=x,e[55]=Ne):Ne=e[55];const Fe=ve.filter(be=>!te||be.title.toLowerCase().includes(te)||be.slug.toLowerCase().includes(te)).filter(_e).filter(Pe).filter(ke).sort(Ne),Ye=y.size,Ie=Fe.map(Zne),Re=Ie.length>0&&Ie.every(be=>y.has(be)),Oe=Ye>0||k,tt=()=>{Re?j():S(Ie)},it=`Search ${s}…`,nt=Dd(s)?`Create new ${Pd[s]}`:s==="redirects"?"Create new redirect":"Create new page",ot=s!=="apps"&&s!=="sections";se="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let Me;e[56]===Symbol.for("react.memo_cache_sentinel")?(Me=r.jsx(mf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=Me):Me=e[56];let lt;e[57]!==f?(lt=be=>f(be.target.value),e[57]=f,e[58]=lt):lt=e[58];let gt;e[59]!==it||e[60]!==h||e[61]!==lt?(gt=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[Me,r.jsx("input",{type:"text",value:h,onChange:lt,placeholder:it,"aria-label":it,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=it,e[60]=h,e[61]=lt,e[62]=gt):gt=e[62];let Xe;e[63]!==nt||e[64]!==E||e[65]!==ot?(Xe=ot&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",onClick:E,"aria-label":nt,children:r.jsx($t,{size:14})})}),r.jsx(Ke,{side:"bottom",children:nt})]}),e[63]=nt,e[64]=E,e[65]=ot,e[66]=Xe):Xe=e[66],e[67]!==gt||e[68]!==Xe?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[gt,Xe]}),e[67]=gt,e[68]=Xe,e[69]=oe):oe=e[69],Z=Q&&(Oe?r.jsx(Ine,{count:Ye,allSelected:Re,onToggleSelectAll:tt,onDelete:N,onExit:C}):r.jsx(Tne,{categories:Ce,authors:Te,categoryFilter:m,statusCounts:Le,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:_,onSortChange:L})),W=$o,ne="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",Y="flex flex-col gap-1 p-1.5",X=s==="pages"?le.length===0?r.jsx(ja,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(be=>{const Ue=V?.collection==="pages"&&V.key===be.key,Ze=QL(u,be.key);return r.jsx(ki,{icon:Or,title:be.name,subtitle:be.path,active:Ue,variantCount:Ze,onClick:()=>T({collection:"pages",key:be.key,path:be.path}),menu:r.jsx(Xc,{onDuplicate:()=>P(be),onRename:()=>D(be),onAddVariant:()=>I(be),onEditSeo:()=>$(be),onViewJson:()=>B(be),onDelete:()=>R(be)})},be.key)}):s==="sections"?ae.length===0&&ue.length===0?r.jsx(ja,{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:[he.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(B5,{icon:Hr,label:"Saved sections"}),he.map(be=>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:be.label}),be.sections.map(Ue=>{const Ze=V?.collection==="sections"&&V.key===Ue.key;return r.jsx(ki,{icon:Hr,accent:"global",title:Ue.name,subtitle:be.label,active:Ze,onClick:()=>T({collection:"sections",key:Ue.key}),menu:r.jsx(Xc,{onDuplicate:()=>M(Ue),onRename:()=>O(Ue),onDelete:()=>z(Ue)})},Ue.key)})]},be.label))]}),ue.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(B5,{icon:Or,label:"Available sections",className:re(he.length>0&&"mt-3")}),ue.map(be=>{const Ue=V?.collection==="available-section"&&V.resolveType===be.resolveType,Ze=be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(ki,{icon:Or,title:be.title,subtitle:Ze??be.resolveType,active:Ue,onClick:()=>T({collection:"available-section",resolveType:be.resolveType,title:be.title})},be.resolveType)})]})]}):s==="apps"?c?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ft,{size:18,className:"animate-spin text-muted-foreground"})}):ce.length===0?r.jsx(ja,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ce.map(be=>{const Ue=V?.collection==="apps"&&be.blockKey!==null&&V.key===be.blockKey;return r.jsx(ki,{icon:r6,logoUrl:be.logo,title:be.title,subtitle:be.category,active:Ue,trailing:be.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(!be.installed||!be.blockKey){pe.message(`${be.title} is not installed on this site.`);return}T({collection:"apps",key:be.blockKey})}},be.id)}):s==="redirects"?ee.length===0?r.jsx(ja,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ee.map(be=>r.jsx(ki,{icon:wy,title:be.from||"(no source)",subtitle:`→ ${be.to||"(no target)"}`,active:V?.collection==="redirects"&&V.key===be.key,trailing:r.jsx(vse,{type:be.type}),onClick:()=>T({collection:"redirects",key:be.key}),menu:r.jsx(Xc,{onDelete:()=>U(be)})},be.key)):Q?Fe.length===0?r.jsx(ja,{hasItems:ve.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Fe.map(be=>{const Ue={key:be.key,kind:"posts",label:be.title,subtitle:be.slug};return r.jsx(ki,{icon:Ti,title:be.title,subtitle:be.slug||"no slug",invalid:be.missing.length>0,invalidReason:`Missing: ${be.missing.join(", ")}`,active:V?.collection==="posts"&&V.key===be.key,selectable:!0,selectionActive:Oe,selected:y.has(be.key),onToggleSelect:()=>w(be.key),onClick:()=>Oe?w(be.key):T({collection:"posts",key:be.key}),menu:r.jsx(Xc,{onDuplicate:()=>H(Ue),onDelete:()=>K(Ue)})},be.key)}):ge.length===0?r.jsx(ja,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Dd(s)?Pd[s]:"item"}.`}):ge.map(be=>{const Ue=V?.collection===be.kind&&V.key===be.key;return r.jsx(ki,{icon:be.kind==="posts"?Ti:be.kind==="authors"?s2:ef,title:be.label,subtitle:be.subtitle,active:Ue,onClick:()=>T({collection:be.kind,key:be.key}),menu:r.jsx(Xc,{onDuplicate:()=>H(be),onDelete:()=>K(be)})},be.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=I,e[7]=N,e[8]=j,e[9]=E,e[10]=K,e[11]=R,e[12]=U,e[13]=z,e[14]=H,e[15]=P,e[16]=M,e[17]=$,e[18]=C,e[19]=v,e[20]=b,e[21]=L,e[22]=_,e[23]=D,e[24]=O,e[25]=f,e[26]=T,e[27]=S,e[28]=w,e[29]=B,e[30]=n,e[31]=p,e[32]=k,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=o,e[39]=y,e[40]=V,e[41]=W,e[42]=Y,e[43]=X,e[44]=ne,e[45]=se,e[46]=oe,e[47]=Z}else W=e[41],Y=e[42],X=e[43],ne=e[44],se=e[45],oe=e[46],Z=e[47];let J;e[70]!==Y||e[71]!==X?(J=r.jsx("div",{className:Y,children:X}),e[70]=Y,e[71]=X,e[72]=J):J=e[72];let q;e[73]!==W||e[74]!==ne||e[75]!==J?(q=r.jsx(W,{className:ne,children:J}),e[73]=W,e[74]=ne,e[75]=J,e[76]=q):q=e[76];let G;return e[77]!==se||e[78]!==oe||e[79]!==Z||e[80]!==q?(G=r.jsxs("div",{className:se,children:[oe,Z,q]}),e[77]=se,e[78]=oe,e[79]=Z,e[80]=q,e[81]=G):G=e[81],G}function Zne(t){return t.key}function eie(t){return t.email}function tie(t){return t.slug}function sie(t){return typeof t=="string"?t:""}function nie(t){const e=F.c(17),{virtualMcpId:s}=t,n=ie(),i=Ws(s),{activeTask:o}=sn();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=br(l);if(!(en(i?.metadata)||en(o?.metadata))){let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(cn,{size:24,className:"text-muted-foreground/60"}),e[1]=u):u=e[1];let h;e[2]!==n?(h=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=h):h=e[3];let f;e[4]!==h?(f=r.jsx("div",{children:h}),e[4]=h,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:[u,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(Yne,{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 iie(t){const e=F.c(6),{virtualMcpId:s}=t,n=Ws(s),i=Hy();let o;e[0]!==i||e[1]!==n?(o=jf(i,u7(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(rie,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=r.jsx(aie,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function rie(){const t=F.c(12),e=ie();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(Xp,{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 oie(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function lie(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function aie(t){const e=F.c(99),{config:s}=t,n=ie(),[i,o]=A.useState(""),l=pf(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=BS(a),d=Yf(),[u,h]=A.useState(!1),[f,m]=A.useState(null),p=A.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const O=Array.from(M);if(O.length===0)return;const z=[];for(const U of O)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const K=H;z.push(`${U.name} (${K instanceof Error?K.message:"upload failed"})`)}await c.refetch(),z.length>0&&pe.error(z.length===O.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:z.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:z.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),h(!0)},e[8]=b):b=e[8];const v=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){h(!1)},e[9]=_):_=e[9];const L=_;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),h(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const k=y,[w,S]=P1();let j,C,N,V,T,E;if(e[12]!==s.name||e[13]!==l||e[14]!==S||e[15]!==w||e[16]!==x||e[17]!==u||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 M=(c.data?.pages??[]).flatMap(cie),O=lie(M,oie(w)),z=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 X;e[40]!==K||e[41]!==Y?(X=r.jsxs("div",{className:"min-w-0",children:[K,Y]}),e[40]=K,e[41]=Y,e[42]=X):X=e[42];let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>p.current?.click(),e[43]=ne):ne=e[43];let se;e[44]!==d.isPending?(se=d.isPending?r.jsx(ft,{size:14,className:"animate-spin"}):r.jsx(ti,{size:14}),e[44]=d.isPending,e[45]=se):se=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 Z;e[49]!==se||e[50]!==oe||e[51]!==d.isPending?(Z=r.jsxs(de,{type:"button",size:"sm",disabled:d.isPending,onClick:ne,children:[se,oe]}),e[49]=se,e[50]=oe,e[51]=d.isPending,e[52]=Z):Z=e[52];let J;e[53]!==x?(J=r.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ge=>{const Q=Array.from(ge.target.files??[]);ge.target.value="",x(Q)}}),e[53]=x,e[54]=J):J=e[54],e[55]!==X||e[56]!==Z||e[57]!==J?(E=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[X,Z,J]}),e[55]=X,e[56]=Z,e[57]=J,e[58]=E):E=e[58];let q;e[59]!==n?(q=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=q):q=e[60],e[61]!==U||e[62]!==i||e[63]!==q?(j=r.jsx(hf,{value:i,onChange:o,isSearching:U,placeholder:q,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=q,e[64]=j):j=e[64];let G;e[65]===Symbol.for("react.memo_cache_sentinel")?(G=()=>p.current?.click(),e[65]=G):G=e[65];const te=u&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ee;e[66]!==te||e[67]!==le?(ee=re("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",te,le),e[66]=te,e[67]=le,e[68]=ee):ee=e[68];let ae;e[69]===Symbol.for("react.memo_cache_sentinel")?(ae=r.jsx(ti,{size:16,className:"text-muted-foreground"}),e[69]=ae):ae=e[69];let ue;e[70]!==n?(ue=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ue):ue=e[71];let he;e[72]!==n?(he=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=he):he=e[73];let ce;e[74]!==ue||e[75]!==he?(ce=r.jsxs("p",{className:"text-xs text-muted-foreground",children:[ue," ",he]}),e[74]=ue,e[75]=he,e[76]=ce):ce=e[76],e[77]!==k||e[78]!==ee||e[79]!==ce?(C=r.jsxs("button",{type:"button",onClick:G,onDragOver:v,onDragLeave:L,onDrop:k,className:ee,children:[ae,ce]}),e[77]=k,e[78]=ee,e[79]=ce,e[80]=C):C=e[80],N="min-h-0 flex-1 overflow-y-auto pr-1",V=M.length===0?z?r.jsx(H5,{title:n("filePicker.filePickerDialog.noMatches",{query:z}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):r.jsx(H5,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):r.jsx("div",{ref:S,className:"flex items-start gap-3",children:O.map((ge,Q)=>r.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ge.map(me=>r.jsx(die,{item:me,onDelete:()=>m(me)},me.key))},Q))}),e[12]=s.name,e[13]=l,e[14]=S,e[15]=w,e[16]=x,e[17]=u,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]=C,e[27]=N,e[28]=V,e[29]=T,e[30]=E}else j=e[25],C=e[26],N=e[27],V=e[28],T=e[29],E=e[30];let P;e[81]!==c||e[82]!==n?(P=c.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(de,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=P):P=e[83];let D;e[84]!==P||e[85]!==N||e[86]!==V?(D=r.jsxs("div",{className:N,children:[V,P]}),e[84]=P,e[85]=N,e[86]=V,e[87]=D):D=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let R;e[89]!==s.id||e[90]!==f?(R=r.jsx(fie,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=R):R=e[91];let $;return e[92]!==j||e[93]!==C||e[94]!==D||e[95]!==R||e[96]!==T||e[97]!==E?($=r.jsxs("div",{className:T,children:[E,j,C,D,R]}),e[92]=j,e[93]=C,e[94]=D,e[95]=R,e[96]=T,e[97]=E,e[98]=$):$=e[98],$}function cie(t){return t.items}function H5(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(Ei,{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 die(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=zS(s.key),e[0]=s.key,e[1]=i):i=e[1];const o=i;let l;e[2]!==s.key?(l=Ug(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:uie}):r.jsx("div",{className:"flex aspect-square items-center justify-center",children:r.jsx(Ti,{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 u=s.key;let h;e[12]!==s.key?(h=Vh(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=r.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=FS(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(hie,{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 uie(t){t.target.style.display="none"}function hie(t){const e=F.c(36),{item:s,onDelete:n}=t,i=ie(),[o,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{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 u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(n2,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Ut,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o?r.jsx(Rt,{size:14}):r.jsx(an,{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(Qe,{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(yn,{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(Qe,{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 _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(tn,{size:14}),e[23]=_):_=e[23];let L;e[24]!==i?(L=i("assets.browser.deleteAction"),e[24]=i,e[25]=L):L=e[25];let y;e[26]!==n||e[27]!==L?(y=r.jsxs(Qe,{variant:"destructive",onClick:n,children:[_,L]}),e[26]=n,e[27]=L,e[28]=y):y=e[28];let k;e[29]!==v||e[30]!==y||e[31]!==p?(k=r.jsxs(Ht,{align:"end",children:[p,v,y]}),e[29]=v,e[30]=y,e[31]=p,e[32]=k):k=e[32];let w;return e[33]!==k||e[34]!==h?(w=r.jsxs(Ft,{children:[h,k]}),e[33]=k,e[34]=h,e[35]=w):w=e[35],w}function fie(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,o=ie(),l=_Z();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 u;e[6]!==i?(u=V=>!V&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==o?(h=o("assets.browser.deleteConfirmTitle"),e[8]=o,e[9]=h):h=e[9];let f;e[10]!==h?(f=r.jsx(nc,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==o?(m=o("assets.browser.deleteConfirmDescription",{name:n?Vh(n.key):""}),e[12]=n,e[13]=o,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx(ic,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=r.jsxs(sc,{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(oc,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=re(zj({variant:"destructive"})),e[25]=_):_=e[25];const L=l.isPending;let y;e[26]!==c?(y=V=>{V.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let k;e[28]!==l.isPending?(k=l.isPending?r.jsx(ft,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=k):k=e[29];let w;e[30]!==o?(w=o("assets.browser.deleteConfirm"),e[30]=o,e[31]=w):w=e[31];let S;e[32]!==l.isPending||e[33]!==y||e[34]!==k||e[35]!==w?(S=r.jsxs(lc,{className:_,disabled:L,onClick:y,children:[k,w]}),e[32]=l.isPending,e[33]=y,e[34]=k,e[35]=w,e[36]=S):S=e[36];let j;e[37]!==v||e[38]!==S?(j=r.jsxs(rc,{children:[v,S]}),e[37]=v,e[38]=S,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=r.jsxs(tc,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let N;return e[43]!==C||e[44]!==d||e[45]!==u?(N=r.jsx(ec,{open:d,onOpenChange:u,children:C}),e[43]=C,e[44]=d,e[45]=u,e[46]=N):N=e[46],N}const Q9={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:Vl},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Br},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:dy}},mie=["fast","smart","thinking"];function pie(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=ie(),[o,l]=A.useState(!1),a=Q9[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=Q9[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=mie.map(x=>{const b=Q9[x],v=b.icon;return r.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:re("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[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(Rt,{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(rs,{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(os,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function gie(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=ie(),[a,c]=A.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?r.jsx(A.Suspense,{fallback:r.jsx(de,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(xie,{override:i,onOverrideChange:o})}):r.jsx(pie,{tier:s,onSelect:n}),e[4]=o,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==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(pr,{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]!==h||e[22]!==g?(x=r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=r.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function xie(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=ie(),o=lf(),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]=A.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==o?(u=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=u):u=e[7];const h=u;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]!==h||e[18]!==n?(g=b=>{const v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(DV,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const jw=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Ep,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Hn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:Ei},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:mi},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:mu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Kr,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:tf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:Tp},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:_p},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Wd},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Kr},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:aV}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Xa,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Xa},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Qa},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Qa}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Hr,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:zy},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Hr},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:zo}]}],bie=jw.flatMap(t=>t.tools.map(e=>e.name));function vie(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function yie(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,o=ie();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(A.Suspense,{fallback:r.jsxs(de,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(Ep,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(_ie,{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 K5(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(Sc,{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 u;e[4]!==o?(u=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&r.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=r.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=r.jsxs(Yt,{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 W5(t){const e=F.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=ie(),d=o===l;let u;e[0]!==i||e[1]!==s?(u=s?r.jsx(Bi,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(yV,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("span",{className:"truncate",children:h}),e[7]=h,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=_=>{_.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]!==u||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function _ie(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,o=ie(),{org:l}=qe(),[a,c]=A.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=Jt(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=Qp(h),p=Pi();let g,x,b,v,_,L,y,k,w,S,j,C,N;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const D=new Map(p.map(jie)),I=new Map;for(const he of f?.tools??[]){const ce=ar(he._meta)??"__other__",ge=bc(he.name,ce==="__other__"?void 0:ce),Q=he.title,me=Q&&Q!==he.name?Q:vie(ge);I.has(ce)||I.set(ce,{clientId:ce,conn:D.get(ce),tools:[]}),I.get(ce).tools.push({name:he.name,display:me,description:he.description})}const R=[...I.values()].sort(kie),$=(f?.tools??[]).map(wie),B=[...bie,...$],M=n===null?new Set(B):new Set(n),O=B.every(he=>M.has(he)),z=he=>i(B.every(ce=>he.has(ce))?null:[...he]),U=he=>{const ce=new Set(M);ce.has(he)?ce.delete(he):ce.add(he),z(ce)},H=(he,ce)=>{const ge=new Set(M);for(const Q of he)ce?ge.add(Q):ge.delete(Q);z(ge)};v=os,N=a,_=c;let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(Ep,{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(FT,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",B.length]});let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[30]=X):X=e[30],e[31]!==W||e[32]!==Y?(L=r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[K,W,Y,X]})}),e[31]=W,e[32]=Y,e[33]=L):L=e[33],b=rs,j="p-0 w-80",C="start",x=zi;let ne;e[34]!==o?(ne=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=ne):ne=e[35],e[36]!==ne?(w=r.jsx(yi,{placeholder:ne}),e[36]=ne,e[37]=w):w=e[37];const se=O?o("automations.automationConfig.allToolsEnabled",{count:B.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:B.length});let oe;e[38]!==se?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:se}),e[38]=se,e[39]=oe):oe=e[39];let Z;e[40]!==i?(Z=()=>i(null),e[40]=i,e[41]=Z):Z=e[41];let J;e[42]!==o?(J=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=J):J=e[43];let q;e[44]!==O||e[45]!==Z||e[46]!==J?(q=r.jsx("button",{type:"button",onClick:Z,disabled:O,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:J}),e[44]=O,e[45]=Z,e[46]=J,e[47]=q):q=e[47];let G;e[48]===Symbol.for("react.memo_cache_sentinel")?(G=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=G):G=e[48];let te;e[49]!==i?(te=()=>i([]),e[49]=i,e[50]=te):te=e[50];const le=M.size===0;let ee;e[51]!==o?(ee=o("automations.automationConfig.clear"),e[51]=o,e[52]=ee):ee=e[52];let ae;e[53]!==te||e[54]!==le||e[55]!==ee?(ae=r.jsx("button",{type:"button",onClick:te,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ee}),e[53]=te,e[54]=le,e[55]=ee,e[56]=ae):ae=e[56];let ue;e[57]!==q||e[58]!==ae?(ue=r.jsxs("div",{className:"flex items-center gap-2",children:[q,G,ae]}),e[57]=q,e[58]=ae,e[59]=ue):ue=e[59],e[60]!==oe||e[61]!==ue?(S=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,ue]}),e[60]=oe,e[61]=ue,e[62]=S):S=e[62],g=_i,y="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(si,{children:o("automations.automationConfig.noToolsFound")}),jw.map(he=>{const ce=he.tools.map(Sie),ge=ce.filter(Q=>M.has(Q)).length;return r.jsx(gs,{heading:r.jsx(W5,{label:o(he.headingKey),icon:he.icon,on:ge,total:ce.length,onToggle:()=>H(ce,ge!==ce.length)}),children:he.tools.map(Q=>r.jsx(K5,{value:`${o(Q.titleKey)} ${Q.name}`,checked:M.has(Q.name),onToggle:()=>U(Q.name),title:o(Q.titleKey),description:o(Q.descriptionKey),leading:r.jsx(Q.icon,{size:16,className:"text-muted-foreground"})},Q.name))},he.key)}),R.map(he=>{const ce=he.tools.map(Lie),ge=ce.filter(Q=>M.has(Q)).length;return r.jsx(gs,{heading:r.jsx(W5,{conn:he.conn,on:ge,total:ce.length,onToggle:()=>H(ce,ge!==ce.length)}),children:he.tools.map(Q=>r.jsx(K5,{value:`${Q.display} ${Q.name} ${he.conn?.title??""}`,checked:M.has(Q.name),onToggle:()=>U(Q.name),title:Q.display,description:Q.description},Q.name))},he.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]=_,e[18]=L,e[19]=y,e[20]=k,e[21]=w,e[22]=S,e[23]=j,e[24]=C,e[25]=N}else g=e[13],x=e[14],b=e[15],v=e[16],_=e[17],L=e[18],y=e[19],k=e[20],w=e[21],S=e[22],j=e[23],C=e[24],N=e[25];let V;e[63]!==g||e[64]!==y||e[65]!==k?(V=r.jsx(g,{className:y,children:k}),e[63]=g,e[64]=y,e[65]=k,e[66]=V):V=e[66];let T;e[67]!==x||e[68]!==V||e[69]!==w||e[70]!==S?(T=r.jsxs(x,{children:[w,S,V]}),e[67]=x,e[68]=V,e[69]=w,e[70]=S,e[71]=T):T=e[71];let E;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==C?(E=r.jsx(b,{className:j,align:C,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=C,e[76]=E):E=e[76];let P;return e[77]!==v||e[78]!==_||e[79]!==L||e[80]!==E||e[81]!==N?(P=r.jsxs(v,{open:N,onOpenChange:_,children:[L,E]}),e[77]=v,e[78]=_,e[79]=L,e[80]=E,e[81]=N,e[82]=P):P=e[82],P}function Lie(t){return t.name}function Sie(t){return t.name}function wie(t){return t.name}function kie(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function jie(t){return[t.id,t]}function Rd(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Cie(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"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function Nie(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 Vie(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 Tie(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Eie=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Aie({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=ie(),{triggerAdd:a}=_u(),[c,d]=A.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),pe.success(l("automations.addStarterPopover.starterAdded")),h(!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"});h(!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(Ft,{open:u,onOpenChange:h,children:[r.jsx(Ut,{asChild:!0,children:r.jsxs(de,{variant:"outline",size:"sm",children:[r.jsx($t,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(Ht,{align:"end",className:"w-[200px]",children:[r.jsxs(nr,{children:[r.jsxs(ir,{className:"gap-2.5",children:[r.jsx(Sd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(rr,{className:"w-[160px]",children:Eie.map(p=>r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(Sd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[r.jsx(Sd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[r.jsx(qr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(Hn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Cw(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,u=ie(),[h,f]=A.useState(null),[m,p]=A.useState("curl"),[g,x]=A.useState("header"),b=A.useId();let v;e[0]!==u?(v=async(R,$)=>{try{await navigator.clipboard.writeText(R),f($),pe.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{pe.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const _=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 y=L,k=i&&o?g==="header"?`curl -X POST "${y}" \\
543
+ `)};Pn.prototype.renderPartial=function(e,s,n,i){if(n){var o=this.getConfigTags(i),l=Qg(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,o);return this.renderTokens(h,s,n,u,i)}}};Pn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Pn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||$i.escape,o=s.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===$i.escape?String(o):i(o)};Pn.prototype.rawValue=function(e){return e[1]};Pn.prototype.getConfigTags=function(e){return Rc(e)?e:e&&typeof e=="object"?e.tags:void 0};Pn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Rc(e))return e.escape};var $i={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){nu.templateCache=t},get templateCache(){return nu.templateCache}},nu=new Pn;$i.clearCache=function(){return nu.clearCache()};$i.parse=function(e,s){return nu.parse(e,s)};$i.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+une(e)+'" was given as the first argument for mustache#render(template, view, partials)');return nu.render(e,s,n,i)};$i.escape=bne;$i.Scanner=Ru;$i.Context=gc;$i.Writer=Pn;function jne(t,e){const s={__resolveType:t},n=qL([s],e)[0];return n?jX(s,n,e):null}function Cne({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=ie(),d=eo(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=A.useState(()=>jne(l,o)),[f,m]=A.useState(h?.data??{}),[p,g]=A.useState([]),[x,b]=A.useState(0),[v,_]=A.useState(!1),[L,y]=A.useState(null),k=L!==null,{save:w,flush:S}=KL({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?Un(h.resolveType,i):null,C=o[l],N=C?xl(l,C):l,V=Ls()?.taskId??null,T={orgSlug:t,virtualMcpId:e,branch:s,threadId:V,previewUrl:n??void 0,siteSlug:u},E=$=>{m($),w(l,$)},P=()=>{k?(y(null),_(!1),b($=>$+1)):y(JSON.stringify(f,null,2))},D=$=>{const B=$??"";try{const M=JSON.parse(B);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),E(M);return}_(!0)}catch{_(!0)}},I=[N,...p],R=$=>{g(p.slice(0,$)),b(B=>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:T2},"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:I.map(($,B)=>{const M=B===I.length-1,O=Cn($);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[B>0&&r.jsx(dn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>R(B),title:O,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:O})]},`${O}-${B}`)})}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:P,"aria-label":c(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?r.jsx(_s,{size:14}):r.jsx(zo,{size:14})})}),r.jsx(Ke,{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($o,{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(Ui,{schema:j,value:f,onChange:$=>E($),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:T},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(yu,{language:"json",height:"100%",code:L,onChange:D,onSave:$=>{D($),S()}})})]})]})]})})}function Nne(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=ie();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(_o,{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=$S(s.title),e[7]=s.title,e[8]=v):v=e[8];let _;e[9]!==u||e[10]!==s.resolveType?(_=(y,k)=>u(s.resolveType,y,k),e[9]=u,e[10]=s.resolveType,e[11]=_):_=e[11];let L;return e[12]!==o||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==i?(L=r.jsx(ane,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:_,onSaveReferencedBlock:h},g),e[12]=o,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=_,e[24]=i,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==o||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=r.jsx(Cne,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=o,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const R5="__all__",I5={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Vne={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},M0={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},M5="status:";function $5(t){if(!t.startsWith(M5))return null;const e=t.slice(M5.length);return e in M0?e:null}const O5=A.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 u;n[6]!==l||n[7]!==d?(u=re("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=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(Qt,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=r.jsxs(de,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function Xg(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 Tne(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:o,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=ie();let p;if(e[0]!==s||e[1]!==o){let ee;e[3]!==o?(ee=ae=>ae.slug===o,e[3]=o,e[4]=ee):ee=e[4],p=s.find(ee),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 ee;e[8]!==l?(ee=ae=>ae.email===l,e[8]=l,e[9]=ee):ee=e[9],x=n.find(ee),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(o||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(_=g?.name??b?.name??m(a?M0[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=_):_=e[14];const L=_,y=o?`cat:${o}`:l?`author:${l}`:a?`status:${a}`:R5;let k;e[15]!==u||e[16]!==d||e[17]!==h?(k=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=k):k=e[18];const w=k;let S;e[19]!==w||e[20]!==u||e[21]!==d||e[22]!==h?(S=ee=>{ee.startsWith("cat:")?(u(null),h(null),d(ee.slice(4))):ee.startsWith("author:")?(d(null),h(null),u(ee.slice(7))):$5(ee)?(d(null),u(null),h($5(ee))):w()},e[19]=w,e[20]=u,e[21]=d,e[22]=h,e[23]=S):S=e[23];const j=S;let C;e[24]!==L||e[25]!==v?(C=r.jsx(Ut,{asChild:!0,children:r.jsx(O5,{icon:oV,active:v,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=v,e[26]=C):C=e[26];let N;e[27]!==m?(N=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=N):N=e[28];let V;e[29]!==N?(V=r.jsx(Fc,{children:N}),e[29]=N,e[30]=V):V=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let E;e[33]!==T?(E=r.jsx(Nn,{value:R5,children:T}),e[33]=T,e[34]=E):E=e[34];let P;e[35]!==m?(P=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=P):P=e[36];let D;e[37]!==P?(D=r.jsx(Fc,{className:"text-muted-foreground/70",children:P}),e[37]=P,e[38]=D):D=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(M0),e[39]=I):I=e[39];let R;e[40]!==i||e[41]!==m?(R=I.map(ee=>r.jsxs(Nn,{value:`status:${ee}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(M0[ee])}),r.jsx(Xg,{count:i[ee]})]},`status:${ee}`)),e[40]=i,e[41]=m,e[42]=R):R=e[42];let $;e[43]!==s.length||e[44]!==m?($=s.length>0&&r.jsx(Fc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=$):$=e[45];let B;e[46]!==s?(B=s.map(Ane),e[46]=s,e[47]=B):B=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&r.jsx(Fc,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let O;e[51]!==n?(O=n.map(Ene),e[51]=n,e[52]=O):O=e[52];let z;e[53]!==y||e[54]!==j||e[55]!==E||e[56]!==D||e[57]!==R||e[58]!==$||e[59]!==B||e[60]!==M||e[61]!==O?(z=r.jsxs(hl,{value:y,onValueChange:j,children:[E,D,R,$,B,M,O]}),e[53]=y,e[54]=j,e[55]=E,e[56]=D,e[57]=R,e[58]=$,e[59]=B,e[60]=M,e[61]=O,e[62]=z):z=e[62];let U;e[63]!==z||e[64]!==V?(U=r.jsxs(Ht,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[V,z]}),e[63]=z,e[64]=V,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=r.jsxs(Ft,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let K;e[69]!==w||e[70]!==v||e[71]!==m?(K=v&&r.jsx(Pne,{label:m("sandbox.postToolbar.clearFilter"),onClick:w}),e[69]=w,e[70]=v,e[71]=m,e[72]=K):K=e[72];const W=Vne[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 X;e[76]!==Y?(X=r.jsx(Ut,{asChild:!0,children:r.jsx(O5,{icon:lV,active:!0,value:Y})}),e[76]=Y,e[77]=X):X=e[77];let ne;e[78]!==m?(ne=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=ne):ne=e[79];let se;e[80]!==ne?(se=r.jsx(Fc,{children:ne}),e[80]=ne,e[81]=se):se=e[81];let oe;e[82]!==f?(oe=ee=>f(ee),e[82]=f,e[83]=oe):oe=e[83];let Z;e[84]===Symbol.for("react.memo_cache_sentinel")?(Z=Object.keys(I5),e[84]=Z):Z=e[84];let J;e[85]!==m?(J=Z.map(ee=>r.jsx(Nn,{value:ee,children:m(I5[ee])},ee)),e[85]=m,e[86]=J):J=e[86];let q;e[87]!==c||e[88]!==oe||e[89]!==J?(q=r.jsx(hl,{value:c,onValueChange:oe,children:J}),e[87]=c,e[88]=oe,e[89]=J,e[90]=q):q=e[90];let G;e[91]!==se||e[92]!==q?(G=r.jsxs(Ht,{align:"end",className:"w-44",children:[se,q]}),e[91]=se,e[92]=q,e[93]=G):G=e[93];let te;e[94]!==X||e[95]!==G?(te=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(Ft,{children:[X,G]})}),e[94]=X,e[95]=G,e[96]=te):te=e[96];let le;return e[97]!==H||e[98]!==K||e[99]!==te?(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,te]}),e[97]=H,e[98]=K,e[99]=te,e[100]=le):le=e[100],le}function Ene(t){return r.jsxs(Nn,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(Xg,{count:t.count})]},`author:${t.email}`)}function Ane(t){return r.jsxs(Nn,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(Xg,{count:t.count})]},`cat:${t.slug}`)}function Pne(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 Dne(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,o=ie();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(He,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Rne,children:r.jsx(Sc,{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 u;e[13]!==d?(u=r.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=r.jsxs(We,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function Rne(t){return t.stopPropagation()}function Ine(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=ie();let c;e[0]!==n||e[1]!==i?(c=r.jsx(Dne,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(tn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==h||e[13]!==f?(p=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:o,"aria-label":f,children:m})}),e[11]=o,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=r.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(We,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(_s,{size:14}),e[24]=_):_=e[24];let L;e[25]!==l||e[26]!==v?(L=r.jsx(He,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:_})}),e[25]=l,e[26]=v,e[27]=L):L=e[27];let y;e[28]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=y):y=e[29];let k;e[30]!==y?(k=r.jsx(Ke,{side:"bottom",children:y}),e[30]=y,e[31]=k):k=e[31];let w;e[32]!==L||e[33]!==k?(w=r.jsxs(We,{children:[L,k]}),e[32]=L,e[33]=k,e[34]=w):w=e[34];let S;e[35]!==b||e[36]!==w?(S=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,w]}),e[35]=b,e[36]=w,e[37]=S):S=e[37];let j;return e[38]!==c||e[39]!==S||e[40]!==u?(j=r.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,S]}),e[38]=c,e[39]=S,e[40]=u,e[41]=j):j=e[41],j}function Xc(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,onViewJson:l,onDelete:a}=t,c=ie();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(ei,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=r.jsx(Ut,{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:Mne,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(Qe,{onClick:n,children:[r.jsx(Tp,{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(Qe,{onClick:s,children:[r.jsx(an,{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(dr,{}),r.jsxs(Qe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(vu,{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(dr,{}),o&&r.jsxs(Qe,{onClick:o,children:[r.jsx(Np,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(Qe,{onClick:l,children:[r.jsx(zo,{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(dr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(tn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let _;e[22]!==a||e[23]!==v?(_=r.jsxs(Qe,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=_):_=e[24];let L;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=r.jsxs(Ht,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let y;return e[31]!==L||e[32]!==h?(y=r.jsxs(Ft,{children:[h,L]}),e[31]=L,e[32]=h,e[33]=y):y=e[33],y}function Mne(t){return t.stopPropagation()}function $ne(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function One(t){const e=new Map;for(const s of t){const n=$ne(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 B5(t){const e=F.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=re("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=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 z5=A.lazy(()=>Tn(()=>import("./app-editor-BITYEeNm.js"),__vite__mapDeps([153,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,35,68,69,22,37,23,24,25,26,27,28,29,30,31,32,33,34,36,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,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,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.AppEditor}))),Bne=A.lazy(()=>Tn(()=>import("./post-editor-B-3AULjS.js"),__vite__mapDeps([154,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,24,50,23,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,97,96,155,129,133,130,131,108,105,101,126,156,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,98,157,158,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,99,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.PostEditor}))),zne=A.lazy(()=>Tn(()=>import("./record-editor-CnkB9zNF.js"),__vite__mapDeps([159,1,2,97,96,69,6,22,37,126,157,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,7,40,8,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,158,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,68,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,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.RecordEditor}))),Fne=A.lazy(()=>Tn(()=>import("./category-editor-CxuIuX9c.js"),__vite__mapDeps([160,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,29,23,24,25,26,27,28,30,31,32,33,34,22,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,110,97,96,156,130,131,108,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,98,157,158,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.CategoryEditor}))),Une=A.lazy(()=>Tn(()=>import("./bulk-category-panel-0Znxf5_5.js"),__vite__mapDeps([161,1,2,23,24,25,26,27,28,29,30,31,32,33,34,6,22,35,36,37,38,39,7,40,8,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,96,69,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,68,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,97,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.BulkCategoryPanel}))),Hne=A.lazy(()=>Tn(()=>import("./sections-editor-Cj6XZcig.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.SectionsEditor}))),Kne=A.lazy(()=>Tn(()=>import("./seo-editor-NyY02_7W.js"),__vite__mapDeps([162,1,2,35,23,24,25,26,27,28,29,30,31,32,33,34,6,22,36,37,38,39,7,40,8,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,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,100,101,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,99,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.SeoEditor}))),Wne=A.lazy(()=>Tn(()=>import("./variant-calendar-B3KUJEEH.js"),__vite__mapDeps([163,1,2,23,24,25,26,27,28,29,30,31,32,33,34,6,22,35,36,37,38,39,7,40,8,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,96,68,69,70,71,72,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,97,98,101,164,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,99,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.VariantCalendar}))),qne=A.lazy(()=>Tn(()=>import("./post-calendar-pijaG7Tm.js"),__vite__mapDeps([165,1,2,24,33,23,25,26,27,28,29,30,31,32,34,6,22,35,36,37,38,39,7,40,8,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,166,68,69,70,71,72,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.PostCalendar}))),Gne=A.lazy(()=>Tn(()=>import("./redirect-editor-DJr4emyY.js"),__vite__mapDeps([167,1,2,133,6,97,96,69,22,37,158,26,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,68,23,24,25,27,28,29,30,31,32,33,34,35,36,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,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,98,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,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.RedirectEditor})));function Yne(t){const e=F.c(20),{deepLinkPage:s}=t,n=eo(),{currentBranch:i}=sn(),{org:o}=qe(),l=n?.entity?.id??null,a=ni(),c=Pl(),{runtime:d,previewServerUrl:u}=En(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=lse({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${o.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=r.jsx(rse,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(_o,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==o.slug||e[17]!==p||e[18]!==l?(g=r.jsx(Qne,{orgSlug:o.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=o.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const F5=2e3,Jne=15;function U5(t,e,s,n){return typeof e!="string"||s&&(hw(e,s,n)||t.state.dataUpdateCount>=Jne)?!1:F5}function Qne({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:o,devServerReady:l,sandboxWarming:a}){const c=ie(),d=Ls()?.taskId??null,u={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:h,isLoading:f}=_f(u,{fetchEnabled:l}),[m,p]=A.useState("pages"),[g,x]=A.useState(null),[b,v]=A.useState(null),_=!!(o?.pageId||o?.path||o?.pathTemplate),[L,y]=A.useState(!1);if(_&&!L&&g===null&&h){y(!0);const fe=PM(ih(h),o??{});fe&&(p("pages"),x({collection:"pages",key:fe.key,path:fe.path}))}const[k,w]=A.useState(""),[S,j]=A.useState(null),[C,N]=A.useState(null),[V,T]=A.useState(null),[E,P]=A.useState("date-desc"),[D,I]=A.useState(()=>new Set),[R,$]=A.useState(null),B=()=>{I(new Set),$(null)},M=fe=>{x(fe),v(null)},[O,z]=A.useState(m);O!==m&&(z(m),w(""),j(null),N(null),T(null),P("date-desc"),I(new Set),$(null));const{data:U,isLoading:H,isFetching:K}=Lf(u,{fetchEnabled:l,refetchInterval:fe=>{const Ve=fe.state.data;if(m==="apps"&&g&&g.collection==="apps"){const Be=h?.[g.key];return U5(fe,typeof Be?.__resolveType=="string"?Be.__resolveType:void 0,Ve)}if(m==="site"&&h){const Be=Ve?M1(h,Ve):null,Se=h.site,ct=Be?.resolveType??(typeof Se?.__resolveType=="string"?Se.__resolveType:void 0);return U5(fe,ct,Ve,["seo"])}return!1}}),W=(fe,Ve)=>!hw(fe,U,Ve)&&(H||K),{catalog:Y,isLoading:X}=nse(U??void 0,h??void 0,{enabled:m==="apps"}),ne=Kse({orgSlug:t,virtualMcpId:e,branch:s,meta:U}),se=Du(u),oe=Gte(u),[Z,J]=A.useState(null),[q,G]=A.useState(),[te,le]=A.useState(null),[ee,ae]=A.useState(null),[ue,he]=A.useState(null),ce=!h||!U;if(f||H||ce&&a)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})});if(ce)return r.jsx(_o,{title:"Could not load site data."});const ge=ih(h).sort((fe,Ve)=>fe.name.localeCompare(Ve.name)),Q=Q8(h).sort((fe,Ve)=>fe.from.localeCompare(Ve.from)),me=M2(h,U),ve=m==="sections"?wM(U):[],we=M1(h,U),ye=xw(h),Le=Yg.some(fe=>ye[fe].length>0),Ce=Dd(m)?ye[m]:[],Te=(Le?su(h,"categories"):[]).map(({key:fe,payload:Ve})=>{const Be=typeof Ve.slug=="string"?Ve.slug:"",Se=typeof Ve.name=="string"?Ve.name:"";return{slug:Be||fe,name:Se||Be||fe}}).filter(fe=>fe.slug).sort((fe,Ve)=>fe.name.localeCompare(Ve.name)),_e=m==="posts"&&(D.size>0||R!==null),Pe=_e?_w(h).filter(fe=>D.has(fe.key)):[],ke=Q4(U,"loaders"),Ne=Q4(U,"actions");if(!kf(h,U)&&!Le&&ke===0&&Ne===0)return r.jsx(_o,{icon:cn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Fe={pages:ge.length,sections:me.length,apps:Y.length,loaders:ke,actions:Ne,redirects:Q.length,posts:ye.posts.length,authors:ye.authors.length,categories:ye.categories.length},Ye=new Set(ge.map(fe=>ko(fe.path))),Ie=new Set(ge.map(fe=>fe.name)),Re=new Set(me.map(fe=>fe.name)),Oe=async fe=>{const Ve=h[fe.key];if(!Ve)return;const Be=QL(h,fe.key),Se=XL(h,fe.key,Math.max(0,Be-1)),ct=cJ(Ve.sections,Se);if(ct)try{await se.mutateAsync({blockKey:fe.key,data:{...Ve,sections:ct}}),pe.success(`Variant added to "${fe.name}"`),x({collection:"pages",key:fe.key,path:fe.path})}catch(mt){pe.error(mt instanceof Error?mt.message:"Could not add variant")}},tt=()=>{G(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=fe=>{G(void 0),J({mode:"duplicate",sourceKey:fe.key,initialName:j5(Ie,fe.name),initialPath:ase(Ye,fe.path)})},nt=fe=>{G(void 0),J({mode:"rename",sourceKey:fe.key,initialName:fe.name,initialPath:fe.path})},ot=async fe=>{if(!Z)return;const{mode:Ve,sourceKey:Be}=Z;try{if(Ve==="create"){let Se;if(fe.templateKey){const mt=h[fe.templateKey];if(!mt)throw new Error("Selected template no longer exists.");Se={...mt,name:fe.name,path:fe.path}}else Se=use(fe.name,fe.path);const ct=fse(h,fe.name);await se.mutateAsync({blockKey:ct,data:Se}),pe.success(`Created "${fe.name}"`),x({collection:"pages",key:ct,path:fe.path})}else if(Ve==="duplicate"&&Be){const Se=h[Be];if(!Se)throw new Error("Source page not found");const{key:ct,data:mt}=dse({source:Se,pages:ge,newName:fe.name,newPath:fe.path});await se.mutateAsync({blockKey:ct,data:mt}),pe.success(`Duplicated as "${fe.name}"`),x({collection:"pages",key:ct,path:fe.path})}else if(Ve==="rename"&&Be){const Se=h[Be];if(!Se)throw new Error("Page not found");const ct={...Se,name:fe.name,path:fe.path};await se.mutateAsync({blockKey:Be,data:ct}),pe.success("Page updated"),g?.collection==="pages"&&g.key===Be&&x({collection:"pages",key:Be,path:fe.path})}J(null)}catch(Se){G(Se instanceof Error?Se.message:"Save failed")}},Me=({path:fe})=>{if(!Z)return null;const Ve=ko(fe);return(Z.mode==="rename"?ko(Z.initialPath):null)!==Ve&&Ye.has(Ve)?`A page with path "${fe}" already exists.`:null},lt=async(fe,Ve,Be)=>{await se.mutateAsync({blockKey:Ve,data:{...Be,name:Ve,__resolveType:fe}}),pe.success(c("sandbox.contentBrowser.createdSection",{name:Ve})),x({collection:"sections",key:Ve})},gt=Dg((fe,Ve)=>se.mutate({blockKey:fe,data:Ve})),Xe=async fe=>{const Ve=h[fe.key];if(!Ve){pe.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Be=cse(h,fe.key),Se=j5(Re,fe.name),ct={...Ve,name:Se};try{await se.mutateAsync({blockKey:Be,data:ct}),pe.success(c("sandbox.contentBrowser.duplicatedSection",{name:fe.name})),x({collection:"sections",key:Be})}catch(mt){pe.error(mt instanceof Error?mt.message:c("sandbox.contentBrowser.duplicateFailed"))}},be=async fe=>{if(!te)return;const Ve=h[te];if(!Ve){pe.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await se.mutateAsync({blockKey:te,data:{...Ve,name:fe}}),pe.success(c("sandbox.contentBrowser.sectionRenamed")),le(null)}catch(Be){pe.error(Be instanceof Error?Be.message:c("sandbox.contentBrowser.renameFailed"))}},Ue=async()=>{const fe="/redirect-from",Ve=AM(h,fe),Be=VM({from:fe,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await se.mutateAsync({blockKey:Ve,data:Be}),pe.success("Created redirect"),x({collection:"redirects",key:Ve})}catch(Se){pe.error(Se instanceof Error?Se.message:"Could not create redirect")}},Ze=async fe=>{const Ve=Y9(h,fe),Be=Ca(Ve,fe,Lw(fe));try{await se.mutateAsync({blockKey:Ve,data:Be}),pe.success(`Created ${Pd[fe]}`),x({collection:fe,key:Ve})}catch(Se){pe.error(Se instanceof Error?Se.message:"Could not create")}},ht=async fe=>{const Ve=Y9(h,"posts"),Be=Ca(Ve,"posts",Ise(fe));try{await se.mutateAsync({blockKey:Ve,data:Be}),pe.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),z("posts"),x({collection:"posts",key:Ve}),v(null)}catch(Se){pe.error(Se instanceof Error?Se.message:c("sandbox.postCalendar.couldNotCreate"))}},st=async(fe,Ve)=>{const Be=h[fe],Se=Be?$se(md(Be,"posts"),Ve):null;if(!Se){pe.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await se.mutateAsync({blockKey:fe,data:Ca(fe,"posts",Se)})}catch(ct){pe.error(ct instanceof Error?ct.message:c("sandbox.postCalendar.couldNotReschedule"))}},wt=async fe=>{const Ve=h[fe.key];if(!Ve){pe.error("Record not found.");return}const Be=Y9(h,fe.kind),Se=fe.kind==="posts"?"title":"name",ct={...structuredClone(md(Ve,fe.kind)),[Se]:`${fe.label} (copy)`};try{await se.mutateAsync({blockKey:Be,data:Ca(Be,fe.kind,ct)}),pe.success(`Duplicated "${fe.label}"`),x({collection:fe.kind,key:Be})}catch(mt){pe.error(mt instanceof Error?mt.message:"Duplicate failed")}},dt=fe=>{I(Ve=>{const Be=new Set(Ve);return Be.has(fe)?Be.delete(fe):Be.add(fe),Be})},Lt=fe=>{p("posts"),z("posts"),x(null),v(null),w(""),j(null),N(null),T(null),P("date-desc"),I(new Set),$(fe||null)},De=async(fe,Ve)=>{const Be=[...D];let Se=0;for(const ct of Be){const mt=h[ct],Xt=md(mt,"posts"),Dt=fe==="add"?jse(Xt,Ve):Cse(Xt,Ve);Dt!==Xt&&(await se.mutateAsync({blockKey:ct,data:Ca(ct,"posts",N5(Dt))}),Se+=1)}return Se},rt=async(fe,Ve)=>{const Be=D.size;try{const Se=await De(fe,Ve),ct=fe==="add"?"Added to":"Moved",mt=Be-Se;pe.success(`${ct} ${Se} ${Se===1?"post":"posts"}`+(mt>0?` (${mt} already set)`:"")),B()}catch(Se){pe.error(Se instanceof Error?Se.message:"Bulk update failed")}},yt=async()=>{if(ee)try{if(ee.kind==="blog-bulk"){for(const Se of ee.keys)await oe.mutateAsync({blockKey:Se});pe.success(`Deleted ${ee.count} ${ee.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&ee.keys.includes(g.key)&&x(null),B(),ae(null);return}const{kind:fe,key:Ve,label:Be}=ee;if(fe==="blog"){if(ee.blogKind==="categories"){const Se=md(h[Ve],"categories").slug,ct=typeof Se=="string"?Se:"";if(ct)for(const{key:mt,payload:Xt}of su(h,"posts")){const Dt=Nse(Xt,ct);Dt!==Xt&&await se.mutateAsync({blockKey:mt,data:Ca(mt,"posts",N5(Dt))})}}await oe.mutateAsync({blockKey:Ve})}else await oe.mutateAsync({blockKey:Ve});pe.success(`Deleted "${Be}"`),g&&g.collection!=="available-section"&&g.key===Ve&&x(null),ae(null)}catch(fe){pe.error(fe instanceof Error?fe.message:"Delete failed")}},ut=oe.isPending||se.isPending,at=ee?.kind==="blog"?Pd[ee.blogKind]:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"}`:ee?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[r.jsx(ise,{active:m,counts:Fe,showBlog:Le,onSelect:fe=>{p(fe),x(null),v(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&r.jsx(Xne,{activeCollection:m,pages:ge,redirects:Q,sections:me,availableSections:ve,appCatalog:Y,appCatalogLoading:X,blogEntries:Ce,decofile:h,searchQuery:k,onSearchChange:w,postCategoryFilter:S,postAuthorFilter:C,postStatusFilter:V,postSort:E,onPostCategoryFilterChange:fe=>{j(fe),I(new Set)},onPostAuthorFilterChange:fe=>{N(fe),I(new Set)},onPostStatusFilterChange:fe=>{T(fe),I(new Set)},onPostSortChange:P,selectedPostKeys:D,postBulkPanelOpen:_e,onTogglePostSelect:dt,onSelectAllPosts:fe=>I(new Set(fe)),onClearPostSelection:()=>I(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>ae({kind:"blog-bulk",keys:[...D],count:D.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?tt():m==="redirects"?Ue():Dd(m)&&Ze(m)},onDuplicatePage:it,onRenamePage:nt,onAddPageVariant:Oe,onDeletePage:fe=>ae({kind:"page",key:fe.key,label:fe.name}),onEditPageSeo:fe=>{const Ve={collection:"pages",key:fe.key,path:fe.path};x(Ve),v(fe.key)},onViewPageJson:fe=>he(fe.key),onDuplicateSection:Xe,onRenameSection:fe=>le(fe.key),onDeleteSection:fe=>ae({kind:"section",key:fe.key,label:fe.name}),onDeleteRedirect:fe=>ae({kind:"redirect",key:fe.key,label:fe.from||fe.key}),onDuplicateBlog:wt,onDeleteBlog:fe=>ae({kind:"blog",blogKind:fe.kind,key:fe.key,label:fe.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?r.jsx(Xse,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,kind:m}):r.jsx(A.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),children:m==="calendar"?r.jsx(Wne,{decofile:h}):m==="post-schedule"?r.jsx(qne,{decofile:h,support:ne,isCreating:se.isPending,onCreate:fe=>{ht(fe)},onReschedule:(fe,Ve)=>{st(fe,Ve)},onSelect:fe=>{p("posts"),z("posts"),x({collection:"posts",key:fe}),v(null)}}):m==="site"?we?r.jsx(z5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:we.key,block:h[we.key],decofile:h,meta:U,title:"Site",excludeFields:["seo"],schemaPending:W(we.resolveType,["seo"]),previewBaseUrl:n},`site:${we.key}`):r.jsx(_o,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?r.jsx(Kne,{orgSlug:t,virtualMcpId:e,branch:s,decofile:h,meta:U,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?r.jsx(Nne,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,isCreating:se.isPending,onCreateAvailable:lt,onSaveReferencedBlock:gt}):_e?r.jsx(Une,{posts:Pe,categories:Te,initialSlug:R,isPending:se.isPending,onApply:(fe,Ve)=>{rt(fe,Ve)},onClose:B},R??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?r.jsx(z5,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:n,schemaPending:W(typeof h[g.key]?.__resolveType=="string"?String(h[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?r.jsx(Bne,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:i},`post:${g.key}`):g.collection==="categories"?r.jsx(Fne,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,onManagePosts:Lt,onOpenPost:fe=>{p("posts"),z("posts"),x({collection:"posts",key:fe}),v(null)},previewBaseUrl:i},`category:${g.key}`):g.collection==="authors"?r.jsx(zne,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:h[g.key]},`authors:${g.key}`):g.collection==="redirects"?r.jsx(Gne,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key]},`redirect:${g.key}`):r.jsx(Hne,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>v(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):r.jsx(_o,{title:`Select ${Dd(m)?`a ${Pd[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),Z&&r.jsx(xse,{open:!!Z,mode:Z.mode,initialName:Z.initialName,initialPath:Z.initialPath,isPending:se.isPending,error:q,templates:ge,validate:Me,onSubmit:ot,onOpenChange:fe=>{fe||(J(null),G(void 0))}}),te&&r.jsx(bse,{open:!!te,blockKey:te,initialName:me.find(fe=>fe.key===te)?.name??te,isPending:se.isPending,onSubmit:be,onOpenChange:fe=>{fe||le(null)}}),ue&&r.jsx(Wse,{open:!!ue,onOpenChange:fe=>{fe||he(null)},pageKey:ue,decofile:h,onSave:fe=>se.mutateAsync({blockKey:ue,data:fe})}),r.jsx(ec,{open:!!ee,onOpenChange:fe=>{!fe&&!ut&&ae(null)},children:r.jsxs(tc,{children:[r.jsxs(sc,{children:[r.jsx(nc,{children:`Delete ${at}?`}),r.jsx(ic,{children:ee?.kind==="section"?`"${ee.label}" will be removed. Pages that still reference it will lose this section.`:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ee?`"${ee.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(rc,{children:[r.jsx(oc,{disabled:ut,children:"Cancel"}),r.jsx(lc,{onClick:fe=>{fe.preventDefault(),yt()},disabled:ut,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ut?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function Xne(t){const e=F.c(82),{activeCollection:s,pages:n,redirects:i,sections:o,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:_,onPostSortChange:L,selectedPostKeys:y,postBulkPanelOpen:k,onTogglePostSelect:w,onSelectAllPosts:S,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:N,selection:V,onSelect:T,onCreate:E,onDuplicatePage:P,onRenamePage:D,onAddPageVariant:I,onDeletePage:R,onEditPageSeo:$,onViewPageJson:B,onDuplicateSection:M,onRenameSection:O,onDeleteSection:z,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:K}=t;let W,Y,X,ne,se,oe,Z;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==I||e[7]!==N||e[8]!==j||e[9]!==E||e[10]!==K||e[11]!==R||e[12]!==U||e[13]!==z||e[14]!==H||e[15]!==P||e[16]!==M||e[17]!==$||e[18]!==C||e[19]!==v||e[20]!==b||e[21]!==L||e[22]!==_||e[23]!==D||e[24]!==O||e[25]!==f||e[26]!==T||e[27]!==S||e[28]!==w||e[29]!==B||e[30]!==n||e[31]!==p||e[32]!==k||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==o||e[39]!==y||e[40]!==V){const te=h.toLowerCase(),le=n.filter(be=>!te||be.name.toLowerCase().includes(te)||be.path.toLowerCase().includes(te)),ee=i.filter(be=>!te||be.from.toLowerCase().includes(te)||be.to.toLowerCase().includes(te)),ae=o.filter(be=>!te||be.name.toLowerCase().includes(te)||be.key.toLowerCase().includes(te)||be.resolveType.toLowerCase().includes(te)),ue=l.filter(be=>!te||be.title.toLowerCase().includes(te)||be.resolveType.toLowerCase().includes(te)||(be.description?.toLowerCase().includes(te)??!1)),he=One(ae),ce=a.filter(be=>!te||be.title.toLowerCase().includes(te)||be.app.toLowerCase().includes(te)||be.vendor.toLowerCase().includes(te)||be.category.toLowerCase().includes(te)),ge=d.filter(be=>!te||be.label.toLowerCase().includes(te)||be.subtitle.toLowerCase().includes(te)),Q=s==="posts",me=sie,ve=Q?_w(u):[],we=new Map,ye=new Map,Le={published:0,scheduled:0,draft:0};for(const be of ve)Le[be.status]=Le[be.status]+1;for(const be of ve){for(const Ue of be.categorySlugs)we.set(Ue,(we.get(Ue)??0)+1);for(const Ue of be.authorEmails)ye.set(Ue,(ye.get(Ue)??0)+1)}const Ce=(Q?su(u,"categories"):[]).map(be=>{const{key:Ue,payload:Ze}=be,ht=me(Ze.slug)||Ue;return{slug:ht,name:me(Ze.name)||me(Ze.slug)||Ue,count:we.get(ht)??0}}).filter(tie),Te=(Q?su(u,"authors"):[]).map(be=>{const{key:Ue,payload:Ze}=be,ht=me(Ze.email);return{email:ht,name:me(Ze.name)||me(Ze.email)||Ue,count:ye.get(ht)??0}}).filter(eie);let _e;e[48]!==m?(_e=be=>!m||be.categorySlugs.includes(m),e[48]=m,e[49]=_e):_e=e[49];let Pe;e[50]!==p?(Pe=be=>!p||be.authorEmails.includes(p),e[50]=p,e[51]=Pe):Pe=e[51];let ke;e[52]!==g?(ke=be=>!g||be.status===g,e[52]=g,e[53]=ke):ke=e[53];let Ne;e[54]!==x?(Ne=(be,Ue)=>{if(x==="az")return be.title.localeCompare(Ue.title);if(x==="za")return Ue.title.localeCompare(be.title);const Ze=be.date.localeCompare(Ue.date);return x==="date-asc"?Ze:-Ze},e[54]=x,e[55]=Ne):Ne=e[55];const Fe=ve.filter(be=>!te||be.title.toLowerCase().includes(te)||be.slug.toLowerCase().includes(te)).filter(_e).filter(Pe).filter(ke).sort(Ne),Ye=y.size,Ie=Fe.map(Zne),Re=Ie.length>0&&Ie.every(be=>y.has(be)),Oe=Ye>0||k,tt=()=>{Re?j():S(Ie)},it=`Search ${s}…`,nt=Dd(s)?`Create new ${Pd[s]}`:s==="redirects"?"Create new redirect":"Create new page",ot=s!=="apps"&&s!=="sections";se="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let Me;e[56]===Symbol.for("react.memo_cache_sentinel")?(Me=r.jsx(mf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=Me):Me=e[56];let lt;e[57]!==f?(lt=be=>f(be.target.value),e[57]=f,e[58]=lt):lt=e[58];let gt;e[59]!==it||e[60]!==h||e[61]!==lt?(gt=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[Me,r.jsx("input",{type:"text",value:h,onChange:lt,placeholder:it,"aria-label":it,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=it,e[60]=h,e[61]=lt,e[62]=gt):gt=e[62];let Xe;e[63]!==nt||e[64]!==E||e[65]!==ot?(Xe=ot&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",onClick:E,"aria-label":nt,children:r.jsx($t,{size:14})})}),r.jsx(Ke,{side:"bottom",children:nt})]}),e[63]=nt,e[64]=E,e[65]=ot,e[66]=Xe):Xe=e[66],e[67]!==gt||e[68]!==Xe?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[gt,Xe]}),e[67]=gt,e[68]=Xe,e[69]=oe):oe=e[69],Z=Q&&(Oe?r.jsx(Ine,{count:Ye,allSelected:Re,onToggleSelectAll:tt,onDelete:N,onExit:C}):r.jsx(Tne,{categories:Ce,authors:Te,categoryFilter:m,statusCounts:Le,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:_,onSortChange:L})),W=$o,ne="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",Y="flex flex-col gap-1 p-1.5",X=s==="pages"?le.length===0?r.jsx(ja,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(be=>{const Ue=V?.collection==="pages"&&V.key===be.key,Ze=QL(u,be.key);return r.jsx(ki,{icon:Or,title:be.name,subtitle:be.path,active:Ue,variantCount:Ze,onClick:()=>T({collection:"pages",key:be.key,path:be.path}),menu:r.jsx(Xc,{onDuplicate:()=>P(be),onRename:()=>D(be),onAddVariant:()=>I(be),onEditSeo:()=>$(be),onViewJson:()=>B(be),onDelete:()=>R(be)})},be.key)}):s==="sections"?ae.length===0&&ue.length===0?r.jsx(ja,{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:[he.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(B5,{icon:Hr,label:"Saved sections"}),he.map(be=>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:be.label}),be.sections.map(Ue=>{const Ze=V?.collection==="sections"&&V.key===Ue.key;return r.jsx(ki,{icon:Hr,accent:"global",title:Ue.name,subtitle:be.label,active:Ze,onClick:()=>T({collection:"sections",key:Ue.key}),menu:r.jsx(Xc,{onDuplicate:()=>M(Ue),onRename:()=>O(Ue),onDelete:()=>z(Ue)})},Ue.key)})]},be.label))]}),ue.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(B5,{icon:Or,label:"Available sections",className:re(he.length>0&&"mt-3")}),ue.map(be=>{const Ue=V?.collection==="available-section"&&V.resolveType===be.resolveType,Ze=be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(ki,{icon:Or,title:be.title,subtitle:Ze??be.resolveType,active:Ue,onClick:()=>T({collection:"available-section",resolveType:be.resolveType,title:be.title})},be.resolveType)})]})]}):s==="apps"?c?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ft,{size:18,className:"animate-spin text-muted-foreground"})}):ce.length===0?r.jsx(ja,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ce.map(be=>{const Ue=V?.collection==="apps"&&be.blockKey!==null&&V.key===be.blockKey;return r.jsx(ki,{icon:r6,logoUrl:be.logo,title:be.title,subtitle:be.category,active:Ue,trailing:be.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(!be.installed||!be.blockKey){pe.message(`${be.title} is not installed on this site.`);return}T({collection:"apps",key:be.blockKey})}},be.id)}):s==="redirects"?ee.length===0?r.jsx(ja,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ee.map(be=>r.jsx(ki,{icon:wy,title:be.from||"(no source)",subtitle:`→ ${be.to||"(no target)"}`,active:V?.collection==="redirects"&&V.key===be.key,trailing:r.jsx(vse,{type:be.type}),onClick:()=>T({collection:"redirects",key:be.key}),menu:r.jsx(Xc,{onDelete:()=>U(be)})},be.key)):Q?Fe.length===0?r.jsx(ja,{hasItems:ve.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Fe.map(be=>{const Ue={key:be.key,kind:"posts",label:be.title,subtitle:be.slug};return r.jsx(ki,{icon:Ti,title:be.title,subtitle:be.slug||"no slug",invalid:be.missing.length>0,invalidReason:`Missing: ${be.missing.join(", ")}`,active:V?.collection==="posts"&&V.key===be.key,selectable:!0,selectionActive:Oe,selected:y.has(be.key),onToggleSelect:()=>w(be.key),onClick:()=>Oe?w(be.key):T({collection:"posts",key:be.key}),menu:r.jsx(Xc,{onDuplicate:()=>H(Ue),onDelete:()=>K(Ue)})},be.key)}):ge.length===0?r.jsx(ja,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Dd(s)?Pd[s]:"item"}.`}):ge.map(be=>{const Ue=V?.collection===be.kind&&V.key===be.key;return r.jsx(ki,{icon:be.kind==="posts"?Ti:be.kind==="authors"?s2:ef,title:be.label,subtitle:be.subtitle,active:Ue,onClick:()=>T({collection:be.kind,key:be.key}),menu:r.jsx(Xc,{onDuplicate:()=>H(be),onDelete:()=>K(be)})},be.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=I,e[7]=N,e[8]=j,e[9]=E,e[10]=K,e[11]=R,e[12]=U,e[13]=z,e[14]=H,e[15]=P,e[16]=M,e[17]=$,e[18]=C,e[19]=v,e[20]=b,e[21]=L,e[22]=_,e[23]=D,e[24]=O,e[25]=f,e[26]=T,e[27]=S,e[28]=w,e[29]=B,e[30]=n,e[31]=p,e[32]=k,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=o,e[39]=y,e[40]=V,e[41]=W,e[42]=Y,e[43]=X,e[44]=ne,e[45]=se,e[46]=oe,e[47]=Z}else W=e[41],Y=e[42],X=e[43],ne=e[44],se=e[45],oe=e[46],Z=e[47];let J;e[70]!==Y||e[71]!==X?(J=r.jsx("div",{className:Y,children:X}),e[70]=Y,e[71]=X,e[72]=J):J=e[72];let q;e[73]!==W||e[74]!==ne||e[75]!==J?(q=r.jsx(W,{className:ne,children:J}),e[73]=W,e[74]=ne,e[75]=J,e[76]=q):q=e[76];let G;return e[77]!==se||e[78]!==oe||e[79]!==Z||e[80]!==q?(G=r.jsxs("div",{className:se,children:[oe,Z,q]}),e[77]=se,e[78]=oe,e[79]=Z,e[80]=q,e[81]=G):G=e[81],G}function Zne(t){return t.key}function eie(t){return t.email}function tie(t){return t.slug}function sie(t){return typeof t=="string"?t:""}function nie(t){const e=F.c(17),{virtualMcpId:s}=t,n=ie(),i=Ws(s),{activeTask:o}=sn();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=br(l);if(!(en(i?.metadata)||en(o?.metadata))){let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(cn,{size:24,className:"text-muted-foreground/60"}),e[1]=u):u=e[1];let h;e[2]!==n?(h=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=h):h=e[3];let f;e[4]!==h?(f=r.jsx("div",{children:h}),e[4]=h,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:[u,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(Yne,{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 iie(t){const e=F.c(6),{virtualMcpId:s}=t,n=Ws(s),i=Hy();let o;e[0]!==i||e[1]!==n?(o=jf(i,u7(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(rie,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=r.jsx(aie,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function rie(){const t=F.c(12),e=ie();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(Xp,{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 oie(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function lie(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function aie(t){const e=F.c(99),{config:s}=t,n=ie(),[i,o]=A.useState(""),l=pf(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=BS(a),d=Yf(),[u,h]=A.useState(!1),[f,m]=A.useState(null),p=A.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const O=Array.from(M);if(O.length===0)return;const z=[];for(const U of O)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const K=H;z.push(`${U.name} (${K instanceof Error?K.message:"upload failed"})`)}await c.refetch(),z.length>0&&pe.error(z.length===O.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:z.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:z.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),h(!0)},e[8]=b):b=e[8];const v=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){h(!1)},e[9]=_):_=e[9];const L=_;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),h(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const k=y,[w,S]=P1();let j,C,N,V,T,E;if(e[12]!==s.name||e[13]!==l||e[14]!==S||e[15]!==w||e[16]!==x||e[17]!==u||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 M=(c.data?.pages??[]).flatMap(cie),O=lie(M,oie(w)),z=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 X;e[40]!==K||e[41]!==Y?(X=r.jsxs("div",{className:"min-w-0",children:[K,Y]}),e[40]=K,e[41]=Y,e[42]=X):X=e[42];let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>p.current?.click(),e[43]=ne):ne=e[43];let se;e[44]!==d.isPending?(se=d.isPending?r.jsx(ft,{size:14,className:"animate-spin"}):r.jsx(ti,{size:14}),e[44]=d.isPending,e[45]=se):se=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 Z;e[49]!==se||e[50]!==oe||e[51]!==d.isPending?(Z=r.jsxs(de,{type:"button",size:"sm",disabled:d.isPending,onClick:ne,children:[se,oe]}),e[49]=se,e[50]=oe,e[51]=d.isPending,e[52]=Z):Z=e[52];let J;e[53]!==x?(J=r.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ge=>{const Q=Array.from(ge.target.files??[]);ge.target.value="",x(Q)}}),e[53]=x,e[54]=J):J=e[54],e[55]!==X||e[56]!==Z||e[57]!==J?(E=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[X,Z,J]}),e[55]=X,e[56]=Z,e[57]=J,e[58]=E):E=e[58];let q;e[59]!==n?(q=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=q):q=e[60],e[61]!==U||e[62]!==i||e[63]!==q?(j=r.jsx(hf,{value:i,onChange:o,isSearching:U,placeholder:q,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=q,e[64]=j):j=e[64];let G;e[65]===Symbol.for("react.memo_cache_sentinel")?(G=()=>p.current?.click(),e[65]=G):G=e[65];const te=u&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ee;e[66]!==te||e[67]!==le?(ee=re("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",te,le),e[66]=te,e[67]=le,e[68]=ee):ee=e[68];let ae;e[69]===Symbol.for("react.memo_cache_sentinel")?(ae=r.jsx(ti,{size:16,className:"text-muted-foreground"}),e[69]=ae):ae=e[69];let ue;e[70]!==n?(ue=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ue):ue=e[71];let he;e[72]!==n?(he=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=he):he=e[73];let ce;e[74]!==ue||e[75]!==he?(ce=r.jsxs("p",{className:"text-xs text-muted-foreground",children:[ue," ",he]}),e[74]=ue,e[75]=he,e[76]=ce):ce=e[76],e[77]!==k||e[78]!==ee||e[79]!==ce?(C=r.jsxs("button",{type:"button",onClick:G,onDragOver:v,onDragLeave:L,onDrop:k,className:ee,children:[ae,ce]}),e[77]=k,e[78]=ee,e[79]=ce,e[80]=C):C=e[80],N="min-h-0 flex-1 overflow-y-auto pr-1",V=M.length===0?z?r.jsx(H5,{title:n("filePicker.filePickerDialog.noMatches",{query:z}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):r.jsx(H5,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):r.jsx("div",{ref:S,className:"flex items-start gap-3",children:O.map((ge,Q)=>r.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ge.map(me=>r.jsx(die,{item:me,onDelete:()=>m(me)},me.key))},Q))}),e[12]=s.name,e[13]=l,e[14]=S,e[15]=w,e[16]=x,e[17]=u,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]=C,e[27]=N,e[28]=V,e[29]=T,e[30]=E}else j=e[25],C=e[26],N=e[27],V=e[28],T=e[29],E=e[30];let P;e[81]!==c||e[82]!==n?(P=c.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(de,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(ft,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=P):P=e[83];let D;e[84]!==P||e[85]!==N||e[86]!==V?(D=r.jsxs("div",{className:N,children:[V,P]}),e[84]=P,e[85]=N,e[86]=V,e[87]=D):D=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let R;e[89]!==s.id||e[90]!==f?(R=r.jsx(fie,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=R):R=e[91];let $;return e[92]!==j||e[93]!==C||e[94]!==D||e[95]!==R||e[96]!==T||e[97]!==E?($=r.jsxs("div",{className:T,children:[E,j,C,D,R]}),e[92]=j,e[93]=C,e[94]=D,e[95]=R,e[96]=T,e[97]=E,e[98]=$):$=e[98],$}function cie(t){return t.items}function H5(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(Ei,{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 die(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=zS(s.key),e[0]=s.key,e[1]=i):i=e[1];const o=i;let l;e[2]!==s.key?(l=Ug(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:uie}):r.jsx("div",{className:"flex aspect-square items-center justify-center",children:r.jsx(Ti,{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 u=s.key;let h;e[12]!==s.key?(h=Vh(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=r.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=FS(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(hie,{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 uie(t){t.target.style.display="none"}function hie(t){const e=F.c(36),{item:s,onDelete:n}=t,i=ie(),[o,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{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 u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(n2,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Ut,{asChild:!0,children:r.jsx(de,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o?r.jsx(Rt,{size:14}):r.jsx(an,{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(Qe,{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(yn,{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(Qe,{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 _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(tn,{size:14}),e[23]=_):_=e[23];let L;e[24]!==i?(L=i("assets.browser.deleteAction"),e[24]=i,e[25]=L):L=e[25];let y;e[26]!==n||e[27]!==L?(y=r.jsxs(Qe,{variant:"destructive",onClick:n,children:[_,L]}),e[26]=n,e[27]=L,e[28]=y):y=e[28];let k;e[29]!==v||e[30]!==y||e[31]!==p?(k=r.jsxs(Ht,{align:"end",children:[p,v,y]}),e[29]=v,e[30]=y,e[31]=p,e[32]=k):k=e[32];let w;return e[33]!==k||e[34]!==h?(w=r.jsxs(Ft,{children:[h,k]}),e[33]=k,e[34]=h,e[35]=w):w=e[35],w}function fie(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,o=ie(),l=_Z();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 u;e[6]!==i?(u=V=>!V&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==o?(h=o("assets.browser.deleteConfirmTitle"),e[8]=o,e[9]=h):h=e[9];let f;e[10]!==h?(f=r.jsx(nc,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==o?(m=o("assets.browser.deleteConfirmDescription",{name:n?Vh(n.key):""}),e[12]=n,e[13]=o,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx(ic,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=r.jsxs(sc,{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(oc,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=re(zj({variant:"destructive"})),e[25]=_):_=e[25];const L=l.isPending;let y;e[26]!==c?(y=V=>{V.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let k;e[28]!==l.isPending?(k=l.isPending?r.jsx(ft,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=k):k=e[29];let w;e[30]!==o?(w=o("assets.browser.deleteConfirm"),e[30]=o,e[31]=w):w=e[31];let S;e[32]!==l.isPending||e[33]!==y||e[34]!==k||e[35]!==w?(S=r.jsxs(lc,{className:_,disabled:L,onClick:y,children:[k,w]}),e[32]=l.isPending,e[33]=y,e[34]=k,e[35]=w,e[36]=S):S=e[36];let j;e[37]!==v||e[38]!==S?(j=r.jsxs(rc,{children:[v,S]}),e[37]=v,e[38]=S,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=r.jsxs(tc,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let N;return e[43]!==C||e[44]!==d||e[45]!==u?(N=r.jsx(ec,{open:d,onOpenChange:u,children:C}),e[43]=C,e[44]=d,e[45]=u,e[46]=N):N=e[46],N}const Q9={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:Vl},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Br},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:dy}},mie=["fast","smart","thinking"];function pie(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=ie(),[o,l]=A.useState(!1),a=Q9[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=Q9[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=mie.map(x=>{const b=Q9[x],v=b.icon;return r.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:re("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[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(Rt,{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(rs,{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(os,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function gie(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=ie(),[a,c]=A.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?r.jsx(A.Suspense,{fallback:r.jsx(de,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(xie,{override:i,onOverrideChange:o})}):r.jsx(pie,{tier:s,onSelect:n}),e[4]=o,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==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(pr,{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]!==h||e[22]!==g?(x=r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=r.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function xie(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=ie(),o=lf(),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]=A.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==o?(u=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=u):u=e[7];const h=u;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]!==h||e[18]!==n?(g=b=>{const v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(DV,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const jw=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Ep,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Hn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:Ei},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:mi},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:mu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Kr,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:tf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:Tp},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:_p},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Wd},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Kr},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:aV}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Xa,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Xa},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Qa},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Qa}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Hr,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:zy},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Hr},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:zo}]}],bie=jw.flatMap(t=>t.tools.map(e=>e.name));function vie(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function yie(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,o=ie();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(A.Suspense,{fallback:r.jsxs(de,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(Ep,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(_ie,{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 K5(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(Sc,{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 u;e[4]!==o?(u=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&r.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=r.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=r.jsxs(Yt,{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 W5(t){const e=F.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=ie(),d=o===l;let u;e[0]!==i||e[1]!==s?(u=s?r.jsx(Bi,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(yV,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("span",{className:"truncate",children:h}),e[7]=h,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=_=>{_.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]!==u||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function _ie(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,o=ie(),{org:l}=qe(),[a,c]=A.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=Jt(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=Qp(h),p=Pi();let g,x,b,v,_,L,y,k,w,S,j,C,N;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const D=new Map(p.map(jie)),I=new Map;for(const he of f?.tools??[]){const ce=ar(he._meta)??"__other__",ge=bc(he.name,ce==="__other__"?void 0:ce),Q=he.title,me=Q&&Q!==he.name?Q:vie(ge);I.has(ce)||I.set(ce,{clientId:ce,conn:D.get(ce),tools:[]}),I.get(ce).tools.push({name:he.name,display:me,description:he.description})}const R=[...I.values()].sort(kie),$=(f?.tools??[]).map(wie),B=[...bie,...$],M=n===null?new Set(B):new Set(n),O=B.every(he=>M.has(he)),z=he=>i(B.every(ce=>he.has(ce))?null:[...he]),U=he=>{const ce=new Set(M);ce.has(he)?ce.delete(he):ce.add(he),z(ce)},H=(he,ce)=>{const ge=new Set(M);for(const Q of he)ce?ge.add(Q):ge.delete(Q);z(ge)};v=os,N=a,_=c;let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(Ep,{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(FT,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",B.length]});let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[30]=X):X=e[30],e[31]!==W||e[32]!==Y?(L=r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[K,W,Y,X]})}),e[31]=W,e[32]=Y,e[33]=L):L=e[33],b=rs,j="p-0 w-80",C="start",x=zi;let ne;e[34]!==o?(ne=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=ne):ne=e[35],e[36]!==ne?(w=r.jsx(yi,{placeholder:ne}),e[36]=ne,e[37]=w):w=e[37];const se=O?o("automations.automationConfig.allToolsEnabled",{count:B.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:B.length});let oe;e[38]!==se?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:se}),e[38]=se,e[39]=oe):oe=e[39];let Z;e[40]!==i?(Z=()=>i(null),e[40]=i,e[41]=Z):Z=e[41];let J;e[42]!==o?(J=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=J):J=e[43];let q;e[44]!==O||e[45]!==Z||e[46]!==J?(q=r.jsx("button",{type:"button",onClick:Z,disabled:O,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:J}),e[44]=O,e[45]=Z,e[46]=J,e[47]=q):q=e[47];let G;e[48]===Symbol.for("react.memo_cache_sentinel")?(G=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=G):G=e[48];let te;e[49]!==i?(te=()=>i([]),e[49]=i,e[50]=te):te=e[50];const le=M.size===0;let ee;e[51]!==o?(ee=o("automations.automationConfig.clear"),e[51]=o,e[52]=ee):ee=e[52];let ae;e[53]!==te||e[54]!==le||e[55]!==ee?(ae=r.jsx("button",{type:"button",onClick:te,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ee}),e[53]=te,e[54]=le,e[55]=ee,e[56]=ae):ae=e[56];let ue;e[57]!==q||e[58]!==ae?(ue=r.jsxs("div",{className:"flex items-center gap-2",children:[q,G,ae]}),e[57]=q,e[58]=ae,e[59]=ue):ue=e[59],e[60]!==oe||e[61]!==ue?(S=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,ue]}),e[60]=oe,e[61]=ue,e[62]=S):S=e[62],g=_i,y="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(si,{children:o("automations.automationConfig.noToolsFound")}),jw.map(he=>{const ce=he.tools.map(Sie),ge=ce.filter(Q=>M.has(Q)).length;return r.jsx(gs,{heading:r.jsx(W5,{label:o(he.headingKey),icon:he.icon,on:ge,total:ce.length,onToggle:()=>H(ce,ge!==ce.length)}),children:he.tools.map(Q=>r.jsx(K5,{value:`${o(Q.titleKey)} ${Q.name}`,checked:M.has(Q.name),onToggle:()=>U(Q.name),title:o(Q.titleKey),description:o(Q.descriptionKey),leading:r.jsx(Q.icon,{size:16,className:"text-muted-foreground"})},Q.name))},he.key)}),R.map(he=>{const ce=he.tools.map(Lie),ge=ce.filter(Q=>M.has(Q)).length;return r.jsx(gs,{heading:r.jsx(W5,{conn:he.conn,on:ge,total:ce.length,onToggle:()=>H(ce,ge!==ce.length)}),children:he.tools.map(Q=>r.jsx(K5,{value:`${Q.display} ${Q.name} ${he.conn?.title??""}`,checked:M.has(Q.name),onToggle:()=>U(Q.name),title:Q.display,description:Q.description},Q.name))},he.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]=_,e[18]=L,e[19]=y,e[20]=k,e[21]=w,e[22]=S,e[23]=j,e[24]=C,e[25]=N}else g=e[13],x=e[14],b=e[15],v=e[16],_=e[17],L=e[18],y=e[19],k=e[20],w=e[21],S=e[22],j=e[23],C=e[24],N=e[25];let V;e[63]!==g||e[64]!==y||e[65]!==k?(V=r.jsx(g,{className:y,children:k}),e[63]=g,e[64]=y,e[65]=k,e[66]=V):V=e[66];let T;e[67]!==x||e[68]!==V||e[69]!==w||e[70]!==S?(T=r.jsxs(x,{children:[w,S,V]}),e[67]=x,e[68]=V,e[69]=w,e[70]=S,e[71]=T):T=e[71];let E;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==C?(E=r.jsx(b,{className:j,align:C,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=C,e[76]=E):E=e[76];let P;return e[77]!==v||e[78]!==_||e[79]!==L||e[80]!==E||e[81]!==N?(P=r.jsxs(v,{open:N,onOpenChange:_,children:[L,E]}),e[77]=v,e[78]=_,e[79]=L,e[80]=E,e[81]=N,e[82]=P):P=e[82],P}function Lie(t){return t.name}function Sie(t){return t.name}function wie(t){return t.name}function kie(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function jie(t){return[t.id,t]}function Rd(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Cie(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"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function Nie(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 Vie(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 Tie(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Eie=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Aie({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=ie(),{triggerAdd:a}=_u(),[c,d]=A.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),pe.success(l("automations.addStarterPopover.starterAdded")),h(!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"});h(!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(Ft,{open:u,onOpenChange:h,children:[r.jsx(Ut,{asChild:!0,children:r.jsxs(de,{variant:"outline",size:"sm",children:[r.jsx($t,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(Ht,{align:"end",className:"w-[200px]",children:[r.jsxs(nr,{children:[r.jsxs(ir,{className:"gap-2.5",children:[r.jsx(Sd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(rr,{className:"w-[160px]",children:Eie.map(p=>r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(Sd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[r.jsx(Sd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[r.jsx(qr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(Hn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Cw(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,u=ie(),[h,f]=A.useState(null),[m,p]=A.useState("curl"),[g,x]=A.useState("header"),b=A.useId();let v;e[0]!==u?(v=async(R,$)=>{try{await navigator.clipboard.writeText(R),f($),pe.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{pe.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const _=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 y=L,k=i&&o?g==="header"?`curl -X POST "${y}" \\
544
544
  -H "Authorization: Bearer ${o}" \\
545
545
  -H "Content-Type: application/json" \\
546
546
  -d '{"hello":"world"}'`:`curl -X POST "${y}" \\
@@ -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 Pre(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Are).replaceAll("{{title}}",Ere).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Dre(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=ul(s),l=ul(i??"");if(o.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(vt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(o.isError||!o.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==o.data?(c=Pre(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 pd(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 Rre(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 h;e[7]!==i||e[8]!==l||e[9]!==o?(h=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:GV(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]=h):h=e[10],c=n.map(h),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 u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Ire(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 Iw(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(Ire,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=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(bt,{value:n,onChange:h=>o(s.name,h.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 u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=r.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Zc(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(pd,{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 h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>r.jsx(Iw,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),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 u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Mre({brandPath:t,onClose:e,variant:s}){const n=ie(),{org:i}=qe(),o=Wh(t),l=o.volume??"",a=o.dirPath,c=as(a),d=o.readOnly,u=bs(),h=Lc(),f=Ry(l),{upload:m,remove:p}=Kd(l),g=A.useRef(null),x=qp(l,a),b=x.data??[],v=Q=>b.some(me=>me.kind==="file"&&as(me.path)===Q),_=v("tokens.css"),L=v("brand.md"),y=v("slides-theme.html"),k=HV(b),w=h(l,`${a}/tokens.css`),S=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),C=ul(w,{enabled:_}),N=ul(S,{enabled:L}),[V,T]=A.useState(!1),[E,P]=A.useState({}),[D,I]=A.useState(null),[R,$]=A.useState(!1),[B,M]=A.useState(!1),[O,z]=A.useState("deck"),U=C.data?KV(C.data):[],H=Q=>U.find(me=>me.name===Q)?.value,K=Q=>E[Q.name]??Q.value,W=WV(U),Y=U.filter(Q=>Q.kind==="font"),X=U.filter(Q=>Q.kind==="type"),ne=U.filter(Q=>Q.kind==="space"),se=U.filter(Q=>Q.kind==="radius"),oe=U.filter(Q=>Q.kind==="shadow"),Z=U.filter(Q=>Q.kind==="motion"),J=U.filter(Q=>Q.kind==="other"),q=(Q,me)=>P(ve=>({...ve,[Q]:me})),G=y&&O==="deck",te=D??N.data??"",le=Object.entries(E).filter(([Q,me])=>H(Q)!==me),ee=D!==null&&D!==(N.data??""),ae=le.length>0||ee;function ue(){P({}),I(null),T(!1)}async function he(){$(!0);try{if(le.length>0){let Q=C.data??"";for(const[me,ve]of le)Q=qV(Q,me,ve);await f.mutateAsync({path:`${a}/tokens.css`,body:Q,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:et.fileText(w)})}ee&&D!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:D,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:et.fileText(S)})),u.invalidateQueries({queryKey:et.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:et.orgFsRecent(i.id)}),P({}),I(null),T(!1),pe.success(n("library.brandPreview.brandSaved"))}catch(Q){pe.error(Q instanceof Error?Q.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function ce(Q){const me=Q?.[0];if(!me)return;const we=`logo.${(me.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([me],we,{type:me.type})]}),k&&as(k)!==we&&await p.mutateAsync(k),pe.success(n("library.brandPreview.logoUpdated"))}catch(ye){pe.error(ye instanceof Error?ye.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ge=!x.isPending&&!_&&!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(j1,{size:18})}),s==="dialog"?r.jsx(Wt,{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&&(V?r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",size:"sm",onClick:ue,disabled:R,children:n("library.brandPreview.cancel")}),r.jsx(de,{size:"sm",disabled:!ae||R,onClick:()=>{he()},children:n(R?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(de,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[r.jsx(dV,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(qv,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(de,{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(vt,{className:"h-40 w-full rounded-xl"}),r.jsx(vt,{className:"h-4 w-1/3"}),r.jsx(vt,{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(B?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(Q=>!Q),onKeyDown:Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),M(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:Q=>Q.stopPropagation(),children:[y&&r.jsx("button",{type:"button",onClick:()=>{z("deck"),M(!1)},className:re("rounded-md px-2.5 py-1",G?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{z("components"),M(!1)},className:re("rounded-md px-2.5 py-1",G?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),B?r.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(a6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!B&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:re("w-full overflow-hidden rounded-xl border border-border bg-muted/30",G?"aspect-[16/9]":"h-96"),children:G?r.jsx(Dre,{readUrl:j,title:`${c} deck theme`,tokensUrl:w}):r.jsx(Tre,{tokensUrl:w})})})]}),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(pd,{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:h(l,k),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(j1,{size:28,className:"text-muted-foreground/50"})}),V&&r.jsxs("div",{children:[r.jsxs(de,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(ti,{size:14}),n(k?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:Q=>{ce(Q.target.files)}})]})]})]}),W.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(pd,{children:n("library.brandPreview.colors")}),W.map(Q=>r.jsx(Rre,{family:Q.family,tokens:Q.tokens,editing:V,valueOf:K,onEdit:q},Q.family))]}),(Y.length>0||X.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(pd,{children:n("library.brandPreview.typography")}),Y.map(Q=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:Q.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),V?r.jsx(bt,{value:K(Q),onChange:me=>q(Q.name,me.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:K(Q)},children:K(Q)})]},Q.name)),X.map(Q=>r.jsx(Iw,{token:Q,value:K(Q),editing:V,onEdit:q},Q.name))]}),r.jsx(Zc,{label:n("library.brandPreview.spacing"),tokens:ne,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.radius"),tokens:se,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.shadows"),tokens:oe,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.motion"),tokens:Z,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.tokens"),tokens:J,editing:V,valueOf:K,onEdit:q}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(pd,{children:n("library.brandPreview.voiceGuidelines")}),V?r.jsx(Wr,{value:te,onChange:Q=>I(Q.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):N.isPending&&L?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(vt,{className:"h-3 w-full"}),r.jsx(vt,{className:"h-3 w-5/6"})]}):te.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Oo,{id:`brand-preview-${t}`,text:te})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Mw(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(It,{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(Mre,{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(Mt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function $w(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(It,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(Rw,{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(Mt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function $re(t){const e=F.c(18),{skillPath:s,onClose:n,variant:i}=t,o=Wh(s),{volume:l,dirPath:a}=o,c=Lc(),d=c(l??"",`${a}/SKILL.md`),u=ul(d),h=qp(l??"",a);let f;e[0]!==a?(f=as(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==u.data?(p=u.data?YV(u.data):null,e[2]=u.data,e[3]=p):p=e[3];const g=p,x=Bre;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(P,D)=>x(P.path)?-1:x(D.path)?1:as(P.path).localeCompare(as(D.path)),e[4]=b):b=e[4];const v=(h.data??[]).filter(Ore).sort(b),[_,L]=A.useState(null),y=_===null?null:v.find(P=>P.path===_)??null,k=g?.name??m;let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(qr,{size:18})}),e[5]=w):w=e[5];let S;e[6]!==k||e[7]!==i?(S=i==="dialog"?r.jsx(Wt,{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]=S):S=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(qv,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(de,{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 C;e[12]!==S||e[13]!==j?(C=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[w,S,j]}),e[12]=S,e[13]=j,e[14]=C):C=e[14];let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=N):N=e[15];const V="relative flex min-w-0 flex-1 flex-col overflow-y-auto",T=y?r.jsx(t3,{file:{key:y.path,filename:as(y.path),size:y.size,downloadUrl:c(l??"",y.path)}}):u.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(vt,{className:"h-4 w-1/3"}),r.jsx(vt,{className:"h-3 w-full"}),r.jsx(vt,{className:"h-3 w-5/6"}),r.jsx(vt,{className:"h-3 w-2/3"})]}):u.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(Oo,{id:`skill-preview-${s}`,text:g.body})})]});let E;return e[16]!==T?(E=r.jsx("div",{className:V,children:T}),e[16]=T,e[17]=E):E=e[17],r.jsxs(r.Fragment,{children:[C,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:[N,h.isPending?r.jsx(vt,{className:"mx-2 h-4 w-24"}):v.map(P=>{const D=x(P.path)?y===null:_===P.path;return r.jsxs("button",{type:"button",onClick:()=>L(x(P.path)?null:P.path),className:re("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",D?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(mr,{filename:as(P.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:re("truncate text-sm",D?"text-foreground":"text-muted-foreground"),children:as(P.path)})]},P.path)})]}),E]})]})}function Ore(t){return t.kind==="file"}function Bre(t){return as(t)==="SKILL.md"}function Ow(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(It,{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($re,{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(Mt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function zre(t){const e=F.c(11),{onOpenDir:s}=t,n=ie(),i=YT();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(xu,{name:d.volume,glyph:Vn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:Iy(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 s3(t){return`${window.location.origin}${t}`}function Id(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Fre=[Bd,"uploads","outputs"],Bw=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:ti},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Br}],pm=new Set([...Bw.map(t=>t.volume),Ya("public")]),Ure=6;function zw(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Pv(t),o=i?`public/${i}`:t==="home"?zd(s):t;return n?`${o}/${n}`:o}function S0(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 vo(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 Dr(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 Xf(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(Dr,{children:Array.from({length:n*3},Hre)}),e[0]=n,e[1]=i):i=e[1],i}function Hre(t,e){return r.jsx(vt,{className:"h-16 rounded-2xl"},e)}function n3(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 Kre(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=ie(),a=ZV(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(u=r.jsx(xu,{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]=u):u=e[11],u}function Wre(t){const e=F.c(12),{onOpenDir:s}=t,n=ie(),o=My().data?.length??0;let l;e[0]!==s?(l=Bw.map(u=>r.jsx(Kre,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o||e[4]!==n?(a=o>0&&r.jsx(xu,{name:Ya("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:qr,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(zre,{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 qre(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=qe();let o;e[0]!==s?(o=s[0]===Bd?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:zd(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Bd),children:zd(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(dn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:Ya(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Ya(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function Gre(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=ie(),{org:d}=qe(),u=Lc(),h=JV(s,n);let f;e[0]!==u||e[1]!==l?(f=w=>l({volume:w.volume,path:w.path,kind:"file",shareMode:w.shareMode??"private",effectivePublic:w.effectivePublic??!1,url:s3(u(w.volume,w.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Xf,{rows:2}),e[3]=w):w=e[3],w}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=h.data??[],g.length===0){let S;e[14]!==s||e[15]!==c?(S=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=S):S=e[16];let j;e[17]!==S?(j=r.jsx(n3,{children:S}),e[17]=S,e[18]=j):j=e[18],v=j;break e}const w=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==w?(b=re("flex flex-col gap-3",w),e[19]=w,e[20]=b):b=e[20],p=vo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let _;e[21]!==p||e[22]!==x?(_=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let L;if(e[24]!==u||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let w;e[31]!==u||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(w=S=>{const j=Pv(S.volume)!==null;return r.jsx($y,{filename:as(S.path),updatedAt:S.updatedAt,downloadUrl:u(S.volume,S.path),subtitle:zw(S.volume,S.path,d.slug),publicState:Id(S),onOpen:()=>o(Dv(S.volume,S.path)),onShare:j?void 0:()=>m(S),onDelete:j?void 0:()=>a({volume:S.volume,path:S.path,kind:"file"})},`${S.volume}/${S.path}`)},e[31]=u,e[32]=a,e[33]=o,e[34]=d,e[35]=m,e[36]=w):w=e[36],L=g.map(w),e[24]=u,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let y;e[37]!==L?(y=r.jsx(Dr,{children:L}),e[37]=L,e[38]=y):y=e[38];let k;return e[39]!==b||e[40]!==_||e[41]!==y?(k=r.jsxs("div",{className:b,children:[_,y]}),e[39]=b,e[40]=_,e[41]=y,e[42]=k):k=e[42],k}function Yre(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=ie(),{org:l}=qe(),a=Dy(),c=Lc();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:s3(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let _;e[5]!==v?(_=r.jsx(vo,{children:v}),e[5]=v,e[6]=_):_=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Xf,{}),e[7]=L):L=e[7];let y;return e[8]!==_?(y=r.jsxs("div",{className:"flex flex-col gap-3",children:[_,L]}),e[8]=_,e[9]=y):y=e[9],y}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,Ure);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==o?(_=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=_):_=e[23],e[24]!==_?(p=r.jsx(vo,{children:_}),e[24]=_,e[25]=p):p=e[25],h=Dr;let L;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(L=y=>r.jsx(eT,{filename:as(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:zw(y.volume,y.path,l.slug),publicState:Id(y),onOpen:()=>s(Dv(y.volume,y.path)),onShare:()=>u(y),onDelete:()=>i({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,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]=u,e[16]=o,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=r.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=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 Jre(t){const e=F.c(16),{onOpenDir:s}=t,n=ie(),i=My();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Xf,{}),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 u;return e[5]!==d?(u=r.jsx(n3,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>r.jsx(xu,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=r.jsx(Dr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Qre(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=ie(),{org:m}=qe(),p=s.volume??"",g=qp(p,s.dirPath),x=Lc();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=V=>s.isHomeRoot&&pm.has(V.toLowerCase())?`${zd(m.slug)}/${V}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?r.jsx(Wre,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const L=_;if(g.isPending){let V;e[6]!==L||e[7]!==f?(V=L&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.folders")}),r.jsx(Dr,{children:L})]}),e[6]=L,e[7]=f,e[8]=V):V=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(Xf,{rows:2}),e[9]=T):T=e[9];let E;return e[10]!==V?(E=r.jsxs(r.Fragment,{children:[V,T]}),e[10]=V,e[11]=E):E=e[11],E}if(g.isError){let V;e[12]!==g.error||e[13]!==f?(V=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=V):V=e[14];let T;return e[15]!==V?(T=r.jsx("p",{className:"text-sm text-destructive",children:V}),e[15]=V,e[16]=T):T=e[16],T}let y,k,w,S,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const V=g.data??[],T=V.filter(toe),E=V.filter(eoe),P=V.filter(Zre),D=V.filter(Xre);if(V.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let O;e[41]!==M?(O=r.jsx(n3,{children:M}),e[41]=M,e[42]=O):O=e[42],j=O;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const R=I;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?s3(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const B=$;y=T.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.skills")}),r.jsx(Dr,{children:T.map(M=>r.jsx(QV,{dirName:as(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:Id(M),onOpen:()=>o(_a(s,M.path)),onBrowse:()=>n(_a(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),k=E.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.brands")}),r.jsx(Dr,{children:E.map(M=>r.jsx(XV,{dirName:as(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(_a(s,M.path)),onBrowse:()=>n(_a(s,M.path)),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),w=(P.length>0||L)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.folders")}),r.jsxs(Dr,{children:[L,P.map(M=>r.jsx(xu,{name:as(M.path),meta:Iy(M.updatedAt),subtitle:v(as(M.path)),readOnly:s.readOnly,publicState:Id(M),onOpen:()=>n(_a(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},M.path))]})]}),S=D.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.files")}),r.jsx(Dr,{children:D.map(M=>r.jsx($y,{filename:as(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:Id(M),onOpen:()=>i(_a(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"file",{onDragStart:d,onContextMenu:u})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=o,e[29]=a,e[30]=L,e[31]=f,e[32]=p,e[33]=y,e[34]=k,e[35]=w,e[36]=S,e[37]=j}else y=e[33],k=e[34],w=e[35],S=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(C=s.isHomeRoot&&r.jsx(Yre,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let N;return e[57]!==y||e[58]!==k||e[59]!==w||e[60]!==S||e[61]!==C?(N=r.jsxs(r.Fragment,{children:[y,k,w,S,C]}),e[57]=y,e[58]=k,e[59]=w,e[60]=S,e[61]=C,e[62]=N):N=e[62],N}function Xre(t){return t.kind==="file"}function Zre(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function eoe(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function toe(t){return t.kind==="dir"&&t.hasSkill}function soe({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ie(),{org:i}=qe(),o=bs(),l=zt(),a=Ro(),c=br({strict:!1}),d=c.path||Bd,u=Wh(d),h=JT(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(Q,me)=>l({to:".",search:ve=>({...ve,[Q]:me||void 0})}),p=Q=>m("path",Q),g=(Q,me)=>l({to:".",search:ve=>({...ve,preview:void 0,skill:void 0,brand:void 0,[Q]:me})}),x=t??(Q=>g("preview",Q)),b=e??(Q=>g("skill",Q)),v=s??(Q=>g("brand",Q)),[_,L]=A.useState(""),y=pf(_.trim(),300),k=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,w=k?n("library.library.searchInPlaceholder",{folder:Ya(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),S=f.isHomeRoot?zd(i.slug):Ya(f.segments.at(-1)??""),[j,C]=A.useState(null),[N,V]=A.useState(null),[T,E]=A.useState(!1),[P,D]=A.useState(""),[I,R]=A.useState(!1),[$,B]=A.useState(null),[M,O]=A.useState(""),z=A.useRef(null),[U,H]=A.useState(!1),K=A.useRef(0),W=f.readOnly?null:f.volume,{upload:Y,mkdir:X,move:ne}=Kd(W??Bd),{remove:se}=Kd(j?.volume??"uploads");async function oe(Q){if(!(!W||!Q||Q.length===0))try{await Y.mutateAsync({dir:f.dirPath,files:[...Q]}),pe.success(Q.length===1?n("library.library.uploadedSingle",{filename:Q[0]?.name??""}):n("library.library.uploadedMultiple",{count:Q.length}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.uploadFailed"))}finally{z.current&&(z.current.value="")}}const Z=W!==null;function J(Q){return Q.dataTransfer.types.includes("Files")}function q(Q){!Z||!J(Q)||(Q.preventDefault(),K.current+=1,H(!0))}function G(Q){!Z||!J(Q)||Q.preventDefault()}function te(){Z&&(K.current=Math.max(0,K.current-1),K.current===0&&H(!1))}function le(Q){Z&&(Q.preventDefault(),Q.stopPropagation(),K.current=0,H(!1),Q.dataTransfer.files.length>0&&oe(Q.dataTransfer.files))}async function ee(){const Q=P.trim();if(!(!W||!Q)){if(f.isHomeRoot&&pm.has(Q.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:Q}));return}try{const me=f.dirPath;await X.mutateAsync(me?`${me}/${Q}`:Q),pe.success(n("library.library.folderCreated",{name:Q})),E(!1),D("")}catch(me){pe.error(me instanceof Error?me.message:n("library.library.folderCreateFailed"))}}}async function ae(){if(!j)return;const Q=j;try{await se.mutateAsync(Q.path),pe.success(n("library.library.deleted",{name:as(Q.path)}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ue(){if(!$)return;const Q=M.trim();if(!Q||Q.includes("/")||Q.includes("..")||Q===as($.path)){R(!1),B(null),O("");return}if($.kind==="dir"&&f.isHomeRoot&&pm.has(Q.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:Q}));return}try{const me=$.path.includes("/")?$.path.slice(0,$.path.lastIndexOf("/")):"",ve=me?`${me}/${Q}`:Q;await ne.mutateAsync({from:$.path,to:ve});const we=Q.replace(/[<>]/g,"");pe.success(n("library.library.renamed",{name:we}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.renameFailed"))}finally{R(!1),B(null),O("")}}async function he(Q,me){try{const ve=as(Q),we=me?`${me}/${ve}`:ve;await ne.mutateAsync({from:Q,to:we}),pe.success(n("library.library.moved",{name:ve,destination:me||n("library.library.theLibrary")}))}catch(ve){pe.error(ve instanceof Error?ve.message:n("library.library.moveFailed"))}}function ce(){for(const Q of Fre)o.invalidateQueries({queryKey:et.orgFsVolume(i.id,Q)});f.volume&&o.invalidateQueries({queryKey:et.orgFsVolume(i.id,f.volume)}),o.invalidateQueries({queryKey:et.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:et.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:et.orgFsPublicSets(i.id)})}function ge(Q){Q.defaultPrevented||!W||Q.target.closest("input, textarea, button, a, [role='button']")||(Q.preventDefault(),E(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:q,onDragOver:G,onDragLeave:te,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(ti,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:S})})]})}),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(qre,{segments:f.segments,onNavigate:p})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(mf,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(bt,{value:_,onChange:Q=>L(Q.target.value),onKeyDown:Q=>{Q.key==="Escape"&&L("")},placeholder:w,className:"h-9 rounded-xl pr-9 pl-9"}),_&&r.jsx(de,{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(Ai,{size:14})})]}),r.jsx(de,{variant:"ghost",size:"icon",onClick:ce,"aria-label":n("library.library.refresh"),children:r.jsx(zn,{size:14})}),W&&r.jsxs(de,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[r.jsx($t,{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(jc,{size:12}),n("library.library.readOnly")]}):r.jsxs(de,{size:"sm",disabled:Y.isPending,onClick:()=>z.current?.click(),children:[r.jsx(ti,{size:14}),Y.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:z,type:"file",multiple:!0,className:"hidden",onChange:Q=>{oe(Q.target.files)}})]}),y?r.jsx(Gre,{query:y,scope:k,stale:_.trim()!==y,onOpenFile:x,onShare:V,onDelete:C}):f.volume===null?r.jsx(Jre,{onOpenDir:p}):r.jsx(Qre,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:V,onDelete:C,onContextMenu:(Q,me)=>{B({path:Q,kind:me}),O(as(Q)),R(!0)},onMove:he},f.volume)]})}),a&&(c.preview?r.jsx($w,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?r.jsx(Ow,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?r.jsx(Mw,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),r.jsx(Mt,{open:T,onOpenChange:E,children:r.jsxs(It,{children:[r.jsxs(xs,{children:[r.jsx(Wt,{children:n("library.library.newFolderTitle")}),r.jsx(Fn,{children:n("library.library.newFolderDescription",{path:S||n("library.library.theLibrary")})})]}),r.jsx(bt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:P,onChange:Q=>D(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&ee()}}),r.jsxs(Zn,{children:[r.jsx(de,{variant:"outline",onClick:()=>E(!1),children:n("library.library.cancel")}),r.jsx(de,{disabled:!P.trim()||X.isPending,onClick:()=>{ee()},children:n("library.library.create")})]})]})}),r.jsx(Mt,{open:I,onOpenChange:Q=>{R(Q),Q||(B(null),O(""))},children:r.jsxs(It,{children:[r.jsxs(xs,{children:[r.jsx(Wt,{children:$&&n("library.library.renameTitle",{name:as($.path)})}),r.jsx(Fn,{children:n("library.library.renameDescription")})]}),r.jsx(bt,{autoFocus:!0,value:M,onChange:Q=>O(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&ue()}}),r.jsxs(Zn,{children:[r.jsx(de,{variant:"outline",onClick:()=>R(!1),children:n("library.library.cancel")}),r.jsx(de,{disabled:!M.trim()||ne.isPending,onClick:()=>{ue()},children:n("library.library.rename")})]})]})}),r.jsx(vre,{target:N,onOpenChange:Q=>{Q||V(null)}}),r.jsx(ec,{open:j!==null,onOpenChange:Q=>{Q||C(null)},children:r.jsxs(tc,{children:[r.jsxs(sc,{children:[r.jsx(nc,{children:n("library.library.deleteTitle",{name:j?as(j.path):""})}),r.jsx(ic,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(rc,{children:[r.jsx(oc,{children:n("library.library.cancel")}),r.jsx(lc,{onClick:()=>{ae()},children:n("library.library.delete")})]})]})})]})}function noe(){const t=F.c(12),e=zt(),[s,n]=A.useState(null),[i,o]=A.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(soe,{onOpenFile:f=>a(vN(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(Ow,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let u;t[6]!==i?(u=i&&r.jsx(Mw,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=u):u=t[7];let h;return t[8]!==c||t[9]!==d||t[10]!==u?(h=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,u]}),t[8]=c,t[9]=d,t[10]=u,t[11]=h):h=t[11],h}const Q5=A.lazy(()=>Tn(()=>import("./project-app-view-DoK4zGoF.js"),__vite__mapDeps([168,1,2,68,69,6,22,37,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,7,40,8,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,70,71,72,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,120,109,110,111,112,113,114,115,116,117,103,104,105,106,107,108,118,119,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.AppViewContent})));function ioe(t){const e=F.c(64),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let y;return e[0]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(EW,{}),e[0]=y):y=e[0],y}if(s==="board"){let y;return e[1]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(hq,{})}),e[1]=y):y=e[1],y}if(yN(s)){let y;return e[2]!==n?(y=r.jsx(Bx,{virtualMcpId:n}),e[2]=n,e[3]=y):y=e[3],y}if(s==="git"){let y;return e[4]!==n?(y=r.jsx(eY,{virtualMcpId:n}),e[4]=n,e[5]=y):y=e[5],y}if(s==="automations"){let y;return e[6]!==n?(y=r.jsx(Yie,{virtualMcpId:n}),e[6]=n,e[7]=y):y=e[7],y}if(s==="preview"){let y;return e[8]!==n?(y=r.jsx(zte,{virtualMcpId:n}),e[8]=n,e[9]=y):y=e[9],y}let c;e[10]!==s?(c=_N(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let y;return e[12]!==d.path?(y=r.jsx(Kte,{openPath:d.path}),e[12]=d.path,e[13]=y):y=e[13],y}if(s==="content"){let y;return e[14]!==n?(y=r.jsx(nie,{virtualMcpId:n}),e[14]=n,e[15]=y):y=e[15],y}if(s==="assets"){let y;return e[16]!==n?(y=r.jsx(iie,{virtualMcpId:n}),e[16]=n,e[17]=y):y=e[17],y}if(s==="files"){let y;return e[18]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(noe,{}),e[18]=y):y=e[18],y}if(s==="reports"){let y;return e[19]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(lre,{}),e[19]=y):y=e[19],y}if(s==="connect-sources"){let y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(ire,{}),e[20]=y):y=e[20],y}if(a){let y;return e[21]!==s?(y=r.jsx(Hie,{tabId:s}),e[21]=s,e[22]=y):y=e[22],y}let u;e[23]!==s?(u=ry(s),e[23]=s,e[24]=u):u=e[24];const h=u;if(h){let y;return e[25]!==h.path?(y=r.jsx(_re,{path:h.path},h.path),e[25]=h.path,e[26]=y):y=e[26],y}let f;e[27]!==s?(f=iy(s),e[27]=s,e[28]=f):f=e[28];const m=f;if(m){let y;return e[29]!==m.key||e[30]!==i?(y=r.jsx(tre,{fileKey:m.key,taskId:i}),e[29]=m.key,e[30]=i,e[31]=y):y=e[31],y}let p;e[32]!==s?(p=oy(s),e[32]=s,e[33]=p):p=e[33];const g=p;if(g){let y;return e[34]!==g.path?(y=r.jsx(kre,{path:g.path},g.path),e[34]=g.path,e[35]=y):y=e[35],y}let x;e[36]!==s?(x=LN(s),e[36]=s,e[37]=x):x=e[37];const b=x;if(b){let y;if(e[38]!==l||e[39]!==b.connectionId||e[40]!==b.toolName){let C;e[42]!==b.connectionId||e[43]!==b.toolName?(C=N=>N.appId===b.connectionId&&N.toolName===b.toolName,e[42]=b.connectionId,e[43]=b.toolName,e[44]=C):C=e[44],y=l.find(C),e[38]=l,e[39]=b.connectionId,e[40]=b.toolName,e[41]=y}else y=e[41];const k=y;let w;e[45]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Qr,{}),e[45]=w):w=e[45];const S=k?.args;let j;return e[46]!==s||e[47]!==b.connectionId||e[48]!==b.toolName||e[49]!==S?(j=r.jsx(A.Suspense,{fallback:w,children:r.jsx(Q5,{connectionId:b.connectionId,toolName:b.toolName,args:S},s)}),e[46]=s,e[47]=b.connectionId,e[48]=b.toolName,e[49]=S,e[50]=j):j=e[50],j}let v;if(e[51]!==s||e[52]!==o){let y;e[54]!==s?(y=k=>k.id===s,e[54]=s,e[55]=y):y=e[55],v=o.find(y),e[51]=s,e[52]=o,e[53]=v}else v=e[53];const _=v;if(_){let y;e[56]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Qr,{}),e[56]=y):y=e[56];let k;return e[57]!==s||e[58]!==_.id||e[59]!==_.view.appId||e[60]!==_.view.args?(k=r.jsx(A.Suspense,{fallback:y,children:r.jsx(Q5,{connectionId:_.view.appId,toolName:_.id,args:_.view.args},s)}),e[57]=s,e[58]=_.id,e[59]=_.view.appId,e[60]=_.view.args,e[61]=k):k=e[61],k}let L;return e[62]!==n?(L=r.jsx(Bx,{virtualMcpId:n}),e[62]=n,e[63]=L):L=e[63],L}function roe(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}=$2(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Qr,{}),e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(u=r.jsx(A.Suspense,{fallback:d,children:r.jsx(ioe,{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]=u):u=e[10];let h;return e[11]!==o||e[12]!==u?(h=r.jsx(Fs,{children:u},o),e[11]=o,e[12]=u,e[13]=h):h=e[13],h}function ooe(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&SN.has(t.mainTab))}const al="setup";function loe(t){const e=F.c(57),s=ie();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=y=>!t.scriptTabs.includes(y),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===al?t.onToggle():t.onSelectTab(al)},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(Qt,{className:"size-4"}):r.jsx(a6,{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(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=r.jsx(Ke,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=r.jsxs(We,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===al;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(aoe,{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(doe,{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(uoe,{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(hoe,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(coe,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let _;return e[53]!==b||e[54]!==v||e[55]!==f?(_=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]=_):_=e[56],_}function aoe(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=re("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(uV,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==o?(h=o("sandbox.toolbar.setupTab"),e[3]=o,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=r.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function coe(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(fl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=r.jsxs(de,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(fl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=r.jsxs(de,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(zn,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=r.jsxs(de,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!o,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=re(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=r.jsx(Ke,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(We,{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(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(Qt,{className:"size-3"})})}),r.jsx(Ht,{align:"end",children:r.jsxs(Qe,{onClick:o,children:[r.jsx(zn,{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 doe(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=re("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=re("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==n||e[7]!==h?(f=r.jsx("button",{type:"button",onClick:n,className:h,children:o}),e[5]=o,e[6]=n,e[7]=h,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 uoe(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=ie(),[o,l]=A.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx($t,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(He,{asChild:!0,children:r.jsx(is,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Ke,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=r.jsxs(We,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=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(rs,{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(os,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function hoe(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(ft,{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(de,{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(fl,{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(He,{asChild:!0,children:r.jsxs(de,{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(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(We,{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(He,{asChild:!0,children:r.jsx(de,{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 u;e[25]!==d?(u=r.jsx(Ke,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=r.jsxs(We,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var Fw=Object.defineProperty,foe=Object.getOwnPropertyDescriptor,moe=(t,e)=>{for(var s in e)Fw(t,s,{get:e[s],enumerable:!0})},Ss=(t,e,s,n)=>{for(var i=n>1?void 0:n?foe(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&&Fw(e,s,i),i},Ge=(t,e)=>(s,n)=>e(s,n,t),X5="Terminal input",gm={get:()=>X5,set:t=>X5=t},Z5="Too much output to announce, navigate to rows manually to read",xm={get:()=>Z5,set:t=>Z5=t};function poe(t){return t.replace(/\r?\n/g,"\r")}function goe(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function xoe(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function boe(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Uw(i,e,s,n)}}function Uw(t,e,s,n){t=poe(t),t=goe(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Hw(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 eb(t,e,s,n,i){Hw(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function bo(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Zf(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 voe=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}},yoe=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 u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((o=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=o,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(c=(i&31)<<6|o&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;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(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Kw="",Lo=" ",Iu=class Ww{constructor(){this.fg=0,this.bg=0,this.extended=new Dh}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 Ww;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}},Dh=class qw{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 qw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class Gw extends Iu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Dh,this.combinedData=""}static fromCharData(e){let s=new Gw;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?bo(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()]}},tb="di$target",bm="di$dependencies",Z9=new Map;function _oe(t){return t[bm]||[]}function nn(t){if(Z9.has(t))return Z9.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");Loe(e,s,i)};return e._id=t,Z9.set(t,e),e}function Loe(t,e,s){e[tb]===e?e[bm].push({id:t,index:s}):(e[bm]=[{id:t,index:s}],e[tb]=e)}var Dn=nn("BufferService"),Yw=nn("CoreMouseService"),Fl=nn("CoreService"),Soe=nn("CharsetService"),i3=nn("InstantiationService"),Jw=nn("LogService"),Rn=nn("OptionsService"),Qw=nn("OscLinkService"),woe=nn("UnicodeService"),Mu=nn("DecorationService"),vm=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 gi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,a=o.extended.urlId;continue}else d=o.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):koe(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=u,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};vm=Ss([Ge(0,Dn),Ge(1,Rn),Ge(2,Qw)],vm);function koe(t,e){if(confirm(`Do you want to navigate to ${e}?
724
+ `);function Pre(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Are).replaceAll("{{title}}",Ere).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Dre(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=ul(s),l=ul(i??"");if(o.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(vt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(o.isError||!o.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==o.data?(c=Pre(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 pd(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 Rre(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 h;e[7]!==i||e[8]!==l||e[9]!==o?(h=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:GV(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]=h):h=e[10],c=n.map(h),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 u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Ire(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 Iw(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(Ire,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=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(bt,{value:n,onChange:h=>o(s.name,h.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 u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=r.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Zc(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(pd,{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 h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>r.jsx(Iw,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),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 u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Mre({brandPath:t,onClose:e,variant:s}){const n=ie(),{org:i}=qe(),o=Wh(t),l=o.volume??"",a=o.dirPath,c=as(a),d=o.readOnly,u=bs(),h=Lc(),f=Ry(l),{upload:m,remove:p}=Kd(l),g=A.useRef(null),x=qp(l,a),b=x.data??[],v=Q=>b.some(me=>me.kind==="file"&&as(me.path)===Q),_=v("tokens.css"),L=v("brand.md"),y=v("slides-theme.html"),k=HV(b),w=h(l,`${a}/tokens.css`),S=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),C=ul(w,{enabled:_}),N=ul(S,{enabled:L}),[V,T]=A.useState(!1),[E,P]=A.useState({}),[D,I]=A.useState(null),[R,$]=A.useState(!1),[B,M]=A.useState(!1),[O,z]=A.useState("deck"),U=C.data?KV(C.data):[],H=Q=>U.find(me=>me.name===Q)?.value,K=Q=>E[Q.name]??Q.value,W=WV(U),Y=U.filter(Q=>Q.kind==="font"),X=U.filter(Q=>Q.kind==="type"),ne=U.filter(Q=>Q.kind==="space"),se=U.filter(Q=>Q.kind==="radius"),oe=U.filter(Q=>Q.kind==="shadow"),Z=U.filter(Q=>Q.kind==="motion"),J=U.filter(Q=>Q.kind==="other"),q=(Q,me)=>P(ve=>({...ve,[Q]:me})),G=y&&O==="deck",te=D??N.data??"",le=Object.entries(E).filter(([Q,me])=>H(Q)!==me),ee=D!==null&&D!==(N.data??""),ae=le.length>0||ee;function ue(){P({}),I(null),T(!1)}async function he(){$(!0);try{if(le.length>0){let Q=C.data??"";for(const[me,ve]of le)Q=qV(Q,me,ve);await f.mutateAsync({path:`${a}/tokens.css`,body:Q,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:et.fileText(w)})}ee&&D!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:D,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:et.fileText(S)})),u.invalidateQueries({queryKey:et.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:et.orgFsRecent(i.id)}),P({}),I(null),T(!1),pe.success(n("library.brandPreview.brandSaved"))}catch(Q){pe.error(Q instanceof Error?Q.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function ce(Q){const me=Q?.[0];if(!me)return;const we=`logo.${(me.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([me],we,{type:me.type})]}),k&&as(k)!==we&&await p.mutateAsync(k),pe.success(n("library.brandPreview.logoUpdated"))}catch(ye){pe.error(ye instanceof Error?ye.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ge=!x.isPending&&!_&&!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(j1,{size:18})}),s==="dialog"?r.jsx(Wt,{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&&(V?r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",size:"sm",onClick:ue,disabled:R,children:n("library.brandPreview.cancel")}),r.jsx(de,{size:"sm",disabled:!ae||R,onClick:()=>{he()},children:n(R?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(de,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[r.jsx(dV,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(qv,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(de,{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(vt,{className:"h-40 w-full rounded-xl"}),r.jsx(vt,{className:"h-4 w-1/3"}),r.jsx(vt,{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(B?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(Q=>!Q),onKeyDown:Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),M(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:Q=>Q.stopPropagation(),children:[y&&r.jsx("button",{type:"button",onClick:()=>{z("deck"),M(!1)},className:re("rounded-md px-2.5 py-1",G?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{z("components"),M(!1)},className:re("rounded-md px-2.5 py-1",G?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),B?r.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(a6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!B&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:re("w-full overflow-hidden rounded-xl border border-border bg-muted/30",G?"aspect-[16/9]":"h-96"),children:G?r.jsx(Dre,{readUrl:j,title:`${c} deck theme`,tokensUrl:w}):r.jsx(Tre,{tokensUrl:w})})})]}),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(pd,{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:h(l,k),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(j1,{size:28,className:"text-muted-foreground/50"})}),V&&r.jsxs("div",{children:[r.jsxs(de,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(ti,{size:14}),n(k?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:Q=>{ce(Q.target.files)}})]})]})]}),W.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(pd,{children:n("library.brandPreview.colors")}),W.map(Q=>r.jsx(Rre,{family:Q.family,tokens:Q.tokens,editing:V,valueOf:K,onEdit:q},Q.family))]}),(Y.length>0||X.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(pd,{children:n("library.brandPreview.typography")}),Y.map(Q=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:Q.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),V?r.jsx(bt,{value:K(Q),onChange:me=>q(Q.name,me.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:K(Q)},children:K(Q)})]},Q.name)),X.map(Q=>r.jsx(Iw,{token:Q,value:K(Q),editing:V,onEdit:q},Q.name))]}),r.jsx(Zc,{label:n("library.brandPreview.spacing"),tokens:ne,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.radius"),tokens:se,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.shadows"),tokens:oe,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.motion"),tokens:Z,editing:V,valueOf:K,onEdit:q}),r.jsx(Zc,{label:n("library.brandPreview.tokens"),tokens:J,editing:V,valueOf:K,onEdit:q}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(pd,{children:n("library.brandPreview.voiceGuidelines")}),V?r.jsx(Wr,{value:te,onChange:Q=>I(Q.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):N.isPending&&L?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(vt,{className:"h-3 w-full"}),r.jsx(vt,{className:"h-3 w-5/6"})]}):te.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Oo,{id:`brand-preview-${t}`,text:te})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Mw(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(It,{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(Mre,{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(Mt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function $w(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(It,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(Rw,{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(Mt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function $re(t){const e=F.c(18),{skillPath:s,onClose:n,variant:i}=t,o=Wh(s),{volume:l,dirPath:a}=o,c=Lc(),d=c(l??"",`${a}/SKILL.md`),u=ul(d),h=qp(l??"",a);let f;e[0]!==a?(f=as(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==u.data?(p=u.data?YV(u.data):null,e[2]=u.data,e[3]=p):p=e[3];const g=p,x=Bre;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(P,D)=>x(P.path)?-1:x(D.path)?1:as(P.path).localeCompare(as(D.path)),e[4]=b):b=e[4];const v=(h.data??[]).filter(Ore).sort(b),[_,L]=A.useState(null),y=_===null?null:v.find(P=>P.path===_)??null,k=g?.name??m;let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(qr,{size:18})}),e[5]=w):w=e[5];let S;e[6]!==k||e[7]!==i?(S=i==="dialog"?r.jsx(Wt,{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]=S):S=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(qv,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(_s,{size:16})})}):r.jsx(de,{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 C;e[12]!==S||e[13]!==j?(C=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[w,S,j]}),e[12]=S,e[13]=j,e[14]=C):C=e[14];let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=N):N=e[15];const V="relative flex min-w-0 flex-1 flex-col overflow-y-auto",T=y?r.jsx(t3,{file:{key:y.path,filename:as(y.path),size:y.size,downloadUrl:c(l??"",y.path)}}):u.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(vt,{className:"h-4 w-1/3"}),r.jsx(vt,{className:"h-3 w-full"}),r.jsx(vt,{className:"h-3 w-5/6"}),r.jsx(vt,{className:"h-3 w-2/3"})]}):u.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(Oo,{id:`skill-preview-${s}`,text:g.body})})]});let E;return e[16]!==T?(E=r.jsx("div",{className:V,children:T}),e[16]=T,e[17]=E):E=e[17],r.jsxs(r.Fragment,{children:[C,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:[N,h.isPending?r.jsx(vt,{className:"mx-2 h-4 w-24"}):v.map(P=>{const D=x(P.path)?y===null:_===P.path;return r.jsxs("button",{type:"button",onClick:()=>L(x(P.path)?null:P.path),className:re("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",D?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(mr,{filename:as(P.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:re("truncate text-sm",D?"text-foreground":"text-muted-foreground"),children:as(P.path)})]},P.path)})]}),E]})]})}function Ore(t){return t.kind==="file"}function Bre(t){return as(t)==="SKILL.md"}function Ow(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(It,{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($re,{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(Mt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function zre(t){const e=F.c(11),{onOpenDir:s}=t,n=ie(),i=YT();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(xu,{name:d.volume,glyph:Vn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:Iy(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 s3(t){return`${window.location.origin}${t}`}function Id(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Fre=[Bd,"uploads","outputs"],Bw=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:ti},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Br}],pm=new Set([...Bw.map(t=>t.volume),Ya("public")]),Ure=6;function zw(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Pv(t),o=i?`public/${i}`:t==="home"?zd(s):t;return n?`${o}/${n}`:o}function S0(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 vo(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 Dr(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 Xf(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(Dr,{children:Array.from({length:n*3},Hre)}),e[0]=n,e[1]=i):i=e[1],i}function Hre(t,e){return r.jsx(vt,{className:"h-16 rounded-2xl"},e)}function n3(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 Kre(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=ie(),a=ZV(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(u=r.jsx(xu,{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]=u):u=e[11],u}function Wre(t){const e=F.c(12),{onOpenDir:s}=t,n=ie(),o=My().data?.length??0;let l;e[0]!==s?(l=Bw.map(u=>r.jsx(Kre,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o||e[4]!==n?(a=o>0&&r.jsx(xu,{name:Ya("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:qr,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(zre,{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 qre(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=qe();let o;e[0]!==s?(o=s[0]===Bd?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:zd(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Bd),children:zd(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(dn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:Ya(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Ya(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function Gre(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=ie(),{org:d}=qe(),u=Lc(),h=JV(s,n);let f;e[0]!==u||e[1]!==l?(f=w=>l({volume:w.volume,path:w.path,kind:"file",shareMode:w.shareMode??"private",effectivePublic:w.effectivePublic??!1,url:s3(u(w.volume,w.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Xf,{rows:2}),e[3]=w):w=e[3],w}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=h.data??[],g.length===0){let S;e[14]!==s||e[15]!==c?(S=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=S):S=e[16];let j;e[17]!==S?(j=r.jsx(n3,{children:S}),e[17]=S,e[18]=j):j=e[18],v=j;break e}const w=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==w?(b=re("flex flex-col gap-3",w),e[19]=w,e[20]=b):b=e[20],p=vo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let _;e[21]!==p||e[22]!==x?(_=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let L;if(e[24]!==u||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let w;e[31]!==u||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(w=S=>{const j=Pv(S.volume)!==null;return r.jsx($y,{filename:as(S.path),updatedAt:S.updatedAt,downloadUrl:u(S.volume,S.path),subtitle:zw(S.volume,S.path,d.slug),publicState:Id(S),onOpen:()=>o(Dv(S.volume,S.path)),onShare:j?void 0:()=>m(S),onDelete:j?void 0:()=>a({volume:S.volume,path:S.path,kind:"file"})},`${S.volume}/${S.path}`)},e[31]=u,e[32]=a,e[33]=o,e[34]=d,e[35]=m,e[36]=w):w=e[36],L=g.map(w),e[24]=u,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let y;e[37]!==L?(y=r.jsx(Dr,{children:L}),e[37]=L,e[38]=y):y=e[38];let k;return e[39]!==b||e[40]!==_||e[41]!==y?(k=r.jsxs("div",{className:b,children:[_,y]}),e[39]=b,e[40]=_,e[41]=y,e[42]=k):k=e[42],k}function Yre(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=ie(),{org:l}=qe(),a=Dy(),c=Lc();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:s3(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let _;e[5]!==v?(_=r.jsx(vo,{children:v}),e[5]=v,e[6]=_):_=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Xf,{}),e[7]=L):L=e[7];let y;return e[8]!==_?(y=r.jsxs("div",{className:"flex flex-col gap-3",children:[_,L]}),e[8]=_,e[9]=y):y=e[9],y}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,Ure);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==o?(_=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=_):_=e[23],e[24]!==_?(p=r.jsx(vo,{children:_}),e[24]=_,e[25]=p):p=e[25],h=Dr;let L;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(L=y=>r.jsx(eT,{filename:as(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:zw(y.volume,y.path,l.slug),publicState:Id(y),onOpen:()=>s(Dv(y.volume,y.path)),onShare:()=>u(y),onDelete:()=>i({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,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]=u,e[16]=o,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=r.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=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 Jre(t){const e=F.c(16),{onOpenDir:s}=t,n=ie(),i=My();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Xf,{}),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 u;return e[5]!==d?(u=r.jsx(n3,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>r.jsx(xu,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=r.jsx(Dr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Qre(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=ie(),{org:m}=qe(),p=s.volume??"",g=qp(p,s.dirPath),x=Lc();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=V=>s.isHomeRoot&&pm.has(V.toLowerCase())?`${zd(m.slug)}/${V}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?r.jsx(Wre,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const L=_;if(g.isPending){let V;e[6]!==L||e[7]!==f?(V=L&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.folders")}),r.jsx(Dr,{children:L})]}),e[6]=L,e[7]=f,e[8]=V):V=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(Xf,{rows:2}),e[9]=T):T=e[9];let E;return e[10]!==V?(E=r.jsxs(r.Fragment,{children:[V,T]}),e[10]=V,e[11]=E):E=e[11],E}if(g.isError){let V;e[12]!==g.error||e[13]!==f?(V=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=V):V=e[14];let T;return e[15]!==V?(T=r.jsx("p",{className:"text-sm text-destructive",children:V}),e[15]=V,e[16]=T):T=e[16],T}let y,k,w,S,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const V=g.data??[],T=V.filter(toe),E=V.filter(eoe),P=V.filter(Zre),D=V.filter(Xre);if(V.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let O;e[41]!==M?(O=r.jsx(n3,{children:M}),e[41]=M,e[42]=O):O=e[42],j=O;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const R=I;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?s3(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const B=$;y=T.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.skills")}),r.jsx(Dr,{children:T.map(M=>r.jsx(QV,{dirName:as(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:Id(M),onOpen:()=>o(_a(s,M.path)),onBrowse:()=>n(_a(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),k=E.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.brands")}),r.jsx(Dr,{children:E.map(M=>r.jsx(XV,{dirName:as(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(_a(s,M.path)),onBrowse:()=>n(_a(s,M.path)),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),w=(P.length>0||L)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.folders")}),r.jsxs(Dr,{children:[L,P.map(M=>r.jsx(xu,{name:as(M.path),meta:Iy(M.updatedAt),subtitle:v(as(M.path)),readOnly:s.readOnly,publicState:Id(M),onOpen:()=>n(_a(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},M.path))]})]}),S=D.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(vo,{children:f("library.libraryViews.files")}),r.jsx(Dr,{children:D.map(M=>r.jsx($y,{filename:as(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:Id(M),onOpen:()=>i(_a(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...S0(M.path,"file",{onDragStart:d,onContextMenu:u})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=o,e[29]=a,e[30]=L,e[31]=f,e[32]=p,e[33]=y,e[34]=k,e[35]=w,e[36]=S,e[37]=j}else y=e[33],k=e[34],w=e[35],S=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(C=s.isHomeRoot&&r.jsx(Yre,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let N;return e[57]!==y||e[58]!==k||e[59]!==w||e[60]!==S||e[61]!==C?(N=r.jsxs(r.Fragment,{children:[y,k,w,S,C]}),e[57]=y,e[58]=k,e[59]=w,e[60]=S,e[61]=C,e[62]=N):N=e[62],N}function Xre(t){return t.kind==="file"}function Zre(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function eoe(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function toe(t){return t.kind==="dir"&&t.hasSkill}function soe({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ie(),{org:i}=qe(),o=bs(),l=zt(),a=Ro(),c=br({strict:!1}),d=c.path||Bd,u=Wh(d),h=JT(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(Q,me)=>l({to:".",search:ve=>({...ve,[Q]:me||void 0})}),p=Q=>m("path",Q),g=(Q,me)=>l({to:".",search:ve=>({...ve,preview:void 0,skill:void 0,brand:void 0,[Q]:me})}),x=t??(Q=>g("preview",Q)),b=e??(Q=>g("skill",Q)),v=s??(Q=>g("brand",Q)),[_,L]=A.useState(""),y=pf(_.trim(),300),k=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,w=k?n("library.library.searchInPlaceholder",{folder:Ya(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),S=f.isHomeRoot?zd(i.slug):Ya(f.segments.at(-1)??""),[j,C]=A.useState(null),[N,V]=A.useState(null),[T,E]=A.useState(!1),[P,D]=A.useState(""),[I,R]=A.useState(!1),[$,B]=A.useState(null),[M,O]=A.useState(""),z=A.useRef(null),[U,H]=A.useState(!1),K=A.useRef(0),W=f.readOnly?null:f.volume,{upload:Y,mkdir:X,move:ne}=Kd(W??Bd),{remove:se}=Kd(j?.volume??"uploads");async function oe(Q){if(!(!W||!Q||Q.length===0))try{await Y.mutateAsync({dir:f.dirPath,files:[...Q]}),pe.success(Q.length===1?n("library.library.uploadedSingle",{filename:Q[0]?.name??""}):n("library.library.uploadedMultiple",{count:Q.length}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.uploadFailed"))}finally{z.current&&(z.current.value="")}}const Z=W!==null;function J(Q){return Q.dataTransfer.types.includes("Files")}function q(Q){!Z||!J(Q)||(Q.preventDefault(),K.current+=1,H(!0))}function G(Q){!Z||!J(Q)||Q.preventDefault()}function te(){Z&&(K.current=Math.max(0,K.current-1),K.current===0&&H(!1))}function le(Q){Z&&(Q.preventDefault(),Q.stopPropagation(),K.current=0,H(!1),Q.dataTransfer.files.length>0&&oe(Q.dataTransfer.files))}async function ee(){const Q=P.trim();if(!(!W||!Q)){if(f.isHomeRoot&&pm.has(Q.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:Q}));return}try{const me=f.dirPath;await X.mutateAsync(me?`${me}/${Q}`:Q),pe.success(n("library.library.folderCreated",{name:Q})),E(!1),D("")}catch(me){pe.error(me instanceof Error?me.message:n("library.library.folderCreateFailed"))}}}async function ae(){if(!j)return;const Q=j;try{await se.mutateAsync(Q.path),pe.success(n("library.library.deleted",{name:as(Q.path)}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ue(){if(!$)return;const Q=M.trim();if(!Q||Q.includes("/")||Q.includes("..")||Q===as($.path)){R(!1),B(null),O("");return}if($.kind==="dir"&&f.isHomeRoot&&pm.has(Q.toLowerCase())){pe.error(n("library.library.folderNameReserved",{name:Q}));return}try{const me=$.path.includes("/")?$.path.slice(0,$.path.lastIndexOf("/")):"",ve=me?`${me}/${Q}`:Q;await ne.mutateAsync({from:$.path,to:ve});const we=Q.replace(/[<>]/g,"");pe.success(n("library.library.renamed",{name:we}))}catch(me){pe.error(me instanceof Error?me.message:n("library.library.renameFailed"))}finally{R(!1),B(null),O("")}}async function he(Q,me){try{const ve=as(Q),we=me?`${me}/${ve}`:ve;await ne.mutateAsync({from:Q,to:we}),pe.success(n("library.library.moved",{name:ve,destination:me||n("library.library.theLibrary")}))}catch(ve){pe.error(ve instanceof Error?ve.message:n("library.library.moveFailed"))}}function ce(){for(const Q of Fre)o.invalidateQueries({queryKey:et.orgFsVolume(i.id,Q)});f.volume&&o.invalidateQueries({queryKey:et.orgFsVolume(i.id,f.volume)}),o.invalidateQueries({queryKey:et.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:et.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:et.orgFsPublicSets(i.id)})}function ge(Q){Q.defaultPrevented||!W||Q.target.closest("input, textarea, button, a, [role='button']")||(Q.preventDefault(),E(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:q,onDragOver:G,onDragLeave:te,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(ti,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:S})})]})}),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(qre,{segments:f.segments,onNavigate:p})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(mf,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(bt,{value:_,onChange:Q=>L(Q.target.value),onKeyDown:Q=>{Q.key==="Escape"&&L("")},placeholder:w,className:"h-9 rounded-xl pr-9 pl-9"}),_&&r.jsx(de,{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(Ai,{size:14})})]}),r.jsx(de,{variant:"ghost",size:"icon",onClick:ce,"aria-label":n("library.library.refresh"),children:r.jsx(zn,{size:14})}),W&&r.jsxs(de,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[r.jsx($t,{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(jc,{size:12}),n("library.library.readOnly")]}):r.jsxs(de,{size:"sm",disabled:Y.isPending,onClick:()=>z.current?.click(),children:[r.jsx(ti,{size:14}),Y.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:z,type:"file",multiple:!0,className:"hidden",onChange:Q=>{oe(Q.target.files)}})]}),y?r.jsx(Gre,{query:y,scope:k,stale:_.trim()!==y,onOpenFile:x,onShare:V,onDelete:C}):f.volume===null?r.jsx(Jre,{onOpenDir:p}):r.jsx(Qre,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:V,onDelete:C,onContextMenu:(Q,me)=>{B({path:Q,kind:me}),O(as(Q)),R(!0)},onMove:he},f.volume)]})}),a&&(c.preview?r.jsx($w,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?r.jsx(Ow,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?r.jsx(Mw,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),r.jsx(Mt,{open:T,onOpenChange:E,children:r.jsxs(It,{children:[r.jsxs(xs,{children:[r.jsx(Wt,{children:n("library.library.newFolderTitle")}),r.jsx(Fn,{children:n("library.library.newFolderDescription",{path:S||n("library.library.theLibrary")})})]}),r.jsx(bt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:P,onChange:Q=>D(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&ee()}}),r.jsxs(Zn,{children:[r.jsx(de,{variant:"outline",onClick:()=>E(!1),children:n("library.library.cancel")}),r.jsx(de,{disabled:!P.trim()||X.isPending,onClick:()=>{ee()},children:n("library.library.create")})]})]})}),r.jsx(Mt,{open:I,onOpenChange:Q=>{R(Q),Q||(B(null),O(""))},children:r.jsxs(It,{children:[r.jsxs(xs,{children:[r.jsx(Wt,{children:$&&n("library.library.renameTitle",{name:as($.path)})}),r.jsx(Fn,{children:n("library.library.renameDescription")})]}),r.jsx(bt,{autoFocus:!0,value:M,onChange:Q=>O(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&ue()}}),r.jsxs(Zn,{children:[r.jsx(de,{variant:"outline",onClick:()=>R(!1),children:n("library.library.cancel")}),r.jsx(de,{disabled:!M.trim()||ne.isPending,onClick:()=>{ue()},children:n("library.library.rename")})]})]})}),r.jsx(vre,{target:N,onOpenChange:Q=>{Q||V(null)}}),r.jsx(ec,{open:j!==null,onOpenChange:Q=>{Q||C(null)},children:r.jsxs(tc,{children:[r.jsxs(sc,{children:[r.jsx(nc,{children:n("library.library.deleteTitle",{name:j?as(j.path):""})}),r.jsx(ic,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(rc,{children:[r.jsx(oc,{children:n("library.library.cancel")}),r.jsx(lc,{onClick:()=>{ae()},children:n("library.library.delete")})]})]})})]})}function noe(){const t=F.c(12),e=zt(),[s,n]=A.useState(null),[i,o]=A.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(soe,{onOpenFile:f=>a(vN(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(Ow,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let u;t[6]!==i?(u=i&&r.jsx(Mw,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=u):u=t[7];let h;return t[8]!==c||t[9]!==d||t[10]!==u?(h=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,u]}),t[8]=c,t[9]=d,t[10]=u,t[11]=h):h=t[11],h}const Q5=A.lazy(()=>Tn(()=>import("./project-app-view-CYxJURVY.js"),__vite__mapDeps([168,1,2,68,69,6,22,37,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,7,40,8,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,70,71,72,11,12,13,18,73,74,75,76,77,78,79,80,81,82,83,5,4,10,14,15,16,3,9,17,19,20,21,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,120,109,110,111,112,113,114,115,116,117,103,104,105,106,107,108,118,119,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,99,136,137,138,139,101,140,141,142,143,144,145,146,147,148,149,150,151])).then(t=>({default:t.AppViewContent})));function ioe(t){const e=F.c(64),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let y;return e[0]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(EW,{}),e[0]=y):y=e[0],y}if(s==="board"){let y;return e[1]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(hq,{})}),e[1]=y):y=e[1],y}if(yN(s)){let y;return e[2]!==n?(y=r.jsx(Bx,{virtualMcpId:n}),e[2]=n,e[3]=y):y=e[3],y}if(s==="git"){let y;return e[4]!==n?(y=r.jsx(eY,{virtualMcpId:n}),e[4]=n,e[5]=y):y=e[5],y}if(s==="automations"){let y;return e[6]!==n?(y=r.jsx(Yie,{virtualMcpId:n}),e[6]=n,e[7]=y):y=e[7],y}if(s==="preview"){let y;return e[8]!==n?(y=r.jsx(zte,{virtualMcpId:n}),e[8]=n,e[9]=y):y=e[9],y}let c;e[10]!==s?(c=_N(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let y;return e[12]!==d.path?(y=r.jsx(Kte,{openPath:d.path}),e[12]=d.path,e[13]=y):y=e[13],y}if(s==="content"){let y;return e[14]!==n?(y=r.jsx(nie,{virtualMcpId:n}),e[14]=n,e[15]=y):y=e[15],y}if(s==="assets"){let y;return e[16]!==n?(y=r.jsx(iie,{virtualMcpId:n}),e[16]=n,e[17]=y):y=e[17],y}if(s==="files"){let y;return e[18]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(noe,{}),e[18]=y):y=e[18],y}if(s==="reports"){let y;return e[19]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(lre,{}),e[19]=y):y=e[19],y}if(s==="connect-sources"){let y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(ire,{}),e[20]=y):y=e[20],y}if(a){let y;return e[21]!==s?(y=r.jsx(Hie,{tabId:s}),e[21]=s,e[22]=y):y=e[22],y}let u;e[23]!==s?(u=ry(s),e[23]=s,e[24]=u):u=e[24];const h=u;if(h){let y;return e[25]!==h.path?(y=r.jsx(_re,{path:h.path},h.path),e[25]=h.path,e[26]=y):y=e[26],y}let f;e[27]!==s?(f=iy(s),e[27]=s,e[28]=f):f=e[28];const m=f;if(m){let y;return e[29]!==m.key||e[30]!==i?(y=r.jsx(tre,{fileKey:m.key,taskId:i}),e[29]=m.key,e[30]=i,e[31]=y):y=e[31],y}let p;e[32]!==s?(p=oy(s),e[32]=s,e[33]=p):p=e[33];const g=p;if(g){let y;return e[34]!==g.path?(y=r.jsx(kre,{path:g.path},g.path),e[34]=g.path,e[35]=y):y=e[35],y}let x;e[36]!==s?(x=LN(s),e[36]=s,e[37]=x):x=e[37];const b=x;if(b){let y;if(e[38]!==l||e[39]!==b.connectionId||e[40]!==b.toolName){let C;e[42]!==b.connectionId||e[43]!==b.toolName?(C=N=>N.appId===b.connectionId&&N.toolName===b.toolName,e[42]=b.connectionId,e[43]=b.toolName,e[44]=C):C=e[44],y=l.find(C),e[38]=l,e[39]=b.connectionId,e[40]=b.toolName,e[41]=y}else y=e[41];const k=y;let w;e[45]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Qr,{}),e[45]=w):w=e[45];const S=k?.args;let j;return e[46]!==s||e[47]!==b.connectionId||e[48]!==b.toolName||e[49]!==S?(j=r.jsx(A.Suspense,{fallback:w,children:r.jsx(Q5,{connectionId:b.connectionId,toolName:b.toolName,args:S},s)}),e[46]=s,e[47]=b.connectionId,e[48]=b.toolName,e[49]=S,e[50]=j):j=e[50],j}let v;if(e[51]!==s||e[52]!==o){let y;e[54]!==s?(y=k=>k.id===s,e[54]=s,e[55]=y):y=e[55],v=o.find(y),e[51]=s,e[52]=o,e[53]=v}else v=e[53];const _=v;if(_){let y;e[56]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Qr,{}),e[56]=y):y=e[56];let k;return e[57]!==s||e[58]!==_.id||e[59]!==_.view.appId||e[60]!==_.view.args?(k=r.jsx(A.Suspense,{fallback:y,children:r.jsx(Q5,{connectionId:_.view.appId,toolName:_.id,args:_.view.args},s)}),e[57]=s,e[58]=_.id,e[59]=_.view.appId,e[60]=_.view.args,e[61]=k):k=e[61],k}let L;return e[62]!==n?(L=r.jsx(Bx,{virtualMcpId:n}),e[62]=n,e[63]=L):L=e[63],L}function roe(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}=$2(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Qr,{}),e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(u=r.jsx(A.Suspense,{fallback:d,children:r.jsx(ioe,{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]=u):u=e[10];let h;return e[11]!==o||e[12]!==u?(h=r.jsx(Fs,{children:u},o),e[11]=o,e[12]=u,e[13]=h):h=e[13],h}function ooe(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&SN.has(t.mainTab))}const al="setup";function loe(t){const e=F.c(57),s=ie();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=y=>!t.scriptTabs.includes(y),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===al?t.onToggle():t.onSelectTab(al)},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(Qt,{className:"size-4"}):r.jsx(a6,{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(He,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=r.jsx(Ke,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=r.jsxs(We,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===al;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(aoe,{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(doe,{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(uoe,{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(hoe,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(coe,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let _;return e[53]!==b||e[54]!==v||e[55]!==f?(_=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]=_):_=e[56],_}function aoe(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=re("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(uV,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==o?(h=o("sandbox.toolbar.setupTab"),e[3]=o,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=r.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function coe(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(fl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=r.jsxs(de,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(fl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=r.jsxs(de,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(zn,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=r.jsxs(de,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!o,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=re(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=r.jsx(He,{asChild:!0,children:r.jsx(de,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=r.jsx(Ke,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(We,{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(Ft,{children:[r.jsx(Ut,{asChild:!0,children:r.jsx(de,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(Qt,{className:"size-3"})})}),r.jsx(Ht,{align:"end",children:r.jsxs(Qe,{onClick:o,children:[r.jsx(zn,{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 doe(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=re("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=re("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==n||e[7]!==h?(f=r.jsx("button",{type:"button",onClick:n,className:h,children:o}),e[5]=o,e[6]=n,e[7]=h,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 uoe(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=ie(),[o,l]=A.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx($t,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(He,{asChild:!0,children:r.jsx(is,{asChild:!0,children:r.jsx(de,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Ke,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=r.jsxs(We,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=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(rs,{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(os,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function hoe(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(ft,{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(de,{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(fl,{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(He,{asChild:!0,children:r.jsxs(de,{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(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(We,{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(He,{asChild:!0,children:r.jsx(de,{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 u;e[25]!==d?(u=r.jsx(Ke,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=r.jsxs(We,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var Fw=Object.defineProperty,foe=Object.getOwnPropertyDescriptor,moe=(t,e)=>{for(var s in e)Fw(t,s,{get:e[s],enumerable:!0})},Ss=(t,e,s,n)=>{for(var i=n>1?void 0:n?foe(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&&Fw(e,s,i),i},Ge=(t,e)=>(s,n)=>e(s,n,t),X5="Terminal input",gm={get:()=>X5,set:t=>X5=t},Z5="Too much output to announce, navigate to rows manually to read",xm={get:()=>Z5,set:t=>Z5=t};function poe(t){return t.replace(/\r?\n/g,"\r")}function goe(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function xoe(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function boe(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Uw(i,e,s,n)}}function Uw(t,e,s,n){t=poe(t),t=goe(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Hw(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 eb(t,e,s,n,i){Hw(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function bo(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Zf(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 voe=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}},yoe=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 u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((o=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=o,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(c=(i&31)<<6|o&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;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(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Kw="",Lo=" ",Iu=class Ww{constructor(){this.fg=0,this.bg=0,this.extended=new Dh}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 Ww;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}},Dh=class qw{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 qw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class Gw extends Iu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Dh,this.combinedData=""}static fromCharData(e){let s=new Gw;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?bo(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()]}},tb="di$target",bm="di$dependencies",Z9=new Map;function _oe(t){return t[bm]||[]}function nn(t){if(Z9.has(t))return Z9.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");Loe(e,s,i)};return e._id=t,Z9.set(t,e),e}function Loe(t,e,s){e[tb]===e?e[bm].push({id:t,index:s}):(e[bm]=[{id:t,index:s}],e[tb]=e)}var Dn=nn("BufferService"),Yw=nn("CoreMouseService"),Fl=nn("CoreService"),Soe=nn("CharsetService"),i3=nn("InstantiationService"),Jw=nn("LogService"),Rn=nn("OptionsService"),Qw=nn("OscLinkService"),woe=nn("UnicodeService"),Mu=nn("DecorationService"),vm=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 gi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,a=o.extended.urlId;continue}else d=o.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):koe(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=u,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};vm=Ss([Ge(0,Dn),Ge(1,Rn),Ge(2,Qw)],vm);function koe(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 e9=nn("CharSizeService"),Xr=nn("CoreBrowserService"),r3=nn("MouseService"),Zr=nn("RenderService"),joe=nn("SelectionService"),Xw=nn("CharacterJoinerService"),Ic=nn("ThemeService"),Zw=nn("LinkProviderService"),Coe=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?sb.isErrorNoTelemetry(t)?new sb(t.message+`
727
727
 
@@ -740,4 +740,4 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
740
740
 
741
741
  `)||n}}function bde(t,e){const s=t.trim().split(`
742
742
  `);return Hk({title:s[0]??"",body:s.slice(1).join(`
743
- `),fallbackTitle:e})}function x3(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function b3(t){return t.fastPreview?{fastPreview:!0}:void 0}async function m1(t,e,s){try{return await s()}catch(n){throw new g3(n instanceof Error?n.message:e,t)}}async function Kk(t){const e=t.expectedHeadSha;if(!e)return;const n=(await Ha(x3(t),b3(t)).catch(()=>null))?.headSha;if(n&&n!==e)throw new Uk(e,n)}function Wk(t,e){return Jq(x3(t),e,b3(t))}function qk(t,e){return wI(t.githubClient,{owner:t.owner,repo:t.repo,branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor,existing:t.existingOpenPr})}async function Gk(t,e,s){await Kk(t),await m1("push",s("thread.publishDialog.failedPushChanges"),()=>Wk(t,e.message)),await m1("sync",s("thread.publishDialog.failedRebase"),()=>fL(x3(t),t.baseBranch,b3(t)));const n=await m1("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>qk(t,e));try{await j8(t.githubClient,{owner:t.owner,repo:t.repo,pullNumber:n.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(i){throw new g3(i instanceof Error?i.message:s("thread.publishDialog.failedMergePullRequest"),"merge",n)}return n}async function Yk(t,e){return await Kk(t),await Wk(t,e.message),qk(t,e)}function vde(t,e){return t instanceof Uk?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof g3&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function ip(t,e){const s=vde(t,e),n=s.pullRequest;return n&&pe.error(s.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(n.htmlUrl,"_blank","noopener,noreferrer")}}),{message:s.message,pullRequestOpened:n!==null,headMoved:s.headMoved}}function Jk(t,e){pe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function yde(t){const{mode:e,target:s,note:n,allPaths:i,destinationHost:o,publishLockRef:l,onOpenChange:a,refresh:c,onPullRequestChanged:d,onPublished:u}=t,h=ie(),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(),v=()=>bde(n,h("thread.publishDialog.changesFrom",{branch:s.headBranch})),_=async()=>{l.current=!0,m(!0),b(void 0);try{await Gk(s,v(),h),pe.success(o?h("thread.publishPopover.publishedTo",{host:o}):h("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),a(!1),await Promise.all([d?.(),u?.()])}catch(k){const w=ip(k,h);b(w.message),w.pullRequestOpened&&await d?.(),w.headMoved&&await c()}finally{l.current=!1,m(!1)}},L=async()=>{l.current=!0,m(!0),b(void 0);try{const k=await Yk(s,v());Jk(k,h),a(!1),await d?.()}catch(k){const w=ip(k,h);b(w.message||h("thread.publishDialog.failedSubmitForReview")),w.headMoved&&await c()}finally{l.current=!1,m(!1)}},y=async(k,w)=>{g(!0);try{await im({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},k,{fastPreview:!0}),pe.success(w),await c()}catch(S){pe.error(S instanceof Error?S.message:h("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:p,publishError:x,submit:e==="review"?L:_,discardChange:k=>y(k.filepaths,h("thread.publishPopover.discarded",{name:k.name})),discardAll:async()=>{i.length!==0&&await y(i,h("thread.publishDialog.allChangesDiscarded"))}}}function _de(t,e,s,n,i){return["cms-publish-bodies",t,e,s,n,i]}const Lde=6e4;function Sde(t,e,s){const n=F.c(6);let i;n[0]!==s||n[1]!==t||n[2]!==e?(i=et.decofile(`${t}/${e}/${s}`),n[0]=s,n[1]=t,n[2]=e,n[3]=i):i=n[3];let o;n[4]!==i?(o={queryKey:i,queryFn:Hj},n[4]=i,n[5]=o):o=n[5];const{data:l}=Et(o);return l}function wde(t){const e=F.c(43),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,baseBranch:l}=t;let a,c,d,u;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n?(c={orgSlug:s,virtualMcpId:n,branch:i,threadId:o},a={fastPreview:!0},d=Fh,u=bL(c,a),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=u):(a=e[4],c=e[5],d=e[6],u=e[7]);const h=d(u),f=h.data,m=f.changedFiles??null,p=f.headSha??null,g=m?m.length>0:(f.aheadOfBase??0)>0;let x;e[8]!==l||e[9]!==i||e[10]!==p||e[11]!==s||e[12]!==n?(x=_de(s,n,i,l,p),e[8]=l,e[9]=i,e[10]=p,e[11]=s,e[12]=n,e[13]=x):x=e[13];let b;e[14]!==l||e[15]!==a||e[16]!==c?(b=()=>Vd(c,{base:l},a),e[14]=l,e[15]=a,e[16]=c,e[17]=b):b=e[17];let v;e[18]!==x||e[19]!==b||e[20]!==g?(v={queryKey:x,queryFn:b,enabled:g,staleTime:Lde},e[18]=x,e[19]=b,e[20]=g,e[21]=v):v=e[21];const _=Et(v),L=Sde(s,n,i),y=_.data??null;let k;e[22]!==L||e[23]!==y||e[24]!==m?(k=m?tde({files:m,lookup:L,diff:y}):Xce(y),e[22]=L,e[23]=y,e[24]=m,e[25]=k):k=e[25];const w=k;let S;e[26]!==y?.diffs||e[27]!==m?(S=m?m.map(kde):Object.keys(y?.diffs??{}),e[26]=y?.diffs,e[27]=m,e[28]=S):S=e[28];const j=f.changedFilesTotal??w.count,C=f.changedFilesTruncated??!1,N=g&&_.isPending,V=!m&&g&&_.isPending;let T;e[29]!==h?(T=()=>h.refetch(),e[29]=h,e[30]=T):T=e[30];let E;return e[31]!==_.isError||e[32]!==y||e[33]!==p||e[34]!==f||e[35]!==w||e[36]!==V||e[37]!==T||e[38]!==S||e[39]!==j||e[40]!==C||e[41]!==N?(E={status:f,summary:w,allPaths:S,changedFilesTotal:j,changedFilesTruncated:C,headSha:p,diff:y,bodiesPending:N,bodiesFailed:_.isError,cardsPending:V,refresh:T},e[31]=_.isError,e[32]=y,e[33]=p,e[34]=f,e[35]=w,e[36]=V,e[37]=T,e[38]=S,e[39]=j,e[40]=C,e[41]=N,e[42]=E):E=e[42],E}function kde(t){return t.path}function jde(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Cde(t){const e=F.c(28),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,status:a,diff:c,enabled:d}=t,[u]=Oi(),{language:h}=u;let f,m,p;if(e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==l||e[4]!==h||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==n){const y=c?Zq(c):"";f=d&&!!i&&!!a&&!!c&&y!=="",p=Et,m=jde({orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,signature:y,language:h}),e[0]=i,e[1]=c,e[2]=d,e[3]=l,e[4]=h,e[5]=s,e[6]=a,e[7]=o,e[8]=n,e[9]=f,e[10]=m,e[11]=p}else f=e[9],m=e[10],p=e[11];let g;e[12]!==i||e[13]!==c||e[14]!==l||e[15]!==h||e[16]!==s||e[17]!==a||e[18]!==o||e[19]!==n?(g=()=>eG({orgSlug:s,virtualMcpId:n,branch:i,threadId:o},{status:a,diff:c,language:h},l?{fastPreview:!0}:void 0),e[12]=i,e[13]=c,e[14]=l,e[15]=h,e[16]=s,e[17]=a,e[18]=o,e[19]=n,e[20]=g):g=e[20];let x;e[21]!==f||e[22]!==m||e[23]!==g?(x={queryKey:m,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:Nde},e[21]=f,e[22]=m,e[23]=g,e[24]=x):x=e[24];const b=p(x),v=b.data??null,_=f&&b.isFetching&&!b.data;let L;return e[25]!==v||e[26]!==_?(L={verdict:v,loading:_},e[25]=v,e[26]=_,e[27]=L):L=e[27],L}function Nde(t,e){return!uL(e)&&t<1}function Qk(t){const e=F.c(30),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,status:a,diff:c,policy:d,judgeEnabled:u,paths:h}=t,f=u===void 0?!0:u,m=h===void 0?null:h;let p;e[0]!==c||e[1]!==f||e[2]!==d?(p=f&&aG(c,d),e[0]=c,e[1]=f,e[2]=d,e[3]=p):p=e[3];const g=p;let x;e[4]!==i||e[5]!==c||e[6]!==l||e[7]!==g||e[8]!==s||e[9]!==a||e[10]!==o||e[11]!==n?(x={orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,status:a,diff:c,enabled:g},e[4]=i,e[5]=c,e[6]=l,e[7]=g,e[8]=s,e[9]=a,e[10]=o,e[11]=n,e[12]=x):x=e[12];const{verdict:b,loading:v}=Cde(x);if(!c&&m){let k;e[13]!==m||e[14]!==d?(k=lG(m,d),e[13]=m,e[14]=d,e[15]=k):k=e[15];let w;return e[16]!==k?(w={gate:k,ready:!1},e[16]=k,e[17]=w):w=e[17],w}if(!c){let k;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k={gate:{allowed:!0,reason:null},ready:!1},e[18]=k):k=e[18],k}if(!g){let k;e[19]!==c||e[20]!==d?(k=oG(c,d),e[19]=c,e[20]=d,e[21]=k):k=e[21];let w;return e[22]!==k?(w={gate:k,ready:!0},e[22]=k,e[23]=w):w=e[23],w}let _;e[24]!==v||e[25]!==b?(_=cG(b,v),e[24]=v,e[25]=b,e[26]=_):_=e[26];const L=!v;let y;return e[27]!==_||e[28]!==L?(y={gate:_,ready:L},e[27]=_,e[28]=L,e[29]=y):y=e[29],y}const Xk="(max-width: 479px)";function Vde(t){const e=globalThis.matchMedia(Xk);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function Tde(){return A.useSyncExternalStore(Vde,Ade,Ede)}function Ede(){return!1}function Ade(){return globalThis.matchMedia(Xk).matches}function Pde(t){const e=F.c(22),s=Tde(),n=A.useRef(!1);let i;e[0]!==t?(i=d=>{!d&&n.current||t.onOpenChange(d)},e[0]=t,e[1]=i):i=e[1];const o=i;if(s){let d;e[2]!==t?(d=t.open?r.jsx(Jb,{...t,publishLockRef:n}):null,e[2]=t,e[3]=d):d=e[3];let u;e[4]!==d?(u=r.jsx(It,{className:"flex max-h-[85vh] w-[92vw] max-w-[420px] flex-col gap-0 overflow-hidden p-0",children:d}),e[4]=d,e[5]=u):u=e[5];let h;e[6]!==o||e[7]!==t.open||e[8]!==u?(h=r.jsx(Mt,{open:t.open,onOpenChange:o,children:u}),e[6]=o,e[7]=t.open,e[8]=u,e[9]=h):h=e[9];let f;return e[10]!==t.children||e[11]!==h?(f=r.jsxs(r.Fragment,{children:[t.children,h]}),e[10]=t.children,e[11]=h,e[12]=f):f=e[12],f}let l;e[13]!==t.children?(l=r.jsx(RV,{asChild:!0,children:r.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=l):l=e[14];let a;e[15]!==t?(a=r.jsx(rs,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:Dde,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:r.jsx(Jb,{...t,publishLockRef:n})}),e[15]=t,e[16]=a):a=e[16];let c;return e[17]!==o||e[18]!==t.open||e[19]!==l||e[20]!==a?(c=r.jsxs(os,{open:t.open,onOpenChange:o,children:[l,a]}),e[17]=o,e[18]=t.open,e[19]=l,e[20]=a,e[21]=c):c=e[21],c}function Dde(t){return t.preventDefault()}function v3(t){const e=F.c(11),{mode:s,title:n,subLine:i,trailing:o}=t,l=s==="review"?So:Hn;let a;e[0]!==l?(a=r.jsx(l,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a||e[3]!==n||e[4]!==o?(c=r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,n,o]}),e[2]=a,e[3]=n,e[4]=o,e[5]=c):c=e[5];let d;e[6]!==i?(d=i?r.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:i}):null,e[6]=i,e[7]=d):d=e[7];let u;return e[8]!==c||e[9]!==d?(u=r.jsxs(r.Fragment,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function y3(t){const e=F.c(9),{draftPreviewUrl:s,t:n}=t;let i;e[0]!==s?(i=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=i):i=e[1];const o=!s;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(jc,{className:"size-4"}),e[2]=l):l=e[2];let a;e[3]!==n?(a=n("thread.publishPopover.preview"),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==i||e[6]!==o||e[7]!==a?(c=r.jsxs(de,{type:"button",variant:"outline",onClick:i,disabled:o,children:[l,a]}),e[5]=i,e[6]=o,e[7]=a,e[8]=c):c=e[8],c}function Rde(t){const e=F.c(20),{mode:s,draftPreviewUrl:n}=t,i=ie();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Mr,{className:"h-3.5 w-48"}),e[0]=o):o=e[0];let l;e[1]!==s?(l=r.jsx(v3,{mode:s,title:o}),e[1]=s,e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(tp,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($d,{}),r.jsx($d,{}),r.jsx($d,{})]})}),c=r.jsxs(r.Fragment,{children:[r.jsx(Mr,{className:"h-3 w-20"}),r.jsx(Mr,{className:"h-14 w-full rounded-lg"})]}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let d;e[5]!==n||e[6]!==i?(d=r.jsx(y3,{draftPreviewUrl:n,t:i}),e[5]=n,e[6]=i,e[7]=d):d=e[7];const u=s==="review"?"default":"brand";let h;e[8]!==s||e[9]!==i?(h=i(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=i,e[10]=h):h=e[10];let f;e[11]!==u||e[12]!==h?(f=r.jsx(de,{type:"button",variant:u,className:"flex-1",disabled:!0,children:h}),e[11]=u,e[12]=h,e[13]=f):f=e[13];let m;e[14]!==d||e[15]!==f?(m=r.jsxs("div",{className:"flex gap-2",children:[d,f]}),e[14]=d,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==l||e[18]!==m?(p=r.jsx(p3,{state:"loading",header:l,body:a,note:c,footer:m}),e[17]=l,e[18]=m,e[19]=p):p=e[19],p}function Ide(t){const e=F.c(25),{mode:s,draftPreviewUrl:n,message:i,onRetry:o}=t,l=ie();let a;e[0]!==l?(a=l("thread.publishPopover.loadFailed"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=r.jsx("span",{className:"truncate",children:a}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==s||e[5]!==c?(d=r.jsx(v3,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=d):d=e[6];let u;e[7]!==i?(u=r.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:i}),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==n||e[10]!==l?(h=r.jsx(y3,{draftPreviewUrl:n,t:l}),e[9]=n,e[10]=l,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(zn,{className:"size-4"}),e[12]=f):f=e[12];let m;e[13]!==l?(m=l("thread.publishPopover.retry"),e[13]=l,e[14]=m):m=e[14];let p;e[15]!==o||e[16]!==m?(p=r.jsxs(de,{type:"button",variant:"outline",className:"flex-1",onClick:o,children:[f,m]}),e[15]=o,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==h||e[19]!==p?(g=r.jsxs("div",{className:"flex gap-2",children:[h,p]}),e[18]=h,e[19]=p,e[20]=g):g=e[20];let x;return e[21]!==d||e[22]!==u||e[23]!==g?(x=r.jsx(p3,{state:"ready",header:d,body:u,footer:g}),e[21]=d,e[22]=u,e[23]=g,e[24]=x):x=e[24],x}function Jb(t){const e=F.c(14),s=t.mode??"publish";let n;e[0]!==s||e[1]!==t.draftPreviewUrl?(n=c=>{const{error:d,resetError:u}=c;return r.jsx(Ide,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:d?.message??"",onRetry:u})},e[0]=s,e[1]=t.draftPreviewUrl,e[2]=n):n=e[2];let i;e[3]!==s||e[4]!==t.draftPreviewUrl?(i=r.jsx(Rde,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),e[3]=s,e[4]=t.draftPreviewUrl,e[5]=i):i=e[5];let o;e[6]!==t?(o=r.jsx(Mde,{...t}),e[6]=t,e[7]=o):o=e[7];let l;e[8]!==i||e[9]!==o?(l=r.jsx(A.Suspense,{fallback:i,children:o}),e[8]=i,e[9]=o,e[10]=l):l=e[10];let a;return e[11]!==n||e[12]!==l?(a=r.jsx(Fs,{fallback:n,children:l}),e[11]=n,e[12]=l,e[13]=a):a=e[13],a}function Mde(t){const e=F.c(168),{publishLockRef:s,onOpenChange:n,mode:i,orgSlug:o,orgId:l,virtualMcpId:a,branch:c,baseBranch:d,githubConnectionId:u,owner:h,repo:f,publishPolicy:m,draftPreviewUrl:p,destinationHost:g,lastPublishedPr:x,onRequestApproval:b,openPullRequest:v,onPullRequestChanged:_,onPublished:L}=t,y=i===void 0?"publish":i,k=x===void 0?null:x,w=v===void 0?null:v,S=ie(),j=Ls()?.taskId??null;let C;e[0]!==u||e[1]!==l||e[2]!==o?(C={connectionId:u,orgId:l,orgSlug:o},e[0]=u,e[1]=l,e[2]=o,e[3]=C):C=e[3];const N=Jt(C),{data:V}=xi.useSession();let T;e[4]!==d||e[5]!==c||e[6]!==o||e[7]!==j||e[8]!==a?(T={orgSlug:o,virtualMcpId:a,branch:c,threadId:j,baseBranch:d},e[4]=d,e[5]=c,e[6]=o,e[7]=j,e[8]=a,e[9]=T):T=e[9];const{status:E,summary:P,allPaths:D,changedFilesTotal:I,changedFilesTruncated:R,headSha:$,diff:B,bodiesPending:M,bodiesFailed:O,cardsPending:z,refresh:U}=wde(T),[H,K]=A.useState(null),[W,Y]=A.useState(!1),[X,ne]=A.useState(null),[se,oe]=A.useState(null);let Z;e[10]!==H||e[11]!==P?(Z=nde(H,rde(P)),e[10]=H,e[11]=P,e[12]=Z):Z=e[12];const J=Z,q=y==="review",G=z?"loading":M?"manifest":"ready",te=!q;let le;e[13]!==D||e[14]!==c||e[15]!==B||e[16]!==E||e[17]!==o||e[18]!==m||e[19]!==te||e[20]!==j||e[21]!==a?(le={orgSlug:o,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,status:E,diff:B,paths:D,policy:m,judgeEnabled:te},e[13]=D,e[14]=c,e[15]=B,e[16]=E,e[17]=o,e[18]=m,e[19]=te,e[20]=j,e[21]=a,e[22]=le):le=e[22];const{gate:ee}=Qk(le),ae=w?.state==="open";let ue;e[23]!==c||e[24]!==E?(ue=yg(E)??c,e[23]=c,e[24]=E,e[25]=ue):ue=e[25];const he=V?.user;let ce;e[26]!==he?(ce=m3(he),e[26]=he,e[27]=ce):ce=e[27];const ge=$??void 0;let Q;e[28]!==ae||e[29]!==w?(Q=ae?{number:w.number,htmlUrl:w.htmlUrl}:void 0,e[28]=ae,e[29]=w,e[30]=Q):Q=e[30];let me;e[31]!==d||e[32]!==c||e[33]!==N||e[34]!==o||e[35]!==h||e[36]!==f||e[37]!==ce||e[38]!==ge||e[39]!==Q||e[40]!==ue||e[41]!==j||e[42]!==a?(me={orgSlug:o,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,baseBranch:d,githubClient:N,owner:h,repo:f,headBranch:ue,coAuthor:ce,expectedHeadSha:ge,existingOpenPr:Q},e[31]=d,e[32]=c,e[33]=N,e[34]=o,e[35]=h,e[36]=f,e[37]=ce,e[38]=ge,e[39]=Q,e[40]=ue,e[41]=j,e[42]=a,e[43]=me):me=e[43];const ve=me;let we;e[44]!==D||e[45]!==g||e[46]!==y||e[47]!==J||e[48]!==n||e[49]!==L||e[50]!==_||e[51]!==s||e[52]!==U||e[53]!==ve?(we={mode:y,target:ve,note:J,allPaths:D,destinationHost:g,publishLockRef:s,onOpenChange:n,refresh:U,onPullRequestChanged:_,onPublished:L},e[44]=D,e[45]=g,e[46]=y,e[47]=J,e[48]=n,e[49]=L,e[50]=_,e[51]=s,e[52]=U,e[53]=ve,e[54]=we):we=e[54];const{isPublishing:ye,isDiscarding:Le,publishError:Ce,submit:Te,discardChange:_e,discardAll:Pe}=yde(we),ke=!ye&&P.count>0&&(q||ee.allowed);let Ne;e[55]!==q||e[56]!==P.count||e[57]!==S?(Ne=q?P.count===0?S("thread.publishPopover.submitForReview"):P.count===1?S("thread.publishPopover.submitOneForReview"):S("thread.publishPopover.submitCountForReview",{count:P.count}):P.count===0?S("thread.publishPopover.publish"):P.count===1?S("thread.publishPopover.publishOneInProduction"):S("thread.publishPopover.publishCountInProduction",{count:P.count}),e[55]=q,e[56]=P.count,e[57]=S,e[58]=Ne):Ne=e[58];const Fe=Ne;let Ye;e:{if(q&&ae){let ut;e[59]!==w.number||e[60]!==S?(ut=S("thread.publishPopover.updatesPullRequest",{number:w.number}),e[59]=w.number,e[60]=S,e[61]=ut):ut=e[61],Ye=ut;break e}const rt=k;if(!rt?.mergedAt){Ye=null;break e}let yt;if(e[62]!==rt||e[63]!==S){const ut=kc(new Date(rt.mergedAt)),at=xde(rt);yt=at?S("thread.publishPopover.lastPublishedBy",{when:ut,name:at}):S("thread.publishPopover.lastPublished",{when:ut}),e[62]=rt,e[63]=S,e[64]=yt}else yt=e[64];Ye=yt}const Ie=Ye;let Re;e[65]!==q||e[66]!==P.count||e[67]!==S?(Re=q?S("thread.publishPopover.submitForReview"):P.count===1?S("thread.publishPopover.publishOne"):P.count>1?S("thread.publishPopover.publishCount",{count:P.count}):S("thread.publishPopover.publish"),e[65]=q,e[66]=P.count,e[67]=S,e[68]=Re):Re=e[68];const Oe=Re;let tt;e[69]!==M||e[70]!==se||e[71]!==_e||e[72]!==X||e[73]!==B||e[74]!==Le||e[75]!==ye?(tt=(rt,yt)=>yt.length===0?null:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:rt}),yt.map(ut=>{const at=Fk(ut);return r.jsx(hde,{change:ut,diff:B,bodyPending:M,expanded:X===at,onToggleExpanded:()=>ne(X===at?null:at),confirming:se===at,onConfirmingChange:fe=>oe(fe?at:null),onDiscard:()=>{_e(ut)},isPublishing:ye,isDiscarding:Le},at)})]}),e[69]=M,e[70]=se,e[71]=_e,e[72]=X,e[73]=B,e[74]=Le,e[75]=ye,e[76]=tt):tt=e[76];const it=tt;let nt;e:{if(q||P.count===0){nt=null;break e}if(ee.pending){let at;e[77]===Symbol.for("react.memo_cache_sentinel")?(at=r.jsx(ft,{className:"size-3.5 animate-spin motion-reduce:animate-none"}),e[77]=at):at=e[77];let fe;e[78]!==S?(fe=S("thread.publishPopover.reviewing"),e[78]=S,e[79]=fe):fe=e[79];let Ve;e[80]!==fe?(Ve=r.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[at,fe]}),e[80]=fe,e[81]=Ve):Ve=e[81],nt=Ve;break e}if(ee.allowed){nt=null;break e}let rt;e[82]===Symbol.for("react.memo_cache_sentinel")?(rt=r.jsx(Io,{className:"mt-0.5 size-3.5 shrink-0"}),e[82]=rt):rt=e[82];let yt;e[83]!==ee.reason||e[84]!==S?(yt=ee.reason??S("thread.publishPopover.needsReviewGeneric"),e[83]=ee.reason,e[84]=S,e[85]=yt):yt=e[85];let ut;e[86]!==yt?(ut=r.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[rt,r.jsx("span",{children:yt})]}),e[86]=yt,e[87]=ut):ut=e[87],nt=ut}const ot=nt;let Me;e:{if(P.count<=1||R){Me=null;break e}if(W){let fe;e[88]!==S?(fe=S("thread.publishPopover.discardAllConfirm"),e[88]=S,e[89]=fe):fe=e[89];let Ve;e[90]!==fe?(Ve=r.jsx("span",{className:"text-destructive",children:fe}),e[90]=fe,e[91]=Ve):Ve=e[91];let Be;e[92]===Symbol.for("react.memo_cache_sentinel")?(Be=()=>Y(!1),e[92]=Be):Be=e[92];let Se;e[93]!==S?(Se=S("thread.publishDialog.cancel"),e[93]=S,e[94]=Se):Se=e[94];let ct;e[95]!==Se?(ct=r.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Be,children:Se}),e[95]=Se,e[96]=ct):ct=e[96];let mt;e[97]!==Pe?(mt=()=>{Y(!1),Pe()},e[97]=Pe,e[98]=mt):mt=e[98];let Xt;e[99]!==S?(Xt=S("thread.publishPopover.discard"),e[99]=S,e[100]=Xt):Xt=e[100];let Dt;e[101]!==Le||e[102]!==mt||e[103]!==Xt?(Dt=r.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:mt,disabled:Le,children:Xt}),e[101]=Le,e[102]=mt,e[103]=Xt,e[104]=Dt):Dt=e[104];let rn;e[105]!==Ve||e[106]!==ct||e[107]!==Dt?(rn=r.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[Ve,ct,Dt]}),e[105]=Ve,e[106]=ct,e[107]=Dt,e[108]=rn):rn=e[108],Me=rn;break e}let rt;e[109]===Symbol.for("react.memo_cache_sentinel")?(rt=()=>Y(!0),e[109]=rt):rt=e[109];const yt=ye||Le;let ut;e[110]!==S?(ut=S("thread.publishPopover.discardAll"),e[110]=S,e[111]=ut):ut=e[111];let at;e[112]!==yt||e[113]!==ut?(at=r.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:rt,disabled:yt,children:ut}),e[112]=yt,e[113]=ut,e[114]=at):at=e[114],Me=at}const lt=Me;let gt;e[115]!==O||e[116]!==z||e[117]!==I||e[118]!==R||e[119]!==q||e[120]!==it||e[121]!==P.blocks||e[122]!==P.count||e[123]!==P.other||e[124]!==P.pages||e[125]!==S?(gt=z?r.jsx(tp,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($d,{}),r.jsx($d,{})]})}):P.count===0?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(vi,{className:"mb-1 size-5 text-success"}),r.jsx("p",{className:"text-sm font-medium",children:S(q?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),r.jsx("p",{className:"text-xs text-muted-foreground",children:S(q?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):r.jsxs(tp,{children:[R?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.showingFirst",{shown:P.count,total:I})}):null,it(S("thread.publishPopover.pagesGroup"),P.pages),it(S("thread.publishPopover.blocksGroup"),P.blocks),it(S("thread.publishPopover.otherGroup"),P.other),O?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.detailsUnavailable")}):null]}),e[115]=O,e[116]=z,e[117]=I,e[118]=R,e[119]=q,e[120]=it,e[121]=P.blocks,e[122]=P.count,e[123]=P.other,e[124]=P.pages,e[125]=S,e[126]=gt):gt=e[126];const Xe=gt;let be;e[127]!==Fe?(be=r.jsx("span",{className:"truncate",children:Fe}),e[127]=Fe,e[128]=be):be=e[128];let Ue;e[129]!==lt||e[130]!==y||e[131]!==Ie||e[132]!==be?(Ue=r.jsx(v3,{mode:y,title:be,subLine:Ie,trailing:lt}),e[129]=lt,e[130]=y,e[131]=Ie,e[132]=be,e[133]=Ue):Ue=e[133];let Ze;e[134]!==ye||e[135]!==q||e[136]!==J||e[137]!==P.count||e[138]!==S?(Ze=P.count===0?null:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-[13px] font-medium",children:S(q?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),r.jsx(Wr,{value:J,onChange:rt=>K(rt.target.value),placeholder:S(q?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:ye})]}),e[134]=ye,e[135]=q,e[136]=J,e[137]=P.count,e[138]=S,e[139]=Ze):Ze=e[139];let ht;e[140]!==p||e[141]!==S?(ht=r.jsx(y3,{draftPreviewUrl:p,t:S}),e[140]=p,e[141]=S,e[142]=ht):ht=e[142];let st;e[143]!==ke||e[144]!==ee||e[145]!==ye||e[146]!==q||e[147]!==b||e[148]!==Oe||e[149]!==Te||e[150]!==P.count||e[151]!==S?(st=!q&&P.count>0&&!ee.allowed&&!ee.pending?r.jsx(de,{type:"button",className:"flex-1",onClick:b,disabled:ye,children:S("thread.publishPopover.requestApproval")}):r.jsxs(de,{type:"button",variant:q?"default":"brand",className:"flex-1",onClick:()=>{Te()},disabled:!ke,children:[ye?r.jsx(ft,{className:"size-4 animate-spin motion-reduce:animate-none"}):null,ye?S(q?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):Oe]}),e[143]=ke,e[144]=ee,e[145]=ye,e[146]=q,e[147]=b,e[148]=Oe,e[149]=Te,e[150]=P.count,e[151]=S,e[152]=st):st=e[152];let wt;e[153]!==ht||e[154]!==st?(wt=r.jsxs("div",{className:"flex gap-2",children:[ht,st]}),e[153]=ht,e[154]=st,e[155]=wt):wt=e[155];let dt;e[156]!==Ce?(dt=Ce?r.jsx("p",{className:"text-xs text-destructive",children:Ce}):null,e[156]=Ce,e[157]=dt):dt=e[157];let Lt;e[158]!==wt||e[159]!==dt?(Lt=r.jsxs(r.Fragment,{children:[wt,dt]}),e[158]=wt,e[159]=dt,e[160]=Lt):Lt=e[160];let De;return e[161]!==Xe||e[162]!==ot||e[163]!==G||e[164]!==Ue||e[165]!==Ze||e[166]!==Lt?(De=r.jsx(p3,{state:G,header:Ue,body:Xe,note:Ze,gate:ot,footer:Lt}),e[161]=Xe,e[162]=ot,e[163]=G,e[164]=Ue,e[165]=Ze,e[166]=Lt,e[167]=De):De=e[167],De}function $de(){return!1}function Zk(t,e){$de()&&console.log(`[github-header] ${t}`,e??"")}function Ode(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return ZL[t].short}const Bde=new Set(["failure","timed_out","cancelled","action_required"]);function ej(t){return t.status==="completed"&&Bde.has(t.conclusion)}function _3(t){return t.status==="queued"||t.status==="in_progress"}function H0(t){return t.isPending&&t.fetchStatus!=="idle"}function zde(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function Cr(t,e,s){return e?[...t,zde(s)]:t}function wi(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"sync",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Qb(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function T0(t,e,s){if(e.filter(_3).length===0)return t;const i=e.filter(o=>o.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:i,total:e.length})}}function Fde(t){const{lifecycle:e,branch:s,pr:n,checks:i,reviews:o,loading:l,t:a}=t;if(l)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&Ode(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":if(!(s.kind==="ready"&&s.aheadOfBase>0))return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}if(s.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForBranchTooltip"),menu:[]};const c=s,d=c.unpushed>0&&!(n&&c.headSha&&n.headSha&&c.headSha===n.headSha);if(t.noReviewableDiff&&!n)return{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:wi([],c,a)};if(c.workingTreeDirty||d)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:wi(Cr([Qb(a)],n,a),c,a)};if(Zk("no local work — checking PR/sync state",{workingTreeDirty:c.workingTreeDirty,unpushed:c.unpushed,aheadOfBase:c.aheadOfBase,behindBase:c.behindBase,branch:c.branch,base:c.base,prMerged:n?.merged??null,prState:n?.state??null}),n?.merged)return!!c.headSha&&!!n.headSha&&c.headSha!==n.headSha?{label:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:wi(Cr([],n,a),c,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(n.number),base:n.base}),menu:wi(Cr([],n,a),c,a)};if(c.aheadOfBase>0){if(n&&n.state==="closed"&&!n.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(n.number)}),menu:wi(Cr([],n,a),c,a)};if(!n)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:wi([Qb(a)],c,a)};if((o?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:a("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const h=i.filter(_3).length,f=i.filter(ej).map(p=>p.name);if(h===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:wi(Cr([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(n.number),base:n.base})}],n,a),c,a)};if(o?.draft)return T0({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:wi(Cr([],n,a),c,a)},i,a);const m=o?.unresolvedConversations??0;return m>0?T0({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(m)}),menu:wi(Cr([],n,a),c,a)},i,a):o?.missingRequiredApprovals?T0({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:wi(Cr([],n,a),c,a)},i,a):T0({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:wi(Cr([{key:"review",label:a("thread.headerActions.review"),action:"review"}],n,a),c,a)},i,a)}return c.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function Xb(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function E0(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"get-latest",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Zb(t,e,s,n){const i=e.length;if(i===0)return t;if(e.filter(_3).length>0){const a=e.filter(d=>d.status==="completed").length,c=n("thread.cmsActions.checksRunning",{done:a,total:i});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const l=e.filter(ej).length;return l>0?{...t,variant:"warning",tooltip:n("thread.cmsActions.checksFailing",{failed:l,total:i})}:t}function Ude(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function Hde(t){return H0(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:H0(t.checksQuery)||H0(t.reviewsQuery)}function Kde(t){return t.aheadOfBase>0||t.workingTreeDirty}function Wde(t){const{branch:e,pr:s,checks:n,reviews:i,publishing:o,saving:l,loading:a,t:c}=t;if(e.kind!=="ready"&&t.statusError)return{label:c("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(a||e.kind!=="ready")return{label:c("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:c("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:c("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(l)return{label:c("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const u=i?.mergeableState??"unknown";return u==="dirty"?{label:c("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:c("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:c("thread.cmsActions.resolveOnGithub"),action:"open-pr"}]}:u==="blocked"||i?.draft?Zb({label:c("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:E0([Xb(c)],e,c)},n,"loading",c):Zb({label:c("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:E0([Xb(c)],e,c)},n,"none",c)}return Ude(s,e)?{label:c("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:E0([],e,c)}:Kde(e)?{label:c("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:E0([{key:"request-approval",label:c("thread.headerActions.submitForReview"),action:"request-approval"}],e,c)}:e.behindBase>0?{label:c("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:c("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:c("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function tj(t){const e=F.c(4);let s;e[0]!==t?(s=bf(t),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={...s,select:qde},e[2]=s,e[3]=n):n=e[3],Et(n)}function qde(t){const e=t.pullRequest;return e?{draft:e.draft,mergeableState:e.mergeableState,unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.missingRequiredApprovals}:null}function ev(t,e){return t==="open-pr"||e==="resolve-on-github"?r.jsx(Vn,{size:16}):t==="publish"?r.jsx(ky,{className:"size-4"}):t==="get-latest"||t==="retry-status"?r.jsx(zn,{className:"size-4"}):r.jsx(So,{className:"size-4"})}function Gde(t){const e=F.c(94),{virtualMcpId:s}=t,n=ie(),{org:i}=qe(),o=bs(),{data:l}=xi.useSession(),a=Ws(s),{currentBranch:c,setCurrentTaskBranch:d,taskId:u,createTask:h}=sn();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={open:!1,mode:"publish"},e[0]=f):f=e[0];const[m,p]=A.useState(f);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=Le=>p({open:!0,mode:Le}),e[1]=g):g=e[1];const x=g,b=Py(a),v=b.status==="attached"||b.status==="public-clone"?b.repo:null,{previewServerUrl:_}=En(s);let L;if(e[2]!==c||e[3]!==i.slug||e[4]!==s){const Le=c?Eg(Tg(i.slug,s,c)):null;L=Le?Ar(Le.path,Le.params):"/",e[2]=c,e[3]=i.slug,e[4]=s,e[5]=L}else L=e[5];const y=L;let k;e[6]!==c||e[7]!==y||e[8]!==i.slug||e[9]!==_||e[10]!==s?(k=c?{orgSlug:i.slug,virtualMcpId:s,branch:c,previewServerUrl:_,path:y}:null,e[6]=c,e[7]=y,e[8]=i.slug,e[9]=_,e[10]=s,e[11]=k):k=e[11];const w=UL(k);let S;e[12]!==c||e[13]!==i.slug||e[14]!==u||e[15]!==s?(S=bL({orgSlug:i.slug,virtualMcpId:s,branch:c??"",threadId:u??null},{fastPreview:!0}),e[12]=c,e[13]=i.slug,e[14]=u,e[15]=s,e[16]=S):S=e[16];const j=!!c;let C;e[17]!==S||e[18]!==j?(C={...S,enabled:j},e[17]=S,e[18]=j,e[19]=C):C=e[19];const N=Et(C),V=N.data??null,T=V?{kind:"ready",branch:yg(V)??c??"",base:V.base??"main",workingTreeDirty:mL(V),unpushed:V.unpushed??0,aheadOfBase:V.aheadOfBase??0,behindBase:V.behindBase??0,headSha:V.headSha??""}:{kind:"unknown"},E=(T.kind==="ready"?T.branch:null)??c??null,P=T.kind==="ready"?T.base:"main",D=vf({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",branch:E}),I=D.data??null,R=AI({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",base:P}),$=L2({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",branch:E}),B=tj({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",branch:E});let M;e[20]!==$||e[21]!==I||e[22]!==D||e[23]!==B?(M=Hde({pr:I,prQuery:D,checksQuery:$,reviewsQuery:B}),e[20]=$,e[21]=I,e[22]=D,e[23]=B,e[24]=M):M=e[24];const O=M;let z;e[25]!==D?(z=async()=>{await D.refetch()},e[25]=D,e[26]=z):z=e[26];const U=z;let H;e[27]!==l?.user||e[28]!==d?(H={mutationFn:async()=>{await d(xf(u2(l?.user)))},onError:Qde},e[27]=l?.user,e[28]=d,e[29]=H):H=e[29];const K=Rs(H);let W;e[30]!==i.slug||e[31]!==u||e[32]!==s?(W=async Le=>(await fL({orgSlug:i.slug,virtualMcpId:s,branch:Le.branch,threadId:u??null},Le.base,{fastPreview:!0}),Le),e[30]=i.slug,e[31]=u,e[32]=s,e[33]=W):W=e[33];let Y;e[34]!==c||e[35]!==i.slug||e[36]!==o||e[37]!==n||e[38]!==u||e[39]!==s?(Y=async Le=>{pe.success(n("thread.headerActions.syncedWithBase",{base:Le.base})),await Promise.all([o.invalidateQueries({queryKey:Pu({orgSlug:i.slug,virtualMcpId:s,branch:c??Le.branch,threadId:u??null})}),o.invalidateQueries({queryKey:et.decofile(`${i.slug}/${s}/${Le.branch}`)})])},e[34]=c,e[35]=i.slug,e[36]=o,e[37]=n,e[38]=u,e[39]=s,e[40]=Y):Y=e[40];let X;e[41]!==W||e[42]!==Y?(X={mutationFn:W,onSuccess:Y,onError:Jde},e[41]=W,e[42]=Y,e[43]=X):X=e[43];const ne=Rs(X),se=Cg(i.slug,s,c??"");if(b.status==="detached"){let Le;e[44]!==n?(Le=n("thread.headerActions.reconnectGithub"),e[44]=n,e[45]=Le):Le=e[45];let Ce;e[46]!==Le?(Ce=r.jsx(He,{asChild:!0,children:r.jsx("span",{children:r.jsx(de,{size:"sm",variant:"outline",disabled:!0,children:Le})})}),e[46]=Le,e[47]=Ce):Ce=e[47];let Te;e[48]!==n?(Te=n("thread.headerActions.githubConnectionRemoved"),e[48]=n,e[49]=Te):Te=e[49];let _e;e[50]!==Te?(_e=r.jsx(Ke,{children:Te}),e[50]=Te,e[51]=_e):_e=e[51];let Pe;return e[52]!==Ce||e[53]!==_e?(Pe=r.jsx(fr,{children:r.jsxs(We,{children:[Ce,_e]})}),e[52]=Ce,e[53]=_e,e[54]=Pe):Pe=e[54],Pe}if(!a)return null;if(!v||!_){const Le=v?"noPreviewServer":"noRepo";let Ce;e[55]!==c||e[56]!==h?(Ce=c?()=>{const _e=h?.({runtime:"sandbox",branch:c});_e&&Je("coding_session_started",{thread_id:_e})}:void 0,e[55]=c,e[56]=h,e[57]=Ce):Ce=e[57];let Te;return e[58]!==Le||e[59]!==Ce?(Te=r.jsx(Xde,{reason:Le,onStartCodingSession:Ce}),e[58]=Le,e[59]=Ce,e[60]=Te):Te=e[60],Te}if(!c)return null;const oe=K.isPending,Z=Wde({branch:T,pr:I,checks:$.data??[],reviews:B.data??null,publishing:oe,saving:se,syncing:ne.isPending,statusRetrying:N.isFetching&&!!N.error,statusError:N.error instanceof Error?N.error.message:N.error?String(N.error):null,loading:!!O,t:n}),J=Le=>{switch(Le){case"publish":{x("publish");return}case"request-approval":{x("review");return}case"get-latest":{if(!E||ne.isPending)return;ne.mutate({branch:E,base:P});return}case"retry-status":{N.refetch();return}case"open-pr":{I?.htmlUrl&&window.open(I.htmlUrl,"_blank","noopener,noreferrer");return}}},q=Z.menu.map(Le=>({key:Le.key,label:Le.label,icon:ev(Le.action,Le.key),...Le.tooltip?{tooltip:Le.tooltip}:{},onSelect:()=>J(Le.action)})),G=Z.action,te=Rk,le="sm",ee=Z.label,ae=Z.variant,ue=!!Z.disabled||!G,he=!!Z.loading,ce=G&&!Z.loading?{icon:ev(G)}:{};let ge;e[61]!==Z.tooltip?(ge=Z.tooltip?{tooltip:Z.tooltip}:{},e[61]=Z.tooltip,e[62]=ge):ge=e[62];let Q;e[63]!==n?(Q=n("thread.cmsActions.moreActionsAriaLabel"),e[63]=n,e[64]=Q):Q=e[64];let me;e[65]!==G||e[66]!==J?(me=G?()=>J(G):void 0,e[65]=G,e[66]=J,e[67]=me):me=e[67];let ve;e[68]!==te||e[69]!==Z.label||e[70]!==Z.variant||e[71]!==q||e[72]!==ue||e[73]!==he||e[74]!==ce||e[75]!==ge||e[76]!==Q||e[77]!==me?(ve=r.jsx(te,{size:le,label:ee,variant:ae,disabled:ue,loading:he,...ce,...ge,items:q,menuAriaLabel:Q,onClick:me}),e[68]=te,e[69]=Z.label,e[70]=Z.variant,e[71]=q,e[72]=ue,e[73]=he,e[74]=ce,e[75]=ge,e[76]=Q,e[77]=me,e[78]=ve):ve=e[78];const we=ve;let ye;return e[79]!==P||e[80]!==c||e[81]!==w||e[82]!==v||e[83]!==R||e[84]!==i.id||e[85]!==i.slug||e[86]!==I||e[87]!==K||e[88]!==U||e[89]!==we||e[90]!==m||e[91]!==s||e[92]!==a?.metadata?.publishPolicy?(ye=r.jsx(r.Fragment,{children:c?r.jsx(Pde,{open:m.open,mode:m.mode,onOpenChange:Le=>{Le||p(Yde)},orgSlug:i.slug,orgId:i.id,virtualMcpId:s,branch:c,baseBranch:P,githubConnectionId:v.connectionId??"",owner:v.owner,repo:v.name,publishPolicy:xL(a?.metadata?.publishPolicy),draftPreviewUrl:w.url,destinationHost:w.host,lastPublishedPr:R.data??null,onRequestApproval:()=>x("review"),openPullRequest:I?.state==="open"?I:null,onPullRequestChanged:U,onPublished:()=>K.mutateAsync(),children:we}):we}),e[79]=P,e[80]=c,e[81]=w,e[82]=v,e[83]=R,e[84]=i.id,e[85]=i.slug,e[86]=I,e[87]=K,e[88]=U,e[89]=we,e[90]=m,e[91]=s,e[92]=a?.metadata?.publishPolicy,e[93]=ye):ye=e[93],ye}function Yde(t){return{...t,open:!1}}function Jde(t){pe.error(t instanceof Error?t.message:String(t))}function Qde(t){pe.error(t instanceof Error?t.message:String(t))}function Xde(t){const e=F.c(14),{reason:s,onStartCodingSession:n}=t,i=ie(),o=!n;let l;e[0]!==i?(l=i("sandbox.cmsUnavailable.startCodingSession"),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==o||e[4]!==l?(a=r.jsx(He,{asChild:!0,children:r.jsx("span",{children:r.jsx(de,{size:"sm",variant:"outline",disabled:o,onClick:n,children:l})})}),e[2]=n,e[3]=o,e[4]=l,e[5]=a):a=e[5];let c;e[6]!==s||e[7]!==i?(c=i(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=i,e[8]=c):c=e[8];let d;e[9]!==c?(d=r.jsx(Ke,{children:c}),e[9]=c,e[10]=d):d=e[10];let u;return e[11]!==a||e[12]!==d?(u=r.jsx(fr,{children:r.jsxs(We,{children:[a,d]})}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u}const Zde=new Set(["main","master"]);function eue(t,e){return Zde.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function tue(t){const e=F.c(10),[s,n]=A.useState(0);let i;e[0]!==t?(i=c=>{c&&n(sue),t.onOpenChange(c)},e[0]=t,e[1]=i):i=e[1];const o=i;let l;e[2]!==o||e[3]!==t||e[4]!==s?(l=t.open?r.jsx(nue,{...t,onOpenChange:o},s):null,e[2]=o,e[3]=t,e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==o||e[7]!==t.open||e[8]!==l?(a=r.jsx(Mt,{open:t.open,onOpenChange:o,children:l}),e[6]=o,e[7]=t.open,e[8]=l,e[9]=a):a=e[9],a}function sue(t){return t+1}function nue({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:n,branch:i,baseBranch:o,githubConnectionId:l,owner:a,repo:c,previewUrl:d,publishPolicy:u,dialogIntent:h="open-pr",headSha:f=null,openPullRequest:m=null,onPullRequestChanged:p,onPublished:g}){const x=ie(),b=Jt({connectionId:l,orgId:s,orgSlug:e}),v=Jt({connectionId:Nl,orgId:s,orgSlug:e}),{data:_}=xi.useSession(),L=Z6(v),y={orgSlug:e,virtualMcpId:n,branch:i,threadId:Ls()?.taskId??null},k=m3(_?.user),w=m?.state==="open",S=m?.state==="open"?{number:m.number,htmlUrl:m.htmlUrl}:void 0,j=h==="open-pr"&&!w,C=h==="publish-only",[N,V]=A.useState(null),[T,E]=A.useState(null),[P,D]=A.useState(!0),[I,R]=A.useState(!1),[$,B]=A.useState(""),[M,O]=A.useState(""),[z,U]=A.useState(),[H,K]=A.useState(!1),[W,Y]=A.useState(),[X,ne]=A.useState(!1),[se,oe]=A.useState(!1),[Z,J]=A.useState(!1),q=A.useRef(!1),G=A.useRef(!1),te={base:o,...f?{headSha:f}:{}},le=async Ie=>{const Re=(Ie.aheadOfBase??0)>0?await Vd(y,te):null,Oe=_g(Ie)?await Vd(y):null;return rG(Re,Oe)},ee=async()=>{const Ie=await Ha(y),Re=C?await le(Ie):await Vd(y,iG(Ie,{openPrFromCommits:j,commitToOpenPr:w})?te:void 0);V(Ie),E(Re),B(x("thread.publishDialog.changesFrom",{branch:Ie.current??i})),J(!0),M4(y,{status:Ie,diff:Re}).then(Oe=>{B(Oe.title),O(Oe.body)}).catch(()=>{}).finally(()=>J(!1))};q.current||(q.current=!0,(async()=>{D(!0),U(void 0),E(null),B(""),O(""),Y(void 0);try{await ee()}catch(Ie){if(uL(Ie)&&!G.current){G.current=!0;try{await L.mutateAsync({virtualMcpId:n,branch:i}),await ee();return}catch(Re){U(Re instanceof Error?Re.message:x("thread.publishDialog.failedLoadAfterReprovision"));return}}U(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedLoad"))}finally{D(!1)}})());const ae=yg(N)??i,ue=eue(o,x),he=()=>{!N||!T||(J(!0),M4(y,{status:N,diff:T}).then(Ie=>{B(Ie.title),O(Ie.body)}).catch(()=>{}).finally(()=>J(!1)))},ce=vL(N),ge=T?Object.keys(T.diffs).length:ce,{gate:Q}=Qk({orgSlug:e,virtualMcpId:n,branch:i,threadId:y.threadId,status:N,diff:T,policy:u,judgeEnabled:C}),me=j?yL(N):nG(N,T),ve=!P&&(me||j),we=ve&&Q.allowed,ye=!ve||Q.allowed?null:Q.pending?x("thread.publishDialog.reviewingChanges"):Q.reason??x("thread.publishDialog.publishNeedsReview"),Le=j||!w&&(N?.aheadOfBase??0)>0,Ce=!P&&(Le||me)&&(ge>0||me),Te={orgSlug:e,virtualMcpId:n,branch:i,threadId:y.threadId,baseBranch:o,githubClient:b,owner:a,repo:c,headBranch:ae,coAuthor:k,existingOpenPr:S,expectedHeadSha:f??void 0},_e=()=>Hk({title:$,body:M,fallbackTitle:x("thread.publishDialog.changesFrom",{branch:ae})}),Pe=Ie=>{I||H||t(Ie)},ke=async()=>{R(!0),U(void 0);try{await Gk(Te,_e(),x),pe.success(x("thread.publishDialog.publishedTo",{baseBranch:o})),Pe(!1),E(null),B(""),O(""),await p?.(),await g?.()}catch(Ie){const Re=ip(Ie,x);U(Re.message),Re.pullRequestOpened&&await p?.()}finally{R(!1)}},Ne=async Ie=>{try{await im(y,[Ie]),pe.success(x("thread.publishDialog.discardedChanges",{filepath:Ie})),E(Oe=>{if(!Oe)return Oe;const tt={...Oe,diffs:{...Oe.diffs}};return delete tt.diffs[Ie],tt});const Re=await Ha(y);V(Re)}catch(Re){pe.error(Re instanceof Error?Re.message:x("thread.publishDialog.failedDiscardChanges"))}},Fe=async()=>{if(T){ne(!1),oe(!0);try{const Ie=Object.keys(T.diffs);if(Ie.length===0)return;await im(y,Ie),pe.success(x("thread.publishDialog.allChangesDiscarded")),E(null);const Re=await Ha(y);V(Re),Pe(!1)}catch(Ie){pe.error(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedDiscardChanges"))}finally{oe(!1)}}},Ye=async()=>{K(!0),Y(void 0);try{const Ie=await Yk(Te,_e());Jk(Ie,x),Pe(!1),await p?.()}catch(Ie){Y(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedSubmitForReview"))}finally{K(!1)}};return r.jsx(It,{className:"top-14 left-auto right-4 flex h-[90%] max-h-[85vh] w-[90vw] max-w-[600px] translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0",children:r.jsxs(_c,{defaultValue:"description",className:"flex h-full flex-col gap-0",children:[r.jsxs("div",{className:"shrink-0 space-y-3 px-6 pt-5 pb-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:j?x("thread.publishDialog.submitForReview"):ue}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-success"}),ge," ",x(ge===1?"thread.publishDialog.change":"thread.publishDialog.changes")," ",x(j?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),X?r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-destructive/5 px-3 py-2",children:[r.jsx("span",{className:"text-xs text-destructive",children:x("thread.publishDialog.discardConfirmMessage")}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(de,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>ne(!1),children:x("thread.publishDialog.cancel")}),r.jsxs(de,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:Fe,disabled:se,children:[se?r.jsx(ft,{className:"h-3 w-3 animate-spin"}):null,x("thread.publishDialog.discardAll")]})]})]}):r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(pu,{className:"h-8 w-auto",variant:"pill",children:[r.jsx(cr,{value:"description",className:"px-3 text-xs",children:x("thread.publishDialog.description")}),r.jsx(cr,{value:"changes",className:"px-3 text-xs",children:x("thread.publishDialog.changesTab")})]}),ge>0&&!j&&r.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>ne(!0),disabled:I||se,children:x("thread.publishDialog.discardAll")})]})]}),r.jsx("div",{className:"border-t"}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:P?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[r.jsx(ft,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:x("thread.publishDialog.loadingChanges")})]}):r.jsxs(r.Fragment,{children:[r.jsx(rl,{value:"description",className:"mt-0 px-6 py-5",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-medium",children:x(j?"thread.publishDialog.pullRequest":"thread.publishDialog.commitMessage")}),r.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",disabled:Z||I||H,onClick:he,children:[Z?r.jsx(ft,{className:"h-3 w-3 animate-spin"}):r.jsx(Br,{className:"h-3 w-3"}),x(Z?"thread.publishDialog.generating":"thread.publishDialog.regenerate")]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"publish-title",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.title")}),r.jsx(bt,{id:"publish-title",value:$,onChange:Ie=>B(Ie.target.value),placeholder:x(Z?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:I||H||Z,className:"text-sm"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"publish-body",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.descriptionLabel")}),r.jsx(Wr,{id:"publish-body",value:M,onChange:Ie=>O(Ie.target.value),placeholder:x(Z?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:I||H||Z,rows:5,className:"resize-none text-sm"})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[x("thread.publishDialog.branchLabel")," ",r.jsx("span",{className:"font-mono",children:i})," → ",r.jsx("span",{className:"font-mono",children:o})," · ",r.jsx("span",{className:"text-foreground/80",children:C?x("thread.publishDialog.squashMergesInto",{publishLabel:ue,baseBranch:o}):x("thread.publishDialog.opensPullRequestInto",{baseBranch:o})})]})]})}),r.jsx(rl,{value:"changes",className:"mt-0",children:r.jsx(Lg,{diff:T,onDiscardFile:Ne})})]})}),r.jsx("div",{className:"shrink-0 border-t",children:r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-6 py-3.5 text-sm transition-colors hover:bg-muted/50 disabled:opacity-50",onClick:()=>{d&&window.open(d,"_blank","noopener,noreferrer")},disabled:!d,children:[r.jsxs("span",{className:"flex items-center gap-3",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),x("thread.publishDialog.visitPreview")]}),r.jsx(Bo,{className:"h-4 w-4 text-muted-foreground"})]})}),r.jsx("div",{className:"shrink-0 border-t px-6 py-3",children:C?r.jsxs(r.Fragment,{children:[r.jsx(iue,{label:ue,canPublish:we,disabledReason:ye,isPublishing:I,onPublish:ke}),z&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:z}),!we&&!Q.pending&&Ce&&r.jsxs(r.Fragment,{children:[r.jsxs(de,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:Ye,disabled:H,children:[H?r.jsx(ft,{className:"h-4 w-4 animate-spin"}):r.jsx(mi,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),W&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:W})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(de,{type:"button",className:"w-full",onClick:Ye,disabled:!Ce||H,children:[H?r.jsx(ft,{className:"h-4 w-4 animate-spin"}):r.jsx(mi,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),W&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:W})]})})]})})}function iue(t){const e=F.c(14),{label:s,canPublish:n,disabledReason:i,isPublishing:o,onPublish:l}=t,a=!n||o;let c;e[0]!==o?(c=o?r.jsx(ft,{className:"h-4 w-4 animate-spin"}):null,e[0]=o,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==l||e[4]!==a||e[5]!==c?(d=r.jsxs(de,{type:"button",variant:"brand",className:"w-full",onClick:l,disabled:a,children:[c,s]}),e[2]=s,e[3]=l,e[4]=a,e[5]=c,e[6]=d):d=e[6];const u=d;if(!i)return u;let h;e[7]!==u?(h=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"flex w-full",children:u})}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==i?(f=r.jsx(Ke,{children:i}),e[9]=i,e[10]=f):f=e[10];let m;return e[11]!==h||e[12]!==f?(m=r.jsx(fr,{children:r.jsxs(We,{children:[h,f]})}),e[11]=h,e[12]=f,e[13]=m):m=e[13],m}function tv(t){switch(t){case"publish":return r.jsx(ky,{className:"size-4"});case"create-pr":case"reopen":return r.jsx(So,{className:"size-4"});case"rebase":case"sync":return r.jsx(zn,{className:"size-4"});case"fix-checks":return r.jsx(Io,{className:"size-4"});case"mark-ready":return r.jsx(vi,{className:"size-4"});case"resolve-comments":return r.jsx(Vp,{className:"size-4"});case"merge":return r.jsx(Ip,{className:"size-4"});case"review":return r.jsx(jc,{className:"size-4"});case"open-pr-page":return r.jsx(Vn,{size:16})}}const sv=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),nv=new Set(["publish","create-pr"]);function rue(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function oue({virtualMcpId:t}){const e=ie(),{org:s}=qe(),{data:n}=xi.useSession(),i=Ws(t),{currentBranch:o,setCurrentTaskBranch:l,taskId:a}=sn(),c=bi(),{openSidePanel:d}=vc(),[u,h]=A.useState(!1),[f,m]=A.useState("open-pr"),[p,g]=A.useState(null),[x,b]=A.useState(!1),v=A.useRef(""),_=Py(i),L=_.status==="attached"||_.status==="public-clone"?_.repo:null,y=Jt({connectionId:L?.connectionId??"",orgId:s.id,orgSlug:s.slug}),{lifecycle:k,branch:w,phase:S}=ni(),j={orgSlug:s.slug,virtualMcpId:t,branch:o??"",threadId:a??null},N=Et({queryKey:Pu(j),queryFn:()=>Ha(j),enabled:!!o,staleTime:15e3,refetchInterval:G=>$9(G.state.data)?5e3:!1}).data??null,V=w,T=k,E=V.kind==="ready"?V.branch:null,P=o??E??void 0,D=(V.kind==="ready"?V.branch:null)??P??null,I=vf({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:D}),R=I.data??null,$=L2({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:D}),B=tj({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:D}),M=V,O=xL(i?.metadata?.publishPolicy),z=Cg(s.slug,t,o??P??""),{previewUrl:U}=Pl();if(_.status==="detached")return r.jsx(aue,{label:e("thread.headerActions.githubConnectionRemoved"),children:r.jsx(de,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!L)return null;const H=D?Fde({lifecycle:T,branch:M,claimPhase:S,pr:R,checks:$.data??[],reviews:B.data??null,noReviewableDiff:$9(N),loading:H0(I),t:e}):rue(e),K=JSON.stringify({label:H.label,branchKind:M.kind,workingTreeDirty:M.kind==="ready"?M.workingTreeDirty:null,unpushed:M.kind==="ready"?M.unpushed:null,aheadOfBase:M.kind==="ready"?M.aheadOfBase:null,lifecycle:T.phase,githubHeadBranch:D,noReviewableDiff:$9(N)});v.current!==K&&(v.current=K,Zk("header button",{label:H.label,tooltip:H.tooltip,action:H.action,chatBranch:o,sandboxBranch:E,sandboxRouteBranch:P,githubHeadBranch:D,branchMeta:V,effectiveBranchMeta:M,lifecyclePhase:T.phase,prNumber:R?.number??null,prState:R?.state??null}));const W=G=>(d("chat"),c.sendMessage({parts:[{type:"text",text:G}]})),Y=c.isStreaming,X=M.kind==="ready"?M.base:"main",ne=async()=>{await I.refetch()},se=async()=>{const G=xf(u2(n?.user));await l(G)},oe=async G=>{if(!(!L?.connectionId||x)){b(!0);try{const te=m3(n?.user);await j8(y,{owner:L.owner,repo:L.name,pullNumber:G,coAuthor:te}),pe.success(e("thread.headerActions.publishedPr",{prNumber:String(G)})),await ne(),await se()}catch(te){pe.error(te instanceof Error?te.message:e("thread.headerActions.failedToMergePullRequest"))}finally{b(!1)}}},Z=(G,te)=>{m(G),g(te),h(!0)},J=G=>{if(D)switch(G){case"publish":Z("publish-only",H.meta?.publishPolicyOverride??null);return;case"create-pr":Z("open-pr",null);return;case"merge":R&&oe(R.number);return;case"sync":if(Y)return;W(yG({branch:D,base:X}));return;case"open-pr-page":R?.htmlUrl&&window.open(R.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(Y)return;R&&W(kG({prNumber:R.number}));return;case"reopen":if(Y)return;R&&W(bG({prNumber:R.number}));return;case"rebase":if(Y)return;W(vG({branch:D}));return;case"fix-checks":if(Y)return;R&&W(LG({prNumber:R.number,failingChecks:H.meta?.failingChecks??[]}));return;case"mark-ready":if(Y)return;R&&W(SG({prNumber:R.number}));return;case"resolve-comments":if(Y)return;R&&W(wG({prNumber:R.number}));return}},q=x||Y;return r.jsxs(r.Fragment,{children:[r.jsx(lue,{t:e,button:H,actionBusy:q,githubActionPending:x,savePending:z,onAction:J}),P&&r.jsx(tue,{open:u,onOpenChange:h,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:P,baseBranch:X,githubConnectionId:L.connectionId??"",owner:L.owner,repo:L.name,previewUrl:U,publishPolicy:p??O,dialogIntent:f,headSha:M.kind==="ready"?M.headSha:null,openPullRequest:R?.state==="open"?R:null,onPullRequestChanged:ne,onPublished:se})]})}function lue(t){const e=F.c(47),{t:s,button:n,actionBusy:i,githubActionPending:o,savePending:l,onAction:a}=t,c=n.action;let d;e[0]!==c||e[1]!==i?(d=i&&c!==void 0&&sv.has(c),e[0]=c,e[1]=i,e[2]=d):d=e[2];const u=d,h=o&&c==="merge";let f;e[3]!==c||e[4]!==l?(f=l&&c!==void 0&&nv.has(c),e[3]=c,e[4]=l,e[5]=f):f=e[5];const m=f,p=!!n.disabled||u||h||m||!c,g=!!n.loading||h;let x;e[6]!==n.tooltip||e[7]!==u||e[8]!==m||e[9]!==s?(x=u?s("thread.headerActions.chatIsRunning"):m?s("thread.headerActions.saving"):n.tooltip,e[6]=n.tooltip,e[7]=u,e[8]=m,e[9]=s,e[10]=x):x=e[10];const b=x;let v;if(e[11]!==i||e[12]!==n.menu||e[13]!==o||e[14]!==a||e[15]!==l||e[16]!==s){let T;e[18]!==i||e[19]!==o||e[20]!==a||e[21]!==l||e[22]!==s?(T=E=>{const P=i&&sv.has(E.action),D=l&&nv.has(E.action),I=E.action==="merge"&&o,R=D?s("thread.headerActions.saving"):P?s("thread.headerActions.chatIsRunning"):E.tooltip;return{key:E.key,label:E.label,icon:tv(E.action),disabled:!!(P||D||I),...R?{tooltip:R}:{},onSelect:()=>a(E.action)}},e[18]=i,e[19]=o,e[20]=a,e[21]=l,e[22]=s,e[23]=T):T=e[23],v=n.menu.map(T),e[11]=i,e[12]=n.menu,e[13]=o,e[14]=a,e[15]=l,e[16]=s,e[17]=v}else v=e[17];const _=v,L=c==="publish"?jo.publish:c==="create-pr"?jo.submit:void 0,y=n.label,k=n.variant;let w;e[24]!==c||e[25]!==g?(w=c&&!g?{icon:tv(c)}:{},e[24]=c,e[25]=g,e[26]=w):w=e[26];let S;e[27]!==b?(S=b?{tooltip:b}:{},e[27]=b,e[28]=S):S=e[28];let j;e[29]!==s?(j=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=j):j=e[30];let C;e[31]!==c||e[32]!==a?(C=c?()=>a(c):void 0,e[31]=c,e[32]=a,e[33]=C):C=e[33];let N;e[34]!==n.label||e[35]!==n.variant||e[36]!==p||e[37]!==_||e[38]!==g||e[39]!==w||e[40]!==S||e[41]!==j||e[42]!==C?(N=r.jsx(Rk,{size:"sm",label:y,variant:k,disabled:p,loading:g,...w,...S,items:_,menuAriaLabel:j,onClick:C}),e[34]=n.label,e[35]=n.variant,e[36]=p,e[37]=_,e[38]=g,e[39]=w,e[40]=S,e[41]=j,e[42]=C,e[43]=N):N=e[43];let V;return e[44]!==N||e[45]!==L?(V=r.jsx("span",{className:"inline-flex","data-tour":L,children:N}),e[44]=N,e[45]=L,e[46]=V):V=e[46],V}function aue(t){const e=F.c(9),{label:s,children:n}=t;if(!s){let a;return e[0]!==n?(a=r.jsx(r.Fragment,{children:n}),e[0]=n,e[1]=a):a=e[1],a}let i;e[2]!==n?(i=r.jsx(He,{asChild:!0,children:r.jsx("span",{children:n})}),e[2]=n,e[3]=i):i=e[3];let o;e[4]!==s?(o=r.jsx(Ke,{children:s}),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==i||e[7]!==o?(l=r.jsx(fr,{children:r.jsxs(We,{children:[i,o]})}),e[6]=i,e[7]=o,e[8]=l):l=e[8],l}function cue(t){const e=F.c(9),{virtualMcp:s}=t,n=uu(),{navigateToTask:i}=lC(),{create:o}=du();let l,a;if(e[0]!==n||e[1]!==o||e[2]!==i||e[3]!==s){a=Symbol.for("react.early_return_sentinel");e:{const c=$V(s,n);if(!c){a=null;break e}const d=c.mode==="dev";let u;e[6]!==o||e[7]!==i?(u=async m=>{const p=crypto.randomUUID();try{await o({id:p,virtual_mcp_id:m})}catch{}i(p,{virtualMcpId:m})},e[6]=o,e[7]=i,e[8]=u):u=e[8];const h=u,f=(m,p,g)=>r.jsxs("button",{type:"button","aria-pressed":p,"aria-label":m,title:m,onClick:()=>{p||h(c.targetId)},className:re("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",p?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(g,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"@max-3xl/panel-header:hidden",children:m})]});l=r.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[f("Develop",d,zo),f("Live",!d,Hn)]})}e[0]=n,e[1]=o,e[2]=i,e[3]=s,e[4]=l,e[5]=a}else l=e[4],a=e[5];return a!==Symbol.for("react.early_return_sentinel")?a:l}function due(t){const e=F.c(10),{locator:s}=qe(),n=$s();let i;e[0]!==s?(i=et.taskBoardItems(s),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=async()=>(await n.call("TASK_BOARD_ITEM_LIST",{})).items,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==i||e[5]!==o?(l={queryKey:i,queryFn:o},e[4]=i,e[5]=o,e[6]=l):l=e[6];const{data:a}=Et(l);if(!t||!a)return null;let c;return e[7]!==a||e[8]!==t?(c=a.find(d=>d.threads.some(u=>u.threadId===t))?.id??null,e[7]=a,e[8]=t,e[9]=c):c=e[9],c}function uue(){const t=F.c(16),e=ie(),{taskId:s}=sn(),n=zt(),i=due(s);if(!i)return null;let o;t[0]!==e?(o=e("thread.openInBoardButton.openTaskAriaLabel"),t[0]=e,t[1]=o):o=t[1];let l;t[2]!==i||t[3]!==n?(l=()=>n({to:".",search:f=>({...f,main:"board",task:i})}),t[2]=i,t[3]=n,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Or,{size:16}),t[5]=a):a=t[5];let c;t[6]!==o||t[7]!==l?(c=r.jsx(He,{asChild:!0,children:r.jsx(yo,{"aria-label":o,onClick:l,children:a})}),t[6]=o,t[7]=l,t[8]=c):c=t[8];let d;t[9]!==e?(d=e("thread.openInBoardButton.openTaskInBoard"),t[9]=e,t[10]=d):d=t[10];let u;t[11]!==d?(u=r.jsx(Ke,{children:d}),t[11]=d,t[12]=u):u=t[12];let h;return t[13]!==c||t[14]!==u?(h=r.jsx(fr,{children:r.jsxs(We,{children:[c,u]})}),t[13]=c,t[14]=u,t[15]=h):h=t[15],h}function hue(t){const e=F.c(9),{virtualMcp:s}=t,n=En(s.id).runtime==="cms";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(uue,{}),e[0]=i):i=e[0];let o;e[1]!==s?(o=r.jsx(cue,{virtualMcp:s}),e[1]=s,e[2]=o):o=e[2];let l;e[3]!==n||e[4]!==s?(l=OV(s)?n?r.jsx(Gde,{virtualMcpId:s.id}):r.jsx(oue,{virtualMcpId:s.id}):null,e[3]=n,e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==o||e[7]!==l?(a=r.jsxs("div",{className:"flex items-center gap-2",children:[i,o,l]}),e[6]=o,e[7]=l,e[8]=a):a=e[8],a}const fue=10080*60*1e3;function mue({sandboxMap:t,userId:e,rawBranches:s,now:n}){const i=new Map;for(const[h,f]of Object.entries(t??{}))for(const[m,p]of Object.entries(f??{})){let g=i.get(m);g||(g={userIds:new Set,lastActiveAt:0},i.set(m,g)),g.userIds.add(h);for(const x of Object.values(p??{})){const b=x?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const o=n-fue,l=[...i.entries()].filter(([,h])=>h.lastActiveAt>=o).sort((h,f)=>f[1].lastActiveAt-h[1].lastActiveAt).map(([h,f])=>({name:h,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(l.map(h=>h.name)),c=new Set(Object.keys(t?.[e]??{})),d=[...c].filter(h=>!a.has(h)).sort().map(h=>({name:h,source:"yours"})),u=s.filter(h=>!c.has(h.name)&&!a.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:l,yours:d,others:u}}function pue(t){const e=new Map;for(const s of t??[])for(const n of s.branches)typeof n.name=="string"&&e.set(n.name,n);return[...e.values()].map(s=>({name:s.name,author:typeof s.commit?.author=="string"?s.commit.author:s.commit?.author?.login??null}))}const sj=100,gue=50,xue=300;function rp(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function bue(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(n=>n.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function vue(t){const e=F.c(65),{orgId:s,orgSlug:n,userId:i,connectionId:o,sandboxMap:l,owner:a,repo:c,search:d,enabled:u}=t,h=d===void 0?"":d,f=u===void 0?!0:u,m=o??null;let p;e[0]!==s||e[1]!==n||e[2]!==m?(p={connectionId:m,orgId:s,orgSlug:n},e[0]=s,e[1]=n,e[2]=m,e[3]=p):p=e[3];const g=Jt(p);let x;e[4]!==h?(x=h.trim(),e[4]=h,e[5]=x):x=e[5];const b=x,v=pf(b,xue),_=!!o&&!!a&&!!c,L=b.length>0;let y;e[6]!==o||e[7]!==s||e[8]!==n||e[9]!==a||e[10]!==c?(y=et.githubBranches(s,n,o,a,c),e[6]=o,e[7]=s,e[8]=n,e[9]=a,e[10]=c,e[11]=y):y=e[11];const k=f&&_&&!L;let w;e[12]!==g||e[13]!==a||e[14]!==c?(w=async q=>{const{pageParam:G,signal:te}=q,le=Number(G),ee=await g.callTool({name:"list_branches",arguments:{owner:a,repo:c,page:le,perPage:sj}},void 0,{signal:te}),ae=bue(ee);return{branches:Array.isArray(ae)?ae:ae.branches??[],default_branch:Array.isArray(ae)?null:ae.default_branch??null,page:le}},e[12]=g,e[13]=a,e[14]=c,e[15]=w):w=e[15];let S;e[16]!==y||e[17]!==k||e[18]!==w?(S={queryKey:y,enabled:k,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:w,getNextPageParam:yue},e[16]=y,e[17]=k,e[18]=w,e[19]=S):S=e[19];const{data:j,isLoading:C,isError:N,hasNextPage:V,isFetchingNextPage:T,fetchNextPage:E}=l6(S);let P;e[20]!==o||e[21]!==v||e[22]!==s||e[23]!==n||e[24]!==a||e[25]!==c?(P=et.githubBranchSearch(s,n,o,a,c,v),e[20]=o,e[21]=v,e[22]=s,e[23]=n,e[24]=a,e[25]=c,e[26]=P):P=e[26];const D=f&&_&&v.length>0;let I;e[27]!==o||e[28]!==v||e[29]!==n||e[30]!==a||e[31]!==c?(I=()=>cp(n,"GITHUB_SEARCH_BRANCHES",{connectionId:o,owner:a,repo:c,query:v,limit:gue}),e[27]=o,e[28]=v,e[29]=n,e[30]=a,e[31]=c,e[32]=I):I=e[32];let R;e[33]!==P||e[34]!==D||e[35]!==I?(R={queryKey:P,enabled:D,staleTime:3e4,retry:!1,queryFn:I},e[33]=P,e[34]=D,e[35]=I,e[36]=R):R=e[36];const{data:$,isLoading:B,isError:M,isFetching:O}=Et(R),z=L&&(v!==b||O);let U,H,K;if(e[37]!==j?.pages||e[38]!==l||e[39]!==$||e[40]!==b||e[41]!==i){const q=$?$.branches:pue(j?.pages);U=mue({sandboxMap:l,userId:i,rawBranches:q,now:Date.now()});let G;e[45]!==b?(G=le=>rp(le.name,b),e[45]=b,e[46]=G):G=e[46],H=U.recent.filter(G);let te;e[47]!==b?(te=le=>rp(le.name,b),e[47]=b,e[48]=te):te=e[48],K=U.yours.filter(te),e[37]=j?.pages,e[38]=l,e[39]=$,e[40]=b,e[41]=i,e[42]=U,e[43]=H,e[44]=K}else U=e[42],H=e[43],K=e[44];const W=K,Y=U.others,X=$&&!z?Math.max(0,$.totalCount-$.branches.length):0,ne=L?B:C,se=L?M:N,oe=!L&&(V??!1);let Z;e[49]!==E||e[50]!==V||e[51]!==T||e[52]!==L?(Z=()=>{!L&&V&&!T&&E()},e[49]=E,e[50]=V,e[51]=T,e[52]=L,e[53]=Z):Z=e[53];let J;return e[54]!==X||e[55]!==T||e[56]!==z||e[57]!==Y||e[58]!==H||e[59]!==ne||e[60]!==se||e[61]!==oe||e[62]!==Z||e[63]!==W?(J={recent:H,yours:W,others:Y,isLoading:ne,isError:se,isSearching:z,hiddenMatchCount:X,hasMore:oe,isFetchingMore:T,fetchMore:Z},e[54]=X,e[55]=T,e[56]=z,e[57]=Y,e[58]=H,e[59]=ne,e[60]=se,e[61]=oe,e[62]=Z,e[63]=W,e[64]=J):J=e[64],J}function yue(t){if(!(t.branches.length<sj))return t.page+1}const _ue=(t,e)=>rp(t,e)?1:0;function Lue(t){const e=F.c(155),{orgId:s,orgSlug:n,userId:i,userLabel:o,connectionId:l,owner:a,repo:c,sandboxMap:d,value:u,onChange:h,onCreateBranch:f,disabled:m,placement:p}=t,g=m===void 0?!1:m,x=p===void 0?"chat":p,b=ie(),v=x==="header",[_,L]=A.useState(!1),[y,k]=A.useState("branches"),[w,S]=A.useState(""),[j,C]=A.useState(u??""),N=y==="branches"?w:"";let V;e[0]!==l||e[1]!==_||e[2]!==s||e[3]!==n||e[4]!==a||e[5]!==c||e[6]!==d||e[7]!==N||e[8]!==i?(V={orgId:s,orgSlug:n,userId:i,connectionId:l,sandboxMap:d,owner:a,repo:c,search:N,enabled:_},e[0]=l,e[1]=_,e[2]=s,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=N,e[8]=i,e[9]=V):V=e[9];const{recent:T,yours:E,others:P,isLoading:D,isError:I,isSearching:R,hiddenMatchCount:$,hasMore:B,isFetchingMore:M,fetchMore:O}=vue(V);let z;e[10]!==_?(z={enabled:_},e[10]=_,e[11]=z):z=e[11];const{data:U}=Oy(z);let H;e[12]!==U?.data?.members?(H=new Map((U?.data?.members??[]).map(Sue)),e[12]=U?.data?.members,e[13]=H):H=e[13];const K=H,W=l??"",Y=_&&y==="prs";let X;e[14]!==s||e[15]!==n||e[16]!==a||e[17]!==c||e[18]!==W||e[19]!==Y?(X={orgId:s,orgSlug:n,connectionId:W,owner:a,repo:c,enabled:Y},e[14]=s,e[15]=n,e[16]=a,e[17]=c,e[18]=W,e[19]=Y,e[20]=X):X=e[20];const{data:ne,isLoading:se,isError:oe}=II(X);let Z,J,q,G,te,le,ee,ae,ue,he,ce,ge,Q,me,ve,we;if(e[21]!==j||e[22]!==g||e[23]!==O||e[24]!==B||e[25]!==$||e[26]!==I||e[27]!==M||e[28]!==v||e[29]!==D||e[30]!==R||e[31]!==K||e[32]!==h||e[33]!==f||e[34]!==_||e[35]!==P||e[36]!==a||e[37]!==oe||e[38]!==se||e[39]!==T||e[40]!==c||e[41]!==w||e[42]!==b||e[43]!==ne||e[44]!==y||e[45]!==o||e[46]!==u||e[47]!==E){const _e=ne===void 0?[]:ne,Pe=`${a}/${c}`;let ke;e[64]!==Pe?(ke=Pe.toLowerCase(),e[64]=Pe,e[65]=ke):ke=e[65];const Ne=ke;let Fe;e[66]!==Ne?(Fe=Se=>Se.headRepoFullName?.toLowerCase()===Ne,e[66]=Ne,e[67]=Fe):Fe=e[67];const Ye=_e.filter(Fe),Ie=_e.length-Ye.length;let Re;e[68]!==h?(Re=Se=>{h(Se),L(!1)},e[68]=h,e[69]=Re):Re=e[69];const Oe=Re;let tt;e[70]!==h||e[71]!==f?(tt=Se=>{(f??h)(Se),L(!1)},e[70]=h,e[71]=f,e[72]=tt):tt=e[72];const it=tt;let nt;e[73]!==b||e[74]!==u?(nt=u??b("thread.branchPicker.selectBranch"),e[73]=b,e[74]=u,e[75]=nt):nt=e[75];const ot=nt;let Me;e[76]!==O||e[77]!==y?(Me=Se=>{const ct=Se.currentTarget,mt=ct.scrollHeight-ct.scrollTop-ct.clientHeight;y==="branches"&&mt<48&&O()},e[76]=O,e[77]=y,e[78]=Me):Me=e[78];const lt=Me;G=os,me=_,e[79]!==g||e[80]!==u?(ve=g?void 0:Se=>{Se&&(C(u??""),S("")),L(Se)},e[79]=g,e[80]=u,e[81]=ve):ve=e[81];const gt=v?"outline":"ghost",Xe=v?"sm":"default",be=v?"text-xs":"text-xs text-muted-foreground hover:text-foreground";let Ue;e[82]!==be?(Ue=re("font-mono shrink min-w-0 max-w-[200px] gap-1.5",be),e[82]=be,e[83]=Ue):Ue=e[83];let Ze;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ze=r.jsx(mi,{className:"h-3.5 w-3.5 shrink-0"}),e[84]=Ze):Ze=e[84];let ht;e[85]!==ot?(ht=r.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:ot}),e[85]=ot,e[86]=ht):ht=e[86];let st;e[87]!==g?(st=!g&&r.jsx(Qt,{size:12,className:"opacity-60 shrink-0"}),e[87]=g,e[88]=st):st=e[88];let wt;e[89]!==g||e[90]!==ot||e[91]!==gt||e[92]!==Xe||e[93]!==Ue||e[94]!==ht||e[95]!==st?(wt=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink","data-tour":jo.branches,children:r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:gt,size:Xe,"aria-label":ot,disabled:g,className:Ue,children:[Ze,ht,st]})})})}),e[89]=g,e[90]=ot,e[91]=gt,e[92]=Xe,e[93]=Ue,e[94]=ht,e[95]=st,e[96]=wt):wt=e[96];let dt;e[97]!==ot?(dt=r.jsx(Ke,{children:ot}),e[97]=ot,e[98]=dt):dt=e[98],e[99]!==wt||e[100]!==dt?(we=r.jsxs(We,{children:[wt,dt]}),e[99]=wt,e[100]=dt,e[101]=we):we=e[101],q=rs,ge="w-[min(420px,calc(100vw-2rem))] p-0",Q="start",J=zi,ee=j,ae=C,ue=y==="branches"?_ue:void 0;let Lt;e[102]!==b||e[103]!==y?(Lt=b(y==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[102]=b,e[103]=y,e[104]=Lt):Lt=e[104];let De;e[105]!==w||e[106]!==Lt?(De=r.jsx(yi,{placeholder:Lt,value:w,onValueChange:S}),e[105]=w,e[106]=Lt,e[107]=De):De=e[107];let rt;e[108]!==it||e[109]!==w||e[110]!==b||e[111]!==y||e[112]!==o?(rt=y==="branches"&&r.jsx(de,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>it(w.trim()||xf(o)),children:w.trim()?b("thread.branchPicker.createBranch",{name:w.trim()}):b("thread.branchPicker.new")}),e[108]=it,e[109]=w,e[110]=b,e[111]=y,e[112]=o,e[113]=rt):rt=e[113],e[114]!==De||e[115]!==rt?(he=r.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[De,rt]}),e[114]=De,e[115]=rt,e[116]=he):he=e[116];let yt;e[117]===Symbol.for("react.memo_cache_sentinel")?(yt=Se=>{k(Se),S("")},e[117]=yt):yt=e[117];let ut;e[118]!==b?(ut=b("thread.branchPicker.branchesTab"),e[118]=b,e[119]=ut):ut=e[119];let at;e[120]!==ut?(at=r.jsx(cr,{value:"branches",className:"h-6 px-2.5 text-xs",children:ut}),e[120]=ut,e[121]=at):at=e[121];let fe;e[122]!==b?(fe=b("thread.branchPicker.prsTab"),e[122]=b,e[123]=fe):fe=e[123];let Ve;e[124]!==fe?(Ve=r.jsx(cr,{value:"prs",className:"h-6 px-2.5 text-xs",children:fe}),e[124]=fe,e[125]=Ve):Ve=e[125];let Be;e[126]!==at||e[127]!==Ve?(Be=r.jsxs(pu,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[at,Ve]}),e[126]=at,e[127]=Ve,e[128]=Be):Be=e[128],e[129]!==Be||e[130]!==y?(ce=r.jsx(_c,{className:"px-2 pt-2 pb-1",value:y,onValueChange:yt,children:Be}),e[129]=Be,e[130]=y,e[131]=ce):ce=e[131],Z=_i,te=lt,le=y==="prs"?r.jsxs(r.Fragment,{children:[oe&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:b("thread.branchPicker.couldntLoadPullRequests")}),se&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:b("thread.branchPicker.loadingPullRequests")}),!oe&&!se&&r.jsx(si,{children:w.trim()?b("thread.branchPicker.noPullRequestsFound"):b("thread.branchPicker.noOpenPullRequests")}),Ye.length>0&&r.jsx(gs,{heading:b("thread.branchPicker.openPullRequests"),children:Ye.map(Se=>r.jsxs(Yt,{value:`#${Se.number} ${Se.title} ${Se.head}`,className:"cursor-pointer",onSelect:()=>Oe(Se.head),children:[r.jsx(So,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate",children:fc(Se.title)}),r.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",Se.number," · ",Se.head,Se.author?` · @${Se.author}`:""]})]})]},Se.number))}),Ie>0&&r.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:b("thread.branchPicker.hiddenForkPrs",{count:Ie})})]}):r.jsxs(r.Fragment,{children:[I&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:b("thread.branchPicker.couldntLoadBranches")}),!I&&(R||!D)&&r.jsx(si,{children:b(R?"thread.branchPicker.searchingBranches":"thread.branchPicker.noBranchesFound")}),T.length>0&&r.jsx(gs,{heading:b("thread.branchPicker.last7Days"),children:T.map(Se=>r.jsxs(Yt,{value:Se.name,className:"cursor-pointer",onSelect:()=>Oe(Se.name),children:[r.jsx(mi,{className:"mr-2 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:Se.name}),Se.name===u&&r.jsx(Rt,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx(wue,{userIds:Se.contributors??[],memberById:K})]},Se.name))}),E.length>0&&r.jsxs(r.Fragment,{children:[T.length>0&&r.jsx(A3,{}),r.jsx(gs,{heading:b("thread.branchPicker.yourBranches"),children:E.map(Se=>r.jsxs(Yt,{value:Se.name,className:"cursor-pointer",onSelect:()=>Oe(Se.name),children:[r.jsx(mi,{className:"mr-2 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:Se.name}),Se.name===u&&r.jsx(Rt,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},Se.name))})]}),P.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(A3,{}),r.jsx(gs,{heading:b("thread.branchPicker.otherBranchesInRepo"),children:P.map(Se=>r.jsxs(Yt,{value:Se.name,className:"cursor-pointer",onSelect:()=>Oe(Se.name),children:[r.jsx(mi,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"flex-1 truncate",children:Se.name}),Se.author&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",Se.author]}),Se.name===u&&r.jsx(Rt,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},Se.name))})]}),B&&r.jsx("div",{className:"border-t p-2",children:r.jsx(de,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:M,onClick:O,children:b(M?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})}),$>0&&r.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:b("thread.branchPicker.moreMatches",{count:$})}),!w.trim()&&!B&&P.length>0&&r.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:b("thread.branchPicker.allLoaded")})]}),e[21]=j,e[22]=g,e[23]=O,e[24]=B,e[25]=$,e[26]=I,e[27]=M,e[28]=v,e[29]=D,e[30]=R,e[31]=K,e[32]=h,e[33]=f,e[34]=_,e[35]=P,e[36]=a,e[37]=oe,e[38]=se,e[39]=T,e[40]=c,e[41]=w,e[42]=b,e[43]=ne,e[44]=y,e[45]=o,e[46]=u,e[47]=E,e[48]=Z,e[49]=J,e[50]=q,e[51]=G,e[52]=te,e[53]=le,e[54]=ee,e[55]=ae,e[56]=ue,e[57]=he,e[58]=ce,e[59]=ge,e[60]=Q,e[61]=me,e[62]=ve,e[63]=we}else Z=e[48],J=e[49],q=e[50],G=e[51],te=e[52],le=e[53],ee=e[54],ae=e[55],ue=e[56],he=e[57],ce=e[58],ge=e[59],Q=e[60],me=e[61],ve=e[62],we=e[63];let ye;e[132]!==Z||e[133]!==te||e[134]!==le?(ye=r.jsx(Z,{onScroll:te,children:le}),e[132]=Z,e[133]=te,e[134]=le,e[135]=ye):ye=e[135];let Le;e[136]!==J||e[137]!==ee||e[138]!==ae||e[139]!==ue||e[140]!==he||e[141]!==ce||e[142]!==ye?(Le=r.jsxs(J,{value:ee,onValueChange:ae,filter:ue,children:[he,ce,ye]}),e[136]=J,e[137]=ee,e[138]=ae,e[139]=ue,e[140]=he,e[141]=ce,e[142]=ye,e[143]=Le):Le=e[143];let Ce;e[144]!==q||e[145]!==ge||e[146]!==Q||e[147]!==Le?(Ce=r.jsx(q,{className:ge,align:Q,children:Le}),e[144]=q,e[145]=ge,e[146]=Q,e[147]=Le,e[148]=Ce):Ce=e[148];let Te;return e[149]!==G||e[150]!==me||e[151]!==ve||e[152]!==we||e[153]!==Ce?(Te=r.jsxs(G,{open:me,onOpenChange:ve,children:[we,Ce]}),e[149]=G,e[150]=me,e[151]=ve,e[152]=we,e[153]=Ce,e[154]=Te):Te=e[154],Te}function Sue(t){return[t.userId,t.user]}function wue(t){const e=F.c(13),{userIds:s,memberById:n}=t;if(s.length===0)return null;let i,o,l;if(e[0]!==n||e[1]!==s){const d=s.slice(0,3);i=s.length-d.length,o="ml-2 flex shrink-0 items-center -space-x-1.5";let u;e[5]!==n?(u=h=>{const f=n.get(h);return r.jsx(Hs,{url:f?.image??void 0,fallback:Qn(f?.name??void 0),shape:"circle",size:"xs",className:"ring-2 ring-background"},h)},e[5]=n,e[6]=u):u=e[6],l=d.map(u),e[0]=n,e[1]=s,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[7]!==i?(a=i>0&&r.jsxs("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[9px] font-semibold text-muted-foreground ring-2 ring-background",children:["+",i]}),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==o||e[10]!==l||e[11]!==a?(c=r.jsxs("span",{className:o,children:[l,a]}),e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function kue(t){const e=F.c(28);let s,n,i,o;e[0]!==t?({locked:s,placement:n,value:o,...i}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=o):(s=e[1],n=e[2],i=e[3],o=e[4]);const l=ie(),a=n==="header";if(s){let d;e[5]!==l||e[6]!==o?(d=o??l("chat.branchPill.noBranch"),e[5]=l,e[6]=o,e[7]=d):d=e[7];const u=d,h=a?"h-8 border border-input bg-background px-2.5":"h-9 px-2";let f;e[8]!==h?(f=re("inline-flex items-center gap-1.5 rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",h),e[8]=h,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(mi,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[10]=m):m=e[10];let p;e[11]!==u?(p=r.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:u}),e[11]=u,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==p?(g=r.jsx(He,{asChild:!0,children:r.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:f,children:[m,p]})}),e[13]=f,e[14]=p,e[15]=g):g=e[15];let x;e[16]!==u||e[17]!==l?(x=l("chat.branchPill.lockedTooltip",{branch:u}),e[16]=u,e[17]=l,e[18]=x):x=e[18];let b;e[19]!==x?(b=r.jsx(Ke,{children:x}),e[19]=x,e[20]=b):b=e[20];let v;return e[21]!==g||e[22]!==b?(v=r.jsxs(We,{children:[g,b]}),e[21]=g,e[22]=b,e[23]=v):v=e[23],v}let c;return e[24]!==n||e[25]!==i||e[26]!==o?(c=r.jsx(Lue,{...i,value:o,placement:n}),e[24]=n,e[25]=i,e[26]=o,e[27]=c):c=e[27],c}function jue(t){const e=F.c(2),{branchPill:s}=t;if(!s)return null;let n;return e[0]!==s?(n=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=n):n=e[1],n}function Cue(t){const e=F.c(25),{virtualMcp:s,currentBranch:n}=t,i=dp(),o=Ls();let l;e[0]!==i?.messages||e[1]!==o?.isThreadLocked?(l=(i?.messages??[]).length>0||(o?.isThreadLocked??!1),e[0]=i?.messages,e[1]=o?.isThreadLocked,e[2]=l):l=e[2];const a=l,c=o?.setCurrentTaskBranch,d=o?.createTask;let u;e[3]!==o?.activeTask?.metadata||e[4]!==s?.metadata?(u=ay(s?.metadata)==="cms"&&ly(o?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=o?.activeTask?.metadata,e[4]=s?.metadata,e[5]=u):u=e[5];const h=u;let f;e[6]!==s?(f=gu(s),e[6]=s,e[7]=f):f=e[7];const m=f,p=m?.connectionId,{data:g}=xi.useSession(),x=g?.user?.id??"",b=g?.user;let v;e[8]!==b?(v=u2(b),e[8]=b,e[9]=v):v=e[9];const _=v,{org:L}=qe();let y;e[10]!==p||e[11]!==h||e[12]!==d||e[13]!==n||e[14]!==m||e[15]!==a||e[16]!==L||e[17]!==c||e[18]!==x||e[19]!==_||e[20]!==s?.id||e[21]!==s?.metadata?.sandboxMap?(y=m&&p?r.jsx(kue,{orgId:L.id,orgSlug:L.slug,userId:x,userLabel:_,virtualMcpId:s?.id??"",connectionId:p,owner:m.owner,repo:m.name,sandboxMap:s?.metadata?.sandboxMap,value:n,onChange:S=>{c&&c(S)},onCreateBranch:S=>{h&&d?d({branch:S}):c&&c(S)},locked:a,placement:"chat"},`${p}:${m.owner}/${m.name}`):null,e[10]=p,e[11]=h,e[12]=d,e[13]=n,e[14]=m,e[15]=a,e[16]=L,e[17]=c,e[18]=x,e[19]=_,e[20]=s?.id,e[21]=s?.metadata?.sandboxMap,e[22]=y):y=e[22];const k=y;let w;return e[23]!==k?(w=r.jsx(jue,{branchPill:k}),e[23]=k,e[24]=w):w=e[24],w}function Nue(){const t=F.c(60),e=ie(),[s,n]=A.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={onNavigate:()=>n(!1)},t[0]=i):i=t[0];const o=wV(i),l=Ls()?.activeTask;let a;t[1]!==l?.title||t[2]!==o.activeTaskId||t[3]!==o.threads||t[4]!==e?(a=l?.title||o.threads.find(R=>R.id===o.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=l?.title,t[2]=o.activeTaskId,t[3]=o.threads,t[4]=e,t[5]=a):a=t[5];const c=a;let d;t[6]!==o?(d=()=>{n(!1),o.openSearch()},t[6]=o,t[7]=d):d=t[7];const u=d;let h;t[8]!==e?(h=e("chat.threadsMenu.chats"),t[8]=e,t[9]=h):h=t[9];const f=s&&"bg-sidebar-accent";let m;t[10]!==f?(m=re("flex h-[34px] min-w-0 shrink items-center gap-1.5 rounded-lg px-2 text-sm text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",f),t[10]=f,t[11]=m):m=t[11];let p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(fV,{size:16,className:"shrink-0"}),t[12]=p):p=t[12];let g;t[13]!==c?(g=r.jsx("span",{className:"truncate max-w-[10rem] font-medium",children:c}),t[13]=c,t[14]=g):g=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Qt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=x):x=t[15];let b;t[16]!==h||t[17]!==m||t[18]!==g?(b=r.jsx(He,{asChild:!0,children:r.jsx(is,{asChild:!0,children:r.jsxs("button",{type:"button","aria-label":h,className:m,children:[p,g,x]})})}),t[16]=h,t[17]=m,t[18]=g,t[19]=b):b=t[19];let v;t[20]!==e?(v=e("chat.threadsMenu.chats"),t[20]=e,t[21]=v):v=t[21];let _;t[22]!==v?(_=r.jsx(Ke,{side:"bottom",children:v}),t[22]=v,t[23]=_):_=t[23];let L;t[24]!==_||t[25]!==b?(L=r.jsxs(We,{children:[b,_]}),t[24]=_,t[25]=b,t[26]=L):L=t[26];let y;t[27]!==o?(y=r.jsx(kV,{panel:o,className:"size-8 rounded-lg"}),t[27]=o,t[28]=y):y=t[28];let k;t[29]!==e?(k=e("sidebar.taskGroupsList.searchChats"),t[29]=e,t[30]=k):k=t[30];let w;t[31]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(hu,{size:16}),t[31]=w):w=t[31];let S;t[32]!==u||t[33]!==k?(S=r.jsx(yo,{"aria-label":k,onClick:u,className:"size-8 rounded-lg",children:w}),t[32]=u,t[33]=k,t[34]=S):S=t[34];let j;t[35]!==e?(j=e("sidebar.taskGroupsList.newChat"),t[35]=e,t[36]=j):j=t[36];let C;t[37]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(Zh,{size:16}),t[37]=C):C=t[37];let N;t[38]!==o.newThread||t[39]!==j?(N=r.jsx(yo,{"aria-label":j,onClick:o.newThread,className:"size-8 rounded-lg",children:C}),t[38]=o.newThread,t[39]=j,t[40]=N):N=t[40];let V;t[41]!==S||t[42]!==N?(V=r.jsxs("div",{className:"flex items-center gap-0.5",children:[S,N]}),t[41]=S,t[42]=N,t[43]=V):V=t[43];let T;t[44]!==y||t[45]!==V?(T=r.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[y,V]}),t[44]=y,t[45]=V,t[46]=T):T=t[46];let E;t[47]!==o?(E=r.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:r.jsx(jV,{panel:o})}),t[47]=o,t[48]=E):E=t[48];let P;t[49]!==T||t[50]!==E?(P=r.jsxs(rs,{align:"start",side:"bottom",onOpenAutoFocus:Vue,className:"flex w-80 flex-col gap-2 p-2",children:[T,E]}),t[49]=T,t[50]=E,t[51]=P):P=t[51];let D;t[52]!==s||t[53]!==L||t[54]!==P?(D=r.jsxs(os,{open:s,onOpenChange:n,children:[L,P]}),t[52]=s,t[53]=L,t[54]=P,t[55]=D):D=t[55];let I;return t[56]!==o.reclaimDialog||t[57]!==o.searchDialog||t[58]!==D?(I=r.jsxs(r.Fragment,{children:[D,o.searchDialog,o.reclaimDialog]}),t[56]=o.reclaimDialog,t[57]=o.searchDialog,t[58]=D,t[59]=I):I=t[59],I}function Vue(t){return t.preventDefault()}function nj(t){const e=F.c(4),{chatContent:s}=t;let n;e[0]!==s?(n=s??r.jsx(Q6,{}),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{"data-testid":"chat-panel",className:"h-full min-h-0",children:n}),e[2]=n,e[3]=i):i=e[3],i}function iv(t){const e=F.c(11),{sidePanel:s,toggleSidePanel:n,disableActiveSidePanelToggle:i}=t,o=i===void 0?!1:i,l=ie();let a;e[0]!==l?(a=l("agentShellLayout.toggleButtons.chat"),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"component",Component:Vp},e[2]=c):c=e[2];const d=s==="chat",u=o&&s==="chat";let h;e[3]!==s||e[4]!==n?(h=()=>{Je("agent_toolbar_toggled",{button:"chat",next_state:s==="chat"?"closed":"open"}),n("chat")},e[3]=s,e[4]=n,e[5]=h):h=e[5];let f;return e[6]!==a||e[7]!==d||e[8]!==u||e[9]!==h?(f=r.jsx(jg,{title:a,icon:c,active:d,disabled:u,labelCollapse:"sooner",className:"h-10 md:h-7 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-50",onClick:h}),e[6]=a,e[7]=d,e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function p1(t){const e=F.c(20),{side:s,open:n,disabled:i,onToggle:o}=t,l=ie();let a;e[0]!==n||e[1]!==s||e[2]!==l?(a=l(n?s==="left"?"agentShellLayout.toggleButtons.hideChat":"agentShellLayout.toggleButtons.hidePanel":s==="left"?"agentShellLayout.toggleButtons.showChat":"agentShellLayout.toggleButtons.showPanel"),e[0]=n,e[1]=s,e[2]=l,e[3]=a):a=e[3];const c=a,d=s==="right"?mV:n?pV:gV;let u;e[4]!==o||e[5]!==n||e[6]!==s?(u=()=>{Je("agent_toolbar_toggled",{button:s==="left"?"chat":"main",next_state:n?"closed":"open"}),o()},e[4]=o,e[5]=n,e[6]=s,e[7]=u):u=e[7];let h;e[8]!==d?(h=r.jsx(d,{size:16}),e[8]=d,e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==c||e[12]!==u||e[13]!==h?(f=r.jsx(He,{asChild:!0,children:r.jsx(yo,{"aria-label":c,disabled:i,onClick:u,className:"size-7 rounded-md disabled:opacity-40",children:h})}),e[10]=i,e[11]=c,e[12]=u,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==c?(m=r.jsx(Ke,{side:"bottom",children:c}),e[15]=c,e[16]=m):m=e[16];let p;return e[17]!==f||e[18]!==m?(p=r.jsxs(We,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=p):p=e[19],p}const g1="workspace-side-panel",rv="workspace-main-panel";function ov(t){const e=F.c(13),{children:s,header:n,testId:i,headerInside:o}=t;if(o){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=re("min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]","flex flex-col"),e[0]=c):c=e[0];let d;e[1]!==s?(d=r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==d||e[5]!==i?(u=r.jsx("div",{className:"flex h-full min-h-0 flex-col p-0.5",children:r.jsxs("div",{"data-testid":i,className:c,children:[n,d]})}),e[3]=n,e[4]=d,e[5]=i,e[6]=u):u=e[6],u}let l;e[7]!==s||e[8]!==i?(l=r.jsx("div",{"data-testid":i,className:"min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]",children:s}),e[7]=s,e[8]=i,e[9]=l):l=e[9];let a;return e[10]!==n||e[11]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-0 flex-col p-0.5 pt-0.25",children:[n,l]}),e[10]=n,e[11]=l,e[12]=a):a=e[12],a}function lv(t){const e=F.c(5),{virtualMcpId:s,taskId:n,disableActiveMainToggle:i,maxVisible:o}=t;let l;return e[0]!==i||e[1]!==o||e[2]!==n||e[3]!==s?(l=r.jsx(Mce,{virtualMcpId:s,taskId:n,disableActiveMainToggle:i,maxVisible:o}),e[0]=i,e[1]=o,e[2]=n,e[3]=s,e[4]=l):l=e[4],l}function Tue(t){const e=F.c(124),{virtualMcpId:s,taskId:n,entity:i,sidePanel:o,mainOpen:l,toggleSidePanel:a,toggleMain:c,chatContent:d}=t,[u,h]=cI(),f=A.useRef(null);let m;e[0]!==l||e[1]!==o?(m=SR({sidePanel:o,mainOpen:l}),e[0]=l,e[1]=o,e[2]=m):m=e[2];const p=m,g=o!==null&&l?u:p.side,x=100-g,b=o!==null,[v,_]=P1(),[L,y]=P1();let k;e[3]!==v||e[4]!==L?(k=Hce(v,L),e[3]=v,e[4]=L,e[5]=k):k=e[5];const{maxTabs:w}=k,{state:S}=Kj(),j=S==="collapsed",C=zp();let N;e[6]!==C||e[7]!==j?(N=j&&!C?r.jsx(CV,{}):null,e[6]=C,e[7]=j,e[8]=N):N=e[8];const V=N;let T;e[9]!==C||e[10]!==j?(T=j||C?r.jsx(NV,{}):null,e[9]=C,e[10]=j,e[11]=T):T=e[11];const E=T;let P;e[12]!==C?(P=C?r.jsx(Nue,{}):null,e[12]=C,e[13]=P):P=e[13];const D=P,I=b&&!l&&!C;let R;e[14]!==i?(R=r.jsx(hue,{virtualMcp:i}),e[14]=i,e[15]=R):R=e[15];const $=R,B=Ls()?.currentBranch??null;let M;e[16]!==B||e[17]!==i?(M=r.jsx(Cue,{virtualMcp:i,currentBranch:B}),e[16]=B,e[17]=i,e[18]=M):M=e[18];const O=M;let z,U;e[19]!==x||e[20]!==g?(z=()=>{f.current?.setLayout({[g1]:g,[rv]:x})},U=[g,x],e[19]=x,e[20]=g,e[21]=z,e[22]=U):(z=e[21],U=e[22]),A.useEffect(z,U);let H;e[23]!==l||e[24]!==C||e[25]!==o||e[26]!==a?(H=!C&&r.jsx(iv,{sidePanel:o,toggleSidePanel:a,disableActiveSidePanelToggle:!l}),e[23]=l,e[24]=C,e[25]=o,e[26]=a,e[27]=H):H=e[27];let K;e[28]!==I||e[29]!==n||e[30]!==s?(K=I&&r.jsx(lv,{virtualMcpId:s,taskId:n,disableActiveMainToggle:!0}),e[28]=I,e[29]=n,e[30]=s,e[31]=K):K=e[31];const W=I&&O,Y=I&&$;let X;e[32]!==b||e[33]!==l||e[34]!==C||e[35]!==c?(X=C&&!l&&r.jsx(p1,{side:"right",open:l,disabled:!b,onToggle:c}),e[32]=b,e[33]=l,e[34]=C,e[35]=c,e[36]=X):X=e[36];let ne;e[37]!==E||e[38]!==W||e[39]!==Y||e[40]!==X?(ne=r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[W,Y,E,X]}),e[37]=E,e[38]=W,e[39]=Y,e[40]=X,e[41]=ne):ne=e[41];let se;e[42]!==V||e[43]!==H||e[44]!==K||e[45]!==ne||e[46]!==D?(se=r.jsxs(B4,{children:[D,V,H,K,ne]}),e[42]=V,e[43]=H,e[44]=K,e[45]=ne,e[46]=D,e[47]=se):se=e[47];const oe=se,Z=!b&&V;let J;e[48]!==b||e[49]!==l||e[50]!==C||e[51]!==o||e[52]!==a?(J=C?r.jsx(p1,{side:"left",open:b,disabled:!l,onToggle:()=>a("chat")}):!b&&r.jsx(iv,{sidePanel:o,toggleSidePanel:a}),e[48]=b,e[49]=l,e[50]=C,e[51]=o,e[52]=a,e[53]=J):J=e[53];const q=!b;let G;e[54]!==w||e[55]!==q||e[56]!==n||e[57]!==s?(G=r.jsx(lv,{virtualMcpId:s,taskId:n,disableActiveMainToggle:q,maxVisible:w}),e[54]=w,e[55]=q,e[56]=n,e[57]=s,e[58]=G):G=e[58];let te;e[59]!==Z||e[60]!==J||e[61]!==G?(te=r.jsxs("div",{className:"flex min-w-0 shrink items-center gap-0.5 overflow-hidden",children:[Z,J,G]}),e[59]=Z,e[60]=J,e[61]=G,e[62]=te):te=e[62];let le;e[63]===Symbol.for("react.memo_cache_sentinel")?(le=r.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center",children:r.jsx(yY,{className:"@max-sm/panel-header:hidden"})}),e[63]=le):le=e[63];let ee;e[64]!==O?(ee=r.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:O}),e[64]=O,e[65]=ee):ee=e[65];let ae;e[66]===Symbol.for("react.memo_cache_sentinel")?(ae=r.jsx(_Y,{}),e[66]=ae):ae=e[66];let ue;e[67]!==b||e[68]!==l||e[69]!==C||e[70]!==c?(ue=C&&r.jsx(p1,{side:"right",open:l,disabled:!b,onToggle:c}),e[67]=b,e[68]=l,e[69]=C,e[70]=c,e[71]=ue):ue=e[71];let he;e[72]!==$||e[73]!==y||e[74]!==ue?(he=r.jsxs("div",{ref:y,className:"flex shrink-0 items-center justify-end gap-1",children:[ae,$,ue]}),e[72]=$,e[73]=y,e[74]=ue,e[75]=he):he=e[75];let ce;e[76]!==ee||e[77]!==he?(ce=r.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[ee,he]}),e[76]=ee,e[77]=he,e[78]=ce):ce=e[78];let ge;e[79]!==_||e[80]!==te||e[81]!==ce?(ge=r.jsxs(B4,{ref:_,className:"justify-between gap-2",children:[te,le,ce]}),e[79]=_,e[80]=te,e[81]=ce,e[82]=ge):ge=e[82];const Q=ge;let me;e[83]!==s?(me=r.jsx(dY,{virtualMcpId:s}),e[83]=s,e[84]=me):me=e[84];const ve=`${s}-${n}`,we=C?"pt-1":"pt-0";let ye;e[85]!==we?(ye=re("flex-1 min-h-0 pb-1 pr-1 pl-0 [&>[data-workspace-panel-open]]:!min-w-[320px]",we),e[85]=we,e[86]=ye):ye=e[86];let Le;e[87]===Symbol.for("react.memo_cache_sentinel")?(Le={overflow:"visible"},e[87]=Le):Le=e[87];let Ce;e[88]!==l||e[89]!==h||e[90]!==o?(Ce=(lt,gt)=>{const{isUserInteraction:Xe}=gt,be=lt[g1];Xe&&o!==null&&l&&typeof be=="number"&&be>0&&be<100&&h(be)},e[88]=l,e[89]=h,e[90]=o,e[91]=Ce):Ce=e[91];const Te=`${p.side}%`,_e=o!==null?"":void 0,Pe=b?oe:null;let ke;e[92]!==d||e[93]!==b?(ke=b&&r.jsx(nj,{chatContent:d}),e[92]=d,e[93]=b,e[94]=ke):ke=e[94];let Ne;e[95]!==C||e[96]!==Pe||e[97]!==ke?(Ne=r.jsx(ov,{testId:"side-panel",headerInside:C,header:Pe,children:ke}),e[95]=C,e[96]=Pe,e[97]=ke,e[98]=Ne):Ne=e[98];let Fe;e[99]!==Te||e[100]!==_e||e[101]!==Ne?(Fe=r.jsx(Z0,{id:g1,defaultSize:Te,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":_e,className:"min-w-0 overflow-hidden bg-sidebar",children:Ne}),e[99]=Te,e[100]=_e,e[101]=Ne,e[102]=Fe):Fe=e[102];let Ye;e[103]===Symbol.for("react.memo_cache_sentinel")?(Ye=r.jsx(v8,{className:"bg-sidebar"}),e[103]=Ye):Ye=e[103];const Ie=`${p.main}%`,Re=l?"":void 0,Oe=l?Q:null;let tt;e[104]!==n||e[105]!==s?(tt=r.jsx(Dk,{taskId:n,virtualMcpId:s}),e[104]=n,e[105]=s,e[106]=tt):tt=e[106];let it;e[107]!==C||e[108]!==Oe||e[109]!==tt?(it=r.jsx(ov,{testId:"main-panel",headerInside:C,header:Oe,children:tt}),e[107]=C,e[108]=Oe,e[109]=tt,e[110]=it):it=e[110];let nt;e[111]!==Ie||e[112]!==Re||e[113]!==it?(nt=r.jsx(Z0,{id:rv,defaultSize:Ie,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":Re,className:"min-w-0 overflow-hidden bg-sidebar",children:it}),e[111]=Ie,e[112]=Re,e[113]=it,e[114]=nt):nt=e[114];let ot;e[115]!==ve||e[116]!==ye||e[117]!==Ce||e[118]!==Fe||e[119]!==nt?(ot=r.jsxs(b8,{ref:f,orientation:"horizontal",className:ye,style:Le,onLayoutChanged:Ce,children:[Fe,Ye,nt]},ve),e[115]=ve,e[116]=ye,e[117]=Ce,e[118]=Fe,e[119]=nt,e[120]=ot):ot=e[120];let Me;return e[121]!==me||e[122]!==ot?(Me=r.jsxs(vY,{children:[me,ot]}),e[121]=me,e[122]=ot,e[123]=Me):Me=e[123],Me}const x1="__mobile-main-panel-tab-select__";function Eue({tabs:t,activeTab:e,mainOpen:s,t:n}){const i=t.find(l=>l.id===e),o=n("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?i?.title??o:i?.title??t[0]?.title??o}const Aue={kind:"component",Component:Vp},Pue={kind:"component",Component:Gp},Due={kind:"component",Component:Kr};function Rue(t){const e=F.c(62),{virtualMcpId:s,taskId:n}=t,i=ie(),o=zt();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=Uh(l);let c;e[1]!==n||e[2]!==s?(c={virtualMcpId:s,taskId:n},e[1]=n,e[2]=s,e[3]=c):c=e[3];const{tabs:d,activeTab:u,mainOpen:h}=$2(c),{org:f}=qe(),m=of();let p;e[4]!==f.id?(p=q0(f.id),e[4]=f.id,e[5]=p):p=e[5];const g=s===p,x=!!(a.org&&a.taskId);let b;e[6]!==i?(b=i("mainPanelTabs.mobileMainPanelTabSelect.chat"),e[6]=i,e[7]=b):b=e[7];let v;e[8]!==b?(v={value:"chat",title:b,icon:Aue},e[8]=b,e[9]=v):v=e[9];let _;if(e[10]!==x||e[11]!==i||e[12]!==v||e[13]!==d){let O,z;e[15]!==x||e[16]!==i?(O=x?[{value:"board",title:i("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:Pue}]:[],z=x?[{value:"files",title:i("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:Due}]:[],e[15]=x,e[16]=i,e[17]=O,e[18]=z):(O=e[17],z=e[18]),_=[v,...d.map(Mue),...O,...z],e[10]=x,e[11]=i,e[12]=v,e[13]=d,e[14]=_}else _=e[14];const L=_;let y;e[19]!==u||e[20]!==h||e[21]!==L?(y=h?L.find(O=>O.value===u)?.value??u:"chat",e[19]=u,e[20]=h,e[21]=L,e[22]=y):y=e[22];const k=y;let w;e[23]!==k||e[24]!==L?(w=L.find(O=>O.value===k),e[23]=k,e[24]=L,e[25]=w):w=e[25];const S=w;let j;e[26]!==u||e[27]!==h||e[28]!==S?.title||e[29]!==i||e[30]!==d?(j=S?.title??Eue({tabs:d,activeTab:u,mainOpen:h,t:i}),e[26]=u,e[27]=h,e[28]=S?.title,e[29]=i,e[30]=d,e[31]=j):j=e[31];const C=j;let N;e[32]!==o||e[33]!==g||e[34]!==f.id||e[35]!==f.slug||e[36]!==m||e[37]!==s?(N=O=>{if(O!==x1){if(Je("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:O,source:"mobile_select"}),d7({reportsOnly:m,onReportAgent:g,tabId:O})){o({to:"/$org/$taskId",params:{org:f.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:q0(f.id),main:O}});return}o({to:".",search:z=>O==="chat"?{...z,sidepanel:"chat",main:0}:{...z,sidepanel:0,main:O},replace:!0})}},e[32]=o,e[33]=g,e[34]=f.id,e[35]=f.slug,e[36]=m,e[37]=s,e[38]=N):N=e[38];const V=N;let T;e[39]!==i?(T=i("mainPanelTabs.mobileMainPanelTabSelect.view"),e[39]=i,e[40]=T):T=e[40];let E;e[41]!==S?(E=S&&r.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:r.jsx(Uf,{icon:S.icon,className:"size-5"})}),e[41]=S,e[42]=E):E=e[42];let P;e[43]!==C?(P=r.jsx("span",{className:"min-w-0 truncate",children:C}),e[43]=C,e[44]=P):P=e[44];let D;e[45]!==E||e[46]!==P?(D=r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[E,P]}),e[45]=E,e[46]=P,e[47]=D):D=e[47];let I;e[48]!==T||e[49]!==D?(I=r.jsx(Ns,{"aria-label":T,className:"h-10! w-full min-w-0 max-w-[7.5rem] rounded-md border-0 bg-transparent px-1.5 text-xs shadow-none [--card-shadow:none]",children:D}),e[48]=T,e[49]=D,e[50]=I):I=e[50];let R;e[51]!==C?(R=r.jsx(Pt,{value:x1,disabled:!0,hideCheck:!0,className:"hidden",children:C}),e[51]=C,e[52]=R):R=e[52];let $;e[53]!==L?($=L.map(Iue),e[53]=L,e[54]=$):$=e[54];let B;e[55]!==R||e[56]!==$?(B=r.jsxs(Vs,{align:"end",className:"w-56",children:[R,$]}),e[55]=R,e[56]=$,e[57]=B):B=e[57];let M;return e[58]!==V||e[59]!==I||e[60]!==B?(M=r.jsxs(Cs,{value:x1,onValueChange:V,children:[I,B]}),e[58]=V,e[59]=I,e[60]=B,e[61]=M):M=e[61],M}function Iue(t){return r.jsx(Pt,{value:t.value,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:r.jsx(Uf,{icon:t.icon})}),r.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function Mue(t){return{value:t.id,title:t.title,icon:t.icon}}function $ue(t,e){const s=F.c(35),n=Zv(),{locator:i}=qe(),o=A.useSyncExternalStore(n.threads.subscribe,n.threads.get),l=A.useSyncExternalStore(n.threadsStatus.subscribe,n.threadsStatus.get);let a;s[0]!==t||s[1]!==o?(a=t?o.find(L=>L.id===t&&!L.partial)??null:null,s[0]=t,s[1]=o,s[2]=a):a=s[2];const c=a,[d,u]=A.useState(void 0);let h;s[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{u(void 0)},s[3]=h):h=s[3];let f;s[4]!==t?(f=[t],s[4]=t,s[5]=f):f=s[5],A.useEffect(h,f);let m,p;s[6]!==d||s[7]!==t||s[8]!==c||s[9]!==n||s[10]!==l.kind?(m=()=>{t&&(c||l.kind!=="loading"&&d===void 0&&(u("pending"),n.fetchThreadIntoSlot(t).then(L=>{u(L)})))},p=[t,c,l.kind,d,n],s[6]=d,s[7]=t,s[8]=c,s[9]=n,s[10]=l.kind,s[11]=m,s[12]=p):(m=s[11],p=s[12]),A.useEffect(m,p);let g;s[13]!==i||s[14]!==n||s[15]!==e?(g={mutationFn:async L=>n.create({id:L,virtual_mcp_id:e,...aC(sessionStorage,i,L)})},s[13]=i,s[14]=n,s[15]=e,s[16]=g):g=s[16];const x=Rs(g);let b,v;if(s[17]!==x||s[18]!==d||s[19]!==t||s[20]!==c||s[21]!==l.kind?(b=()=>{t&&(c||d===null&&l.kind!=="loading"&&(x.isPending||x.variables!==t&&x.mutate(t)))},v=[t,c,d,l.kind,x],s[17]=x,s[18]=d,s[19]=t,s[20]=c,s[21]=l.kind,s[22]=b,s[23]=v):(b=s[22],v=s[23]),A.useEffect(b,v),!t){let L;return s[24]===Symbol.for("react.memo_cache_sentinel")?(L={status:"ready",task:null},s[24]=L):L=s[24],L}if(c){let L;return s[25]!==c?(L={status:"ready",task:c},s[25]=c,s[26]=L):L=s[26],L}if(d&&typeof d=="object"){let L;return s[27]!==d?(L={status:"ready",task:d},s[27]=d,s[28]=L):L=s[28],L}if(x.data){let L;return s[29]!==x.data?(L={status:"ready",task:x.data},s[29]=x.data,s[30]=L):L=s[30],L}if(x.isError){let L;return s[31]!==x.error?(L={status:"error",error:x.error},s[31]=x.error,s[32]=L):L=s[32],L}if(x.isPending||l.kind!=="loading"){let L;return s[33]===Symbol.for("react.memo_cache_sentinel")?(L={status:"creating"},s[33]=L):L=s[33],L}let _;return s[34]===Symbol.for("react.memo_cache_sentinel")?(_={status:"loading"},s[34]=_):_=s[34],_}function Oue(){const t=F.c(6),e=Ro(),s=zt();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{preview:i}=br(n);if(!e||!i)return null;let o;t[1]!==s?(o=()=>s({to:".",search:Bue}),t[1]=s,t[2]=o):o=t[2];let l;return t[3]!==i||t[4]!==o?(l=r.jsx($w,{previewPath:i,onClose:o,showSeeInLibrary:!0}),t[3]=i,t[4]=o,t[5]=l):l=t[5],l}function Bue(t){const{preview:e,...s}=t;return s}const zue=A.createContext(null);function ij(){return A.useContext(zue)}const Pa=A.createContext(null);function eo(){return A.use(Pa)}function rj(t){const e=F.c(13),{children:s}=t,n=ie(),i=cf(),o=ij();let l;e[0]!==i||e[1]!==o?(l=r.jsx(Q6,{}),e[0]=i,e[1]=o,e[2]=l):l=e[2];const a=l;let c;e[3]!==n?(c=n("agentShellLayout.agentShellLayout.chatLoadingError"),e[3]=n,e[4]=c):c=e[4];let d;e[5]!==c?(d=r.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:c}),e[5]=c,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(ms.Skeleton,{}),e[7]=u):u=e[7];const h=s??a;let f;e[8]!==h?(f=r.jsx(A.Suspense,{fallback:u,children:h}),e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==d||e[11]!==f?(m=r.jsx(Fs,{fallback:d,children:f}),e[10]=d,e[11]=f,e[12]=m):m=e[12],m}function av(t){const e=F.c(11),{taskId:s,children:n}=t;ie(),ij();let i;return e[8]!==n||e[9]!==s?(i=r.jsx(ms.ActiveTaskProvider,{taskId:s,children:n}),e[8]=n,e[9]=s,e[10]=i):i=e[10],i}function oj(t){const e=F.c(3),{onNewTaskRef:s,createNewTask:n}=t;let i;return e[0]!==n||e[1]!==s?(i=()=>(s.current=n,()=>{s.current=null}),e[0]=n,e[1]=s,e[2]=i):i=e[2],A.useLayoutEffect(i),null}function cv({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:n}){const i=ie(),{currentBranch:o,activeTask:l,setCurrentTaskBranch:a}=sn(),{pendingSandboxProviderKind:c}=Mo(),d=cf(),{data:u}=xi.useSession(),h=u?.user?.id,f=!Xv({isDesktopApp:d,harnessId:l?.harness_id,sandboxProviderKind:l?.sandbox_provider_kind}),m=QM({agentSandboxMap:s,threadSandboxMap:l?.metadata?.sandboxMap,userId:h,ownerId:l?.created_by,branch:o}),p=e||en(l?.metadata),g=A.useRef(null),x=f&&YM({threadLoaded:!!l,isOwner:!!h&&l?.created_by===h,hasActiveGithubRepo:p,branch:o??null,attempted:g.current===(l?.id??null)});A.useEffect(()=>{!x||!l||(g.current=l.id,a(xf(u?.user?.name||u?.user?.email?.split("@")[0])))},[x,l,u,a]);const b=En(t),v=b.resolved?b.runtime:null,_=yR(t,o??void 0),L=h&&o?Ev(m?.[h]?.[o]):{},k=s7(L,c)?.previewUrl??null,w=f&&v!=="cms"&&(Object.keys(L).length>0||_);return f?v==="cms"?r.jsx(X4,{children:n},`${t}:${o??"no-branch"}:${l?.id??""}`):r.jsx(HM,{virtualMcpId:t,branch:o??null,previewUrl:k,enabled:w,children:r.jsx(o$,{executionEnabled:f,virtualMcpId:t,branch:o??null,userId:h??null,hasActiveGithubRepo:p,sandboxMap:m,sandboxProviderKind:c,threadId:l?.id??null,children:r.jsx(X4,{children:n},`${t}:${o??"no-branch"}:${l?.id??""}`)})},l?.id??"no-thread"):r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsx("div",{className:"flex h-full rounded-[0.75rem] bg-background card-shadow",children:r.jsx(To,{image:r.jsx(cn,{size:48,className:"text-muted-foreground"}),title:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function Fue(t){const e=F.c(16),{entity:s,virtualMcpId:n,layout:i,onNewTaskRef:o}=t;let l;e[0]!==i.createNewTask||e[1]!==o?(l=r.jsx(oj,{onNewTaskRef:o,createNewTask:i.createNewTask}),e[0]=i.createNewTask,e[1]=o,e[2]=l):l=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(ms.Skeleton,{}),e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(rj,{}),e[4]=c):c=e[4];let d;e[5]!==s||e[6]!==i.mainOpen||e[7]!==i.sidePanel||e[8]!==i.taskId||e[9]!==i.toggleMain||e[10]!==i.toggleSidePanel||e[11]!==n?(d=r.jsx(A.Suspense,{fallback:a,children:r.jsx(Tue,{virtualMcpId:n,taskId:i.taskId,entity:s,sidePanel:i.sidePanel,mainOpen:i.mainOpen,toggleSidePanel:i.toggleSidePanel,toggleMain:i.toggleMain,chatContent:c})}),e[5]=s,e[6]=i.mainOpen,e[7]=i.sidePanel,e[8]=i.taskId,e[9]=i.toggleMain,e[10]=i.toggleSidePanel,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[13]=l,e[14]=d,e[15]=u):u=e[15],u}function Uue(t){const e=F.c(20),{virtualMcpId:s,layout:n,onNewTaskRef:i}=t,o=ie();let l;e[0]!==n.mainOpen||e[1]!==n.sidePanel||e[2]!==n.sidePanelParamPresent?(l=wR({visibility:{sidePanel:n.sidePanel,mainOpen:n.mainOpen},sidePanelParamPresent:n.sidePanelParamPresent}),e[0]=n.mainOpen,e[1]=n.sidePanel,e[2]=n.sidePanelParamPresent,e[3]=l):l=e[3];const a=l;let c;e[4]!==n.taskId||e[5]!==s?(c=r.jsx(iT.Tabs,{children:r.jsx(Rue,{virtualMcpId:s,taskId:n.taskId})}),e[4]=n.taskId,e[5]=s,e[6]=c):c=e[6];let d;e[7]!==n.createNewTask||e[8]!==i?(d=r.jsx(oj,{onNewTaskRef:i,createNewTask:n.createNewTask}),e[7]=n.createNewTask,e[8]=i,e[9]=d):d=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(ms.Skeleton,{}),e[10]=u):u=e[10];let h;e[11]!==n.taskId||e[12]!==a||e[13]!==o||e[14]!==s?(h=r.jsx(A.Suspense,{fallback:u,children:r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:a==="main"?r.jsx(Fs,{fallback:r.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:o("agentShellLayout.agentShellLayout.somethingWentWrong")}),children:r.jsx(A.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx("div",{"data-testid":"main-panel",className:"h-full",children:r.jsx(Dk,{taskId:n.taskId,virtualMcpId:s})})})}):r.jsx(nj,{chatContent:r.jsx(rj,{})})})}),e[11]=n.taskId,e[12]=a,e[13]=o,e[14]=s,e[15]=h):h=e[15];let f;return e[16]!==c||e[17]!==d||e[18]!==h?(f=r.jsxs(r.Fragment,{children:[c,d,h]}),e[16]=c,e[17]=d,e[18]=h,e[19]=f):f=e[19],f}function Hue(){const t=F.c(97),e=ie(),s=Ro(),n=zt(),{org:i}=qe();nT(i.slug);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const l=Uh(o),a=l.org??"";let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[1]=c):c=t[1];const d=br(c);let u;t[2]!==i.id||t[3]!==d.virtualmcpid?(u=d.virtualmcpid??Cl(i.id).id,t[2]=i.id,t[3]=d.virtualmcpid,t[4]=u):u=t[4];const h=u,f=$ue(l.taskId??"",h);CR(f.status==="ready"?f.task:null);const m=Ws(h),p=m?.metadata?.ui?.layout??null;let g;t[5]!==p?(g=p?{defaultMainView:p.defaultMainView??null,chatDefaultOpen:p.chatDefaultOpen??null}:null,t[5]=p,t[6]=g):g=t[6];const x=g;let b;t[7]!==m?(b=m&&gu(m),t[7]=m,t[8]=b):b=t[8];const v=!!b;let _;t[9]!==a||t[10]!==h?(_={virtualMcpId:h,orgSlug:a,isAgentRoute:!0},t[9]=a,t[10]=h,t[11]=_):_=t[11];const L=jR(x,_),y=A.useRef(null);let k,w;t[12]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const $=B=>{ey(B)&&B.shiftKey&&B.code==="KeyS"&&!B.repeat&&(B.preventDefault(),y.current?.())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},w=[],t[12]=k,t[13]=w):(k=t[12],w=t[13]),A.useEffect(k,w);const S=h;let j;t[14]!==m||t[15]!==h?(j={virtualMcpId:h,entity:m},t[14]=m,t[15]=h,t[16]=j):j=t[16];const C=j;if(f.status==="creating"||f.status==="loading"){let $;t[17]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(ft,{className:"size-4 animate-spin mr-2"}),t[17]=$):$=t[17];let B;t[18]!==e?(B=e("agentShellLayout.agentShellLayout.creatingTask"),t[18]=e,t[19]=B):B=t[19];let M;t[20]!==B?(M=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[$,B]})}),t[20]=B,t[21]=M):M=t[21];let O;return t[22]!==C||t[23]!==M?(O=r.jsx(Pa,{value:C,children:M}),t[22]=C,t[23]=M,t[24]=O):O=t[24],O}if(f.status==="error"){let $;t[25]!==e?($=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[25]=e,t[26]=$):$=t[26];let B;t[27]!==$?(B=r.jsx("div",{className:"font-medium",children:$}),t[27]=$,t[28]=B):B=t[28];let M;t[29]!==f.error.message?(M=r.jsx("div",{className:"text-muted-foreground",children:f.error.message}),t[29]=f.error.message,t[30]=M):M=t[30];let O;t[31]!==B||t[32]!==M?(O=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{role:"alert",className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[B,M]})}),t[31]=B,t[32]=M,t[33]=O):O=t[33];let z;return t[34]!==C||t[35]!==O?(z=r.jsx(Pa,{value:C,children:O}),t[34]=C,t[35]=O,t[36]=z):z=t[36],z}if(!m){let $;t[37]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(cn,{size:48,className:"text-muted-foreground"}),t[37]=$):$=t[37];let B;t[38]!==e?(B=e("agentShellLayout.agentShellLayout.agentNotFound"),t[38]=e,t[39]=B):B=t[39];let M;t[40]!==e||t[41]!==h?(M=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:h}),t[40]=e,t[41]=h,t[42]=M):M=t[42];let O;t[43]!==n||t[44]!==a?(O=()=>n({to:"/$org",params:{org:a}}),t[43]=n,t[44]=a,t[45]=O):O=t[45];let z;t[46]!==e?(z=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[46]=e,t[47]=z):z=t[47];let U;t[48]!==O||t[49]!==z?(U=r.jsx(de,{variant:"outline",onClick:O,children:z}),t[48]=O,t[49]=z,t[50]=U):U=t[50];let H;t[51]!==B||t[52]!==M||t[53]!==U?(H=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:r.jsx(To,{image:$,title:B,description:M,actions:U})})}),t[51]=B,t[52]=M,t[53]=U,t[54]=H):H=t[54];let K;return t[55]!==C||t[56]!==H?(K=r.jsx(Pa,{value:C,children:H}),t[55]=C,t[56]=H,t[57]=K):K=t[57],K}if(s){const $=f.status==="ready"?f.task:null,B=m?.metadata?.sandboxMap;let M;t[58]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(ms.Skeleton,{}),t[58]=M):M=t[58];let O;t[59]!==S||t[60]!==L?(O=r.jsx(A.Suspense,{fallback:M,children:r.jsx(Uue,{virtualMcpId:S,layout:L,onNewTaskRef:y})}),t[59]=S,t[60]=L,t[61]=O):O=t[61];let z;t[62]!==L.taskId||t[63]!==O?(z=r.jsx(av,{taskId:L.taskId,children:O},L.taskId),t[62]=L.taskId,t[63]=O,t[64]=z):z=t[64];let U;t[65]!==v||t[66]!==B||t[67]!==z||t[68]!==h?(U=r.jsx(cv,{virtualMcpId:h,hasActiveGithubRepo:v,sandboxMap:B,children:z}),t[65]=v,t[66]=B,t[67]=z,t[68]=h,t[69]=U):U=t[69];let H;t[70]!==S||t[71]!==U||t[72]!==$?(H=r.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:r.jsx(ms.Provider,{virtualMcpId:S,task:$,children:U},S)}),t[70]=S,t[71]=U,t[72]=$,t[73]=H):H=t[73];let K;return t[74]!==C||t[75]!==H?(K=r.jsx(Pa,{value:C,children:H}),t[74]=C,t[75]=H,t[76]=K):K=t[76],K}const N=f.status==="ready"?f.task:null,V=m?.metadata?.sandboxMap;let T;t[77]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(ms.Skeleton,{}),t[77]=T):T=t[77];let E;t[78]!==m||t[79]!==L||t[80]!==h?(E=r.jsx(A.Suspense,{fallback:T,children:r.jsx(Fue,{entity:m,virtualMcpId:h,layout:L,onNewTaskRef:y})}),t[78]=m,t[79]=L,t[80]=h,t[81]=E):E=t[81];let P;t[82]!==L.taskId||t[83]!==E?(P=r.jsx(av,{taskId:L.taskId,children:E},L.taskId),t[82]=L.taskId,t[83]=E,t[84]=P):P=t[84];let D;t[85]!==v||t[86]!==V||t[87]!==P||t[88]!==h?(D=r.jsx(cv,{virtualMcpId:h,hasActiveGithubRepo:v,sandboxMap:V,children:P}),t[85]=v,t[86]=V,t[87]=P,t[88]=h,t[89]=D):D=t[89];let I;t[90]!==S||t[91]!==D||t[92]!==N?(I=r.jsx(ms.Provider,{virtualMcpId:S,task:N,children:D},S),t[90]=S,t[91]=D,t[92]=N,t[93]=I):I=t[93];let R;return t[94]!==C||t[95]!==I?(R=r.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:r.jsx(Pa,{value:C,children:I})}),t[94]=C,t[95]=I,t[96]=R):R=t[96],R}function Kue(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Wj,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(A.Suspense,{fallback:e,children:r.jsxs(KC,{children:[r.jsx(Hue,{}),r.jsx(Oue,{})]})}),t[1]=s):s=t[1],s}const Wue=Object.freeze(Object.defineProperty({__proto__:null,default:Kue,useInsetContext:eo},Symbol.toStringTag,{value:"Module"}));export{yw as $,ufe as A,cse as B,qte as C,rh as D,JI as E,KL as F,Du as G,Cn as H,Xfe as I,Dg as J,vte as K,Lfe as L,th as M,Sfe as N,Afe as O,T2 as P,En as Q,MY as R,Ui as S,Kse as T,$Y as U,md as V,bw as W,Ca as X,N5 as Y,k9e as Z,j9e as _,ofe as a,Lh as a$,f9e as a0,x0 as a1,h9e as a2,su as a3,m9e as a4,WZ as a5,FL as a6,E6 as a7,es as a8,ZU as a9,VS as aA,Pf as aB,LS as aC,Ms as aD,Kfe as aE,t9e as aF,s9e as aG,hee as aH,Kg as aI,Cfe as aJ,ew as aK,Cee as aL,Qee as aM,_f as aN,Lf as aO,eo as aP,Gte as aQ,ih as aR,I1 as aS,xl as aT,o9e as aU,um as aV,rw as aW,Vee as aX,Oee as aY,c9e as aZ,qL as a_,E8 as aa,Vu as ab,gr as ac,Dl as ad,Rl as ae,Mf as af,bl as ag,Rf as ah,c_ as ai,Eu as aj,H2 as ak,If as al,Ri as am,Ase as an,Dse as ao,Un as ap,g9e as aq,Df as ar,_w as as,p9e as at,KO as au,HO as av,Rfe as aw,wh as ax,bX as ay,$i as az,xfe as b,w9e as b$,jX as b0,Vfe as b1,kee as b2,n9e as b3,YL as b4,$fe as b5,a9e as b6,u9e as b7,d9e as b8,vee as b9,$L as bA,ML as bB,Nfe as bC,TY as bD,Tfe as bE,Efe as bF,FY as bG,Jfe as bH,Bfe as bI,Yfe as bJ,Gfe as bK,Qfe as bL,Tee as bM,Wg as bN,r9e as bO,Yee as bP,i9e as bQ,b9e as bR,v9e as bS,_9e as bT,ll as bU,L9e as bV,y9e as bW,x9e as bX,S9e as bY,Ah as bZ,zse as b_,NY as ba,VY as bb,l9e as bc,Fg as bd,$S as be,Wse as bf,mc as bg,Dc as bh,Ofe as bi,Wfe as bj,cJ as bk,qfe as bl,Ufe as bm,eJ as bn,Mfe as bo,Hfe as bp,Ffe as bq,zfe as br,Zfe as bs,EY as bt,M8 as bu,Dfe as bv,Ife as bw,Pfe as bx,e9e as by,zg as bz,cfe as c,wfe as c0,CM as c1,VM as c2,Wue as c3,cc as d,pfe as e,eM as f,_fe as g,QI as h,lfe as i,I8 as j,gfe as k,yfe as l,hfe as m,Zk as n,Pu as o,Ha as p,afe as q,ffe as r,tM as s,yf as t,Pl as u,dfe as v,Yr as w,vfe as x,bfe as y,mfe as z};
743
+ `),fallbackTitle:e})}function x3(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function b3(t){return t.fastPreview?{fastPreview:!0}:void 0}async function m1(t,e,s){try{return await s()}catch(n){throw new g3(n instanceof Error?n.message:e,t)}}async function Kk(t){const e=t.expectedHeadSha;if(!e)return;const n=(await Ha(x3(t),b3(t)).catch(()=>null))?.headSha;if(n&&n!==e)throw new Uk(e,n)}function Wk(t,e){return Jq(x3(t),e,b3(t))}function qk(t,e){return wI(t.githubClient,{owner:t.owner,repo:t.repo,branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor,existing:t.existingOpenPr})}async function Gk(t,e,s){await Kk(t),await m1("push",s("thread.publishDialog.failedPushChanges"),()=>Wk(t,e.message)),await m1("sync",s("thread.publishDialog.failedRebase"),()=>fL(x3(t),t.baseBranch,b3(t)));const n=await m1("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>qk(t,e));try{await j8(t.githubClient,{owner:t.owner,repo:t.repo,pullNumber:n.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(i){throw new g3(i instanceof Error?i.message:s("thread.publishDialog.failedMergePullRequest"),"merge",n)}return n}async function Yk(t,e){return await Kk(t),await Wk(t,e.message),qk(t,e)}function vde(t,e){return t instanceof Uk?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof g3&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function ip(t,e){const s=vde(t,e),n=s.pullRequest;return n&&pe.error(s.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(n.htmlUrl,"_blank","noopener,noreferrer")}}),{message:s.message,pullRequestOpened:n!==null,headMoved:s.headMoved}}function Jk(t,e){pe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function yde(t){const{mode:e,target:s,note:n,allPaths:i,destinationHost:o,publishLockRef:l,onOpenChange:a,refresh:c,onPullRequestChanged:d,onPublished:u}=t,h=ie(),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(),v=()=>bde(n,h("thread.publishDialog.changesFrom",{branch:s.headBranch})),_=async()=>{l.current=!0,m(!0),b(void 0);try{await Gk(s,v(),h),pe.success(o?h("thread.publishPopover.publishedTo",{host:o}):h("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),a(!1),await Promise.all([d?.(),u?.()])}catch(k){const w=ip(k,h);b(w.message),w.pullRequestOpened&&await d?.(),w.headMoved&&await c()}finally{l.current=!1,m(!1)}},L=async()=>{l.current=!0,m(!0),b(void 0);try{const k=await Yk(s,v());Jk(k,h),a(!1),await d?.()}catch(k){const w=ip(k,h);b(w.message||h("thread.publishDialog.failedSubmitForReview")),w.headMoved&&await c()}finally{l.current=!1,m(!1)}},y=async(k,w)=>{g(!0);try{await im({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},k,{fastPreview:!0}),pe.success(w),await c()}catch(S){pe.error(S instanceof Error?S.message:h("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:p,publishError:x,submit:e==="review"?L:_,discardChange:k=>y(k.filepaths,h("thread.publishPopover.discarded",{name:k.name})),discardAll:async()=>{i.length!==0&&await y(i,h("thread.publishDialog.allChangesDiscarded"))}}}function _de(t,e,s,n,i){return["cms-publish-bodies",t,e,s,n,i]}const Lde=6e4;function Sde(t,e,s){const n=F.c(6);let i;n[0]!==s||n[1]!==t||n[2]!==e?(i=et.decofile(`${t}/${e}/${s}`),n[0]=s,n[1]=t,n[2]=e,n[3]=i):i=n[3];let o;n[4]!==i?(o={queryKey:i,queryFn:Hj},n[4]=i,n[5]=o):o=n[5];const{data:l}=Et(o);return l}function wde(t){const e=F.c(43),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,baseBranch:l}=t;let a,c,d,u;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n?(c={orgSlug:s,virtualMcpId:n,branch:i,threadId:o},a={fastPreview:!0},d=Fh,u=bL(c,a),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=u):(a=e[4],c=e[5],d=e[6],u=e[7]);const h=d(u),f=h.data,m=f.changedFiles??null,p=f.headSha??null,g=m?m.length>0:(f.aheadOfBase??0)>0;let x;e[8]!==l||e[9]!==i||e[10]!==p||e[11]!==s||e[12]!==n?(x=_de(s,n,i,l,p),e[8]=l,e[9]=i,e[10]=p,e[11]=s,e[12]=n,e[13]=x):x=e[13];let b;e[14]!==l||e[15]!==a||e[16]!==c?(b=()=>Vd(c,{base:l},a),e[14]=l,e[15]=a,e[16]=c,e[17]=b):b=e[17];let v;e[18]!==x||e[19]!==b||e[20]!==g?(v={queryKey:x,queryFn:b,enabled:g,staleTime:Lde},e[18]=x,e[19]=b,e[20]=g,e[21]=v):v=e[21];const _=Et(v),L=Sde(s,n,i),y=_.data??null;let k;e[22]!==L||e[23]!==y||e[24]!==m?(k=m?tde({files:m,lookup:L,diff:y}):Xce(y),e[22]=L,e[23]=y,e[24]=m,e[25]=k):k=e[25];const w=k;let S;e[26]!==y?.diffs||e[27]!==m?(S=m?m.map(kde):Object.keys(y?.diffs??{}),e[26]=y?.diffs,e[27]=m,e[28]=S):S=e[28];const j=f.changedFilesTotal??w.count,C=f.changedFilesTruncated??!1,N=g&&_.isPending,V=!m&&g&&_.isPending;let T;e[29]!==h?(T=()=>h.refetch(),e[29]=h,e[30]=T):T=e[30];let E;return e[31]!==_.isError||e[32]!==y||e[33]!==p||e[34]!==f||e[35]!==w||e[36]!==V||e[37]!==T||e[38]!==S||e[39]!==j||e[40]!==C||e[41]!==N?(E={status:f,summary:w,allPaths:S,changedFilesTotal:j,changedFilesTruncated:C,headSha:p,diff:y,bodiesPending:N,bodiesFailed:_.isError,cardsPending:V,refresh:T},e[31]=_.isError,e[32]=y,e[33]=p,e[34]=f,e[35]=w,e[36]=V,e[37]=T,e[38]=S,e[39]=j,e[40]=C,e[41]=N,e[42]=E):E=e[42],E}function kde(t){return t.path}function jde(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Cde(t){const e=F.c(28),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,status:a,diff:c,enabled:d}=t,[u]=Oi(),{language:h}=u;let f,m,p;if(e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==l||e[4]!==h||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==n){const y=c?Zq(c):"";f=d&&!!i&&!!a&&!!c&&y!=="",p=Et,m=jde({orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,signature:y,language:h}),e[0]=i,e[1]=c,e[2]=d,e[3]=l,e[4]=h,e[5]=s,e[6]=a,e[7]=o,e[8]=n,e[9]=f,e[10]=m,e[11]=p}else f=e[9],m=e[10],p=e[11];let g;e[12]!==i||e[13]!==c||e[14]!==l||e[15]!==h||e[16]!==s||e[17]!==a||e[18]!==o||e[19]!==n?(g=()=>eG({orgSlug:s,virtualMcpId:n,branch:i,threadId:o},{status:a,diff:c,language:h},l?{fastPreview:!0}:void 0),e[12]=i,e[13]=c,e[14]=l,e[15]=h,e[16]=s,e[17]=a,e[18]=o,e[19]=n,e[20]=g):g=e[20];let x;e[21]!==f||e[22]!==m||e[23]!==g?(x={queryKey:m,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:Nde},e[21]=f,e[22]=m,e[23]=g,e[24]=x):x=e[24];const b=p(x),v=b.data??null,_=f&&b.isFetching&&!b.data;let L;return e[25]!==v||e[26]!==_?(L={verdict:v,loading:_},e[25]=v,e[26]=_,e[27]=L):L=e[27],L}function Nde(t,e){return!uL(e)&&t<1}function Qk(t){const e=F.c(30),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,status:a,diff:c,policy:d,judgeEnabled:u,paths:h}=t,f=u===void 0?!0:u,m=h===void 0?null:h;let p;e[0]!==c||e[1]!==f||e[2]!==d?(p=f&&aG(c,d),e[0]=c,e[1]=f,e[2]=d,e[3]=p):p=e[3];const g=p;let x;e[4]!==i||e[5]!==c||e[6]!==l||e[7]!==g||e[8]!==s||e[9]!==a||e[10]!==o||e[11]!==n?(x={orgSlug:s,virtualMcpId:n,branch:i,threadId:o,fastPreview:l,status:a,diff:c,enabled:g},e[4]=i,e[5]=c,e[6]=l,e[7]=g,e[8]=s,e[9]=a,e[10]=o,e[11]=n,e[12]=x):x=e[12];const{verdict:b,loading:v}=Cde(x);if(!c&&m){let k;e[13]!==m||e[14]!==d?(k=lG(m,d),e[13]=m,e[14]=d,e[15]=k):k=e[15];let w;return e[16]!==k?(w={gate:k,ready:!1},e[16]=k,e[17]=w):w=e[17],w}if(!c){let k;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k={gate:{allowed:!0,reason:null},ready:!1},e[18]=k):k=e[18],k}if(!g){let k;e[19]!==c||e[20]!==d?(k=oG(c,d),e[19]=c,e[20]=d,e[21]=k):k=e[21];let w;return e[22]!==k?(w={gate:k,ready:!0},e[22]=k,e[23]=w):w=e[23],w}let _;e[24]!==v||e[25]!==b?(_=cG(b,v),e[24]=v,e[25]=b,e[26]=_):_=e[26];const L=!v;let y;return e[27]!==_||e[28]!==L?(y={gate:_,ready:L},e[27]=_,e[28]=L,e[29]=y):y=e[29],y}const Xk="(max-width: 479px)";function Vde(t){const e=globalThis.matchMedia(Xk);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function Tde(){return A.useSyncExternalStore(Vde,Ade,Ede)}function Ede(){return!1}function Ade(){return globalThis.matchMedia(Xk).matches}function Pde(t){const e=F.c(22),s=Tde(),n=A.useRef(!1);let i;e[0]!==t?(i=d=>{!d&&n.current||t.onOpenChange(d)},e[0]=t,e[1]=i):i=e[1];const o=i;if(s){let d;e[2]!==t?(d=t.open?r.jsx(Jb,{...t,publishLockRef:n}):null,e[2]=t,e[3]=d):d=e[3];let u;e[4]!==d?(u=r.jsx(It,{className:"flex max-h-[85vh] w-[92vw] max-w-[420px] flex-col gap-0 overflow-hidden p-0",children:d}),e[4]=d,e[5]=u):u=e[5];let h;e[6]!==o||e[7]!==t.open||e[8]!==u?(h=r.jsx(Mt,{open:t.open,onOpenChange:o,children:u}),e[6]=o,e[7]=t.open,e[8]=u,e[9]=h):h=e[9];let f;return e[10]!==t.children||e[11]!==h?(f=r.jsxs(r.Fragment,{children:[t.children,h]}),e[10]=t.children,e[11]=h,e[12]=f):f=e[12],f}let l;e[13]!==t.children?(l=r.jsx(RV,{asChild:!0,children:r.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=l):l=e[14];let a;e[15]!==t?(a=r.jsx(rs,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:Dde,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:r.jsx(Jb,{...t,publishLockRef:n})}),e[15]=t,e[16]=a):a=e[16];let c;return e[17]!==o||e[18]!==t.open||e[19]!==l||e[20]!==a?(c=r.jsxs(os,{open:t.open,onOpenChange:o,children:[l,a]}),e[17]=o,e[18]=t.open,e[19]=l,e[20]=a,e[21]=c):c=e[21],c}function Dde(t){return t.preventDefault()}function v3(t){const e=F.c(11),{mode:s,title:n,subLine:i,trailing:o}=t,l=s==="review"?So:Hn;let a;e[0]!==l?(a=r.jsx(l,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a||e[3]!==n||e[4]!==o?(c=r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,n,o]}),e[2]=a,e[3]=n,e[4]=o,e[5]=c):c=e[5];let d;e[6]!==i?(d=i?r.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:i}):null,e[6]=i,e[7]=d):d=e[7];let u;return e[8]!==c||e[9]!==d?(u=r.jsxs(r.Fragment,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function y3(t){const e=F.c(9),{draftPreviewUrl:s,t:n}=t;let i;e[0]!==s?(i=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=i):i=e[1];const o=!s;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(jc,{className:"size-4"}),e[2]=l):l=e[2];let a;e[3]!==n?(a=n("thread.publishPopover.preview"),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==i||e[6]!==o||e[7]!==a?(c=r.jsxs(de,{type:"button",variant:"outline",onClick:i,disabled:o,children:[l,a]}),e[5]=i,e[6]=o,e[7]=a,e[8]=c):c=e[8],c}function Rde(t){const e=F.c(20),{mode:s,draftPreviewUrl:n}=t,i=ie();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Mr,{className:"h-3.5 w-48"}),e[0]=o):o=e[0];let l;e[1]!==s?(l=r.jsx(v3,{mode:s,title:o}),e[1]=s,e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(tp,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($d,{}),r.jsx($d,{}),r.jsx($d,{})]})}),c=r.jsxs(r.Fragment,{children:[r.jsx(Mr,{className:"h-3 w-20"}),r.jsx(Mr,{className:"h-14 w-full rounded-lg"})]}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let d;e[5]!==n||e[6]!==i?(d=r.jsx(y3,{draftPreviewUrl:n,t:i}),e[5]=n,e[6]=i,e[7]=d):d=e[7];const u=s==="review"?"default":"brand";let h;e[8]!==s||e[9]!==i?(h=i(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=i,e[10]=h):h=e[10];let f;e[11]!==u||e[12]!==h?(f=r.jsx(de,{type:"button",variant:u,className:"flex-1",disabled:!0,children:h}),e[11]=u,e[12]=h,e[13]=f):f=e[13];let m;e[14]!==d||e[15]!==f?(m=r.jsxs("div",{className:"flex gap-2",children:[d,f]}),e[14]=d,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==l||e[18]!==m?(p=r.jsx(p3,{state:"loading",header:l,body:a,note:c,footer:m}),e[17]=l,e[18]=m,e[19]=p):p=e[19],p}function Ide(t){const e=F.c(25),{mode:s,draftPreviewUrl:n,message:i,onRetry:o}=t,l=ie();let a;e[0]!==l?(a=l("thread.publishPopover.loadFailed"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=r.jsx("span",{className:"truncate",children:a}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==s||e[5]!==c?(d=r.jsx(v3,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=d):d=e[6];let u;e[7]!==i?(u=r.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:i}),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==n||e[10]!==l?(h=r.jsx(y3,{draftPreviewUrl:n,t:l}),e[9]=n,e[10]=l,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(zn,{className:"size-4"}),e[12]=f):f=e[12];let m;e[13]!==l?(m=l("thread.publishPopover.retry"),e[13]=l,e[14]=m):m=e[14];let p;e[15]!==o||e[16]!==m?(p=r.jsxs(de,{type:"button",variant:"outline",className:"flex-1",onClick:o,children:[f,m]}),e[15]=o,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==h||e[19]!==p?(g=r.jsxs("div",{className:"flex gap-2",children:[h,p]}),e[18]=h,e[19]=p,e[20]=g):g=e[20];let x;return e[21]!==d||e[22]!==u||e[23]!==g?(x=r.jsx(p3,{state:"ready",header:d,body:u,footer:g}),e[21]=d,e[22]=u,e[23]=g,e[24]=x):x=e[24],x}function Jb(t){const e=F.c(14),s=t.mode??"publish";let n;e[0]!==s||e[1]!==t.draftPreviewUrl?(n=c=>{const{error:d,resetError:u}=c;return r.jsx(Ide,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:d?.message??"",onRetry:u})},e[0]=s,e[1]=t.draftPreviewUrl,e[2]=n):n=e[2];let i;e[3]!==s||e[4]!==t.draftPreviewUrl?(i=r.jsx(Rde,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),e[3]=s,e[4]=t.draftPreviewUrl,e[5]=i):i=e[5];let o;e[6]!==t?(o=r.jsx(Mde,{...t}),e[6]=t,e[7]=o):o=e[7];let l;e[8]!==i||e[9]!==o?(l=r.jsx(A.Suspense,{fallback:i,children:o}),e[8]=i,e[9]=o,e[10]=l):l=e[10];let a;return e[11]!==n||e[12]!==l?(a=r.jsx(Fs,{fallback:n,children:l}),e[11]=n,e[12]=l,e[13]=a):a=e[13],a}function Mde(t){const e=F.c(168),{publishLockRef:s,onOpenChange:n,mode:i,orgSlug:o,orgId:l,virtualMcpId:a,branch:c,baseBranch:d,githubConnectionId:u,owner:h,repo:f,publishPolicy:m,draftPreviewUrl:p,destinationHost:g,lastPublishedPr:x,onRequestApproval:b,openPullRequest:v,onPullRequestChanged:_,onPublished:L}=t,y=i===void 0?"publish":i,k=x===void 0?null:x,w=v===void 0?null:v,S=ie(),j=Ls()?.taskId??null;let C;e[0]!==u||e[1]!==l||e[2]!==o?(C={connectionId:u,orgId:l,orgSlug:o},e[0]=u,e[1]=l,e[2]=o,e[3]=C):C=e[3];const N=Jt(C),{data:V}=xi.useSession();let T;e[4]!==d||e[5]!==c||e[6]!==o||e[7]!==j||e[8]!==a?(T={orgSlug:o,virtualMcpId:a,branch:c,threadId:j,baseBranch:d},e[4]=d,e[5]=c,e[6]=o,e[7]=j,e[8]=a,e[9]=T):T=e[9];const{status:E,summary:P,allPaths:D,changedFilesTotal:I,changedFilesTruncated:R,headSha:$,diff:B,bodiesPending:M,bodiesFailed:O,cardsPending:z,refresh:U}=wde(T),[H,K]=A.useState(null),[W,Y]=A.useState(!1),[X,ne]=A.useState(null),[se,oe]=A.useState(null);let Z;e[10]!==H||e[11]!==P?(Z=nde(H,rde(P)),e[10]=H,e[11]=P,e[12]=Z):Z=e[12];const J=Z,q=y==="review",G=z?"loading":M?"manifest":"ready",te=!q;let le;e[13]!==D||e[14]!==c||e[15]!==B||e[16]!==E||e[17]!==o||e[18]!==m||e[19]!==te||e[20]!==j||e[21]!==a?(le={orgSlug:o,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,status:E,diff:B,paths:D,policy:m,judgeEnabled:te},e[13]=D,e[14]=c,e[15]=B,e[16]=E,e[17]=o,e[18]=m,e[19]=te,e[20]=j,e[21]=a,e[22]=le):le=e[22];const{gate:ee}=Qk(le),ae=w?.state==="open";let ue;e[23]!==c||e[24]!==E?(ue=yg(E)??c,e[23]=c,e[24]=E,e[25]=ue):ue=e[25];const he=V?.user;let ce;e[26]!==he?(ce=m3(he),e[26]=he,e[27]=ce):ce=e[27];const ge=$??void 0;let Q;e[28]!==ae||e[29]!==w?(Q=ae?{number:w.number,htmlUrl:w.htmlUrl}:void 0,e[28]=ae,e[29]=w,e[30]=Q):Q=e[30];let me;e[31]!==d||e[32]!==c||e[33]!==N||e[34]!==o||e[35]!==h||e[36]!==f||e[37]!==ce||e[38]!==ge||e[39]!==Q||e[40]!==ue||e[41]!==j||e[42]!==a?(me={orgSlug:o,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,baseBranch:d,githubClient:N,owner:h,repo:f,headBranch:ue,coAuthor:ce,expectedHeadSha:ge,existingOpenPr:Q},e[31]=d,e[32]=c,e[33]=N,e[34]=o,e[35]=h,e[36]=f,e[37]=ce,e[38]=ge,e[39]=Q,e[40]=ue,e[41]=j,e[42]=a,e[43]=me):me=e[43];const ve=me;let we;e[44]!==D||e[45]!==g||e[46]!==y||e[47]!==J||e[48]!==n||e[49]!==L||e[50]!==_||e[51]!==s||e[52]!==U||e[53]!==ve?(we={mode:y,target:ve,note:J,allPaths:D,destinationHost:g,publishLockRef:s,onOpenChange:n,refresh:U,onPullRequestChanged:_,onPublished:L},e[44]=D,e[45]=g,e[46]=y,e[47]=J,e[48]=n,e[49]=L,e[50]=_,e[51]=s,e[52]=U,e[53]=ve,e[54]=we):we=e[54];const{isPublishing:ye,isDiscarding:Le,publishError:Ce,submit:Te,discardChange:_e,discardAll:Pe}=yde(we),ke=!ye&&P.count>0&&(q||ee.allowed);let Ne;e[55]!==q||e[56]!==P.count||e[57]!==S?(Ne=q?P.count===0?S("thread.publishPopover.submitForReview"):P.count===1?S("thread.publishPopover.submitOneForReview"):S("thread.publishPopover.submitCountForReview",{count:P.count}):P.count===0?S("thread.publishPopover.publish"):P.count===1?S("thread.publishPopover.publishOneInProduction"):S("thread.publishPopover.publishCountInProduction",{count:P.count}),e[55]=q,e[56]=P.count,e[57]=S,e[58]=Ne):Ne=e[58];const Fe=Ne;let Ye;e:{if(q&&ae){let ut;e[59]!==w.number||e[60]!==S?(ut=S("thread.publishPopover.updatesPullRequest",{number:w.number}),e[59]=w.number,e[60]=S,e[61]=ut):ut=e[61],Ye=ut;break e}const rt=k;if(!rt?.mergedAt){Ye=null;break e}let yt;if(e[62]!==rt||e[63]!==S){const ut=kc(new Date(rt.mergedAt)),at=xde(rt);yt=at?S("thread.publishPopover.lastPublishedBy",{when:ut,name:at}):S("thread.publishPopover.lastPublished",{when:ut}),e[62]=rt,e[63]=S,e[64]=yt}else yt=e[64];Ye=yt}const Ie=Ye;let Re;e[65]!==q||e[66]!==P.count||e[67]!==S?(Re=q?S("thread.publishPopover.submitForReview"):P.count===1?S("thread.publishPopover.publishOne"):P.count>1?S("thread.publishPopover.publishCount",{count:P.count}):S("thread.publishPopover.publish"),e[65]=q,e[66]=P.count,e[67]=S,e[68]=Re):Re=e[68];const Oe=Re;let tt;e[69]!==M||e[70]!==se||e[71]!==_e||e[72]!==X||e[73]!==B||e[74]!==Le||e[75]!==ye?(tt=(rt,yt)=>yt.length===0?null:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:rt}),yt.map(ut=>{const at=Fk(ut);return r.jsx(hde,{change:ut,diff:B,bodyPending:M,expanded:X===at,onToggleExpanded:()=>ne(X===at?null:at),confirming:se===at,onConfirmingChange:fe=>oe(fe?at:null),onDiscard:()=>{_e(ut)},isPublishing:ye,isDiscarding:Le},at)})]}),e[69]=M,e[70]=se,e[71]=_e,e[72]=X,e[73]=B,e[74]=Le,e[75]=ye,e[76]=tt):tt=e[76];const it=tt;let nt;e:{if(q||P.count===0){nt=null;break e}if(ee.pending){let at;e[77]===Symbol.for("react.memo_cache_sentinel")?(at=r.jsx(ft,{className:"size-3.5 animate-spin motion-reduce:animate-none"}),e[77]=at):at=e[77];let fe;e[78]!==S?(fe=S("thread.publishPopover.reviewing"),e[78]=S,e[79]=fe):fe=e[79];let Ve;e[80]!==fe?(Ve=r.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[at,fe]}),e[80]=fe,e[81]=Ve):Ve=e[81],nt=Ve;break e}if(ee.allowed){nt=null;break e}let rt;e[82]===Symbol.for("react.memo_cache_sentinel")?(rt=r.jsx(Io,{className:"mt-0.5 size-3.5 shrink-0"}),e[82]=rt):rt=e[82];let yt;e[83]!==ee.reason||e[84]!==S?(yt=ee.reason??S("thread.publishPopover.needsReviewGeneric"),e[83]=ee.reason,e[84]=S,e[85]=yt):yt=e[85];let ut;e[86]!==yt?(ut=r.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[rt,r.jsx("span",{children:yt})]}),e[86]=yt,e[87]=ut):ut=e[87],nt=ut}const ot=nt;let Me;e:{if(P.count<=1||R){Me=null;break e}if(W){let fe;e[88]!==S?(fe=S("thread.publishPopover.discardAllConfirm"),e[88]=S,e[89]=fe):fe=e[89];let Ve;e[90]!==fe?(Ve=r.jsx("span",{className:"text-destructive",children:fe}),e[90]=fe,e[91]=Ve):Ve=e[91];let Be;e[92]===Symbol.for("react.memo_cache_sentinel")?(Be=()=>Y(!1),e[92]=Be):Be=e[92];let Se;e[93]!==S?(Se=S("thread.publishDialog.cancel"),e[93]=S,e[94]=Se):Se=e[94];let ct;e[95]!==Se?(ct=r.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Be,children:Se}),e[95]=Se,e[96]=ct):ct=e[96];let mt;e[97]!==Pe?(mt=()=>{Y(!1),Pe()},e[97]=Pe,e[98]=mt):mt=e[98];let Xt;e[99]!==S?(Xt=S("thread.publishPopover.discard"),e[99]=S,e[100]=Xt):Xt=e[100];let Dt;e[101]!==Le||e[102]!==mt||e[103]!==Xt?(Dt=r.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:mt,disabled:Le,children:Xt}),e[101]=Le,e[102]=mt,e[103]=Xt,e[104]=Dt):Dt=e[104];let rn;e[105]!==Ve||e[106]!==ct||e[107]!==Dt?(rn=r.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[Ve,ct,Dt]}),e[105]=Ve,e[106]=ct,e[107]=Dt,e[108]=rn):rn=e[108],Me=rn;break e}let rt;e[109]===Symbol.for("react.memo_cache_sentinel")?(rt=()=>Y(!0),e[109]=rt):rt=e[109];const yt=ye||Le;let ut;e[110]!==S?(ut=S("thread.publishPopover.discardAll"),e[110]=S,e[111]=ut):ut=e[111];let at;e[112]!==yt||e[113]!==ut?(at=r.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:rt,disabled:yt,children:ut}),e[112]=yt,e[113]=ut,e[114]=at):at=e[114],Me=at}const lt=Me;let gt;e[115]!==O||e[116]!==z||e[117]!==I||e[118]!==R||e[119]!==q||e[120]!==it||e[121]!==P.blocks||e[122]!==P.count||e[123]!==P.other||e[124]!==P.pages||e[125]!==S?(gt=z?r.jsx(tp,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($d,{}),r.jsx($d,{})]})}):P.count===0?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(vi,{className:"mb-1 size-5 text-success"}),r.jsx("p",{className:"text-sm font-medium",children:S(q?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),r.jsx("p",{className:"text-xs text-muted-foreground",children:S(q?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):r.jsxs(tp,{children:[R?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.showingFirst",{shown:P.count,total:I})}):null,it(S("thread.publishPopover.pagesGroup"),P.pages),it(S("thread.publishPopover.blocksGroup"),P.blocks),it(S("thread.publishPopover.otherGroup"),P.other),O?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.detailsUnavailable")}):null]}),e[115]=O,e[116]=z,e[117]=I,e[118]=R,e[119]=q,e[120]=it,e[121]=P.blocks,e[122]=P.count,e[123]=P.other,e[124]=P.pages,e[125]=S,e[126]=gt):gt=e[126];const Xe=gt;let be;e[127]!==Fe?(be=r.jsx("span",{className:"truncate",children:Fe}),e[127]=Fe,e[128]=be):be=e[128];let Ue;e[129]!==lt||e[130]!==y||e[131]!==Ie||e[132]!==be?(Ue=r.jsx(v3,{mode:y,title:be,subLine:Ie,trailing:lt}),e[129]=lt,e[130]=y,e[131]=Ie,e[132]=be,e[133]=Ue):Ue=e[133];let Ze;e[134]!==ye||e[135]!==q||e[136]!==J||e[137]!==P.count||e[138]!==S?(Ze=P.count===0?null:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-[13px] font-medium",children:S(q?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),r.jsx(Wr,{value:J,onChange:rt=>K(rt.target.value),placeholder:S(q?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:ye})]}),e[134]=ye,e[135]=q,e[136]=J,e[137]=P.count,e[138]=S,e[139]=Ze):Ze=e[139];let ht;e[140]!==p||e[141]!==S?(ht=r.jsx(y3,{draftPreviewUrl:p,t:S}),e[140]=p,e[141]=S,e[142]=ht):ht=e[142];let st;e[143]!==ke||e[144]!==ee||e[145]!==ye||e[146]!==q||e[147]!==b||e[148]!==Oe||e[149]!==Te||e[150]!==P.count||e[151]!==S?(st=!q&&P.count>0&&!ee.allowed&&!ee.pending?r.jsx(de,{type:"button",className:"flex-1",onClick:b,disabled:ye,children:S("thread.publishPopover.requestApproval")}):r.jsxs(de,{type:"button",variant:q?"default":"brand",className:"flex-1",onClick:()=>{Te()},disabled:!ke,children:[ye?r.jsx(ft,{className:"size-4 animate-spin motion-reduce:animate-none"}):null,ye?S(q?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):Oe]}),e[143]=ke,e[144]=ee,e[145]=ye,e[146]=q,e[147]=b,e[148]=Oe,e[149]=Te,e[150]=P.count,e[151]=S,e[152]=st):st=e[152];let wt;e[153]!==ht||e[154]!==st?(wt=r.jsxs("div",{className:"flex gap-2",children:[ht,st]}),e[153]=ht,e[154]=st,e[155]=wt):wt=e[155];let dt;e[156]!==Ce?(dt=Ce?r.jsx("p",{className:"text-xs text-destructive",children:Ce}):null,e[156]=Ce,e[157]=dt):dt=e[157];let Lt;e[158]!==wt||e[159]!==dt?(Lt=r.jsxs(r.Fragment,{children:[wt,dt]}),e[158]=wt,e[159]=dt,e[160]=Lt):Lt=e[160];let De;return e[161]!==Xe||e[162]!==ot||e[163]!==G||e[164]!==Ue||e[165]!==Ze||e[166]!==Lt?(De=r.jsx(p3,{state:G,header:Ue,body:Xe,note:Ze,gate:ot,footer:Lt}),e[161]=Xe,e[162]=ot,e[163]=G,e[164]=Ue,e[165]=Ze,e[166]=Lt,e[167]=De):De=e[167],De}function $de(){return!1}function Zk(t,e){$de()&&console.log(`[github-header] ${t}`,e??"")}function Ode(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return ZL[t].short}const Bde=new Set(["failure","timed_out","cancelled","action_required"]);function ej(t){return t.status==="completed"&&Bde.has(t.conclusion)}function _3(t){return t.status==="queued"||t.status==="in_progress"}function H0(t){return t.isPending&&t.fetchStatus!=="idle"}function zde(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function Cr(t,e,s){return e?[...t,zde(s)]:t}function wi(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"sync",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Qb(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function T0(t,e,s){if(e.filter(_3).length===0)return t;const i=e.filter(o=>o.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:i,total:e.length})}}function Fde(t){const{lifecycle:e,branch:s,pr:n,checks:i,reviews:o,loading:l,t:a}=t;if(l)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&Ode(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForBranchTooltip"),menu:[]};const c=s,d=c.unpushed>0&&!(n&&c.headSha&&n.headSha&&c.headSha===n.headSha);if(t.noReviewableDiff&&!n)return{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:wi([],c,a)};if(c.workingTreeDirty||d)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:wi(Cr([Qb(a)],n,a),c,a)};if(Zk("no local work — checking PR/sync state",{workingTreeDirty:c.workingTreeDirty,unpushed:c.unpushed,aheadOfBase:c.aheadOfBase,behindBase:c.behindBase,branch:c.branch,base:c.base,prMerged:n?.merged??null,prState:n?.state??null}),n?.merged)return!!c.headSha&&!!n.headSha&&c.headSha!==n.headSha?{label:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:wi(Cr([],n,a),c,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(n.number),base:n.base}),menu:wi(Cr([],n,a),c,a)};if(c.aheadOfBase>0){if(n&&n.state==="closed"&&!n.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(n.number)}),menu:wi(Cr([],n,a),c,a)};if(!n)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:wi([Qb(a)],c,a)};if((o?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:a("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const h=i.filter(_3).length,f=i.filter(ej).map(p=>p.name);if(h===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:wi(Cr([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(n.number),base:n.base})}],n,a),c,a)};if(o?.draft)return T0({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:wi(Cr([],n,a),c,a)},i,a);const m=o?.unresolvedConversations??0;return m>0?T0({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(m)}),menu:wi(Cr([],n,a),c,a)},i,a):o?.missingRequiredApprovals?T0({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:wi(Cr([],n,a),c,a)},i,a):T0({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:wi(Cr([{key:"review",label:a("thread.headerActions.review"),action:"review"}],n,a),c,a)},i,a)}return c.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function Xb(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function E0(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"get-latest",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Zb(t,e,s,n){const i=e.length;if(i===0)return t;if(e.filter(_3).length>0){const a=e.filter(d=>d.status==="completed").length,c=n("thread.cmsActions.checksRunning",{done:a,total:i});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const l=e.filter(ej).length;return l>0?{...t,variant:"warning",tooltip:n("thread.cmsActions.checksFailing",{failed:l,total:i})}:t}function Ude(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function Hde(t){return H0(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:H0(t.checksQuery)||H0(t.reviewsQuery)}function Kde(t){return t.aheadOfBase>0||t.workingTreeDirty}function Wde(t){const{branch:e,pr:s,checks:n,reviews:i,publishing:o,saving:l,loading:a,t:c}=t;if(e.kind!=="ready"&&t.statusError)return{label:c("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(a||e.kind!=="ready")return{label:c("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:c("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:c("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(l)return{label:c("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const u=i?.mergeableState??"unknown";return u==="dirty"?{label:c("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:c("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:c("thread.cmsActions.resolveOnGithub"),action:"open-pr"}]}:u==="blocked"||i?.draft?Zb({label:c("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:E0([Xb(c)],e,c)},n,"loading",c):Zb({label:c("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:E0([Xb(c)],e,c)},n,"none",c)}return Ude(s,e)?{label:c("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:E0([],e,c)}:Kde(e)?{label:c("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:E0([{key:"request-approval",label:c("thread.headerActions.submitForReview"),action:"request-approval"}],e,c)}:e.behindBase>0?{label:c("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:c("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:c("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function tj(t){const e=F.c(4);let s;e[0]!==t?(s=bf(t),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={...s,select:qde},e[2]=s,e[3]=n):n=e[3],Et(n)}function qde(t){const e=t.pullRequest;return e?{draft:e.draft,mergeableState:e.mergeableState,unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.missingRequiredApprovals}:null}function ev(t,e){return t==="open-pr"||e==="resolve-on-github"?r.jsx(Vn,{size:16}):t==="publish"?r.jsx(ky,{className:"size-4"}):t==="get-latest"||t==="retry-status"?r.jsx(zn,{className:"size-4"}):r.jsx(So,{className:"size-4"})}function Gde(t){const e=F.c(94),{virtualMcpId:s}=t,n=ie(),{org:i}=qe(),o=bs(),{data:l}=xi.useSession(),a=Ws(s),{currentBranch:c,setCurrentTaskBranch:d,taskId:u,createTask:h}=sn();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={open:!1,mode:"publish"},e[0]=f):f=e[0];const[m,p]=A.useState(f);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=Le=>p({open:!0,mode:Le}),e[1]=g):g=e[1];const x=g,b=Py(a),v=b.status==="attached"||b.status==="public-clone"?b.repo:null,{previewServerUrl:_}=En(s);let L;if(e[2]!==c||e[3]!==i.slug||e[4]!==s){const Le=c?Eg(Tg(i.slug,s,c)):null;L=Le?Ar(Le.path,Le.params):"/",e[2]=c,e[3]=i.slug,e[4]=s,e[5]=L}else L=e[5];const y=L;let k;e[6]!==c||e[7]!==y||e[8]!==i.slug||e[9]!==_||e[10]!==s?(k=c?{orgSlug:i.slug,virtualMcpId:s,branch:c,previewServerUrl:_,path:y}:null,e[6]=c,e[7]=y,e[8]=i.slug,e[9]=_,e[10]=s,e[11]=k):k=e[11];const w=UL(k);let S;e[12]!==c||e[13]!==i.slug||e[14]!==u||e[15]!==s?(S=bL({orgSlug:i.slug,virtualMcpId:s,branch:c??"",threadId:u??null},{fastPreview:!0}),e[12]=c,e[13]=i.slug,e[14]=u,e[15]=s,e[16]=S):S=e[16];const j=!!c;let C;e[17]!==S||e[18]!==j?(C={...S,enabled:j},e[17]=S,e[18]=j,e[19]=C):C=e[19];const N=Et(C),V=N.data??null,T=V?{kind:"ready",branch:yg(V)??c??"",base:V.base??"main",workingTreeDirty:mL(V),unpushed:V.unpushed??0,aheadOfBase:V.aheadOfBase??0,behindBase:V.behindBase??0,headSha:V.headSha??""}:{kind:"unknown"},E=(T.kind==="ready"?T.branch:null)??c??null,P=T.kind==="ready"?T.base:"main",D=vf({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",branch:E}),I=D.data??null,R=AI({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",base:P}),$=L2({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",branch:E}),B=tj({orgId:i.id,orgSlug:i.slug,connectionId:v?.connectionId??"",owner:v?.owner??"",repo:v?.name??"",branch:E});let M;e[20]!==$||e[21]!==I||e[22]!==D||e[23]!==B?(M=Hde({pr:I,prQuery:D,checksQuery:$,reviewsQuery:B}),e[20]=$,e[21]=I,e[22]=D,e[23]=B,e[24]=M):M=e[24];const O=M;let z;e[25]!==D?(z=async()=>{await D.refetch()},e[25]=D,e[26]=z):z=e[26];const U=z;let H;e[27]!==l?.user||e[28]!==d?(H={mutationFn:async()=>{await d(xf(u2(l?.user)))},onError:Qde},e[27]=l?.user,e[28]=d,e[29]=H):H=e[29];const K=Rs(H);let W;e[30]!==i.slug||e[31]!==u||e[32]!==s?(W=async Le=>(await fL({orgSlug:i.slug,virtualMcpId:s,branch:Le.branch,threadId:u??null},Le.base,{fastPreview:!0}),Le),e[30]=i.slug,e[31]=u,e[32]=s,e[33]=W):W=e[33];let Y;e[34]!==c||e[35]!==i.slug||e[36]!==o||e[37]!==n||e[38]!==u||e[39]!==s?(Y=async Le=>{pe.success(n("thread.headerActions.syncedWithBase",{base:Le.base})),await Promise.all([o.invalidateQueries({queryKey:Pu({orgSlug:i.slug,virtualMcpId:s,branch:c??Le.branch,threadId:u??null})}),o.invalidateQueries({queryKey:et.decofile(`${i.slug}/${s}/${Le.branch}`)})])},e[34]=c,e[35]=i.slug,e[36]=o,e[37]=n,e[38]=u,e[39]=s,e[40]=Y):Y=e[40];let X;e[41]!==W||e[42]!==Y?(X={mutationFn:W,onSuccess:Y,onError:Jde},e[41]=W,e[42]=Y,e[43]=X):X=e[43];const ne=Rs(X),se=Cg(i.slug,s,c??"");if(b.status==="detached"){let Le;e[44]!==n?(Le=n("thread.headerActions.reconnectGithub"),e[44]=n,e[45]=Le):Le=e[45];let Ce;e[46]!==Le?(Ce=r.jsx(He,{asChild:!0,children:r.jsx("span",{children:r.jsx(de,{size:"sm",variant:"outline",disabled:!0,children:Le})})}),e[46]=Le,e[47]=Ce):Ce=e[47];let Te;e[48]!==n?(Te=n("thread.headerActions.githubConnectionRemoved"),e[48]=n,e[49]=Te):Te=e[49];let _e;e[50]!==Te?(_e=r.jsx(Ke,{children:Te}),e[50]=Te,e[51]=_e):_e=e[51];let Pe;return e[52]!==Ce||e[53]!==_e?(Pe=r.jsx(fr,{children:r.jsxs(We,{children:[Ce,_e]})}),e[52]=Ce,e[53]=_e,e[54]=Pe):Pe=e[54],Pe}if(!a)return null;if(!v||!_){const Le=v?"noPreviewServer":"noRepo";let Ce;e[55]!==c||e[56]!==h?(Ce=c?()=>{const _e=h?.({runtime:"sandbox",branch:c});_e&&Je("coding_session_started",{thread_id:_e})}:void 0,e[55]=c,e[56]=h,e[57]=Ce):Ce=e[57];let Te;return e[58]!==Le||e[59]!==Ce?(Te=r.jsx(Xde,{reason:Le,onStartCodingSession:Ce}),e[58]=Le,e[59]=Ce,e[60]=Te):Te=e[60],Te}if(!c)return null;const oe=K.isPending,Z=Wde({branch:T,pr:I,checks:$.data??[],reviews:B.data??null,publishing:oe,saving:se,syncing:ne.isPending,statusRetrying:N.isFetching&&!!N.error,statusError:N.error instanceof Error?N.error.message:N.error?String(N.error):null,loading:!!O,t:n}),J=Le=>{switch(Le){case"publish":{x("publish");return}case"request-approval":{x("review");return}case"get-latest":{if(!E||ne.isPending)return;ne.mutate({branch:E,base:P});return}case"retry-status":{N.refetch();return}case"open-pr":{I?.htmlUrl&&window.open(I.htmlUrl,"_blank","noopener,noreferrer");return}}},q=Z.menu.map(Le=>({key:Le.key,label:Le.label,icon:ev(Le.action,Le.key),...Le.tooltip?{tooltip:Le.tooltip}:{},onSelect:()=>J(Le.action)})),G=Z.action,te=Rk,le="sm",ee=Z.label,ae=Z.variant,ue=!!Z.disabled||!G,he=!!Z.loading,ce=G&&!Z.loading?{icon:ev(G)}:{};let ge;e[61]!==Z.tooltip?(ge=Z.tooltip?{tooltip:Z.tooltip}:{},e[61]=Z.tooltip,e[62]=ge):ge=e[62];let Q;e[63]!==n?(Q=n("thread.cmsActions.moreActionsAriaLabel"),e[63]=n,e[64]=Q):Q=e[64];let me;e[65]!==G||e[66]!==J?(me=G?()=>J(G):void 0,e[65]=G,e[66]=J,e[67]=me):me=e[67];let ve;e[68]!==te||e[69]!==Z.label||e[70]!==Z.variant||e[71]!==q||e[72]!==ue||e[73]!==he||e[74]!==ce||e[75]!==ge||e[76]!==Q||e[77]!==me?(ve=r.jsx(te,{size:le,label:ee,variant:ae,disabled:ue,loading:he,...ce,...ge,items:q,menuAriaLabel:Q,onClick:me}),e[68]=te,e[69]=Z.label,e[70]=Z.variant,e[71]=q,e[72]=ue,e[73]=he,e[74]=ce,e[75]=ge,e[76]=Q,e[77]=me,e[78]=ve):ve=e[78];const we=ve;let ye;return e[79]!==P||e[80]!==c||e[81]!==w||e[82]!==v||e[83]!==R||e[84]!==i.id||e[85]!==i.slug||e[86]!==I||e[87]!==K||e[88]!==U||e[89]!==we||e[90]!==m||e[91]!==s||e[92]!==a?.metadata?.publishPolicy?(ye=r.jsx(r.Fragment,{children:c?r.jsx(Pde,{open:m.open,mode:m.mode,onOpenChange:Le=>{Le||p(Yde)},orgSlug:i.slug,orgId:i.id,virtualMcpId:s,branch:c,baseBranch:P,githubConnectionId:v.connectionId??"",owner:v.owner,repo:v.name,publishPolicy:xL(a?.metadata?.publishPolicy),draftPreviewUrl:w.url,destinationHost:w.host,lastPublishedPr:R.data??null,onRequestApproval:()=>x("review"),openPullRequest:I?.state==="open"?I:null,onPullRequestChanged:U,onPublished:()=>K.mutateAsync(),children:we}):we}),e[79]=P,e[80]=c,e[81]=w,e[82]=v,e[83]=R,e[84]=i.id,e[85]=i.slug,e[86]=I,e[87]=K,e[88]=U,e[89]=we,e[90]=m,e[91]=s,e[92]=a?.metadata?.publishPolicy,e[93]=ye):ye=e[93],ye}function Yde(t){return{...t,open:!1}}function Jde(t){pe.error(t instanceof Error?t.message:String(t))}function Qde(t){pe.error(t instanceof Error?t.message:String(t))}function Xde(t){const e=F.c(14),{reason:s,onStartCodingSession:n}=t,i=ie(),o=!n;let l;e[0]!==i?(l=i("sandbox.cmsUnavailable.startCodingSession"),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==o||e[4]!==l?(a=r.jsx(He,{asChild:!0,children:r.jsx("span",{children:r.jsx(de,{size:"sm",variant:"outline",disabled:o,onClick:n,children:l})})}),e[2]=n,e[3]=o,e[4]=l,e[5]=a):a=e[5];let c;e[6]!==s||e[7]!==i?(c=i(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=i,e[8]=c):c=e[8];let d;e[9]!==c?(d=r.jsx(Ke,{children:c}),e[9]=c,e[10]=d):d=e[10];let u;return e[11]!==a||e[12]!==d?(u=r.jsx(fr,{children:r.jsxs(We,{children:[a,d]})}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u}const Zde=new Set(["main","master"]);function eue(t,e){return Zde.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function tue(t){const e=F.c(10),[s,n]=A.useState(0);let i;e[0]!==t?(i=c=>{c&&n(sue),t.onOpenChange(c)},e[0]=t,e[1]=i):i=e[1];const o=i;let l;e[2]!==o||e[3]!==t||e[4]!==s?(l=t.open?r.jsx(nue,{...t,onOpenChange:o},s):null,e[2]=o,e[3]=t,e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==o||e[7]!==t.open||e[8]!==l?(a=r.jsx(Mt,{open:t.open,onOpenChange:o,children:l}),e[6]=o,e[7]=t.open,e[8]=l,e[9]=a):a=e[9],a}function sue(t){return t+1}function nue({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:n,branch:i,baseBranch:o,githubConnectionId:l,owner:a,repo:c,previewUrl:d,publishPolicy:u,dialogIntent:h="open-pr",headSha:f=null,openPullRequest:m=null,onPullRequestChanged:p,onPublished:g}){const x=ie(),b=Jt({connectionId:l,orgId:s,orgSlug:e}),v=Jt({connectionId:Nl,orgId:s,orgSlug:e}),{data:_}=xi.useSession(),L=Z6(v),y={orgSlug:e,virtualMcpId:n,branch:i,threadId:Ls()?.taskId??null},k=m3(_?.user),w=m?.state==="open",S=m?.state==="open"?{number:m.number,htmlUrl:m.htmlUrl}:void 0,j=h==="open-pr"&&!w,C=h==="publish-only",[N,V]=A.useState(null),[T,E]=A.useState(null),[P,D]=A.useState(!0),[I,R]=A.useState(!1),[$,B]=A.useState(""),[M,O]=A.useState(""),[z,U]=A.useState(),[H,K]=A.useState(!1),[W,Y]=A.useState(),[X,ne]=A.useState(!1),[se,oe]=A.useState(!1),[Z,J]=A.useState(!1),q=A.useRef(!1),G=A.useRef(!1),te={base:o,...f?{headSha:f}:{}},le=async Ie=>{const Re=(Ie.aheadOfBase??0)>0?await Vd(y,te):null,Oe=_g(Ie)?await Vd(y):null;return rG(Re,Oe)},ee=async()=>{const Ie=await Ha(y),Re=C?await le(Ie):await Vd(y,iG(Ie,{openPrFromCommits:j,commitToOpenPr:w})?te:void 0);V(Ie),E(Re),B(x("thread.publishDialog.changesFrom",{branch:Ie.current??i})),J(!0),M4(y,{status:Ie,diff:Re}).then(Oe=>{B(Oe.title),O(Oe.body)}).catch(()=>{}).finally(()=>J(!1))};q.current||(q.current=!0,(async()=>{D(!0),U(void 0),E(null),B(""),O(""),Y(void 0);try{await ee()}catch(Ie){if(uL(Ie)&&!G.current){G.current=!0;try{await L.mutateAsync({virtualMcpId:n,branch:i}),await ee();return}catch(Re){U(Re instanceof Error?Re.message:x("thread.publishDialog.failedLoadAfterReprovision"));return}}U(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedLoad"))}finally{D(!1)}})());const ae=yg(N)??i,ue=eue(o,x),he=()=>{!N||!T||(J(!0),M4(y,{status:N,diff:T}).then(Ie=>{B(Ie.title),O(Ie.body)}).catch(()=>{}).finally(()=>J(!1)))},ce=vL(N),ge=T?Object.keys(T.diffs).length:ce,{gate:Q}=Qk({orgSlug:e,virtualMcpId:n,branch:i,threadId:y.threadId,status:N,diff:T,policy:u,judgeEnabled:C}),me=j?yL(N):nG(N,T),ve=!P&&(me||j),we=ve&&Q.allowed,ye=!ve||Q.allowed?null:Q.pending?x("thread.publishDialog.reviewingChanges"):Q.reason??x("thread.publishDialog.publishNeedsReview"),Le=j||!w&&(N?.aheadOfBase??0)>0,Ce=!P&&(Le||me)&&(ge>0||me),Te={orgSlug:e,virtualMcpId:n,branch:i,threadId:y.threadId,baseBranch:o,githubClient:b,owner:a,repo:c,headBranch:ae,coAuthor:k,existingOpenPr:S,expectedHeadSha:f??void 0},_e=()=>Hk({title:$,body:M,fallbackTitle:x("thread.publishDialog.changesFrom",{branch:ae})}),Pe=Ie=>{I||H||t(Ie)},ke=async()=>{R(!0),U(void 0);try{await Gk(Te,_e(),x),pe.success(x("thread.publishDialog.publishedTo",{baseBranch:o})),Pe(!1),E(null),B(""),O(""),await p?.(),await g?.()}catch(Ie){const Re=ip(Ie,x);U(Re.message),Re.pullRequestOpened&&await p?.()}finally{R(!1)}},Ne=async Ie=>{try{await im(y,[Ie]),pe.success(x("thread.publishDialog.discardedChanges",{filepath:Ie})),E(Oe=>{if(!Oe)return Oe;const tt={...Oe,diffs:{...Oe.diffs}};return delete tt.diffs[Ie],tt});const Re=await Ha(y);V(Re)}catch(Re){pe.error(Re instanceof Error?Re.message:x("thread.publishDialog.failedDiscardChanges"))}},Fe=async()=>{if(T){ne(!1),oe(!0);try{const Ie=Object.keys(T.diffs);if(Ie.length===0)return;await im(y,Ie),pe.success(x("thread.publishDialog.allChangesDiscarded")),E(null);const Re=await Ha(y);V(Re),Pe(!1)}catch(Ie){pe.error(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedDiscardChanges"))}finally{oe(!1)}}},Ye=async()=>{K(!0),Y(void 0);try{const Ie=await Yk(Te,_e());Jk(Ie,x),Pe(!1),await p?.()}catch(Ie){Y(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedSubmitForReview"))}finally{K(!1)}};return r.jsx(It,{className:"top-14 left-auto right-4 flex h-[90%] max-h-[85vh] w-[90vw] max-w-[600px] translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0",children:r.jsxs(_c,{defaultValue:"description",className:"flex h-full flex-col gap-0",children:[r.jsxs("div",{className:"shrink-0 space-y-3 px-6 pt-5 pb-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:j?x("thread.publishDialog.submitForReview"):ue}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-success"}),ge," ",x(ge===1?"thread.publishDialog.change":"thread.publishDialog.changes")," ",x(j?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),X?r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-destructive/5 px-3 py-2",children:[r.jsx("span",{className:"text-xs text-destructive",children:x("thread.publishDialog.discardConfirmMessage")}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(de,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>ne(!1),children:x("thread.publishDialog.cancel")}),r.jsxs(de,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:Fe,disabled:se,children:[se?r.jsx(ft,{className:"h-3 w-3 animate-spin"}):null,x("thread.publishDialog.discardAll")]})]})]}):r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(pu,{className:"h-8 w-auto",variant:"pill",children:[r.jsx(cr,{value:"description",className:"px-3 text-xs",children:x("thread.publishDialog.description")}),r.jsx(cr,{value:"changes",className:"px-3 text-xs",children:x("thread.publishDialog.changesTab")})]}),ge>0&&!j&&r.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>ne(!0),disabled:I||se,children:x("thread.publishDialog.discardAll")})]})]}),r.jsx("div",{className:"border-t"}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:P?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[r.jsx(ft,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:x("thread.publishDialog.loadingChanges")})]}):r.jsxs(r.Fragment,{children:[r.jsx(rl,{value:"description",className:"mt-0 px-6 py-5",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-medium",children:x(j?"thread.publishDialog.pullRequest":"thread.publishDialog.commitMessage")}),r.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",disabled:Z||I||H,onClick:he,children:[Z?r.jsx(ft,{className:"h-3 w-3 animate-spin"}):r.jsx(Br,{className:"h-3 w-3"}),x(Z?"thread.publishDialog.generating":"thread.publishDialog.regenerate")]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"publish-title",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.title")}),r.jsx(bt,{id:"publish-title",value:$,onChange:Ie=>B(Ie.target.value),placeholder:x(Z?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:I||H||Z,className:"text-sm"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"publish-body",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.descriptionLabel")}),r.jsx(Wr,{id:"publish-body",value:M,onChange:Ie=>O(Ie.target.value),placeholder:x(Z?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:I||H||Z,rows:5,className:"resize-none text-sm"})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[x("thread.publishDialog.branchLabel")," ",r.jsx("span",{className:"font-mono",children:i})," → ",r.jsx("span",{className:"font-mono",children:o})," · ",r.jsx("span",{className:"text-foreground/80",children:C?x("thread.publishDialog.squashMergesInto",{publishLabel:ue,baseBranch:o}):x("thread.publishDialog.opensPullRequestInto",{baseBranch:o})})]})]})}),r.jsx(rl,{value:"changes",className:"mt-0",children:r.jsx(Lg,{diff:T,onDiscardFile:Ne})})]})}),r.jsx("div",{className:"shrink-0 border-t",children:r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-6 py-3.5 text-sm transition-colors hover:bg-muted/50 disabled:opacity-50",onClick:()=>{d&&window.open(d,"_blank","noopener,noreferrer")},disabled:!d,children:[r.jsxs("span",{className:"flex items-center gap-3",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),x("thread.publishDialog.visitPreview")]}),r.jsx(Bo,{className:"h-4 w-4 text-muted-foreground"})]})}),r.jsx("div",{className:"shrink-0 border-t px-6 py-3",children:C?r.jsxs(r.Fragment,{children:[r.jsx(iue,{label:ue,canPublish:we,disabledReason:ye,isPublishing:I,onPublish:ke}),z&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:z}),!we&&!Q.pending&&Ce&&r.jsxs(r.Fragment,{children:[r.jsxs(de,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:Ye,disabled:H,children:[H?r.jsx(ft,{className:"h-4 w-4 animate-spin"}):r.jsx(mi,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),W&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:W})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(de,{type:"button",className:"w-full",onClick:Ye,disabled:!Ce||H,children:[H?r.jsx(ft,{className:"h-4 w-4 animate-spin"}):r.jsx(mi,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),W&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:W})]})})]})})}function iue(t){const e=F.c(14),{label:s,canPublish:n,disabledReason:i,isPublishing:o,onPublish:l}=t,a=!n||o;let c;e[0]!==o?(c=o?r.jsx(ft,{className:"h-4 w-4 animate-spin"}):null,e[0]=o,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==l||e[4]!==a||e[5]!==c?(d=r.jsxs(de,{type:"button",variant:"brand",className:"w-full",onClick:l,disabled:a,children:[c,s]}),e[2]=s,e[3]=l,e[4]=a,e[5]=c,e[6]=d):d=e[6];const u=d;if(!i)return u;let h;e[7]!==u?(h=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"flex w-full",children:u})}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==i?(f=r.jsx(Ke,{children:i}),e[9]=i,e[10]=f):f=e[10];let m;return e[11]!==h||e[12]!==f?(m=r.jsx(fr,{children:r.jsxs(We,{children:[h,f]})}),e[11]=h,e[12]=f,e[13]=m):m=e[13],m}function tv(t){switch(t){case"publish":return r.jsx(ky,{className:"size-4"});case"create-pr":case"reopen":return r.jsx(So,{className:"size-4"});case"rebase":case"sync":return r.jsx(zn,{className:"size-4"});case"fix-checks":return r.jsx(Io,{className:"size-4"});case"mark-ready":return r.jsx(vi,{className:"size-4"});case"resolve-comments":return r.jsx(Vp,{className:"size-4"});case"merge":return r.jsx(Ip,{className:"size-4"});case"review":return r.jsx(jc,{className:"size-4"});case"open-pr-page":return r.jsx(Vn,{size:16})}}const sv=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),nv=new Set(["publish","create-pr"]);function rue(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function oue({virtualMcpId:t}){const e=ie(),{org:s}=qe(),{data:n}=xi.useSession(),i=Ws(t),{currentBranch:o,setCurrentTaskBranch:l,taskId:a}=sn(),c=bi(),{openSidePanel:d}=vc(),[u,h]=A.useState(!1),[f,m]=A.useState("open-pr"),[p,g]=A.useState(null),[x,b]=A.useState(!1),v=A.useRef(""),_=Py(i),L=_.status==="attached"||_.status==="public-clone"?_.repo:null,y=Jt({connectionId:L?.connectionId??"",orgId:s.id,orgSlug:s.slug}),{lifecycle:k,branch:w,phase:S}=ni(),j={orgSlug:s.slug,virtualMcpId:t,branch:o??"",threadId:a??null},N=Et({queryKey:Pu(j),queryFn:()=>Ha(j),enabled:!!o,staleTime:15e3,refetchInterval:G=>$9(G.state.data)?5e3:!1}).data??null,V=w,T=k,E=V.kind==="ready"?V.branch:null,P=o??E??void 0,D=(V.kind==="ready"?V.branch:null)??P??null,I=vf({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:D}),R=I.data??null,$=L2({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:D}),B=tj({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:D}),M=V,O=xL(i?.metadata?.publishPolicy),z=Cg(s.slug,t,o??P??""),{previewUrl:U}=Pl();if(_.status==="detached")return r.jsx(aue,{label:e("thread.headerActions.githubConnectionRemoved"),children:r.jsx(de,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!L)return null;const H=D?Fde({lifecycle:T,branch:M,claimPhase:S,pr:R,checks:$.data??[],reviews:B.data??null,noReviewableDiff:$9(N),loading:H0(I),t:e}):rue(e),K=JSON.stringify({label:H.label,branchKind:M.kind,workingTreeDirty:M.kind==="ready"?M.workingTreeDirty:null,unpushed:M.kind==="ready"?M.unpushed:null,aheadOfBase:M.kind==="ready"?M.aheadOfBase:null,lifecycle:T.phase,githubHeadBranch:D,noReviewableDiff:$9(N)});v.current!==K&&(v.current=K,Zk("header button",{label:H.label,tooltip:H.tooltip,action:H.action,chatBranch:o,sandboxBranch:E,sandboxRouteBranch:P,githubHeadBranch:D,branchMeta:V,effectiveBranchMeta:M,lifecyclePhase:T.phase,prNumber:R?.number??null,prState:R?.state??null}));const W=G=>(d("chat"),c.sendMessage({parts:[{type:"text",text:G}]})),Y=c.isStreaming,X=M.kind==="ready"?M.base:"main",ne=async()=>{await I.refetch()},se=async()=>{const G=xf(u2(n?.user));await l(G)},oe=async G=>{if(!(!L?.connectionId||x)){b(!0);try{const te=m3(n?.user);await j8(y,{owner:L.owner,repo:L.name,pullNumber:G,coAuthor:te}),pe.success(e("thread.headerActions.publishedPr",{prNumber:String(G)})),await ne(),await se()}catch(te){pe.error(te instanceof Error?te.message:e("thread.headerActions.failedToMergePullRequest"))}finally{b(!1)}}},Z=(G,te)=>{m(G),g(te),h(!0)},J=G=>{if(D)switch(G){case"publish":Z("publish-only",H.meta?.publishPolicyOverride??null);return;case"create-pr":Z("open-pr",null);return;case"merge":R&&oe(R.number);return;case"sync":if(Y)return;W(yG({branch:D,base:X}));return;case"open-pr-page":R?.htmlUrl&&window.open(R.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(Y)return;R&&W(kG({prNumber:R.number}));return;case"reopen":if(Y)return;R&&W(bG({prNumber:R.number}));return;case"rebase":if(Y)return;W(vG({branch:D}));return;case"fix-checks":if(Y)return;R&&W(LG({prNumber:R.number,failingChecks:H.meta?.failingChecks??[]}));return;case"mark-ready":if(Y)return;R&&W(SG({prNumber:R.number}));return;case"resolve-comments":if(Y)return;R&&W(wG({prNumber:R.number}));return}},q=x||Y;return r.jsxs(r.Fragment,{children:[r.jsx(lue,{t:e,button:H,actionBusy:q,githubActionPending:x,savePending:z,onAction:J}),P&&r.jsx(tue,{open:u,onOpenChange:h,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:P,baseBranch:X,githubConnectionId:L.connectionId??"",owner:L.owner,repo:L.name,previewUrl:U,publishPolicy:p??O,dialogIntent:f,headSha:M.kind==="ready"?M.headSha:null,openPullRequest:R?.state==="open"?R:null,onPullRequestChanged:ne,onPublished:se})]})}function lue(t){const e=F.c(47),{t:s,button:n,actionBusy:i,githubActionPending:o,savePending:l,onAction:a}=t,c=n.action;let d;e[0]!==c||e[1]!==i?(d=i&&c!==void 0&&sv.has(c),e[0]=c,e[1]=i,e[2]=d):d=e[2];const u=d,h=o&&c==="merge";let f;e[3]!==c||e[4]!==l?(f=l&&c!==void 0&&nv.has(c),e[3]=c,e[4]=l,e[5]=f):f=e[5];const m=f,p=!!n.disabled||u||h||m||!c,g=!!n.loading||h;let x;e[6]!==n.tooltip||e[7]!==u||e[8]!==m||e[9]!==s?(x=u?s("thread.headerActions.chatIsRunning"):m?s("thread.headerActions.saving"):n.tooltip,e[6]=n.tooltip,e[7]=u,e[8]=m,e[9]=s,e[10]=x):x=e[10];const b=x;let v;if(e[11]!==i||e[12]!==n.menu||e[13]!==o||e[14]!==a||e[15]!==l||e[16]!==s){let T;e[18]!==i||e[19]!==o||e[20]!==a||e[21]!==l||e[22]!==s?(T=E=>{const P=i&&sv.has(E.action),D=l&&nv.has(E.action),I=E.action==="merge"&&o,R=D?s("thread.headerActions.saving"):P?s("thread.headerActions.chatIsRunning"):E.tooltip;return{key:E.key,label:E.label,icon:tv(E.action),disabled:!!(P||D||I),...R?{tooltip:R}:{},onSelect:()=>a(E.action)}},e[18]=i,e[19]=o,e[20]=a,e[21]=l,e[22]=s,e[23]=T):T=e[23],v=n.menu.map(T),e[11]=i,e[12]=n.menu,e[13]=o,e[14]=a,e[15]=l,e[16]=s,e[17]=v}else v=e[17];const _=v,L=c==="publish"?jo.publish:c==="create-pr"?jo.submit:void 0,y=n.label,k=n.variant;let w;e[24]!==c||e[25]!==g?(w=c&&!g?{icon:tv(c)}:{},e[24]=c,e[25]=g,e[26]=w):w=e[26];let S;e[27]!==b?(S=b?{tooltip:b}:{},e[27]=b,e[28]=S):S=e[28];let j;e[29]!==s?(j=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=j):j=e[30];let C;e[31]!==c||e[32]!==a?(C=c?()=>a(c):void 0,e[31]=c,e[32]=a,e[33]=C):C=e[33];let N;e[34]!==n.label||e[35]!==n.variant||e[36]!==p||e[37]!==_||e[38]!==g||e[39]!==w||e[40]!==S||e[41]!==j||e[42]!==C?(N=r.jsx(Rk,{size:"sm",label:y,variant:k,disabled:p,loading:g,...w,...S,items:_,menuAriaLabel:j,onClick:C}),e[34]=n.label,e[35]=n.variant,e[36]=p,e[37]=_,e[38]=g,e[39]=w,e[40]=S,e[41]=j,e[42]=C,e[43]=N):N=e[43];let V;return e[44]!==N||e[45]!==L?(V=r.jsx("span",{className:"inline-flex","data-tour":L,children:N}),e[44]=N,e[45]=L,e[46]=V):V=e[46],V}function aue(t){const e=F.c(9),{label:s,children:n}=t;if(!s){let a;return e[0]!==n?(a=r.jsx(r.Fragment,{children:n}),e[0]=n,e[1]=a):a=e[1],a}let i;e[2]!==n?(i=r.jsx(He,{asChild:!0,children:r.jsx("span",{children:n})}),e[2]=n,e[3]=i):i=e[3];let o;e[4]!==s?(o=r.jsx(Ke,{children:s}),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==i||e[7]!==o?(l=r.jsx(fr,{children:r.jsxs(We,{children:[i,o]})}),e[6]=i,e[7]=o,e[8]=l):l=e[8],l}function cue(t){const e=F.c(9),{virtualMcp:s}=t,n=uu(),{navigateToTask:i}=lC(),{create:o}=du();let l,a;if(e[0]!==n||e[1]!==o||e[2]!==i||e[3]!==s){a=Symbol.for("react.early_return_sentinel");e:{const c=$V(s,n);if(!c){a=null;break e}const d=c.mode==="dev";let u;e[6]!==o||e[7]!==i?(u=async m=>{const p=crypto.randomUUID();try{await o({id:p,virtual_mcp_id:m})}catch{}i(p,{virtualMcpId:m})},e[6]=o,e[7]=i,e[8]=u):u=e[8];const h=u,f=(m,p,g)=>r.jsxs("button",{type:"button","aria-pressed":p,"aria-label":m,title:m,onClick:()=>{p||h(c.targetId)},className:re("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",p?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(g,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"@max-3xl/panel-header:hidden",children:m})]});l=r.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[f("Develop",d,zo),f("Live",!d,Hn)]})}e[0]=n,e[1]=o,e[2]=i,e[3]=s,e[4]=l,e[5]=a}else l=e[4],a=e[5];return a!==Symbol.for("react.early_return_sentinel")?a:l}function due(t){const e=F.c(10),{locator:s}=qe(),n=$s();let i;e[0]!==s?(i=et.taskBoardItems(s),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=async()=>(await n.call("TASK_BOARD_ITEM_LIST",{})).items,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==i||e[5]!==o?(l={queryKey:i,queryFn:o},e[4]=i,e[5]=o,e[6]=l):l=e[6];const{data:a}=Et(l);if(!t||!a)return null;let c;return e[7]!==a||e[8]!==t?(c=a.find(d=>d.threads.some(u=>u.threadId===t))?.id??null,e[7]=a,e[8]=t,e[9]=c):c=e[9],c}function uue(){const t=F.c(16),e=ie(),{taskId:s}=sn(),n=zt(),i=due(s);if(!i)return null;let o;t[0]!==e?(o=e("thread.openInBoardButton.openTaskAriaLabel"),t[0]=e,t[1]=o):o=t[1];let l;t[2]!==i||t[3]!==n?(l=()=>n({to:".",search:f=>({...f,main:"board",task:i})}),t[2]=i,t[3]=n,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Or,{size:16}),t[5]=a):a=t[5];let c;t[6]!==o||t[7]!==l?(c=r.jsx(He,{asChild:!0,children:r.jsx(yo,{"aria-label":o,onClick:l,children:a})}),t[6]=o,t[7]=l,t[8]=c):c=t[8];let d;t[9]!==e?(d=e("thread.openInBoardButton.openTaskInBoard"),t[9]=e,t[10]=d):d=t[10];let u;t[11]!==d?(u=r.jsx(Ke,{children:d}),t[11]=d,t[12]=u):u=t[12];let h;return t[13]!==c||t[14]!==u?(h=r.jsx(fr,{children:r.jsxs(We,{children:[c,u]})}),t[13]=c,t[14]=u,t[15]=h):h=t[15],h}function hue(t){const e=F.c(9),{virtualMcp:s}=t,n=En(s.id).runtime==="cms";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(uue,{}),e[0]=i):i=e[0];let o;e[1]!==s?(o=r.jsx(cue,{virtualMcp:s}),e[1]=s,e[2]=o):o=e[2];let l;e[3]!==n||e[4]!==s?(l=OV(s)?n?r.jsx(Gde,{virtualMcpId:s.id}):r.jsx(oue,{virtualMcpId:s.id}):null,e[3]=n,e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==o||e[7]!==l?(a=r.jsxs("div",{className:"flex items-center gap-2",children:[i,o,l]}),e[6]=o,e[7]=l,e[8]=a):a=e[8],a}const fue=10080*60*1e3;function mue({sandboxMap:t,userId:e,rawBranches:s,now:n}){const i=new Map;for(const[h,f]of Object.entries(t??{}))for(const[m,p]of Object.entries(f??{})){let g=i.get(m);g||(g={userIds:new Set,lastActiveAt:0},i.set(m,g)),g.userIds.add(h);for(const x of Object.values(p??{})){const b=x?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const o=n-fue,l=[...i.entries()].filter(([,h])=>h.lastActiveAt>=o).sort((h,f)=>f[1].lastActiveAt-h[1].lastActiveAt).map(([h,f])=>({name:h,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(l.map(h=>h.name)),c=new Set(Object.keys(t?.[e]??{})),d=[...c].filter(h=>!a.has(h)).sort().map(h=>({name:h,source:"yours"})),u=s.filter(h=>!c.has(h.name)&&!a.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:l,yours:d,others:u}}function pue(t){const e=new Map;for(const s of t??[])for(const n of s.branches)typeof n.name=="string"&&e.set(n.name,n);return[...e.values()].map(s=>({name:s.name,author:typeof s.commit?.author=="string"?s.commit.author:s.commit?.author?.login??null}))}const sj=100,gue=50,xue=300;function rp(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function bue(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(n=>n.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function vue(t){const e=F.c(65),{orgId:s,orgSlug:n,userId:i,connectionId:o,sandboxMap:l,owner:a,repo:c,search:d,enabled:u}=t,h=d===void 0?"":d,f=u===void 0?!0:u,m=o??null;let p;e[0]!==s||e[1]!==n||e[2]!==m?(p={connectionId:m,orgId:s,orgSlug:n},e[0]=s,e[1]=n,e[2]=m,e[3]=p):p=e[3];const g=Jt(p);let x;e[4]!==h?(x=h.trim(),e[4]=h,e[5]=x):x=e[5];const b=x,v=pf(b,xue),_=!!o&&!!a&&!!c,L=b.length>0;let y;e[6]!==o||e[7]!==s||e[8]!==n||e[9]!==a||e[10]!==c?(y=et.githubBranches(s,n,o,a,c),e[6]=o,e[7]=s,e[8]=n,e[9]=a,e[10]=c,e[11]=y):y=e[11];const k=f&&_&&!L;let w;e[12]!==g||e[13]!==a||e[14]!==c?(w=async q=>{const{pageParam:G,signal:te}=q,le=Number(G),ee=await g.callTool({name:"list_branches",arguments:{owner:a,repo:c,page:le,perPage:sj}},void 0,{signal:te}),ae=bue(ee);return{branches:Array.isArray(ae)?ae:ae.branches??[],default_branch:Array.isArray(ae)?null:ae.default_branch??null,page:le}},e[12]=g,e[13]=a,e[14]=c,e[15]=w):w=e[15];let S;e[16]!==y||e[17]!==k||e[18]!==w?(S={queryKey:y,enabled:k,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:w,getNextPageParam:yue},e[16]=y,e[17]=k,e[18]=w,e[19]=S):S=e[19];const{data:j,isLoading:C,isError:N,hasNextPage:V,isFetchingNextPage:T,fetchNextPage:E}=l6(S);let P;e[20]!==o||e[21]!==v||e[22]!==s||e[23]!==n||e[24]!==a||e[25]!==c?(P=et.githubBranchSearch(s,n,o,a,c,v),e[20]=o,e[21]=v,e[22]=s,e[23]=n,e[24]=a,e[25]=c,e[26]=P):P=e[26];const D=f&&_&&v.length>0;let I;e[27]!==o||e[28]!==v||e[29]!==n||e[30]!==a||e[31]!==c?(I=()=>cp(n,"GITHUB_SEARCH_BRANCHES",{connectionId:o,owner:a,repo:c,query:v,limit:gue}),e[27]=o,e[28]=v,e[29]=n,e[30]=a,e[31]=c,e[32]=I):I=e[32];let R;e[33]!==P||e[34]!==D||e[35]!==I?(R={queryKey:P,enabled:D,staleTime:3e4,retry:!1,queryFn:I},e[33]=P,e[34]=D,e[35]=I,e[36]=R):R=e[36];const{data:$,isLoading:B,isError:M,isFetching:O}=Et(R),z=L&&(v!==b||O);let U,H,K;if(e[37]!==j?.pages||e[38]!==l||e[39]!==$||e[40]!==b||e[41]!==i){const q=$?$.branches:pue(j?.pages);U=mue({sandboxMap:l,userId:i,rawBranches:q,now:Date.now()});let G;e[45]!==b?(G=le=>rp(le.name,b),e[45]=b,e[46]=G):G=e[46],H=U.recent.filter(G);let te;e[47]!==b?(te=le=>rp(le.name,b),e[47]=b,e[48]=te):te=e[48],K=U.yours.filter(te),e[37]=j?.pages,e[38]=l,e[39]=$,e[40]=b,e[41]=i,e[42]=U,e[43]=H,e[44]=K}else U=e[42],H=e[43],K=e[44];const W=K,Y=U.others,X=$&&!z?Math.max(0,$.totalCount-$.branches.length):0,ne=L?B:C,se=L?M:N,oe=!L&&(V??!1);let Z;e[49]!==E||e[50]!==V||e[51]!==T||e[52]!==L?(Z=()=>{!L&&V&&!T&&E()},e[49]=E,e[50]=V,e[51]=T,e[52]=L,e[53]=Z):Z=e[53];let J;return e[54]!==X||e[55]!==T||e[56]!==z||e[57]!==Y||e[58]!==H||e[59]!==ne||e[60]!==se||e[61]!==oe||e[62]!==Z||e[63]!==W?(J={recent:H,yours:W,others:Y,isLoading:ne,isError:se,isSearching:z,hiddenMatchCount:X,hasMore:oe,isFetchingMore:T,fetchMore:Z},e[54]=X,e[55]=T,e[56]=z,e[57]=Y,e[58]=H,e[59]=ne,e[60]=se,e[61]=oe,e[62]=Z,e[63]=W,e[64]=J):J=e[64],J}function yue(t){if(!(t.branches.length<sj))return t.page+1}const _ue=(t,e)=>rp(t,e)?1:0;function Lue(t){const e=F.c(155),{orgId:s,orgSlug:n,userId:i,userLabel:o,connectionId:l,owner:a,repo:c,sandboxMap:d,value:u,onChange:h,onCreateBranch:f,disabled:m,placement:p}=t,g=m===void 0?!1:m,x=p===void 0?"chat":p,b=ie(),v=x==="header",[_,L]=A.useState(!1),[y,k]=A.useState("branches"),[w,S]=A.useState(""),[j,C]=A.useState(u??""),N=y==="branches"?w:"";let V;e[0]!==l||e[1]!==_||e[2]!==s||e[3]!==n||e[4]!==a||e[5]!==c||e[6]!==d||e[7]!==N||e[8]!==i?(V={orgId:s,orgSlug:n,userId:i,connectionId:l,sandboxMap:d,owner:a,repo:c,search:N,enabled:_},e[0]=l,e[1]=_,e[2]=s,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=N,e[8]=i,e[9]=V):V=e[9];const{recent:T,yours:E,others:P,isLoading:D,isError:I,isSearching:R,hiddenMatchCount:$,hasMore:B,isFetchingMore:M,fetchMore:O}=vue(V);let z;e[10]!==_?(z={enabled:_},e[10]=_,e[11]=z):z=e[11];const{data:U}=Oy(z);let H;e[12]!==U?.data?.members?(H=new Map((U?.data?.members??[]).map(Sue)),e[12]=U?.data?.members,e[13]=H):H=e[13];const K=H,W=l??"",Y=_&&y==="prs";let X;e[14]!==s||e[15]!==n||e[16]!==a||e[17]!==c||e[18]!==W||e[19]!==Y?(X={orgId:s,orgSlug:n,connectionId:W,owner:a,repo:c,enabled:Y},e[14]=s,e[15]=n,e[16]=a,e[17]=c,e[18]=W,e[19]=Y,e[20]=X):X=e[20];const{data:ne,isLoading:se,isError:oe}=II(X);let Z,J,q,G,te,le,ee,ae,ue,he,ce,ge,Q,me,ve,we;if(e[21]!==j||e[22]!==g||e[23]!==O||e[24]!==B||e[25]!==$||e[26]!==I||e[27]!==M||e[28]!==v||e[29]!==D||e[30]!==R||e[31]!==K||e[32]!==h||e[33]!==f||e[34]!==_||e[35]!==P||e[36]!==a||e[37]!==oe||e[38]!==se||e[39]!==T||e[40]!==c||e[41]!==w||e[42]!==b||e[43]!==ne||e[44]!==y||e[45]!==o||e[46]!==u||e[47]!==E){const _e=ne===void 0?[]:ne,Pe=`${a}/${c}`;let ke;e[64]!==Pe?(ke=Pe.toLowerCase(),e[64]=Pe,e[65]=ke):ke=e[65];const Ne=ke;let Fe;e[66]!==Ne?(Fe=Se=>Se.headRepoFullName?.toLowerCase()===Ne,e[66]=Ne,e[67]=Fe):Fe=e[67];const Ye=_e.filter(Fe),Ie=_e.length-Ye.length;let Re;e[68]!==h?(Re=Se=>{h(Se),L(!1)},e[68]=h,e[69]=Re):Re=e[69];const Oe=Re;let tt;e[70]!==h||e[71]!==f?(tt=Se=>{(f??h)(Se),L(!1)},e[70]=h,e[71]=f,e[72]=tt):tt=e[72];const it=tt;let nt;e[73]!==b||e[74]!==u?(nt=u??b("thread.branchPicker.selectBranch"),e[73]=b,e[74]=u,e[75]=nt):nt=e[75];const ot=nt;let Me;e[76]!==O||e[77]!==y?(Me=Se=>{const ct=Se.currentTarget,mt=ct.scrollHeight-ct.scrollTop-ct.clientHeight;y==="branches"&&mt<48&&O()},e[76]=O,e[77]=y,e[78]=Me):Me=e[78];const lt=Me;G=os,me=_,e[79]!==g||e[80]!==u?(ve=g?void 0:Se=>{Se&&(C(u??""),S("")),L(Se)},e[79]=g,e[80]=u,e[81]=ve):ve=e[81];const gt=v?"outline":"ghost",Xe=v?"sm":"default",be=v?"text-xs":"text-xs text-muted-foreground hover:text-foreground";let Ue;e[82]!==be?(Ue=re("font-mono shrink min-w-0 max-w-[200px] gap-1.5",be),e[82]=be,e[83]=Ue):Ue=e[83];let Ze;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ze=r.jsx(mi,{className:"h-3.5 w-3.5 shrink-0"}),e[84]=Ze):Ze=e[84];let ht;e[85]!==ot?(ht=r.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:ot}),e[85]=ot,e[86]=ht):ht=e[86];let st;e[87]!==g?(st=!g&&r.jsx(Qt,{size:12,className:"opacity-60 shrink-0"}),e[87]=g,e[88]=st):st=e[88];let wt;e[89]!==g||e[90]!==ot||e[91]!==gt||e[92]!==Xe||e[93]!==Ue||e[94]!==ht||e[95]!==st?(wt=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink","data-tour":jo.branches,children:r.jsx(is,{asChild:!0,children:r.jsxs(de,{variant:gt,size:Xe,"aria-label":ot,disabled:g,className:Ue,children:[Ze,ht,st]})})})}),e[89]=g,e[90]=ot,e[91]=gt,e[92]=Xe,e[93]=Ue,e[94]=ht,e[95]=st,e[96]=wt):wt=e[96];let dt;e[97]!==ot?(dt=r.jsx(Ke,{children:ot}),e[97]=ot,e[98]=dt):dt=e[98],e[99]!==wt||e[100]!==dt?(we=r.jsxs(We,{children:[wt,dt]}),e[99]=wt,e[100]=dt,e[101]=we):we=e[101],q=rs,ge="w-[min(420px,calc(100vw-2rem))] p-0",Q="start",J=zi,ee=j,ae=C,ue=y==="branches"?_ue:void 0;let Lt;e[102]!==b||e[103]!==y?(Lt=b(y==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[102]=b,e[103]=y,e[104]=Lt):Lt=e[104];let De;e[105]!==w||e[106]!==Lt?(De=r.jsx(yi,{placeholder:Lt,value:w,onValueChange:S}),e[105]=w,e[106]=Lt,e[107]=De):De=e[107];let rt;e[108]!==it||e[109]!==w||e[110]!==b||e[111]!==y||e[112]!==o?(rt=y==="branches"&&r.jsx(de,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>it(w.trim()||xf(o)),children:w.trim()?b("thread.branchPicker.createBranch",{name:w.trim()}):b("thread.branchPicker.new")}),e[108]=it,e[109]=w,e[110]=b,e[111]=y,e[112]=o,e[113]=rt):rt=e[113],e[114]!==De||e[115]!==rt?(he=r.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[De,rt]}),e[114]=De,e[115]=rt,e[116]=he):he=e[116];let yt;e[117]===Symbol.for("react.memo_cache_sentinel")?(yt=Se=>{k(Se),S("")},e[117]=yt):yt=e[117];let ut;e[118]!==b?(ut=b("thread.branchPicker.branchesTab"),e[118]=b,e[119]=ut):ut=e[119];let at;e[120]!==ut?(at=r.jsx(cr,{value:"branches",className:"h-6 px-2.5 text-xs",children:ut}),e[120]=ut,e[121]=at):at=e[121];let fe;e[122]!==b?(fe=b("thread.branchPicker.prsTab"),e[122]=b,e[123]=fe):fe=e[123];let Ve;e[124]!==fe?(Ve=r.jsx(cr,{value:"prs",className:"h-6 px-2.5 text-xs",children:fe}),e[124]=fe,e[125]=Ve):Ve=e[125];let Be;e[126]!==at||e[127]!==Ve?(Be=r.jsxs(pu,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[at,Ve]}),e[126]=at,e[127]=Ve,e[128]=Be):Be=e[128],e[129]!==Be||e[130]!==y?(ce=r.jsx(_c,{className:"px-2 pt-2 pb-1",value:y,onValueChange:yt,children:Be}),e[129]=Be,e[130]=y,e[131]=ce):ce=e[131],Z=_i,te=lt,le=y==="prs"?r.jsxs(r.Fragment,{children:[oe&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:b("thread.branchPicker.couldntLoadPullRequests")}),se&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:b("thread.branchPicker.loadingPullRequests")}),!oe&&!se&&r.jsx(si,{children:w.trim()?b("thread.branchPicker.noPullRequestsFound"):b("thread.branchPicker.noOpenPullRequests")}),Ye.length>0&&r.jsx(gs,{heading:b("thread.branchPicker.openPullRequests"),children:Ye.map(Se=>r.jsxs(Yt,{value:`#${Se.number} ${Se.title} ${Se.head}`,className:"cursor-pointer",onSelect:()=>Oe(Se.head),children:[r.jsx(So,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate",children:fc(Se.title)}),r.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",Se.number," · ",Se.head,Se.author?` · @${Se.author}`:""]})]})]},Se.number))}),Ie>0&&r.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:b("thread.branchPicker.hiddenForkPrs",{count:Ie})})]}):r.jsxs(r.Fragment,{children:[I&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:b("thread.branchPicker.couldntLoadBranches")}),!I&&(R||!D)&&r.jsx(si,{children:b(R?"thread.branchPicker.searchingBranches":"thread.branchPicker.noBranchesFound")}),T.length>0&&r.jsx(gs,{heading:b("thread.branchPicker.last7Days"),children:T.map(Se=>r.jsxs(Yt,{value:Se.name,className:"cursor-pointer",onSelect:()=>Oe(Se.name),children:[r.jsx(mi,{className:"mr-2 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:Se.name}),Se.name===u&&r.jsx(Rt,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx(wue,{userIds:Se.contributors??[],memberById:K})]},Se.name))}),E.length>0&&r.jsxs(r.Fragment,{children:[T.length>0&&r.jsx(A3,{}),r.jsx(gs,{heading:b("thread.branchPicker.yourBranches"),children:E.map(Se=>r.jsxs(Yt,{value:Se.name,className:"cursor-pointer",onSelect:()=>Oe(Se.name),children:[r.jsx(mi,{className:"mr-2 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:Se.name}),Se.name===u&&r.jsx(Rt,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},Se.name))})]}),P.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(A3,{}),r.jsx(gs,{heading:b("thread.branchPicker.otherBranchesInRepo"),children:P.map(Se=>r.jsxs(Yt,{value:Se.name,className:"cursor-pointer",onSelect:()=>Oe(Se.name),children:[r.jsx(mi,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"flex-1 truncate",children:Se.name}),Se.author&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",Se.author]}),Se.name===u&&r.jsx(Rt,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},Se.name))})]}),B&&r.jsx("div",{className:"border-t p-2",children:r.jsx(de,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:M,onClick:O,children:b(M?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})}),$>0&&r.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:b("thread.branchPicker.moreMatches",{count:$})}),!w.trim()&&!B&&P.length>0&&r.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:b("thread.branchPicker.allLoaded")})]}),e[21]=j,e[22]=g,e[23]=O,e[24]=B,e[25]=$,e[26]=I,e[27]=M,e[28]=v,e[29]=D,e[30]=R,e[31]=K,e[32]=h,e[33]=f,e[34]=_,e[35]=P,e[36]=a,e[37]=oe,e[38]=se,e[39]=T,e[40]=c,e[41]=w,e[42]=b,e[43]=ne,e[44]=y,e[45]=o,e[46]=u,e[47]=E,e[48]=Z,e[49]=J,e[50]=q,e[51]=G,e[52]=te,e[53]=le,e[54]=ee,e[55]=ae,e[56]=ue,e[57]=he,e[58]=ce,e[59]=ge,e[60]=Q,e[61]=me,e[62]=ve,e[63]=we}else Z=e[48],J=e[49],q=e[50],G=e[51],te=e[52],le=e[53],ee=e[54],ae=e[55],ue=e[56],he=e[57],ce=e[58],ge=e[59],Q=e[60],me=e[61],ve=e[62],we=e[63];let ye;e[132]!==Z||e[133]!==te||e[134]!==le?(ye=r.jsx(Z,{onScroll:te,children:le}),e[132]=Z,e[133]=te,e[134]=le,e[135]=ye):ye=e[135];let Le;e[136]!==J||e[137]!==ee||e[138]!==ae||e[139]!==ue||e[140]!==he||e[141]!==ce||e[142]!==ye?(Le=r.jsxs(J,{value:ee,onValueChange:ae,filter:ue,children:[he,ce,ye]}),e[136]=J,e[137]=ee,e[138]=ae,e[139]=ue,e[140]=he,e[141]=ce,e[142]=ye,e[143]=Le):Le=e[143];let Ce;e[144]!==q||e[145]!==ge||e[146]!==Q||e[147]!==Le?(Ce=r.jsx(q,{className:ge,align:Q,children:Le}),e[144]=q,e[145]=ge,e[146]=Q,e[147]=Le,e[148]=Ce):Ce=e[148];let Te;return e[149]!==G||e[150]!==me||e[151]!==ve||e[152]!==we||e[153]!==Ce?(Te=r.jsxs(G,{open:me,onOpenChange:ve,children:[we,Ce]}),e[149]=G,e[150]=me,e[151]=ve,e[152]=we,e[153]=Ce,e[154]=Te):Te=e[154],Te}function Sue(t){return[t.userId,t.user]}function wue(t){const e=F.c(13),{userIds:s,memberById:n}=t;if(s.length===0)return null;let i,o,l;if(e[0]!==n||e[1]!==s){const d=s.slice(0,3);i=s.length-d.length,o="ml-2 flex shrink-0 items-center -space-x-1.5";let u;e[5]!==n?(u=h=>{const f=n.get(h);return r.jsx(Hs,{url:f?.image??void 0,fallback:Qn(f?.name??void 0),shape:"circle",size:"xs",className:"ring-2 ring-background"},h)},e[5]=n,e[6]=u):u=e[6],l=d.map(u),e[0]=n,e[1]=s,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[7]!==i?(a=i>0&&r.jsxs("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[9px] font-semibold text-muted-foreground ring-2 ring-background",children:["+",i]}),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==o||e[10]!==l||e[11]!==a?(c=r.jsxs("span",{className:o,children:[l,a]}),e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function kue(t){const e=F.c(28);let s,n,i,o;e[0]!==t?({locked:s,placement:n,value:o,...i}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=o):(s=e[1],n=e[2],i=e[3],o=e[4]);const l=ie(),a=n==="header";if(s){let d;e[5]!==l||e[6]!==o?(d=o??l("chat.branchPill.noBranch"),e[5]=l,e[6]=o,e[7]=d):d=e[7];const u=d,h=a?"h-8 border border-input bg-background px-2.5":"h-9 px-2";let f;e[8]!==h?(f=re("inline-flex items-center gap-1.5 rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",h),e[8]=h,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(mi,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[10]=m):m=e[10];let p;e[11]!==u?(p=r.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:u}),e[11]=u,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==p?(g=r.jsx(He,{asChild:!0,children:r.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:f,children:[m,p]})}),e[13]=f,e[14]=p,e[15]=g):g=e[15];let x;e[16]!==u||e[17]!==l?(x=l("chat.branchPill.lockedTooltip",{branch:u}),e[16]=u,e[17]=l,e[18]=x):x=e[18];let b;e[19]!==x?(b=r.jsx(Ke,{children:x}),e[19]=x,e[20]=b):b=e[20];let v;return e[21]!==g||e[22]!==b?(v=r.jsxs(We,{children:[g,b]}),e[21]=g,e[22]=b,e[23]=v):v=e[23],v}let c;return e[24]!==n||e[25]!==i||e[26]!==o?(c=r.jsx(Lue,{...i,value:o,placement:n}),e[24]=n,e[25]=i,e[26]=o,e[27]=c):c=e[27],c}function jue(t){const e=F.c(2),{branchPill:s}=t;if(!s)return null;let n;return e[0]!==s?(n=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=n):n=e[1],n}function Cue(t){const e=F.c(25),{virtualMcp:s,currentBranch:n}=t,i=dp(),o=Ls();let l;e[0]!==i?.messages||e[1]!==o?.isThreadLocked?(l=(i?.messages??[]).length>0||(o?.isThreadLocked??!1),e[0]=i?.messages,e[1]=o?.isThreadLocked,e[2]=l):l=e[2];const a=l,c=o?.setCurrentTaskBranch,d=o?.createTask;let u;e[3]!==o?.activeTask?.metadata||e[4]!==s?.metadata?(u=ay(s?.metadata)==="cms"&&ly(o?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=o?.activeTask?.metadata,e[4]=s?.metadata,e[5]=u):u=e[5];const h=u;let f;e[6]!==s?(f=gu(s),e[6]=s,e[7]=f):f=e[7];const m=f,p=m?.connectionId,{data:g}=xi.useSession(),x=g?.user?.id??"",b=g?.user;let v;e[8]!==b?(v=u2(b),e[8]=b,e[9]=v):v=e[9];const _=v,{org:L}=qe();let y;e[10]!==p||e[11]!==h||e[12]!==d||e[13]!==n||e[14]!==m||e[15]!==a||e[16]!==L||e[17]!==c||e[18]!==x||e[19]!==_||e[20]!==s?.id||e[21]!==s?.metadata?.sandboxMap?(y=m&&p?r.jsx(kue,{orgId:L.id,orgSlug:L.slug,userId:x,userLabel:_,virtualMcpId:s?.id??"",connectionId:p,owner:m.owner,repo:m.name,sandboxMap:s?.metadata?.sandboxMap,value:n,onChange:S=>{c&&c(S)},onCreateBranch:S=>{h&&d?d({branch:S}):c&&c(S)},locked:a,placement:"chat"},`${p}:${m.owner}/${m.name}`):null,e[10]=p,e[11]=h,e[12]=d,e[13]=n,e[14]=m,e[15]=a,e[16]=L,e[17]=c,e[18]=x,e[19]=_,e[20]=s?.id,e[21]=s?.metadata?.sandboxMap,e[22]=y):y=e[22];const k=y;let w;return e[23]!==k?(w=r.jsx(jue,{branchPill:k}),e[23]=k,e[24]=w):w=e[24],w}function Nue(){const t=F.c(60),e=ie(),[s,n]=A.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={onNavigate:()=>n(!1)},t[0]=i):i=t[0];const o=wV(i),l=Ls()?.activeTask;let a;t[1]!==l?.title||t[2]!==o.activeTaskId||t[3]!==o.threads||t[4]!==e?(a=l?.title||o.threads.find(R=>R.id===o.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=l?.title,t[2]=o.activeTaskId,t[3]=o.threads,t[4]=e,t[5]=a):a=t[5];const c=a;let d;t[6]!==o?(d=()=>{n(!1),o.openSearch()},t[6]=o,t[7]=d):d=t[7];const u=d;let h;t[8]!==e?(h=e("chat.threadsMenu.chats"),t[8]=e,t[9]=h):h=t[9];const f=s&&"bg-sidebar-accent";let m;t[10]!==f?(m=re("flex h-[34px] min-w-0 shrink items-center gap-1.5 rounded-lg px-2 text-sm text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",f),t[10]=f,t[11]=m):m=t[11];let p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(fV,{size:16,className:"shrink-0"}),t[12]=p):p=t[12];let g;t[13]!==c?(g=r.jsx("span",{className:"truncate max-w-[10rem] font-medium",children:c}),t[13]=c,t[14]=g):g=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Qt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=x):x=t[15];let b;t[16]!==h||t[17]!==m||t[18]!==g?(b=r.jsx(He,{asChild:!0,children:r.jsx(is,{asChild:!0,children:r.jsxs("button",{type:"button","aria-label":h,className:m,children:[p,g,x]})})}),t[16]=h,t[17]=m,t[18]=g,t[19]=b):b=t[19];let v;t[20]!==e?(v=e("chat.threadsMenu.chats"),t[20]=e,t[21]=v):v=t[21];let _;t[22]!==v?(_=r.jsx(Ke,{side:"bottom",children:v}),t[22]=v,t[23]=_):_=t[23];let L;t[24]!==_||t[25]!==b?(L=r.jsxs(We,{children:[b,_]}),t[24]=_,t[25]=b,t[26]=L):L=t[26];let y;t[27]!==o?(y=r.jsx(kV,{panel:o,className:"size-8 rounded-lg"}),t[27]=o,t[28]=y):y=t[28];let k;t[29]!==e?(k=e("sidebar.taskGroupsList.searchChats"),t[29]=e,t[30]=k):k=t[30];let w;t[31]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(hu,{size:16}),t[31]=w):w=t[31];let S;t[32]!==u||t[33]!==k?(S=r.jsx(yo,{"aria-label":k,onClick:u,className:"size-8 rounded-lg",children:w}),t[32]=u,t[33]=k,t[34]=S):S=t[34];let j;t[35]!==e?(j=e("sidebar.taskGroupsList.newChat"),t[35]=e,t[36]=j):j=t[36];let C;t[37]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(Zh,{size:16}),t[37]=C):C=t[37];let N;t[38]!==o.newThread||t[39]!==j?(N=r.jsx(yo,{"aria-label":j,onClick:o.newThread,className:"size-8 rounded-lg",children:C}),t[38]=o.newThread,t[39]=j,t[40]=N):N=t[40];let V;t[41]!==S||t[42]!==N?(V=r.jsxs("div",{className:"flex items-center gap-0.5",children:[S,N]}),t[41]=S,t[42]=N,t[43]=V):V=t[43];let T;t[44]!==y||t[45]!==V?(T=r.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[y,V]}),t[44]=y,t[45]=V,t[46]=T):T=t[46];let E;t[47]!==o?(E=r.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:r.jsx(jV,{panel:o})}),t[47]=o,t[48]=E):E=t[48];let P;t[49]!==T||t[50]!==E?(P=r.jsxs(rs,{align:"start",side:"bottom",onOpenAutoFocus:Vue,className:"flex w-80 flex-col gap-2 p-2",children:[T,E]}),t[49]=T,t[50]=E,t[51]=P):P=t[51];let D;t[52]!==s||t[53]!==L||t[54]!==P?(D=r.jsxs(os,{open:s,onOpenChange:n,children:[L,P]}),t[52]=s,t[53]=L,t[54]=P,t[55]=D):D=t[55];let I;return t[56]!==o.reclaimDialog||t[57]!==o.searchDialog||t[58]!==D?(I=r.jsxs(r.Fragment,{children:[D,o.searchDialog,o.reclaimDialog]}),t[56]=o.reclaimDialog,t[57]=o.searchDialog,t[58]=D,t[59]=I):I=t[59],I}function Vue(t){return t.preventDefault()}function nj(t){const e=F.c(4),{chatContent:s}=t;let n;e[0]!==s?(n=s??r.jsx(Q6,{}),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{"data-testid":"chat-panel",className:"h-full min-h-0",children:n}),e[2]=n,e[3]=i):i=e[3],i}function iv(t){const e=F.c(11),{sidePanel:s,toggleSidePanel:n,disableActiveSidePanelToggle:i}=t,o=i===void 0?!1:i,l=ie();let a;e[0]!==l?(a=l("agentShellLayout.toggleButtons.chat"),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"component",Component:Vp},e[2]=c):c=e[2];const d=s==="chat",u=o&&s==="chat";let h;e[3]!==s||e[4]!==n?(h=()=>{Je("agent_toolbar_toggled",{button:"chat",next_state:s==="chat"?"closed":"open"}),n("chat")},e[3]=s,e[4]=n,e[5]=h):h=e[5];let f;return e[6]!==a||e[7]!==d||e[8]!==u||e[9]!==h?(f=r.jsx(jg,{title:a,icon:c,active:d,disabled:u,labelCollapse:"sooner",className:"h-10 md:h-7 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-50",onClick:h}),e[6]=a,e[7]=d,e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function p1(t){const e=F.c(20),{side:s,open:n,disabled:i,onToggle:o}=t,l=ie();let a;e[0]!==n||e[1]!==s||e[2]!==l?(a=l(n?s==="left"?"agentShellLayout.toggleButtons.hideChat":"agentShellLayout.toggleButtons.hidePanel":s==="left"?"agentShellLayout.toggleButtons.showChat":"agentShellLayout.toggleButtons.showPanel"),e[0]=n,e[1]=s,e[2]=l,e[3]=a):a=e[3];const c=a,d=s==="right"?mV:n?pV:gV;let u;e[4]!==o||e[5]!==n||e[6]!==s?(u=()=>{Je("agent_toolbar_toggled",{button:s==="left"?"chat":"main",next_state:n?"closed":"open"}),o()},e[4]=o,e[5]=n,e[6]=s,e[7]=u):u=e[7];let h;e[8]!==d?(h=r.jsx(d,{size:16}),e[8]=d,e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==c||e[12]!==u||e[13]!==h?(f=r.jsx(He,{asChild:!0,children:r.jsx(yo,{"aria-label":c,disabled:i,onClick:u,className:"size-7 rounded-md disabled:opacity-40",children:h})}),e[10]=i,e[11]=c,e[12]=u,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==c?(m=r.jsx(Ke,{side:"bottom",children:c}),e[15]=c,e[16]=m):m=e[16];let p;return e[17]!==f||e[18]!==m?(p=r.jsxs(We,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=p):p=e[19],p}const g1="workspace-side-panel",rv="workspace-main-panel";function ov(t){const e=F.c(13),{children:s,header:n,testId:i,headerInside:o}=t;if(o){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=re("min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]","flex flex-col"),e[0]=c):c=e[0];let d;e[1]!==s?(d=r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==d||e[5]!==i?(u=r.jsx("div",{className:"flex h-full min-h-0 flex-col p-0.5",children:r.jsxs("div",{"data-testid":i,className:c,children:[n,d]})}),e[3]=n,e[4]=d,e[5]=i,e[6]=u):u=e[6],u}let l;e[7]!==s||e[8]!==i?(l=r.jsx("div",{"data-testid":i,className:"min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]",children:s}),e[7]=s,e[8]=i,e[9]=l):l=e[9];let a;return e[10]!==n||e[11]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-0 flex-col p-0.5 pt-0.25",children:[n,l]}),e[10]=n,e[11]=l,e[12]=a):a=e[12],a}function lv(t){const e=F.c(5),{virtualMcpId:s,taskId:n,disableActiveMainToggle:i,maxVisible:o}=t;let l;return e[0]!==i||e[1]!==o||e[2]!==n||e[3]!==s?(l=r.jsx(Mce,{virtualMcpId:s,taskId:n,disableActiveMainToggle:i,maxVisible:o}),e[0]=i,e[1]=o,e[2]=n,e[3]=s,e[4]=l):l=e[4],l}function Tue(t){const e=F.c(124),{virtualMcpId:s,taskId:n,entity:i,sidePanel:o,mainOpen:l,toggleSidePanel:a,toggleMain:c,chatContent:d}=t,[u,h]=cI(),f=A.useRef(null);let m;e[0]!==l||e[1]!==o?(m=SR({sidePanel:o,mainOpen:l}),e[0]=l,e[1]=o,e[2]=m):m=e[2];const p=m,g=o!==null&&l?u:p.side,x=100-g,b=o!==null,[v,_]=P1(),[L,y]=P1();let k;e[3]!==v||e[4]!==L?(k=Hce(v,L),e[3]=v,e[4]=L,e[5]=k):k=e[5];const{maxTabs:w}=k,{state:S}=Kj(),j=S==="collapsed",C=zp();let N;e[6]!==C||e[7]!==j?(N=j&&!C?r.jsx(CV,{}):null,e[6]=C,e[7]=j,e[8]=N):N=e[8];const V=N;let T;e[9]!==C||e[10]!==j?(T=j||C?r.jsx(NV,{}):null,e[9]=C,e[10]=j,e[11]=T):T=e[11];const E=T;let P;e[12]!==C?(P=C?r.jsx(Nue,{}):null,e[12]=C,e[13]=P):P=e[13];const D=P,I=b&&!l&&!C;let R;e[14]!==i?(R=r.jsx(hue,{virtualMcp:i}),e[14]=i,e[15]=R):R=e[15];const $=R,B=Ls()?.currentBranch??null;let M;e[16]!==B||e[17]!==i?(M=r.jsx(Cue,{virtualMcp:i,currentBranch:B}),e[16]=B,e[17]=i,e[18]=M):M=e[18];const O=M;let z,U;e[19]!==x||e[20]!==g?(z=()=>{f.current?.setLayout({[g1]:g,[rv]:x})},U=[g,x],e[19]=x,e[20]=g,e[21]=z,e[22]=U):(z=e[21],U=e[22]),A.useEffect(z,U);let H;e[23]!==l||e[24]!==C||e[25]!==o||e[26]!==a?(H=!C&&r.jsx(iv,{sidePanel:o,toggleSidePanel:a,disableActiveSidePanelToggle:!l}),e[23]=l,e[24]=C,e[25]=o,e[26]=a,e[27]=H):H=e[27];let K;e[28]!==I||e[29]!==n||e[30]!==s?(K=I&&r.jsx(lv,{virtualMcpId:s,taskId:n,disableActiveMainToggle:!0}),e[28]=I,e[29]=n,e[30]=s,e[31]=K):K=e[31];const W=I&&O,Y=I&&$;let X;e[32]!==b||e[33]!==l||e[34]!==C||e[35]!==c?(X=C&&!l&&r.jsx(p1,{side:"right",open:l,disabled:!b,onToggle:c}),e[32]=b,e[33]=l,e[34]=C,e[35]=c,e[36]=X):X=e[36];let ne;e[37]!==E||e[38]!==W||e[39]!==Y||e[40]!==X?(ne=r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[W,Y,E,X]}),e[37]=E,e[38]=W,e[39]=Y,e[40]=X,e[41]=ne):ne=e[41];let se;e[42]!==V||e[43]!==H||e[44]!==K||e[45]!==ne||e[46]!==D?(se=r.jsxs(B4,{children:[D,V,H,K,ne]}),e[42]=V,e[43]=H,e[44]=K,e[45]=ne,e[46]=D,e[47]=se):se=e[47];const oe=se,Z=!b&&V;let J;e[48]!==b||e[49]!==l||e[50]!==C||e[51]!==o||e[52]!==a?(J=C?r.jsx(p1,{side:"left",open:b,disabled:!l,onToggle:()=>a("chat")}):!b&&r.jsx(iv,{sidePanel:o,toggleSidePanel:a}),e[48]=b,e[49]=l,e[50]=C,e[51]=o,e[52]=a,e[53]=J):J=e[53];const q=!b;let G;e[54]!==w||e[55]!==q||e[56]!==n||e[57]!==s?(G=r.jsx(lv,{virtualMcpId:s,taskId:n,disableActiveMainToggle:q,maxVisible:w}),e[54]=w,e[55]=q,e[56]=n,e[57]=s,e[58]=G):G=e[58];let te;e[59]!==Z||e[60]!==J||e[61]!==G?(te=r.jsxs("div",{className:"flex min-w-0 shrink items-center gap-0.5 overflow-hidden",children:[Z,J,G]}),e[59]=Z,e[60]=J,e[61]=G,e[62]=te):te=e[62];let le;e[63]===Symbol.for("react.memo_cache_sentinel")?(le=r.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center",children:r.jsx(yY,{className:"@max-sm/panel-header:hidden"})}),e[63]=le):le=e[63];let ee;e[64]!==O?(ee=r.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:O}),e[64]=O,e[65]=ee):ee=e[65];let ae;e[66]===Symbol.for("react.memo_cache_sentinel")?(ae=r.jsx(_Y,{}),e[66]=ae):ae=e[66];let ue;e[67]!==b||e[68]!==l||e[69]!==C||e[70]!==c?(ue=C&&r.jsx(p1,{side:"right",open:l,disabled:!b,onToggle:c}),e[67]=b,e[68]=l,e[69]=C,e[70]=c,e[71]=ue):ue=e[71];let he;e[72]!==$||e[73]!==y||e[74]!==ue?(he=r.jsxs("div",{ref:y,className:"flex shrink-0 items-center justify-end gap-1",children:[ae,$,ue]}),e[72]=$,e[73]=y,e[74]=ue,e[75]=he):he=e[75];let ce;e[76]!==ee||e[77]!==he?(ce=r.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[ee,he]}),e[76]=ee,e[77]=he,e[78]=ce):ce=e[78];let ge;e[79]!==_||e[80]!==te||e[81]!==ce?(ge=r.jsxs(B4,{ref:_,className:"justify-between gap-2",children:[te,le,ce]}),e[79]=_,e[80]=te,e[81]=ce,e[82]=ge):ge=e[82];const Q=ge;let me;e[83]!==s?(me=r.jsx(dY,{virtualMcpId:s}),e[83]=s,e[84]=me):me=e[84];const ve=`${s}-${n}`,we=C?"pt-1":"pt-0";let ye;e[85]!==we?(ye=re("flex-1 min-h-0 pb-1 pr-1 pl-0 [&>[data-workspace-panel-open]]:!min-w-[320px]",we),e[85]=we,e[86]=ye):ye=e[86];let Le;e[87]===Symbol.for("react.memo_cache_sentinel")?(Le={overflow:"visible"},e[87]=Le):Le=e[87];let Ce;e[88]!==l||e[89]!==h||e[90]!==o?(Ce=(lt,gt)=>{const{isUserInteraction:Xe}=gt,be=lt[g1];Xe&&o!==null&&l&&typeof be=="number"&&be>0&&be<100&&h(be)},e[88]=l,e[89]=h,e[90]=o,e[91]=Ce):Ce=e[91];const Te=`${p.side}%`,_e=o!==null?"":void 0,Pe=b?oe:null;let ke;e[92]!==d||e[93]!==b?(ke=b&&r.jsx(nj,{chatContent:d}),e[92]=d,e[93]=b,e[94]=ke):ke=e[94];let Ne;e[95]!==C||e[96]!==Pe||e[97]!==ke?(Ne=r.jsx(ov,{testId:"side-panel",headerInside:C,header:Pe,children:ke}),e[95]=C,e[96]=Pe,e[97]=ke,e[98]=Ne):Ne=e[98];let Fe;e[99]!==Te||e[100]!==_e||e[101]!==Ne?(Fe=r.jsx(Z0,{id:g1,defaultSize:Te,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":_e,className:"min-w-0 overflow-hidden bg-sidebar",children:Ne}),e[99]=Te,e[100]=_e,e[101]=Ne,e[102]=Fe):Fe=e[102];let Ye;e[103]===Symbol.for("react.memo_cache_sentinel")?(Ye=r.jsx(v8,{className:"bg-sidebar"}),e[103]=Ye):Ye=e[103];const Ie=`${p.main}%`,Re=l?"":void 0,Oe=l?Q:null;let tt;e[104]!==n||e[105]!==s?(tt=r.jsx(Dk,{taskId:n,virtualMcpId:s}),e[104]=n,e[105]=s,e[106]=tt):tt=e[106];let it;e[107]!==C||e[108]!==Oe||e[109]!==tt?(it=r.jsx(ov,{testId:"main-panel",headerInside:C,header:Oe,children:tt}),e[107]=C,e[108]=Oe,e[109]=tt,e[110]=it):it=e[110];let nt;e[111]!==Ie||e[112]!==Re||e[113]!==it?(nt=r.jsx(Z0,{id:rv,defaultSize:Ie,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":Re,className:"min-w-0 overflow-hidden bg-sidebar",children:it}),e[111]=Ie,e[112]=Re,e[113]=it,e[114]=nt):nt=e[114];let ot;e[115]!==ve||e[116]!==ye||e[117]!==Ce||e[118]!==Fe||e[119]!==nt?(ot=r.jsxs(b8,{ref:f,orientation:"horizontal",className:ye,style:Le,onLayoutChanged:Ce,children:[Fe,Ye,nt]},ve),e[115]=ve,e[116]=ye,e[117]=Ce,e[118]=Fe,e[119]=nt,e[120]=ot):ot=e[120];let Me;return e[121]!==me||e[122]!==ot?(Me=r.jsxs(vY,{children:[me,ot]}),e[121]=me,e[122]=ot,e[123]=Me):Me=e[123],Me}const x1="__mobile-main-panel-tab-select__";function Eue({tabs:t,activeTab:e,mainOpen:s,t:n}){const i=t.find(l=>l.id===e),o=n("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?i?.title??o:i?.title??t[0]?.title??o}const Aue={kind:"component",Component:Vp},Pue={kind:"component",Component:Gp},Due={kind:"component",Component:Kr};function Rue(t){const e=F.c(62),{virtualMcpId:s,taskId:n}=t,i=ie(),o=zt();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=Uh(l);let c;e[1]!==n||e[2]!==s?(c={virtualMcpId:s,taskId:n},e[1]=n,e[2]=s,e[3]=c):c=e[3];const{tabs:d,activeTab:u,mainOpen:h}=$2(c),{org:f}=qe(),m=of();let p;e[4]!==f.id?(p=q0(f.id),e[4]=f.id,e[5]=p):p=e[5];const g=s===p,x=!!(a.org&&a.taskId);let b;e[6]!==i?(b=i("mainPanelTabs.mobileMainPanelTabSelect.chat"),e[6]=i,e[7]=b):b=e[7];let v;e[8]!==b?(v={value:"chat",title:b,icon:Aue},e[8]=b,e[9]=v):v=e[9];let _;if(e[10]!==x||e[11]!==i||e[12]!==v||e[13]!==d){let O,z;e[15]!==x||e[16]!==i?(O=x?[{value:"board",title:i("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:Pue}]:[],z=x?[{value:"files",title:i("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:Due}]:[],e[15]=x,e[16]=i,e[17]=O,e[18]=z):(O=e[17],z=e[18]),_=[v,...d.map(Mue),...O,...z],e[10]=x,e[11]=i,e[12]=v,e[13]=d,e[14]=_}else _=e[14];const L=_;let y;e[19]!==u||e[20]!==h||e[21]!==L?(y=h?L.find(O=>O.value===u)?.value??u:"chat",e[19]=u,e[20]=h,e[21]=L,e[22]=y):y=e[22];const k=y;let w;e[23]!==k||e[24]!==L?(w=L.find(O=>O.value===k),e[23]=k,e[24]=L,e[25]=w):w=e[25];const S=w;let j;e[26]!==u||e[27]!==h||e[28]!==S?.title||e[29]!==i||e[30]!==d?(j=S?.title??Eue({tabs:d,activeTab:u,mainOpen:h,t:i}),e[26]=u,e[27]=h,e[28]=S?.title,e[29]=i,e[30]=d,e[31]=j):j=e[31];const C=j;let N;e[32]!==o||e[33]!==g||e[34]!==f.id||e[35]!==f.slug||e[36]!==m||e[37]!==s?(N=O=>{if(O!==x1){if(Je("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:O,source:"mobile_select"}),d7({reportsOnly:m,onReportAgent:g,tabId:O})){o({to:"/$org/$taskId",params:{org:f.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:q0(f.id),main:O}});return}o({to:".",search:z=>O==="chat"?{...z,sidepanel:"chat",main:0}:{...z,sidepanel:0,main:O},replace:!0})}},e[32]=o,e[33]=g,e[34]=f.id,e[35]=f.slug,e[36]=m,e[37]=s,e[38]=N):N=e[38];const V=N;let T;e[39]!==i?(T=i("mainPanelTabs.mobileMainPanelTabSelect.view"),e[39]=i,e[40]=T):T=e[40];let E;e[41]!==S?(E=S&&r.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:r.jsx(Uf,{icon:S.icon,className:"size-5"})}),e[41]=S,e[42]=E):E=e[42];let P;e[43]!==C?(P=r.jsx("span",{className:"min-w-0 truncate",children:C}),e[43]=C,e[44]=P):P=e[44];let D;e[45]!==E||e[46]!==P?(D=r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[E,P]}),e[45]=E,e[46]=P,e[47]=D):D=e[47];let I;e[48]!==T||e[49]!==D?(I=r.jsx(Ns,{"aria-label":T,className:"h-10! w-full min-w-0 max-w-[7.5rem] rounded-md border-0 bg-transparent px-1.5 text-xs shadow-none [--card-shadow:none]",children:D}),e[48]=T,e[49]=D,e[50]=I):I=e[50];let R;e[51]!==C?(R=r.jsx(Pt,{value:x1,disabled:!0,hideCheck:!0,className:"hidden",children:C}),e[51]=C,e[52]=R):R=e[52];let $;e[53]!==L?($=L.map(Iue),e[53]=L,e[54]=$):$=e[54];let B;e[55]!==R||e[56]!==$?(B=r.jsxs(Vs,{align:"end",className:"w-56",children:[R,$]}),e[55]=R,e[56]=$,e[57]=B):B=e[57];let M;return e[58]!==V||e[59]!==I||e[60]!==B?(M=r.jsxs(Cs,{value:x1,onValueChange:V,children:[I,B]}),e[58]=V,e[59]=I,e[60]=B,e[61]=M):M=e[61],M}function Iue(t){return r.jsx(Pt,{value:t.value,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:r.jsx(Uf,{icon:t.icon})}),r.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function Mue(t){return{value:t.id,title:t.title,icon:t.icon}}function $ue(t,e){const s=F.c(35),n=Zv(),{locator:i}=qe(),o=A.useSyncExternalStore(n.threads.subscribe,n.threads.get),l=A.useSyncExternalStore(n.threadsStatus.subscribe,n.threadsStatus.get);let a;s[0]!==t||s[1]!==o?(a=t?o.find(L=>L.id===t&&!L.partial)??null:null,s[0]=t,s[1]=o,s[2]=a):a=s[2];const c=a,[d,u]=A.useState(void 0);let h;s[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{u(void 0)},s[3]=h):h=s[3];let f;s[4]!==t?(f=[t],s[4]=t,s[5]=f):f=s[5],A.useEffect(h,f);let m,p;s[6]!==d||s[7]!==t||s[8]!==c||s[9]!==n||s[10]!==l.kind?(m=()=>{t&&(c||l.kind!=="loading"&&d===void 0&&(u("pending"),n.fetchThreadIntoSlot(t).then(L=>{u(L)})))},p=[t,c,l.kind,d,n],s[6]=d,s[7]=t,s[8]=c,s[9]=n,s[10]=l.kind,s[11]=m,s[12]=p):(m=s[11],p=s[12]),A.useEffect(m,p);let g;s[13]!==i||s[14]!==n||s[15]!==e?(g={mutationFn:async L=>n.create({id:L,virtual_mcp_id:e,...aC(sessionStorage,i,L)})},s[13]=i,s[14]=n,s[15]=e,s[16]=g):g=s[16];const x=Rs(g);let b,v;if(s[17]!==x||s[18]!==d||s[19]!==t||s[20]!==c||s[21]!==l.kind?(b=()=>{t&&(c||d===null&&l.kind!=="loading"&&(x.isPending||x.variables!==t&&x.mutate(t)))},v=[t,c,d,l.kind,x],s[17]=x,s[18]=d,s[19]=t,s[20]=c,s[21]=l.kind,s[22]=b,s[23]=v):(b=s[22],v=s[23]),A.useEffect(b,v),!t){let L;return s[24]===Symbol.for("react.memo_cache_sentinel")?(L={status:"ready",task:null},s[24]=L):L=s[24],L}if(c){let L;return s[25]!==c?(L={status:"ready",task:c},s[25]=c,s[26]=L):L=s[26],L}if(d&&typeof d=="object"){let L;return s[27]!==d?(L={status:"ready",task:d},s[27]=d,s[28]=L):L=s[28],L}if(x.data){let L;return s[29]!==x.data?(L={status:"ready",task:x.data},s[29]=x.data,s[30]=L):L=s[30],L}if(x.isError){let L;return s[31]!==x.error?(L={status:"error",error:x.error},s[31]=x.error,s[32]=L):L=s[32],L}if(x.isPending||l.kind!=="loading"){let L;return s[33]===Symbol.for("react.memo_cache_sentinel")?(L={status:"creating"},s[33]=L):L=s[33],L}let _;return s[34]===Symbol.for("react.memo_cache_sentinel")?(_={status:"loading"},s[34]=_):_=s[34],_}function Oue(){const t=F.c(6),e=Ro(),s=zt();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{preview:i}=br(n);if(!e||!i)return null;let o;t[1]!==s?(o=()=>s({to:".",search:Bue}),t[1]=s,t[2]=o):o=t[2];let l;return t[3]!==i||t[4]!==o?(l=r.jsx($w,{previewPath:i,onClose:o,showSeeInLibrary:!0}),t[3]=i,t[4]=o,t[5]=l):l=t[5],l}function Bue(t){const{preview:e,...s}=t;return s}const zue=A.createContext(null);function ij(){return A.useContext(zue)}const Pa=A.createContext(null);function eo(){return A.use(Pa)}function rj(t){const e=F.c(13),{children:s}=t,n=ie(),i=cf(),o=ij();let l;e[0]!==i||e[1]!==o?(l=r.jsx(Q6,{}),e[0]=i,e[1]=o,e[2]=l):l=e[2];const a=l;let c;e[3]!==n?(c=n("agentShellLayout.agentShellLayout.chatLoadingError"),e[3]=n,e[4]=c):c=e[4];let d;e[5]!==c?(d=r.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:c}),e[5]=c,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(ms.Skeleton,{}),e[7]=u):u=e[7];const h=s??a;let f;e[8]!==h?(f=r.jsx(A.Suspense,{fallback:u,children:h}),e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==d||e[11]!==f?(m=r.jsx(Fs,{fallback:d,children:f}),e[10]=d,e[11]=f,e[12]=m):m=e[12],m}function av(t){const e=F.c(11),{taskId:s,children:n}=t;ie(),ij();let i;return e[8]!==n||e[9]!==s?(i=r.jsx(ms.ActiveTaskProvider,{taskId:s,children:n}),e[8]=n,e[9]=s,e[10]=i):i=e[10],i}function oj(t){const e=F.c(3),{onNewTaskRef:s,createNewTask:n}=t;let i;return e[0]!==n||e[1]!==s?(i=()=>(s.current=n,()=>{s.current=null}),e[0]=n,e[1]=s,e[2]=i):i=e[2],A.useLayoutEffect(i),null}function cv({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:n}){const i=ie(),{currentBranch:o,activeTask:l,setCurrentTaskBranch:a}=sn(),{pendingSandboxProviderKind:c}=Mo(),d=cf(),{data:u}=xi.useSession(),h=u?.user?.id,f=!Xv({isDesktopApp:d,harnessId:l?.harness_id,sandboxProviderKind:l?.sandbox_provider_kind}),m=QM({agentSandboxMap:s,threadSandboxMap:l?.metadata?.sandboxMap,userId:h,ownerId:l?.created_by,branch:o}),p=e||en(l?.metadata),g=A.useRef(null),x=f&&YM({threadLoaded:!!l,isOwner:!!h&&l?.created_by===h,hasActiveGithubRepo:p,branch:o??null,attempted:g.current===(l?.id??null)});A.useEffect(()=>{!x||!l||(g.current=l.id,a(xf(u?.user?.name||u?.user?.email?.split("@")[0])))},[x,l,u,a]);const b=En(t),v=b.resolved?b.runtime:null,_=yR(t,o??void 0),L=h&&o?Ev(m?.[h]?.[o]):{},k=s7(L,c)?.previewUrl??null,w=f&&v!=="cms"&&(Object.keys(L).length>0||_);return f?v==="cms"?r.jsx(X4,{children:n},`${t}:${o??"no-branch"}:${l?.id??""}`):r.jsx(HM,{virtualMcpId:t,branch:o??null,previewUrl:k,enabled:w,children:r.jsx(o$,{executionEnabled:f,virtualMcpId:t,branch:o??null,userId:h??null,hasActiveGithubRepo:p,sandboxMap:m,sandboxProviderKind:c,threadId:l?.id??null,children:r.jsx(X4,{children:n},`${t}:${o??"no-branch"}:${l?.id??""}`)})},l?.id??"no-thread"):r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsx("div",{className:"flex h-full rounded-[0.75rem] bg-background card-shadow",children:r.jsx(To,{image:r.jsx(cn,{size:48,className:"text-muted-foreground"}),title:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function Fue(t){const e=F.c(16),{entity:s,virtualMcpId:n,layout:i,onNewTaskRef:o}=t;let l;e[0]!==i.createNewTask||e[1]!==o?(l=r.jsx(oj,{onNewTaskRef:o,createNewTask:i.createNewTask}),e[0]=i.createNewTask,e[1]=o,e[2]=l):l=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(ms.Skeleton,{}),e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(rj,{}),e[4]=c):c=e[4];let d;e[5]!==s||e[6]!==i.mainOpen||e[7]!==i.sidePanel||e[8]!==i.taskId||e[9]!==i.toggleMain||e[10]!==i.toggleSidePanel||e[11]!==n?(d=r.jsx(A.Suspense,{fallback:a,children:r.jsx(Tue,{virtualMcpId:n,taskId:i.taskId,entity:s,sidePanel:i.sidePanel,mainOpen:i.mainOpen,toggleSidePanel:i.toggleSidePanel,toggleMain:i.toggleMain,chatContent:c})}),e[5]=s,e[6]=i.mainOpen,e[7]=i.sidePanel,e[8]=i.taskId,e[9]=i.toggleMain,e[10]=i.toggleSidePanel,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[13]=l,e[14]=d,e[15]=u):u=e[15],u}function Uue(t){const e=F.c(20),{virtualMcpId:s,layout:n,onNewTaskRef:i}=t,o=ie();let l;e[0]!==n.mainOpen||e[1]!==n.sidePanel||e[2]!==n.sidePanelParamPresent?(l=wR({visibility:{sidePanel:n.sidePanel,mainOpen:n.mainOpen},sidePanelParamPresent:n.sidePanelParamPresent}),e[0]=n.mainOpen,e[1]=n.sidePanel,e[2]=n.sidePanelParamPresent,e[3]=l):l=e[3];const a=l;let c;e[4]!==n.taskId||e[5]!==s?(c=r.jsx(iT.Tabs,{children:r.jsx(Rue,{virtualMcpId:s,taskId:n.taskId})}),e[4]=n.taskId,e[5]=s,e[6]=c):c=e[6];let d;e[7]!==n.createNewTask||e[8]!==i?(d=r.jsx(oj,{onNewTaskRef:i,createNewTask:n.createNewTask}),e[7]=n.createNewTask,e[8]=i,e[9]=d):d=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(ms.Skeleton,{}),e[10]=u):u=e[10];let h;e[11]!==n.taskId||e[12]!==a||e[13]!==o||e[14]!==s?(h=r.jsx(A.Suspense,{fallback:u,children:r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:a==="main"?r.jsx(Fs,{fallback:r.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:o("agentShellLayout.agentShellLayout.somethingWentWrong")}),children:r.jsx(A.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(ft,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx("div",{"data-testid":"main-panel",className:"h-full",children:r.jsx(Dk,{taskId:n.taskId,virtualMcpId:s})})})}):r.jsx(nj,{chatContent:r.jsx(rj,{})})})}),e[11]=n.taskId,e[12]=a,e[13]=o,e[14]=s,e[15]=h):h=e[15];let f;return e[16]!==c||e[17]!==d||e[18]!==h?(f=r.jsxs(r.Fragment,{children:[c,d,h]}),e[16]=c,e[17]=d,e[18]=h,e[19]=f):f=e[19],f}function Hue(){const t=F.c(97),e=ie(),s=Ro(),n=zt(),{org:i}=qe();nT(i.slug);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const l=Uh(o),a=l.org??"";let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[1]=c):c=t[1];const d=br(c);let u;t[2]!==i.id||t[3]!==d.virtualmcpid?(u=d.virtualmcpid??Cl(i.id).id,t[2]=i.id,t[3]=d.virtualmcpid,t[4]=u):u=t[4];const h=u,f=$ue(l.taskId??"",h);CR(f.status==="ready"?f.task:null);const m=Ws(h),p=m?.metadata?.ui?.layout??null;let g;t[5]!==p?(g=p?{defaultMainView:p.defaultMainView??null,chatDefaultOpen:p.chatDefaultOpen??null}:null,t[5]=p,t[6]=g):g=t[6];const x=g;let b;t[7]!==m?(b=m&&gu(m),t[7]=m,t[8]=b):b=t[8];const v=!!b;let _;t[9]!==a||t[10]!==h?(_={virtualMcpId:h,orgSlug:a,isAgentRoute:!0},t[9]=a,t[10]=h,t[11]=_):_=t[11];const L=jR(x,_),y=A.useRef(null);let k,w;t[12]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const $=B=>{ey(B)&&B.shiftKey&&B.code==="KeyS"&&!B.repeat&&(B.preventDefault(),y.current?.())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},w=[],t[12]=k,t[13]=w):(k=t[12],w=t[13]),A.useEffect(k,w);const S=h;let j;t[14]!==m||t[15]!==h?(j={virtualMcpId:h,entity:m},t[14]=m,t[15]=h,t[16]=j):j=t[16];const C=j;if(f.status==="creating"||f.status==="loading"){let $;t[17]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(ft,{className:"size-4 animate-spin mr-2"}),t[17]=$):$=t[17];let B;t[18]!==e?(B=e("agentShellLayout.agentShellLayout.creatingTask"),t[18]=e,t[19]=B):B=t[19];let M;t[20]!==B?(M=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[$,B]})}),t[20]=B,t[21]=M):M=t[21];let O;return t[22]!==C||t[23]!==M?(O=r.jsx(Pa,{value:C,children:M}),t[22]=C,t[23]=M,t[24]=O):O=t[24],O}if(f.status==="error"){let $;t[25]!==e?($=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[25]=e,t[26]=$):$=t[26];let B;t[27]!==$?(B=r.jsx("div",{className:"font-medium",children:$}),t[27]=$,t[28]=B):B=t[28];let M;t[29]!==f.error.message?(M=r.jsx("div",{className:"text-muted-foreground",children:f.error.message}),t[29]=f.error.message,t[30]=M):M=t[30];let O;t[31]!==B||t[32]!==M?(O=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{role:"alert",className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[B,M]})}),t[31]=B,t[32]=M,t[33]=O):O=t[33];let z;return t[34]!==C||t[35]!==O?(z=r.jsx(Pa,{value:C,children:O}),t[34]=C,t[35]=O,t[36]=z):z=t[36],z}if(!m){let $;t[37]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(cn,{size:48,className:"text-muted-foreground"}),t[37]=$):$=t[37];let B;t[38]!==e?(B=e("agentShellLayout.agentShellLayout.agentNotFound"),t[38]=e,t[39]=B):B=t[39];let M;t[40]!==e||t[41]!==h?(M=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:h}),t[40]=e,t[41]=h,t[42]=M):M=t[42];let O;t[43]!==n||t[44]!==a?(O=()=>n({to:"/$org",params:{org:a}}),t[43]=n,t[44]=a,t[45]=O):O=t[45];let z;t[46]!==e?(z=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[46]=e,t[47]=z):z=t[47];let U;t[48]!==O||t[49]!==z?(U=r.jsx(de,{variant:"outline",onClick:O,children:z}),t[48]=O,t[49]=z,t[50]=U):U=t[50];let H;t[51]!==B||t[52]!==M||t[53]!==U?(H=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:r.jsx(To,{image:$,title:B,description:M,actions:U})})}),t[51]=B,t[52]=M,t[53]=U,t[54]=H):H=t[54];let K;return t[55]!==C||t[56]!==H?(K=r.jsx(Pa,{value:C,children:H}),t[55]=C,t[56]=H,t[57]=K):K=t[57],K}if(s){const $=f.status==="ready"?f.task:null,B=m?.metadata?.sandboxMap;let M;t[58]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(ms.Skeleton,{}),t[58]=M):M=t[58];let O;t[59]!==S||t[60]!==L?(O=r.jsx(A.Suspense,{fallback:M,children:r.jsx(Uue,{virtualMcpId:S,layout:L,onNewTaskRef:y})}),t[59]=S,t[60]=L,t[61]=O):O=t[61];let z;t[62]!==L.taskId||t[63]!==O?(z=r.jsx(av,{taskId:L.taskId,children:O},L.taskId),t[62]=L.taskId,t[63]=O,t[64]=z):z=t[64];let U;t[65]!==v||t[66]!==B||t[67]!==z||t[68]!==h?(U=r.jsx(cv,{virtualMcpId:h,hasActiveGithubRepo:v,sandboxMap:B,children:z}),t[65]=v,t[66]=B,t[67]=z,t[68]=h,t[69]=U):U=t[69];let H;t[70]!==S||t[71]!==U||t[72]!==$?(H=r.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:r.jsx(ms.Provider,{virtualMcpId:S,task:$,children:U},S)}),t[70]=S,t[71]=U,t[72]=$,t[73]=H):H=t[73];let K;return t[74]!==C||t[75]!==H?(K=r.jsx(Pa,{value:C,children:H}),t[74]=C,t[75]=H,t[76]=K):K=t[76],K}const N=f.status==="ready"?f.task:null,V=m?.metadata?.sandboxMap;let T;t[77]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(ms.Skeleton,{}),t[77]=T):T=t[77];let E;t[78]!==m||t[79]!==L||t[80]!==h?(E=r.jsx(A.Suspense,{fallback:T,children:r.jsx(Fue,{entity:m,virtualMcpId:h,layout:L,onNewTaskRef:y})}),t[78]=m,t[79]=L,t[80]=h,t[81]=E):E=t[81];let P;t[82]!==L.taskId||t[83]!==E?(P=r.jsx(av,{taskId:L.taskId,children:E},L.taskId),t[82]=L.taskId,t[83]=E,t[84]=P):P=t[84];let D;t[85]!==v||t[86]!==V||t[87]!==P||t[88]!==h?(D=r.jsx(cv,{virtualMcpId:h,hasActiveGithubRepo:v,sandboxMap:V,children:P}),t[85]=v,t[86]=V,t[87]=P,t[88]=h,t[89]=D):D=t[89];let I;t[90]!==S||t[91]!==D||t[92]!==N?(I=r.jsx(ms.Provider,{virtualMcpId:S,task:N,children:D},S),t[90]=S,t[91]=D,t[92]=N,t[93]=I):I=t[93];let R;return t[94]!==C||t[95]!==I?(R=r.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:r.jsx(Pa,{value:C,children:I})}),t[94]=C,t[95]=I,t[96]=R):R=t[96],R}function Kue(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Wj,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(A.Suspense,{fallback:e,children:r.jsxs(KC,{children:[r.jsx(Hue,{}),r.jsx(Oue,{})]})}),t[1]=s):s=t[1],s}const Wue=Object.freeze(Object.defineProperty({__proto__:null,default:Kue,useInsetContext:eo},Symbol.toStringTag,{value:"Module"}));export{yw as $,ufe as A,cse as B,qte as C,rh as D,JI as E,KL as F,Du as G,Cn as H,Xfe as I,Dg as J,vte as K,Lfe as L,th as M,Sfe as N,Afe as O,T2 as P,En as Q,MY as R,Ui as S,Kse as T,$Y as U,md as V,bw as W,Ca as X,N5 as Y,k9e as Z,j9e as _,ofe as a,Lh as a$,f9e as a0,x0 as a1,h9e as a2,su as a3,m9e as a4,WZ as a5,FL as a6,E6 as a7,es as a8,ZU as a9,VS as aA,Pf as aB,LS as aC,Ms as aD,Kfe as aE,t9e as aF,s9e as aG,hee as aH,Kg as aI,Cfe as aJ,ew as aK,Cee as aL,Qee as aM,_f as aN,Lf as aO,eo as aP,Gte as aQ,ih as aR,I1 as aS,xl as aT,o9e as aU,um as aV,rw as aW,Vee as aX,Oee as aY,c9e as aZ,qL as a_,E8 as aa,Vu as ab,gr as ac,Dl as ad,Rl as ae,Mf as af,bl as ag,Rf as ah,c_ as ai,Eu as aj,H2 as ak,If as al,Ri as am,Ase as an,Dse as ao,Un as ap,g9e as aq,Df as ar,_w as as,p9e as at,KO as au,HO as av,Rfe as aw,wh as ax,bX as ay,$i as az,xfe as b,w9e as b$,jX as b0,Vfe as b1,kee as b2,n9e as b3,YL as b4,$fe as b5,a9e as b6,u9e as b7,d9e as b8,vee as b9,$L as bA,ML as bB,Nfe as bC,TY as bD,Tfe as bE,Efe as bF,FY as bG,Jfe as bH,Bfe as bI,Yfe as bJ,Gfe as bK,Qfe as bL,Tee as bM,Wg as bN,r9e as bO,Yee as bP,i9e as bQ,b9e as bR,v9e as bS,_9e as bT,ll as bU,L9e as bV,y9e as bW,x9e as bX,S9e as bY,Ah as bZ,zse as b_,NY as ba,VY as bb,l9e as bc,Fg as bd,$S as be,Wse as bf,mc as bg,Dc as bh,Ofe as bi,Wfe as bj,cJ as bk,qfe as bl,Ufe as bm,eJ as bn,Mfe as bo,Hfe as bp,Ffe as bq,zfe as br,Zfe as bs,EY as bt,M8 as bu,Dfe as bv,Ife as bw,Pfe as bx,e9e as by,zg as bz,cfe as c,wfe as c0,CM as c1,VM as c2,Wue as c3,cc as d,pfe as e,eM as f,_fe as g,QI as h,lfe as i,I8 as j,gfe as k,yfe as l,hfe as m,Zk as n,Pu as o,Ha as p,afe as q,ffe as r,tM as s,yf as t,Pl as u,dfe as v,Yr as w,vfe as x,bfe as y,mfe as z};