decocms 4.200.2 → 4.201.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/client/assets/{AlertCircle-WwYKI5Qb.js → AlertCircle-Bj0VV7up.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DF9gicSk.js → AreaChart-CeR7jziX.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-aA-FzaCr.js → ArrowLeft-BqlCFBY7.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Dl3cQVzC.js → ArrowUp-D_w2qey6.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-BZW220i4.js → ArrowUpRight-DZ8WfL-N.js} +1 -1
  6. package/dist/client/assets/{Check-CQsEmdtb.js → Check-BuqR_Kwe.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DR3Li8PK.js → CheckCircle-Bp_VEEVz.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-l4iG0p-P.js → ChevronDown-65wLzJTw.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-BgMlkNeC.js → ChevronRight-EyYVLyQY.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-DOlZYOVw.js → ChevronUp-BNz5kAIR.js} +1 -1
  11. package/dist/client/assets/{Copy01-CKF7O5eT.js → Copy01-CC0Hd3xm.js} +1 -1
  12. package/dist/client/assets/{CpuChip01-rrqN9f4p.js → CpuChip01-AFiwguFW.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-DD6aW3wk.js → CreditCard01-Crsjk2NQ.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-CowCWATW.js → DotsVertical-DlkoNOjo.js} +1 -1
  15. package/dist/client/assets/{Eye-DoysLbE1.js → Eye-DA0zzgps.js} +1 -1
  16. package/dist/client/assets/{FilterLines-CXcCTqQu.js → FilterLines-URZsEuaM.js} +1 -1
  17. package/dist/client/assets/{Globe01-Bl9pBdBK.js → Globe01-BzoxFmTs.js} +1 -1
  18. package/dist/client/assets/{Globe04-Ccsw_B8c.js → Globe04-3sGIF22h.js} +1 -1
  19. package/dist/client/assets/{HardDrive-D30Gjyo8.js → HardDrive-Do13Gda6.js} +1 -1
  20. package/dist/client/assets/{Key01-Ch_IQKvS.js → Key01-f9O3oH8b.js} +1 -1
  21. package/dist/client/assets/{LayoutLeft-CV2T0vO3.js → LayoutLeft-Dve3wTbL.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-DLPXVHWD.js → LinkExternal01-BT1cKht3.js} +1 -1
  23. package/dist/client/assets/{LogOut01-BtWQrKvN.js → LogOut01-BUyEI5Ky.js} +1 -1
  24. package/dist/client/assets/{Monitor01-BT8u7fos.js → Monitor01-CvmVoJ-i.js} +1 -1
  25. package/dist/client/assets/{Palette-CZ3inffY.js → Palette--hypnXQO.js} +1 -1
  26. package/dist/client/assets/{Play-D7O034DB.js → Play-xBu_rWbV.js} +1 -1
  27. package/dist/client/assets/{Plus-tOluSbOt.js → Plus-D4rlrlLr.js} +1 -1
  28. package/dist/client/assets/{SearchLg-C67h3xK8.js → SearchLg-DxcRs5em.js} +1 -1
  29. package/dist/client/assets/{SearchMd-P-qGR4xa.js → SearchMd-CGwyuA_K.js} +1 -1
  30. package/dist/client/assets/{Settings02-DrpZgC_J.js → Settings02-C6kyxW7G.js} +1 -1
  31. package/dist/client/assets/{Share07-DGsuXOEY.js → Share07-q1slgvW5.js} +1 -1
  32. package/dist/client/assets/{Shield01-DVvWyA23.js → Shield01-CYrRKcNn.js} +1 -1
  33. package/dist/client/assets/{Star01-BYdY-DAR.js → Star01-DSgMIlZH.js} +1 -1
  34. package/dist/client/assets/{Stars01-DsD31Ln0.js → Stars01-Cv4Wame5.js} +1 -1
  35. package/dist/client/assets/{Stars02-CV1jiWYO.js → Stars02-B6VMIlyW.js} +1 -1
  36. package/dist/client/assets/{Sun-C9UnoqJl.js → Sun-BhbPIZVi.js} +1 -1
  37. package/dist/client/assets/{SwitchHorizontal01-44Mb4crN.js → SwitchHorizontal01-OZQMkGRb.js} +1 -1
  38. package/dist/client/assets/{Tool01-Dc3mraKQ.js → Tool01-CEpJ1e8Z.js} +1 -1
  39. package/dist/client/assets/{Tool02-Br6dtRR1.js → Tool02-Cn87iqZi.js} +1 -1
  40. package/dist/client/assets/{Trash01-CCc2xaoD.js → Trash01-CBJEu1qv.js} +1 -1
  41. package/dist/client/assets/{TrendUp01-Drrs9no-.js → TrendUp01-B5Y95ssn.js} +1 -1
  42. package/dist/client/assets/{Upload01-pkxuOolK.js → Upload01-BtHH4hys.js} +1 -1
  43. package/dist/client/assets/{User01-DQvk8cF7.js → User01-wzGmobUI.js} +1 -1
  44. package/dist/client/assets/{Users01-BTeOoP3Y.js → Users01-JAFRD8ie.js} +1 -1
  45. package/dist/client/assets/{Users03-BJlJhI3u.js → Users03-BAonmOfw.js} +1 -1
  46. package/dist/client/assets/{X-Db6CXFPy.js → X-Co0bDnHw.js} +1 -1
  47. package/dist/client/assets/{XCircle-u_MUCjn5.js → XCircle-C2qoD1I-.js} +1 -1
  48. package/dist/client/assets/{XClose-C0MPTyCv.js → XClose-BZUFm2pl.js} +1 -1
  49. package/dist/client/assets/{Zap-DW4Pf0JH.js → Zap-B7cBqfTM.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-CATFBr1V.js → ZapSquare-Cois6M8k.js} +1 -1
  51. package/dist/client/assets/{access-gate-CVnQdqcu.js → access-gate-68wkTQqm.js} +1 -1
  52. package/dist/client/assets/{agent-icon-BHmHLR-n.js → agent-icon-BwZmxZXB.js} +1 -1
  53. package/dist/client/assets/{agents-list-D9pwGkMm.js → agents-list-DZ2-ECSa.js} +1 -1
  54. package/dist/client/assets/{ai-providers-CDX8gwKf.js → ai-providers-DxhKtWB7.js} +1 -1
  55. package/dist/client/assets/{alert-NZgy_rHY.js → alert-BGGhmUxc.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-6X4VWLwP.js → alert-dialog-Dw-FseSS.js} +1 -1
  57. package/dist/client/assets/{app-editor-DtRvevzC.js → app-editor-RBN0Dgx1.js} +1 -1
  58. package/dist/client/assets/{auth-CHfV0PAM.js → auth-BN6YAe4k.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-BHKlxCjP.js → auth-catchall-BLaRDm_O.js} +1 -1
  60. package/dist/client/assets/{auth-entry-CCsrgRKl.js → auth-entry-BwMLOarS.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-D3I9GWqu.js → auth-split-layout-CJX8EGRs.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-2C0xJmA1.js → authenticate-and-persist-oauth-C7D93rUY.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-CRYE-69o.js → automation-list-row-wSuBQBzW.js} +1 -1
  64. package/dist/client/assets/{automation-runs-BPvY5e0p.js → automation-runs-Cdra6s3F.js} +2 -2
  65. package/dist/client/assets/{automations-h9Z-3w97.js → automations-BqtiRNOo.js} +1 -1
  66. package/dist/client/assets/{avatar-z-df-Tey.js → avatar-BoobWyQ-.js} +1 -1
  67. package/dist/client/assets/{badge-CSetiRsF.js → badge-Be6ykVtM.js} +1 -1
  68. package/dist/client/assets/{billing-D0B10PsD.js → billing-DV9Pq5tO.js} +1 -1
  69. package/dist/client/assets/{block-document-PFKgUD2p.js → block-document-BfglFSmv.js} +1 -1
  70. package/dist/client/assets/{brand-context-BRvh-5Aa.js → brand-context-BS2GSGgR.js} +1 -1
  71. package/dist/client/assets/{buckets-CJ_17CzK.js → buckets-B54fSv7r.js} +1 -1
  72. package/dist/client/assets/{bulk-category-panel-C-sv_cyv.js → bulk-category-panel-Zs7soiIs.js} +1 -1
  73. package/dist/client/assets/{capability-load-error-CxtjMYLj.js → capability-load-error-1c_U2BKc.js} +1 -1
  74. package/dist/client/assets/{card-BvQeGTaA.js → card-Bits-eBf.js} +1 -1
  75. package/dist/client/assets/{cards-DM50BBl9.js → cards-PKu1jg4N.js} +1 -1
  76. package/dist/client/assets/{category-editor-oTeE4PRw.js → category-editor-DCYOljVX.js} +1 -1
  77. package/dist/client/assets/{chat-context-WBuSodUL.js → chat-context-IReX7DMx.js} +1 -1
  78. package/dist/client/assets/{checkbox-CHPu3dI7.js → checkbox-BQcYZZpc.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-CS9cPK3T.js → cli-auth-success-cI7Przfq.js} +1 -1
  80. package/dist/client/assets/{collection-detail-D6slJdD_.js → collection-detail-iwlIHn3x.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-CqSLKnip.js → collection-display-button-C5p4lTil.js} +1 -1
  82. package/dist/client/assets/{collection-search-TJMJz_8d.js → collection-search-DhMY4ddj.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-C9Ckz61d.js → collection-table-wrapper-CmI6XIvY.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-DOWoAX_i.js → collection-tabs-ByKLfy-a.js} +1 -1
  85. package/dist/client/assets/{command-B1gQ3Abx.js → command-BszbaY2I.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-Dd6p5vHW.js → commerce-onboarding-eTGVyKe3.js} +1 -1
  87. package/dist/client/assets/{connect-D3GOYcEb.js → connect-BuV5jO6T.js} +1 -1
  88. package/dist/client/assets/{connection-Rt2sx7Mg.js → connection-BZoUH2M3.js} +1 -1
  89. package/dist/client/assets/{connection-card-Cetubrum.js → connection-card-DzP8uvoS.js} +1 -1
  90. package/dist/client/assets/{connection-detail-CTqRZboh.js → connection-detail-D8wCWQqw.js} +1 -1
  91. package/dist/client/assets/{connection-form-helpers-BVEb50_K.js → connection-form-helpers-RsEw84Yh.js} +1 -1
  92. package/dist/client/assets/{connections-4kZSQ3Gu.js → connections-BHKreEGm.js} +1 -1
  93. package/dist/client/assets/{decopilot-sse-pool-DEYtntVd.js → decopilot-sse-pool-gVDOcCp6.js} +1 -1
  94. package/dist/client/assets/{dialog-dwIz7L83.js → dialog-Ct9Ey8Rj.js} +1 -1
  95. package/dist/client/assets/{domain-settings-D3Jm6_73.js → domain-settings-bEyA-5zE.js} +1 -1
  96. package/dist/client/assets/{drawer-CgKwyvsH.js → drawer-GYAwqNoq.js} +1 -1
  97. package/dist/client/assets/{dropdown-menu-DBTeEfEp.js → dropdown-menu-BggRvEh9.js} +1 -1
  98. package/dist/client/assets/{empty-state-DIZU59YF.js → empty-state-Cp2wPJZ8.js} +1 -1
  99. package/dist/client/assets/{extract-connection-data-CW-wL2c1.js → extract-connection-data-Da3hmofn.js} +1 -1
  100. package/dist/client/assets/{file-explorer-BbbNchTa.js → file-explorer-DmldxqX4.js} +1 -1
  101. package/dist/client/assets/{file-type-icon-BkqsbMIs.js → file-type-icon-_hn3I6uX.js} +1 -1
  102. package/dist/client/assets/{form-Z85glc_u.js → form-ahiIaHkC.js} +1 -1
  103. package/dist/client/assets/{general-B3H0CGgb.js → general-CUYY-Vdi.js} +1 -1
  104. package/dist/client/assets/{github-repo-picker-CgqrZDpc.js → github-repo-picker-CzqkmjKN.js} +1 -1
  105. package/dist/client/assets/{hooks-C786cEpP.js → hooks-B2o1BQtV.js} +1 -1
  106. package/dist/client/assets/index-BEdBSIIA.css +1 -0
  107. package/dist/client/assets/{index-DrnLfJO7.js → index-BJ7Ko_7e.js} +1 -1
  108. package/dist/client/assets/{index-BHdTRFZE.js → index-BY10LBdj.js} +1 -1
  109. package/dist/client/assets/index-BeO9MUAr.js +5 -0
  110. package/dist/client/assets/{index-cjWVUbYe.js → index-Byd_5VBR.js} +1 -1
  111. package/dist/client/assets/{index-D6mIw648.js → index-CNhpdWse.js} +1 -1
  112. package/dist/client/assets/{index-DrMtZH3n.js → index-DDNkkWLs.js} +4 -4
  113. package/dist/client/assets/{index-Dk3Vbw6f.js → index-DKOI2-fs.js} +1 -1
  114. package/dist/client/assets/{index-DBCVpCmb.js → index-DLk8Iv0l.js} +1 -1
  115. package/dist/client/assets/{index-5uJTtKF7.js → index-DUS53ufg.js} +35 -35
  116. package/dist/client/assets/{index-BWnlSPNF.js → index-DwQehU15.js} +1 -1
  117. package/dist/client/assets/{index-redirect-BJZztwOf.js → index-redirect-TNlyrx_q.js} +1 -1
  118. package/dist/client/assets/{input-B8CuwYhS.js → input-B6Ue8Gtq.js} +1 -1
  119. package/dist/client/assets/{integration-icon-CyGR5k8y.js → integration-icon-WlgJZAAr.js} +1 -1
  120. package/dist/client/assets/{invite-member-dialog-Cs9yQPe7.js → invite-member-dialog-DD0wDOJp.js} +1 -1
  121. package/dist/client/assets/{label-mbqBY0TT.js → label-ByQVKXpC.js} +1 -1
  122. package/dist/client/assets/{layout-CRcIcX3z.js → layout-BVvRMohF.js} +1 -1
  123. package/dist/client/assets/{login-B3BCqwfk.js → login-CwYGauog.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-Bh4D_1yr.js → mcp-oauth-upBlM6GN.js} +1 -1
  125. package/dist/client/assets/{members-Bt4tVUpE.js → members-B_Jhbrbd.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-BEE54e2X.js → monaco-editor-B8kAUX7x.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-CZBQe1J_.js → monitoring-stats-row-NGkVTGPZ.js} +1 -1
  128. package/dist/client/assets/{multi-select-5v4y46yQ.js → multi-select-DfdiRGzA.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-C8tO2ViQ.js → oauth-callback-BpM_vE_w.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-ai-provider-BlyuICqa.js → oauth-callback-ai-provider-DQIszpko.js} +1 -1
  131. package/dist/client/assets/{onboarding-C_77UeCV.js → onboarding-DvTU1LUv.js} +1 -1
  132. package/dist/client/assets/{org-layout-tSw8Hzo6.js → org-layout-Csca47cZ.js} +1 -1
  133. package/dist/client/assets/{organization-choice-ClTFwbDy.js → organization-choice-COSQhsCq.js} +1 -1
  134. package/dist/client/assets/{orgs-B5Bbgmvk.js → orgs-DR2Di9NE.js} +1 -1
  135. package/dist/client/assets/{page-seo-form-CoUiXlS_.js → page-seo-form-tKqIF-y-.js} +1 -1
  136. package/dist/client/assets/{popover-jpJstolX.js → popover-C4xldx8X.js} +1 -1
  137. package/dist/client/assets/{post-editor-Ddr_6Fac.js → post-editor-D0E8JoBe.js} +1 -1
  138. package/dist/client/assets/{primitives-FhnYAl6u.js → primitives-BaWGwJqw.js} +1 -1
  139. package/dist/client/assets/{profile-BZc7LzYW.js → profile-BbdnyzH1.js} +1 -1
  140. package/dist/client/assets/{project-app-view-DzeT8LJu.js → project-app-view-6rbxnT-3.js} +1 -1
  141. package/dist/client/assets/record-editor-C7AV-kwd.js +1 -0
  142. package/dist/client/assets/{redirect-editor-DKvHrWmX.js → redirect-editor-D1X-LItd.js} +1 -1
  143. package/dist/client/assets/registry-BGzmQpf5.js +2 -0
  144. package/dist/client/assets/{registry-layout-Bmt_KMV2.js → registry-layout-CVgJH-tf.js} +1 -1
  145. package/dist/client/assets/{reports-BvAVG37q.js → reports-uTUZayik.js} +1 -1
  146. package/dist/client/assets/{require-capability-DOx9AETn.js → require-capability-D8V-K-Ln.js} +1 -1
  147. package/dist/client/assets/{required-auth-layout-088Qrhua.js → required-auth-layout-QkQ_LFn1.js} +1 -1
  148. package/dist/client/assets/{reset-password-DMec7zHu.js → reset-password-JK0bR-tQ.js} +1 -1
  149. package/dist/client/assets/{roles-DfRoUUPR.js → roles-BNGONjav.js} +1 -1
  150. package/dist/client/assets/{search-input-yzjarZOy.js → search-input-kBCGvCld.js} +1 -1
  151. package/dist/client/assets/{secrets-EaPte9tu.js → secrets-Bys27HEe.js} +1 -1
  152. package/dist/client/assets/{sections-editor-CPtZM9nP.js → sections-editor-g-030qn4.js} +1 -1
  153. package/dist/client/assets/{select-DwoG3i35.js → select-Bn2gd7PP.js} +1 -1
  154. package/dist/client/assets/{select-model-BJcNU1LC.js → select-model-2-cyvNOe.js} +1 -1
  155. package/dist/client/assets/{self-tool-result-BIcvrUov.js → self-tool-result-PcOApdBI.js} +1 -1
  156. package/dist/client/assets/{seo-editor-BCBdG81E.js → seo-editor-C1PaWNCw.js} +1 -1
  157. package/dist/client/assets/{settings-layout-D5Vqc4xw.js → settings-layout-BLCffzES.js} +1 -1
  158. package/dist/client/assets/{settings-section-BaQE1wG9.js → settings-section-rIBQA49t.js} +1 -1
  159. package/dist/client/assets/{shell-controls-CBnHbN6H.js → shell-controls-D9MoX2ZP.js} +1 -1
  160. package/dist/client/assets/{shell-layout-B5fO0Zra.js → shell-layout-DvrKfubx.js} +1 -1
  161. package/dist/client/assets/{sidebar-DgQgb5sn.js → sidebar-6Pwgqwg8.js} +1 -1
  162. package/dist/client/assets/{skeleton-BAWjjFCN.js → skeleton-BAcj33ku.js} +1 -1
  163. package/dist/client/assets/{spinner-DGBqgXCx.js → spinner-ws5yutkc.js} +1 -1
  164. package/dist/client/assets/{sso-ZyfgZDXz.js → sso-Cvp5Ol5f.js} +1 -1
  165. package/dist/client/assets/{store-CDmxLg6b.js → store-CQEGPQV9.js} +1 -1
  166. package/dist/client/assets/store-registry-F2nsDsGp.js +2 -0
  167. package/dist/client/assets/{studio-tools-Cl_MnIvi.js → studio-tools-DM5QBHCQ.js} +1 -1
  168. package/dist/client/assets/{switch-BkAM2D0l.js → switch-DkU4M0dt.js} +1 -1
  169. package/dist/client/assets/{synced-repos-DEOggDSZ.js → synced-repos-QtDUxULK.js} +1 -1
  170. package/dist/client/assets/{tab-id-Bxlhy6J5.js → tab-id-CiGWDuEk.js} +1 -1
  171. package/dist/client/assets/{table-wkh9heo2.js → table-la-GCDtJ.js} +1 -1
  172. package/dist/client/assets/{tabs-CEYHI8Md.js → tabs-CA2r-tm8.js} +1 -1
  173. package/dist/client/assets/{textarea-1wjTSY40.js → textarea-Cgxpb5eg.js} +1 -1
  174. package/dist/client/assets/{toggle-group-2FXdfAeH.js → toggle-group-BEWMY4aK.js} +1 -1
  175. package/dist/client/assets/{toolbar-DJeYjzbm.js → toolbar-DOAlJJnD.js} +1 -1
  176. package/dist/client/assets/{tooltip-H0fhJGAw.js → tooltip-11Yrt4wp.js} +1 -1
  177. package/dist/client/assets/{use-ai-providers-BHJZGUc0.js → use-ai-providers-CUHFWYci.js} +1 -1
  178. package/dist/client/assets/{use-automations-CUmyAWfM.js → use-automations-iQtt0rLd.js} +1 -1
  179. package/dist/client/assets/{use-autosave-DlIf0aXm.js → use-autosave-jWI3co6x.js} +1 -1
  180. package/dist/client/assets/{use-capability-wtjHty-j.js → use-capability-DcMyBnS4.js} +1 -1
  181. package/dist/client/assets/{use-clock-tick-CxYlu2Gq.js → use-clock-tick-QY57Oj13.js} +1 -1
  182. package/dist/client/assets/{use-connection-C06aQf36.js → use-connection-DVLPDTuB.js} +1 -1
  183. package/dist/client/assets/{use-copy-gW0QHo8P.js → use-copy-D-GM29SE.js} +1 -1
  184. package/dist/client/assets/{use-create-virtual-mcp-f_SJloId.js → use-create-virtual-mcp-BBFP4Vw4.js} +1 -1
  185. package/dist/client/assets/{use-debounced-autosave-JjCfq5kj.js → use-debounced-autosave-yTGUa49y.js} +1 -1
  186. package/dist/client/assets/{use-debounced-value-Dp6sftMR.js → use-debounced-value-CkNYo5YL.js} +1 -1
  187. package/dist/client/assets/{use-deco-credits-g0IlK0Pn.js → use-deco-credits-Cthvsr_H.js} +1 -1
  188. package/dist/client/assets/{use-decopilot-events-a7Wk8Vas.js → use-decopilot-events-BcjIJdRs.js} +1 -1
  189. package/dist/client/assets/{use-delete-connection-gv8RXinn.js → use-delete-connection-e1S0S9Xr.js} +1 -1
  190. package/dist/client/assets/{use-deployment-admin-BNsEQ5Jb.js → use-deployment-admin-DbpLqnqh.js} +1 -1
  191. package/dist/client/assets/{use-file-configs-BXAOsCuo.js → use-file-configs-CpKyEHH5.js} +1 -1
  192. package/dist/client/assets/{use-infinite-scroll-CbzOsGKa.js → use-infinite-scroll-B52yZeYp.js} +1 -1
  193. package/dist/client/assets/{use-join-requests-BihL-Sex.js → use-join-requests-CRtQD5St.js} +1 -1
  194. package/dist/client/assets/{use-mcp-client-BYQZ09jw.js → use-mcp-client-B1vuae8u.js} +1 -1
  195. package/dist/client/assets/{use-mcp-tools-1zzjIAwR.js → use-mcp-tools-DwnvrfSJ.js} +1 -1
  196. package/dist/client/assets/{use-members-hO-mw4Hb.js → use-members-Cu4tim8h.js} +1 -1
  197. package/dist/client/assets/{use-mobile-BpvQFpHJ.js → use-mobile-Cavq-ZyH.js} +1 -1
  198. package/dist/client/assets/{use-navigate-to-agent-BqIzfs1W.js → use-navigate-to-agent-CO828s2W.js} +1 -1
  199. package/dist/client/assets/{use-open-billing-url-DhJWA6Ab.js → use-open-billing-url-Cq6CFoOt.js} +1 -1
  200. package/dist/client/assets/{use-org-auth-client-BemR7rGU.js → use-org-auth-client-BQJU69BH.js} +1 -1
  201. package/dist/client/assets/{use-org-sso-BCOboyXc.js → use-org-sso-Bv_JE25K.js} +1 -1
  202. package/dist/client/assets/{use-organization-roles-KuqucuwR.js → use-organization-roles-DwEMIze7.js} +1 -1
  203. package/dist/client/assets/{use-organization-settings-DO-5TCG5.js → use-organization-settings-B2Gux989.js} +1 -1
  204. package/dist/client/assets/{use-registry-connections-DAUYDjwC.js → use-registry-connections-B30kwQ-D.js} +1 -1
  205. package/dist/client/assets/{use-secrets-DbAKuIqf.js → use-secrets-DVBgSmhl.js} +1 -1
  206. package/dist/client/assets/{use-section-preview-base-DadVPpps.js → use-section-preview-base-D_sClGro.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-B7jzN0nF.js → use-status-sounds-CT1tk-BS.js} +1 -1
  208. package/dist/client/assets/{use-tags-C70JhIII.js → use-tags-CzUPzpBT.js} +1 -1
  209. package/dist/client/assets/{use-view-mode-E1cNgKEH.js → use-view-mode-xMHcPi5K.js} +1 -1
  210. package/dist/client/assets/{use-virtual-mcp-Cfa_s6xG.js → use-virtual-mcp-DrXsz2Gh.js} +1 -1
  211. package/dist/client/assets/useInfiniteQuery-CpFXCemx.js +1 -0
  212. package/dist/client/assets/{useRouterState-dnxSkJ3B.js → useRouterState-DfJ79l1w.js} +1 -1
  213. package/dist/client/assets/useSuspenseInfiniteQuery-BSnce96W.js +1 -0
  214. package/dist/client/assets/{users-DC66nhJN.js → users-DY2kfXVp.js} +1 -1
  215. package/dist/client/assets/{variant-calendar-HycG7TtG.js → variant-calendar-CPISZecu.js} +1 -1
  216. package/dist/client/assets/{view-mode-toggle-BqYvPkBg.js → view-mode-toggle-CoAzgunL.js} +1 -1
  217. package/dist/client/index.html +2 -2
  218. package/dist/server/cli.js +1 -1
  219. package/dist/server/server.js +1 -1
  220. package/package.json +1 -1
  221. package/dist/client/assets/index-9SfcAKRH.css +0 -1
  222. package/dist/client/assets/index-BTa_wQw_.js +0 -5
  223. package/dist/client/assets/record-editor-pWAfV-bV.js +0 -1
  224. package/dist/client/assets/registry-6xLfaylj.js +0 -2
  225. package/dist/client/assets/store-registry-1BNfPgeY.js +0 -2
  226. package/dist/client/assets/useInfiniteQuery-BSP--nFF.js +0 -1
  227. package/dist/client/assets/useSuspenseInfiniteQuery-CrU4YP2H.js +0 -1
@@ -1,2 +1,2 @@
1
- import{c as Ge,b as ct,r as w,m as $e,j as n,ae as Xn,B as Xe,k as Zn,o as Ca,t as Q,K as Ma}from"./index-DrMtZH3n.js";import{ap as Ba,aq as Ka,ar as La,a4 as es,a5 as Qt,as as ts,at as ns,a6 as ss,a7 as as,au as os,av as Fa,ae as rs,af as is,aw as Ia,ax as Oa,ay as ls,O as $a,a8 as cs,a9 as Mt,ac as us,ad as ds,aa as ms,ak as fs,az as za,aA as Bt,aB as ps,aC as Ha,S as gs,aD as lt,G as hs,aE as Ua,aF as qa,aG as Ga,aH as Wa,D as Ya,F as Ja,aI as Qa,aJ as Xa,aK as Za,aL as eo,ai as qt,aM as Gt,aN as to,aO as St,aP as Pt,aQ as no,aR as so,aS as tt,aT as Kn,aU as ao,aV as At,aW as Wt,aX as oo,aY as mn,aZ as ro,a_ as kt,a$ as io,b0 as lo,b1 as co,b2 as uo,b3 as mo,b4 as xt,b5 as fo,b6 as po,b7 as go,I as ho,b8 as Ln,b9 as Ct,ba as Fn,bb as In,bc as vo,bd as bo,be as So,bf as xo,bg as fn,bh as On,bi as $n,bj as Tt,bk as Yt,bl as zn,bm as yo,bn as pn,bo as _o,bp as jo,bq as Eo,br as Ro,bs as wo}from"./index-5uJTtKF7.js";import{t as ko}from"./ChevronDown-l4iG0p-P.js";import{ad as hn,v as To,T as vs,E as No,u as bs,af as Vo,_ as Do}from"./agent-icon-BHmHLR-n.js";import{i as Ss}from"./ChevronRight-BgMlkNeC.js";import{n as Po}from"./ChevronUp-DOlZYOVw.js";import{i as Ao}from"./Globe01-Bl9pBdBK.js";import{B as Jt}from"./automation-runs-BPvY5e0p.js";import{c as yt,T as _t,a as jt}from"./tooltip-H0fhJGAw.js";import{b as Co,h as Mo,a as Bo,c as Ko,d as Lo,e as Fo}from"./dialog-dwIz7L83.js";import{I as Io}from"./input-B8CuwYhS.js";import{a as xs}from"./Copy01-CKF7O5eT.js";import{i as Oo}from"./Settings02-DrpZgC_J.js";import{s as $o}from"./Eye-DoysLbE1.js";import{s as ys}from"./TrendUp01-Drrs9no-.js";import{s as vn}from"./Plus-tOluSbOt.js";import{s as _s}from"./Trash01-CCc2xaoD.js";import{i as zo}from"./Zap-DW4Pf0JH.js";import{D as js,a as vt,c as Es,b as Rs,i as Ho}from"./dropdown-menu-DBTeEfEp.js";import{S as Uo,r as Hn,u as qo,d as Go,a as Wo,i as Yo,f as Jo,P as Qo,b as Xo}from"./page-seo-form-CoUiXlS_.js";import{c as Zo}from"./Tool01-Dc3mraKQ.js";import{u as er,A as tr}from"./use-section-preview-base-DadVPpps.js";import"./ArrowUp-Dl3cQVzC.js";import"./chat-context-WBuSodUL.js";import"./tab-id-Bxlhy6J5.js";import"./Check-CQsEmdtb.js";import"./hooks-C786cEpP.js";import"./use-mcp-client-BYQZ09jw.js";import"./auth-CHfV0PAM.js";import"./decopilot-sse-pool-DEYtntVd.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-Cfa_s6xG.js";import"./use-ai-providers-BHJZGUc0.js";import"./studio-tools-Cl_MnIvi.js";import"./use-decopilot-events-a7Wk8Vas.js";import"./use-organization-settings-DO-5TCG5.js";import"./spinner-DGBqgXCx.js";import"./drawer-CgKwyvsH.js";import"./collection-search-TJMJz_8d.js";import"./SearchMd-P-qGR4xa.js";import"./use-mobile-BpvQFpHJ.js";import"./AreaChart-DF9gicSk.js";import"./index-cjWVUbYe.js";import"./X-Db6CXFPy.js";import"./shell-layout-B5fO0Zra.js";import"./avatar-z-df-Tey.js";import"./User01-DQvk8cF7.js";import"./Users03-BJlJhI3u.js";import"./SearchLg-C67h3xK8.js";import"./Stars02-CV1jiWYO.js";import"./XClose-C0MPTyCv.js";import"./CheckCircle-DR3Li8PK.js";import"./CpuChip01-rrqN9f4p.js";import"./FilterLines-CXcCTqQu.js";import"./Monitor01-BT8u7fos.js";import"./required-auth-layout-088Qrhua.js";import"./use-org-sso-BCOboyXc.js";import"./ZapSquare-CATFBr1V.js";import"./Star01-BYdY-DAR.js";import"./Upload01-pkxuOolK.js";import"./AlertCircle-WwYKI5Qb.js";import"./form-Z85glc_u.js";import"./label-mbqBY0TT.js";import"./select-DwoG3i35.js";import"./ArrowLeft-aA-FzaCr.js";import"./XCircle-u_MUCjn5.js";import"./tabs-CEYHI8Md.js";import"./Tool02-Br6dtRR1.js";import"./toggle-group-2FXdfAeH.js";import"./use-deco-credits-g0IlK0Pn.js";import"./sidebar-DgQgb5sn.js";import"./LayoutLeft-CV2T0vO3.js";import"./popover-jpJstolX.js";import"./alert-dialog-6X4VWLwP.js";import"./toolbar-DJeYjzbm.js";import"./skeleton-BAWjjFCN.js";import"./github-repo-picker-CgqrZDpc.js";import"./use-debounced-value-Dp6sftMR.js";import"./use-connection-C06aQf36.js";import"./authenticate-and-persist-oauth-2C0xJmA1.js";import"./mcp-oauth-Bh4D_1yr.js";import"./LinkExternal01-DLPXVHWD.js";import"./Share07-DGsuXOEY.js";import"./use-mcp-tools-1zzjIAwR.js";import"./extract-connection-data-CW-wL2c1.js";import"./metadata-dUsYcpuu.js";import"./use-navigate-to-agent-BqIzfs1W.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-Cetubrum.js";import"./use-registry-connections-DAUYDjwC.js";import"./useInfiniteQuery-BSP--nFF.js";import"./use-infinite-scroll-CbzOsGKa.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-BvQeGTaA.js";import"./integration-icon-CyGR5k8y.js";import"./textarea-1wjTSY40.js";import"./connection-form-helpers-BVEb50_K.js";import"./collection-tabs-DOWoAX_i.js";import"./badge-CSetiRsF.js";import"./useSuspenseInfiniteQuery-CrU4YP2H.js";import"./use-open-billing-url-DhJWA6Ab.js";import"./select-model-BJcNU1LC.js";import"./checkbox-CHPu3dI7.js";import"./Key01-Ch_IQKvS.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BaQE1wG9.js";import"./ArrowUpRight-BZW220i4.js";import"./Stars01-DsD31Ln0.js";import"./cards-DM50BBl9.js";import"./DotsVertical-CowCWATW.js";import"./Palette-CZ3inffY.js";import"./file-type-icon-BkqsbMIs.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-B7jzN0nF.js";import"./empty-state-DIZU59YF.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-wtjHty-j.js";import"./monaco-editor-BEE54e2X.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./switch-BkAM2D0l.js";import"./Play-D7O034DB.js";import"./use-debounced-autosave-JjCfq5kj.js";import"./index-BHdTRFZE.js";import"./search-input-yzjarZOy.js";import"./index-DBCVpCmb.js";import"./Users01-BTeOoP3Y.js";import"./use-secrets-DbAKuIqf.js";import"./self-tool-result-BIcvrUov.js";import"./format-time-BnbuEtat.js";import"./use-members-hO-mw4Hb.js";import"./use-org-auth-client-BemR7rGU.js";import"./use-copy-gW0QHo8P.js";import"./SwitchHorizontal01-44Mb4crN.js";import"./use-tags-C70JhIII.js";import"./get-initials-D-f_fDFw.js";import"./command-B1gQ3Abx.js";import"./index-D6mIw648.js";import"./use-file-configs-BXAOsCuo.js";import"./use-automations-CUmyAWfM.js";import"./automation-list-row-CRYE-69o.js";import"./CreditCard01-DD6aW3wk.js";import"./Globe04-Ccsw_B8c.js";import"./HardDrive-D30Gjyo8.js";import"./LogOut01-BtWQrKvN.js";import"./Sun-C9UnoqJl.js";import"./Shield01-DVvWyA23.js";import"./table-wkh9heo2.js";import"./use-clock-tick-CxYlu2Gq.js";function nr(g){return g.schema?.definitions??g.schema?.$defs??{}}function sr(g,e){const r=nr(e),d=r[btoa(g)];if(!d)return;let p=typeof d.image=="string"?d.image:void 0;if(!p&&Array.isArray(d.allOf)){const b=d.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof b=="string"){const S=b.replace("#/definitions/",""),m=r[S];p=typeof m?.image=="string"?m.image:void 0}}if(p?.includes("{{{"))return p}function ar(g,e){if(!e)return;const r=Ba(g);if(!r)return;const d=sr(r.resolveType,e);if(!d)return;const p=Ka(d,r.data);if(p)return La(p)}const or="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",rr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Un(g){return Array.from({length:g},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ws(g){return g.map((e,r)=>({...e,index:r}))}function ir(g,e){if(e===g.length)return g;if(e<g.length)return ws(g.slice(0,e));const r=Array.from({length:e-g.length},(d,p)=>({id:crypto.randomUUID(),index:g.length+p}));return[...g,...r]}function ks(g){const e=Ge.c(20),{section:r,raw:d,meta:p}=g,b=r.isSavedBlock===!0,S=r.isMultivariate===!0;let m;e[0]!==p||e[1]!==d?(m=d&&p?ar(d,p):void 0,e[0]=p,e[1]=d,e[2]=m):m=e[2];const x=m;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(To,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=u):u=e[3];let y;e[4]!==x?(y=x&&n.jsx("img",{src:x,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=x,e[5]=y):y=e[5];let T;e[6]!==S||e[7]!==b?(T=b?{color:$a}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=b,e[8]=T):T=e[8];let V;e[9]!==T?(V=n.jsx(hn,{className:"h-4 w-4 shrink-0",style:T}),e[9]=T,e[10]=V):V=e[10];const E=r.isHidden&&"line-through opacity-50";let i;e[11]!==E?(i=$e("min-w-0 flex-1 truncate text-sm font-medium",E),e[11]=E,e[12]=i):i=e[12];let h;e[13]!==r.label||e[14]!==i?(h=n.jsx("span",{className:i,children:r.label}),e[13]=r.label,e[14]=i,e[15]=h):h=e[15];let o;return e[16]!==y||e[17]!==V||e[18]!==h?(o=n.jsxs(n.Fragment,{children:[u,y,V,h]}),e[16]=y,e[17]=V,e[18]=h,e[19]=o):o=e[19],o}const lr="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",cr="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-7 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-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ur="w-7 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 gn(g,e){return $e("h-7 shrink-0 overflow-hidden",e?lr:g?ur:cr)}function Ts(g,e){const r=g.isSavedBlock===!0,d=g.isMultivariate===!0;return $e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?or:d?ls:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function dr(g){const e=Ge.c(82),{section:r,raw:d,meta:p,sortableId:b,selected:S,onSelect:m,onDelete:x,onDuplicate:u,onMakeReusable:y,onToggleHidden:T,onToggleLazy:V,onAddVariant:E,onDetach:i}=g,h=ct(),o=d?os(d.__resolveType??""):!1,P=r.isHidden===!0,l=o||P;let R;e[0]!==r?(R=Fa(r),e[0]=r,e[1]=R):R=e[1];const K=R;let O;e[2]!==b?(O={id:b,animateLayoutChanges:hr},e[2]=b,e[3]=O):O=e[3];const{attributes:H,listeners:f,setNodeRef:A,transform:De,isDragging:C}=rs(O);let ce;e[4]!==De?(ce=is.Transform.toString(De?{...De,x:0}:null),e[4]=De,e[5]=ce):ce=e[5];const B=C?0:void 0;let ne;e[6]!==ce||e[7]!==B?(ne={transform:ce,opacity:B},e[6]=ce,e[7]=B,e[8]=ne):ne=e[8];const F=ne;let ie;e[9]!==r?(ie=Ia(r),e[9]=r,e[10]=ie):ie=e[10];const le=ie,ye="button",X=0;let Z;e[11]!==m?(Z=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m())},e[11]=m,e[12]=Z):Z=e[12];const ge=C?"cursor-grabbing":"cursor-pointer";let se;e[13]!==r||e[14]!==S||e[15]!==ge?(se=$e("touch-none transition-colors",ge,Ts(r,S)),e[13]=r,e[14]=S,e[15]=ge,e[16]=se):se=e[16];let L;e[17]!==p||e[18]!==d||e[19]!==r?(L=n.jsx(ks,{section:r,raw:d,meta:p}),e[17]=p,e[18]=d,e[19]=r,e[20]=L):L=e[20];const ze=!r.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(o?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:$e(gn(l,o)),onClick:N=>{N.stopPropagation(),V()},onPointerDown:gr,children:n.jsx(zo,{className:$e("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(jt,{side:"bottom",children:h(o?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),nt=!r.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(P?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:$e(gn(l,P)),onClick:N=>{N.stopPropagation(),T()},onPointerDown:pr,children:P?n.jsx(Oo,{className:"h-3.5 w-3.5"}):n.jsx($o,{className:"h-3.5 w-3.5"})})}),n.jsx(jt,{side:"bottom",children:h(P?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),Le=Es,Me=js,Y=!0,ee=Xe,Fe="button",Pe="ghost",_e="icon";let ue;e[21]!==h?(ue=h("sectionsEditor.sectionList.sectionActionsMenu"),e[21]=h,e[22]=ue):ue=e[22];const he=$e(gn(l,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let je;e[23]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(vs,{className:"h-3.5 w-3.5"}),e[23]=je):je=e[23];let ke;e[24]!==ee||e[25]!==ue||e[26]!==he?(ke=n.jsx(ee,{type:Fe,variant:Pe,size:_e,"aria-label":ue,className:he,onClick:fr,onPointerDown:mr,children:je}),e[24]=ee,e[25]=ue,e[26]=he,e[27]=ke):ke=e[27];let ve;e[28]!==Me||e[29]!==ke?(ve=n.jsx(Me,{asChild:Y,children:ke}),e[28]=Me,e[29]=ke,e[30]=ve):ve=e[30];let ae;e[31]!==u?(ae=N=>{N.stopPropagation(),u()},e[31]=u,e[32]=ae):ae=e[32];let Ae;e[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(xs,{className:"h-4 w-4"}),e[33]=Ae):Ae=e[33];let Ee;e[34]!==h?(Ee=h("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=h,e[35]=Ee):Ee=e[35];let fe;e[36]!==ae||e[37]!==Ee?(fe=n.jsxs(vt,{onClick:ae,children:[Ae,Ee]}),e[36]=ae,e[37]=Ee,e[38]=fe):fe=e[38];let $;e[39]!==K||e[40]!==E||e[41]!==h?($=K&&n.jsxs(vt,{className:Oa,onClick:N=>{N.stopPropagation(),E()},children:[n.jsx(ys,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=K,e[40]=E,e[41]=h,e[42]=$):$=e[42];let pe;e[43]!==le||e[44]!==y||e[45]!==h?(pe=le&&n.jsxs(vt,{className:rr,onClick:N=>{N.stopPropagation(),y()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=le,e[44]=y,e[45]=h,e[46]=pe):pe=e[46];let Ce;e[47]!==i||e[48]!==r.isMultivariate||e[49]!==r.isSavedBlock||e[50]!==h?(Ce=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(vt,{onClick:N=>{N.stopPropagation(),i()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=i,e[48]=r.isMultivariate,e[49]=r.isSavedBlock,e[50]=h,e[51]=Ce):Ce=e[51];let be;e[52]!==x?(be=N=>{N.stopPropagation(),x()},e[52]=x,e[53]=be):be=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=n.jsx(_s,{className:"h-4 w-4"}),e[54]=Se):Se=e[54];let q;e[55]!==h?(q=h("sectionsEditor.sectionList.deleteMenuItem"),e[55]=h,e[56]=q):q=e[56];let oe;e[57]!==be||e[58]!==q?(oe=n.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:be,children:[Se,q]}),e[57]=be,e[58]=q,e[59]=oe):oe=e[59];let de;e[60]!==fe||e[61]!==$||e[62]!==pe||e[63]!==Ce||e[64]!==oe?(de=n.jsxs(Rs,{align:"end",className:"w-44",children:[fe,$,pe,Ce,oe]}),e[60]=fe,e[61]=$,e[62]=pe,e[63]=Ce,e[64]=oe,e[65]=de):de=e[65];let Re;e[66]!==Le||e[67]!==ve||e[68]!==de?(Re=n.jsxs(Le,{children:[ve,de]}),e[66]=Le,e[67]=ve,e[68]=de,e[69]=Re):Re=e[69];let me;return e[70]!==H||e[71]!==f||e[72]!==m||e[73]!==A||e[74]!==F||e[75]!==se||e[76]!==L||e[77]!==ze||e[78]!==nt||e[79]!==Re||e[80]!==Z?(me=n.jsxs("div",{ref:A,style:F,...H,...f,role:ye,tabIndex:X,onClick:m,onKeyDown:Z,className:se,children:[L,ze,nt,Re]}),e[70]=H,e[71]=f,e[72]=m,e[73]=A,e[74]=F,e[75]=se,e[76]=L,e[77]=ze,e[78]=nt,e[79]=Re,e[80]=Z,e[81]=me):me=e[81],me}function mr(g){return g.stopPropagation()}function fr(g){return g.stopPropagation()}function pr(g){return g.stopPropagation()}function gr(g){return g.stopPropagation()}function hr(){return!1}function vr(g){const e=Ge.c(104),{listKey:r,rawSections:d,sections:p,meta:b,selectedIndex:S,onSelect:m,onReorder:x,onDelete:u,onDuplicate:y,onMakeReusable:T,onToggleHidden:V,onToggleLazy:E,onAddVariant:i,onDetach:h,onAddSection:o,canAddSection:P}=g,l=P===void 0?!0:P,R=ct();let K;e[0]!==p.length?(K=()=>Un(p.length),e[0]=p.length,e[1]=K):K=e[1];const[O,H]=w.useState(K),[f,A]=w.useState(null),[De,C]=w.useState(r),[ce,B]=w.useState(p.length),ne=w.useRef(!1);De!==r?(C(r),B(p.length),H(Un(p.length))):ce!==p.length&&(B(p.length),H(me=>ir(me,p.length)));let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[2]=F):F=e[2];let ie;e[3]===Symbol.for("react.memo_cache_sentinel")?(ie={coordinateGetter:cs},e[3]=ie):ie=e[3];const le=es(Qt(as,F),Qt(ss,ie));let ye;e[4]!==O?(ye=O.map(br),e[4]=O,e[5]=ye):ye=e[5];const X=ye;let Z;e[6]===Symbol.for("react.memo_cache_sentinel")?(Z=me=>{A(String(me.active.id))},e[6]=Z):Z=e[6];const ge=Z;let se;e[7]!==X||e[8]!==x?(se=me=>{A(null);const{active:N,over:re}=me;if(!re||N.id===re.id)return;const I=X.indexOf(String(N.id)),Be=X.indexOf(String(re.id));I===-1||Be===-1||(H(ut=>ws(Mt([...ut],I,Be))),ne.current=!0,requestAnimationFrame(()=>{ne.current=!1}),x?.(I,Be))},e[7]=X,e[8]=x,e[9]=se):se=e[9];const L=se;let ze;e[10]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{A(null)},e[10]=ze):ze=e[10];const nt=ze;let Le,Me,Y,ee,Fe,Pe,_e,ue,he,je,ke,ve,ae,Ae,Ee;if(e[11]!==f||e[12]!==l||e[13]!==O||e[14]!==X||e[15]!==L||e[16]!==b||e[17]!==o||e[18]!==i||e[19]!==u||e[20]!==h||e[21]!==y||e[22]!==T||e[23]!==m||e[24]!==V||e[25]!==E||e[26]!==d||e[27]!==p||e[28]!==S||e[29]!==le||e[30]!==R){Ae=Symbol.for("react.early_return_sentinel");e:{const me=N=>{ne.current||m(N)};if(e[46]!==f||e[47]!==l||e[48]!==O||e[49]!==o||e[50]!==d||e[51]!==p||e[52]!==R){const N=f?O.find(re=>re.id===f):null;if(ee=N!=null?p[N.index]:null,Y=N!=null?d[N.index]:void 0,O.length===0){let re;e[56]!==R?(re=R("sectionsEditor.sectionList.noSections"),e[56]=R,e[57]=re):re=e[57];let I;e[58]!==re?(I=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:re}),e[58]=re,e[59]=I):I=e[59];const Be=!l;let ut;e[60]===Symbol.for("react.memo_cache_sentinel")?(ut=n.jsx(vn,{size:14}),e[60]=ut):ut=e[60];let Te;e[61]!==R?(Te=R("sectionsEditor.sectionList.addSectionButton"),e[61]=R,e[62]=Te):Te=e[62];let We;e[63]!==o||e[64]!==Be||e[65]!==Te?(We=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Be,onClick:o,children:[ut,Te]}),e[63]=o,e[64]=Be,e[65]=Te,e[66]=We):We=e[66];let Ie;e[67]!==I||e[68]!==We?(Ie=n.jsxs("div",{className:"space-y-2",children:[I,We]}),e[67]=I,e[68]=We,e[69]=Ie):Ie=e[69],Ae=Ie;break e}ae=$e(N&&"cursor-grabbing"),e[46]=f,e[47]=l,e[48]=O,e[49]=o,e[50]=d,e[51]=p,e[52]=R,e[53]=Y,e[54]=ee,e[55]=ae}else Y=e[53],ee=e[54],ae=e[55];Me=us,ue=le,he=ds,je=ge,ke=L,ve=nt,Le=ms,Pe=X,_e=fs,Ee="space-y-1",Fe=O.map(N=>{const re=p[N.index];return re?n.jsx(dr,{sortableId:N.id,section:re,raw:d[N.index],meta:b,selected:S===N.index,onSelect:()=>me(N.index),onDelete:()=>u(N.index),onDuplicate:()=>y(N.index),onMakeReusable:()=>T(N.index),onToggleHidden:()=>V(N.index),onToggleLazy:()=>E(N.index),onAddVariant:()=>i(N.index),onDetach:()=>h(N.index)},N.id):null})}e[11]=f,e[12]=l,e[13]=O,e[14]=X,e[15]=L,e[16]=b,e[17]=o,e[18]=i,e[19]=u,e[20]=h,e[21]=y,e[22]=T,e[23]=m,e[24]=V,e[25]=E,e[26]=d,e[27]=p,e[28]=S,e[29]=le,e[30]=R,e[31]=Le,e[32]=Me,e[33]=Y,e[34]=ee,e[35]=Fe,e[36]=Pe,e[37]=_e,e[38]=ue,e[39]=he,e[40]=je,e[41]=ke,e[42]=ve,e[43]=ae,e[44]=Ae,e[45]=Ee}else Le=e[31],Me=e[32],Y=e[33],ee=e[34],Fe=e[35],Pe=e[36],_e=e[37],ue=e[38],he=e[39],je=e[40],ke=e[41],ve=e[42],ae=e[43],Ae=e[44],Ee=e[45];if(Ae!==Symbol.for("react.early_return_sentinel"))return Ae;let fe;e[70]!==Fe||e[71]!==Ee?(fe=n.jsx("div",{className:Ee,children:Fe}),e[70]=Fe,e[71]=Ee,e[72]=fe):fe=e[72];let $;e[73]!==Le||e[74]!==Pe||e[75]!==_e||e[76]!==fe?($=n.jsx(Le,{items:Pe,strategy:_e,children:fe}),e[73]=Le,e[74]=Pe,e[75]=_e,e[76]=fe,e[77]=$):$=e[77];let pe;e[78]!==Y||e[79]!==ee||e[80]!==b?(pe=ee?n.jsx("div",{className:$e("cursor-grabbing shadow-lg ring-1 ring-border/60",Ts(ee,!1)),children:n.jsx(ks,{section:ee,raw:Y,meta:b})}):null,e[78]=Y,e[79]=ee,e[80]=b,e[81]=pe):pe=e[81];let Ce;e[82]!==pe?(Ce=Xn.createPortal(n.jsx(ts,{dropAnimation:ns,children:pe}),document.body),e[82]=pe,e[83]=Ce):Ce=e[83];let be;e[84]!==Me||e[85]!==ue||e[86]!==he||e[87]!==je||e[88]!==ke||e[89]!==ve||e[90]!==$||e[91]!==Ce?(be=n.jsxs(Me,{sensors:ue,collisionDetection:he,onDragStart:je,onDragEnd:ke,onDragCancel:ve,children:[$,Ce]}),e[84]=Me,e[85]=ue,e[86]=he,e[87]=je,e[88]=ke,e[89]=ve,e[90]=$,e[91]=Ce,e[92]=be):be=e[92];const Se=!l;let q;e[93]===Symbol.for("react.memo_cache_sentinel")?(q=n.jsx(vn,{size:14}),e[93]=q):q=e[93];let oe;e[94]!==R?(oe=R("sectionsEditor.sectionList.addSectionButton"),e[94]=R,e[95]=oe):oe=e[95];let de;e[96]!==o||e[97]!==Se||e[98]!==oe?(de=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Se,onClick:o,children:[q,oe]}),e[96]=o,e[97]=Se,e[98]=oe,e[99]=de):de=e[99];let Re;return e[100]!==ae||e[101]!==be||e[102]!==de?(Re=n.jsxs("div",{className:ae,children:[be,de]}),e[100]=ae,e[101]=be,e[102]=de,e[103]=Re):Re=e[103],Re}function br(g){return g.id}function qn(g){const e=Ge.c(57),{open:r,initialName:d,autoLabel:p,isPending:b,onSubmit:S,onOpenChange:m}=g,x=b===void 0?!1:b,u=ct(),[y,T]=w.useState(d),[V,E]=w.useState(r);r!==V&&(E(r),r&&T(d));let i;e[0]!==x||e[1]!==m?(i=ge=>{!ge&&!x&&m(!1)},e[0]=x,e[1]=m,e[2]=i):i=e[2];const h=i;let o;e[3]!==x||e[4]!==y||e[5]!==S?(o=async ge=>{ge.preventDefault(),!x&&await S(y.trim())},e[3]=x,e[4]=y,e[5]=S,e[6]=o):o=e[6];const P=o;let l;e[7]!==u?(l=u("sectionsEditor.variantRenameDialog.title"),e[7]=u,e[8]=l):l=e[8];let R;e[9]!==l?(R=n.jsx(Co,{children:l}),e[9]=l,e[10]=R):R=e[10];let K;e[11]!==p||e[12]!==u?(K=u("sectionsEditor.variantRenameDialog.description",{fallback:p||u("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=p,e[12]=u,e[13]=K):K=e[13];let O;e[14]!==K?(O=n.jsx(Mo,{children:K}),e[14]=K,e[15]=O):O=e[15];let H;e[16]!==R||e[17]!==O?(H=n.jsxs(Bo,{children:[R,O]}),e[16]=R,e[17]=O,e[18]=H):H=e[18];let f;e[19]!==u?(f=u("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=u,e[20]=f):f=e[20];let A;e[21]!==f?(A=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:f}),e[21]=f,e[22]=A):A=e[22];let De;e[23]===Symbol.for("react.memo_cache_sentinel")?(De=ge=>T(ge.target.value),e[23]=De):De=e[23];let C;e[24]!==p||e[25]!==x||e[26]!==y?(C=n.jsx(Io,{id:"variant-rename-name",value:y,onChange:De,placeholder:p,autoFocus:!0,disabled:x}),e[24]=p,e[25]=x,e[26]=y,e[27]=C):C=e[27];let ce;e[28]!==A||e[29]!==C?(ce=n.jsxs("div",{className:"space-y-1.5 py-4",children:[A,C]}),e[28]=A,e[29]=C,e[30]=ce):ce=e[30];let B;e[31]!==m?(B=()=>m(!1),e[31]=m,e[32]=B):B=e[32];let ne;e[33]!==u?(ne=u("sectionsEditor.variantRenameDialog.cancel"),e[33]=u,e[34]=ne):ne=e[34];let F;e[35]!==x||e[36]!==B||e[37]!==ne?(F=n.jsx(Xe,{type:"button",variant:"outline",onClick:B,disabled:x,children:ne}),e[35]=x,e[36]=B,e[37]=ne,e[38]=F):F=e[38];let ie;e[39]!==x||e[40]!==u?(ie=x?n.jsxs(n.Fragment,{children:[n.jsx(Zn,{size:14,className:"animate-spin"}),u("sectionsEditor.variantRenameDialog.saving")]}):u("sectionsEditor.variantRenameDialog.save"),e[39]=x,e[40]=u,e[41]=ie):ie=e[41];let le;e[42]!==x||e[43]!==ie?(le=n.jsx(Xe,{type:"submit",disabled:x,children:ie}),e[42]=x,e[43]=ie,e[44]=le):le=e[44];let ye;e[45]!==F||e[46]!==le?(ye=n.jsxs(Ko,{children:[F,le]}),e[45]=F,e[46]=le,e[47]=ye):ye=e[47];let X;e[48]!==P||e[49]!==ce||e[50]!==ye||e[51]!==H?(X=n.jsx(Lo,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:P,children:[H,ce,ye]})}),e[48]=P,e[49]=ce,e[50]=ye,e[51]=H,e[52]=X):X=e[52];let Z;return e[53]!==h||e[54]!==r||e[55]!==X?(Z=n.jsx(Fo,{open:r,onOpenChange:h,children:X}),e[53]=h,e[54]=r,e[55]=X,e[56]=Z):Z=e[56],Z}function Ns(g){const e=Ge.c(5),{rule:r,matchers:d}=g,p=r?.__resolveType??"";let b;if(e[0]!==d||e[1]!==p){const u=d.find(y=>y.resolveType===p)?.iconName??za(p);b=No(u),e[0]=d,e[1]=p,e[2]=b}else b=e[2];const S=b;if(!S)return null;let m;return e[3]!==S?(m=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=m):m=e[4],m}function Gn(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
1
+ import{c as Ge,b as ct,r as w,m as $e,j as n,ae as Xn,B as Xe,k as Zn,o as Ca,t as Q,K as Ma}from"./index-DDNkkWLs.js";import{ap as Ba,aq as Ka,ar as La,a4 as es,a5 as Qt,as as ts,at as ns,a6 as ss,a7 as as,au as os,av as Fa,ae as rs,af as is,aw as Ia,ax as Oa,ay as ls,O as $a,a8 as cs,a9 as Mt,ac as us,ad as ds,aa as ms,ak as fs,az as za,aA as Bt,aB as ps,aC as Ha,S as gs,aD as lt,G as hs,aE as Ua,aF as qa,aG as Ga,aH as Wa,D as Ya,F as Ja,aI as Qa,aJ as Xa,aK as Za,aL as eo,ai as qt,aM as Gt,aN as to,aO as St,aP as Pt,aQ as no,aR as so,aS as tt,aT as Kn,aU as ao,aV as At,aW as Wt,aX as oo,aY as mn,aZ as ro,a_ as kt,a$ as io,b0 as lo,b1 as co,b2 as uo,b3 as mo,b4 as xt,b5 as fo,b6 as po,b7 as go,I as ho,b8 as Ln,b9 as Ct,ba as Fn,bb as In,bc as vo,bd as bo,be as So,bf as xo,bg as fn,bh as On,bi as $n,bj as Tt,bk as Yt,bl as zn,bm as yo,bn as pn,bo as _o,bp as jo,bq as Eo,br as Ro,bs as wo}from"./index-DUS53ufg.js";import{t as ko}from"./ChevronDown-65wLzJTw.js";import{ad as hn,v as To,T as vs,E as No,u as bs,af as Vo,_ as Do}from"./agent-icon-BwZmxZXB.js";import{i as Ss}from"./ChevronRight-EyYVLyQY.js";import{n as Po}from"./ChevronUp-BNz5kAIR.js";import{i as Ao}from"./Globe01-BzoxFmTs.js";import{B as Jt}from"./automation-runs-Cdra6s3F.js";import{c as yt,T as _t,a as jt}from"./tooltip-11Yrt4wp.js";import{b as Co,h as Mo,a as Bo,c as Ko,d as Lo,e as Fo}from"./dialog-Ct9Ey8Rj.js";import{I as Io}from"./input-B6Ue8Gtq.js";import{a as xs}from"./Copy01-CC0Hd3xm.js";import{i as Oo}from"./Settings02-C6kyxW7G.js";import{s as $o}from"./Eye-DA0zzgps.js";import{s as ys}from"./TrendUp01-B5Y95ssn.js";import{s as vn}from"./Plus-D4rlrlLr.js";import{s as _s}from"./Trash01-CBJEu1qv.js";import{i as zo}from"./Zap-B7cBqfTM.js";import{D as js,a as vt,c as Es,b as Rs,i as Ho}from"./dropdown-menu-BggRvEh9.js";import{S as Uo,r as Hn,u as qo,d as Go,a as Wo,i as Yo,f as Jo,P as Qo,b as Xo}from"./page-seo-form-tKqIF-y-.js";import{c as Zo}from"./Tool01-CEpJ1e8Z.js";import{u as er,A as tr}from"./use-section-preview-base-D_sClGro.js";import"./ArrowUp-D_w2qey6.js";import"./chat-context-IReX7DMx.js";import"./tab-id-CiGWDuEk.js";import"./Check-BuqR_Kwe.js";import"./hooks-B2o1BQtV.js";import"./use-mcp-client-B1vuae8u.js";import"./auth-BN6YAe4k.js";import"./decopilot-sse-pool-gVDOcCp6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-DrXsz2Gh.js";import"./use-ai-providers-CUHFWYci.js";import"./studio-tools-DM5QBHCQ.js";import"./use-decopilot-events-BcjIJdRs.js";import"./use-organization-settings-B2Gux989.js";import"./spinner-ws5yutkc.js";import"./drawer-GYAwqNoq.js";import"./collection-search-DhMY4ddj.js";import"./SearchMd-CGwyuA_K.js";import"./use-mobile-Cavq-ZyH.js";import"./AreaChart-CeR7jziX.js";import"./index-Byd_5VBR.js";import"./X-Co0bDnHw.js";import"./shell-layout-DvrKfubx.js";import"./avatar-BoobWyQ-.js";import"./User01-wzGmobUI.js";import"./Users03-BAonmOfw.js";import"./SearchLg-DxcRs5em.js";import"./Stars02-B6VMIlyW.js";import"./XClose-BZUFm2pl.js";import"./CheckCircle-Bp_VEEVz.js";import"./CpuChip01-AFiwguFW.js";import"./FilterLines-URZsEuaM.js";import"./Monitor01-CvmVoJ-i.js";import"./required-auth-layout-QkQ_LFn1.js";import"./use-org-sso-Bv_JE25K.js";import"./ZapSquare-Cois6M8k.js";import"./Star01-DSgMIlZH.js";import"./Upload01-BtHH4hys.js";import"./AlertCircle-Bj0VV7up.js";import"./form-ahiIaHkC.js";import"./label-ByQVKXpC.js";import"./select-Bn2gd7PP.js";import"./ArrowLeft-BqlCFBY7.js";import"./XCircle-C2qoD1I-.js";import"./tabs-CA2r-tm8.js";import"./Tool02-Cn87iqZi.js";import"./toggle-group-BEWMY4aK.js";import"./use-deco-credits-Cthvsr_H.js";import"./sidebar-6Pwgqwg8.js";import"./LayoutLeft-Dve3wTbL.js";import"./popover-C4xldx8X.js";import"./alert-dialog-Dw-FseSS.js";import"./toolbar-DOAlJJnD.js";import"./skeleton-BAcj33ku.js";import"./github-repo-picker-CzqkmjKN.js";import"./use-debounced-value-CkNYo5YL.js";import"./use-connection-DVLPDTuB.js";import"./authenticate-and-persist-oauth-C7D93rUY.js";import"./mcp-oauth-upBlM6GN.js";import"./LinkExternal01-BT1cKht3.js";import"./Share07-q1slgvW5.js";import"./use-mcp-tools-DwnvrfSJ.js";import"./extract-connection-data-Da3hmofn.js";import"./metadata-dUsYcpuu.js";import"./use-navigate-to-agent-CO828s2W.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-DzP8uvoS.js";import"./use-registry-connections-B30kwQ-D.js";import"./useInfiniteQuery-CpFXCemx.js";import"./use-infinite-scroll-B52yZeYp.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-Bits-eBf.js";import"./integration-icon-WlgJZAAr.js";import"./textarea-Cgxpb5eg.js";import"./connection-form-helpers-RsEw84Yh.js";import"./collection-tabs-ByKLfy-a.js";import"./badge-Be6ykVtM.js";import"./useSuspenseInfiniteQuery-BSnce96W.js";import"./use-open-billing-url-Cq6CFoOt.js";import"./select-model-2-cyvNOe.js";import"./checkbox-BQcYZZpc.js";import"./Key01-f9O3oH8b.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-rIBQA49t.js";import"./ArrowUpRight-DZ8WfL-N.js";import"./Stars01-Cv4Wame5.js";import"./cards-PKu1jg4N.js";import"./DotsVertical-DlkoNOjo.js";import"./Palette--hypnXQO.js";import"./file-type-icon-_hn3I6uX.js";import"./question-004-sINsf4GQ.js";import"./use-members-Cu4tim8h.js";import"./use-org-auth-client-BQJU69BH.js";import"./use-status-sounds-CT1tk-BS.js";import"./empty-state-Cp2wPJZ8.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-DcMyBnS4.js";import"./monaco-editor-B8kAUX7x.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./switch-DkU4M0dt.js";import"./Play-xBu_rWbV.js";import"./use-debounced-autosave-yTGUa49y.js";import"./index-BY10LBdj.js";import"./search-input-kBCGvCld.js";import"./index-DLk8Iv0l.js";import"./Users01-JAFRD8ie.js";import"./use-secrets-DVBgSmhl.js";import"./self-tool-result-PcOApdBI.js";import"./format-time-BnbuEtat.js";import"./use-copy-D-GM29SE.js";import"./SwitchHorizontal01-OZQMkGRb.js";import"./use-tags-CzUPzpBT.js";import"./get-initials-D-f_fDFw.js";import"./command-BszbaY2I.js";import"./index-CNhpdWse.js";import"./use-file-configs-CpKyEHH5.js";import"./use-automations-iQtt0rLd.js";import"./automation-list-row-wSuBQBzW.js";import"./CreditCard01-Crsjk2NQ.js";import"./Globe04-3sGIF22h.js";import"./HardDrive-Do13Gda6.js";import"./LogOut01-BUyEI5Ky.js";import"./Sun-BhbPIZVi.js";import"./Shield01-CYrRKcNn.js";import"./table-la-GCDtJ.js";import"./use-clock-tick-QY57Oj13.js";function nr(g){return g.schema?.definitions??g.schema?.$defs??{}}function sr(g,e){const r=nr(e),d=r[btoa(g)];if(!d)return;let p=typeof d.image=="string"?d.image:void 0;if(!p&&Array.isArray(d.allOf)){const b=d.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof b=="string"){const S=b.replace("#/definitions/",""),m=r[S];p=typeof m?.image=="string"?m.image:void 0}}if(p?.includes("{{{"))return p}function ar(g,e){if(!e)return;const r=Ba(g);if(!r)return;const d=sr(r.resolveType,e);if(!d)return;const p=Ka(d,r.data);if(p)return La(p)}const or="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",rr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Un(g){return Array.from({length:g},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ws(g){return g.map((e,r)=>({...e,index:r}))}function ir(g,e){if(e===g.length)return g;if(e<g.length)return ws(g.slice(0,e));const r=Array.from({length:e-g.length},(d,p)=>({id:crypto.randomUUID(),index:g.length+p}));return[...g,...r]}function ks(g){const e=Ge.c(20),{section:r,raw:d,meta:p}=g,b=r.isSavedBlock===!0,S=r.isMultivariate===!0;let m;e[0]!==p||e[1]!==d?(m=d&&p?ar(d,p):void 0,e[0]=p,e[1]=d,e[2]=m):m=e[2];const x=m;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(To,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=u):u=e[3];let y;e[4]!==x?(y=x&&n.jsx("img",{src:x,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=x,e[5]=y):y=e[5];let T;e[6]!==S||e[7]!==b?(T=b?{color:$a}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=b,e[8]=T):T=e[8];let V;e[9]!==T?(V=n.jsx(hn,{className:"h-4 w-4 shrink-0",style:T}),e[9]=T,e[10]=V):V=e[10];const E=r.isHidden&&"line-through opacity-50";let i;e[11]!==E?(i=$e("min-w-0 flex-1 truncate text-sm font-medium",E),e[11]=E,e[12]=i):i=e[12];let h;e[13]!==r.label||e[14]!==i?(h=n.jsx("span",{className:i,children:r.label}),e[13]=r.label,e[14]=i,e[15]=h):h=e[15];let o;return e[16]!==y||e[17]!==V||e[18]!==h?(o=n.jsxs(n.Fragment,{children:[u,y,V,h]}),e[16]=y,e[17]=V,e[18]=h,e[19]=o):o=e[19],o}const lr="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",cr="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-7 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-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ur="w-7 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 gn(g,e){return $e("h-7 shrink-0 overflow-hidden",e?lr:g?ur:cr)}function Ts(g,e){const r=g.isSavedBlock===!0,d=g.isMultivariate===!0;return $e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?or:d?ls:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function dr(g){const e=Ge.c(82),{section:r,raw:d,meta:p,sortableId:b,selected:S,onSelect:m,onDelete:x,onDuplicate:u,onMakeReusable:y,onToggleHidden:T,onToggleLazy:V,onAddVariant:E,onDetach:i}=g,h=ct(),o=d?os(d.__resolveType??""):!1,P=r.isHidden===!0,l=o||P;let R;e[0]!==r?(R=Fa(r),e[0]=r,e[1]=R):R=e[1];const K=R;let O;e[2]!==b?(O={id:b,animateLayoutChanges:hr},e[2]=b,e[3]=O):O=e[3];const{attributes:H,listeners:f,setNodeRef:A,transform:De,isDragging:C}=rs(O);let ce;e[4]!==De?(ce=is.Transform.toString(De?{...De,x:0}:null),e[4]=De,e[5]=ce):ce=e[5];const B=C?0:void 0;let ne;e[6]!==ce||e[7]!==B?(ne={transform:ce,opacity:B},e[6]=ce,e[7]=B,e[8]=ne):ne=e[8];const F=ne;let ie;e[9]!==r?(ie=Ia(r),e[9]=r,e[10]=ie):ie=e[10];const le=ie,ye="button",X=0;let Z;e[11]!==m?(Z=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m())},e[11]=m,e[12]=Z):Z=e[12];const ge=C?"cursor-grabbing":"cursor-pointer";let se;e[13]!==r||e[14]!==S||e[15]!==ge?(se=$e("touch-none transition-colors",ge,Ts(r,S)),e[13]=r,e[14]=S,e[15]=ge,e[16]=se):se=e[16];let L;e[17]!==p||e[18]!==d||e[19]!==r?(L=n.jsx(ks,{section:r,raw:d,meta:p}),e[17]=p,e[18]=d,e[19]=r,e[20]=L):L=e[20];const ze=!r.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(o?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:$e(gn(l,o)),onClick:N=>{N.stopPropagation(),V()},onPointerDown:gr,children:n.jsx(zo,{className:$e("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(jt,{side:"bottom",children:h(o?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),nt=!r.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(P?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:$e(gn(l,P)),onClick:N=>{N.stopPropagation(),T()},onPointerDown:pr,children:P?n.jsx(Oo,{className:"h-3.5 w-3.5"}):n.jsx($o,{className:"h-3.5 w-3.5"})})}),n.jsx(jt,{side:"bottom",children:h(P?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),Le=Es,Me=js,Y=!0,ee=Xe,Fe="button",Pe="ghost",_e="icon";let ue;e[21]!==h?(ue=h("sectionsEditor.sectionList.sectionActionsMenu"),e[21]=h,e[22]=ue):ue=e[22];const he=$e(gn(l,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let je;e[23]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(vs,{className:"h-3.5 w-3.5"}),e[23]=je):je=e[23];let ke;e[24]!==ee||e[25]!==ue||e[26]!==he?(ke=n.jsx(ee,{type:Fe,variant:Pe,size:_e,"aria-label":ue,className:he,onClick:fr,onPointerDown:mr,children:je}),e[24]=ee,e[25]=ue,e[26]=he,e[27]=ke):ke=e[27];let ve;e[28]!==Me||e[29]!==ke?(ve=n.jsx(Me,{asChild:Y,children:ke}),e[28]=Me,e[29]=ke,e[30]=ve):ve=e[30];let ae;e[31]!==u?(ae=N=>{N.stopPropagation(),u()},e[31]=u,e[32]=ae):ae=e[32];let Ae;e[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(xs,{className:"h-4 w-4"}),e[33]=Ae):Ae=e[33];let Ee;e[34]!==h?(Ee=h("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=h,e[35]=Ee):Ee=e[35];let fe;e[36]!==ae||e[37]!==Ee?(fe=n.jsxs(vt,{onClick:ae,children:[Ae,Ee]}),e[36]=ae,e[37]=Ee,e[38]=fe):fe=e[38];let $;e[39]!==K||e[40]!==E||e[41]!==h?($=K&&n.jsxs(vt,{className:Oa,onClick:N=>{N.stopPropagation(),E()},children:[n.jsx(ys,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=K,e[40]=E,e[41]=h,e[42]=$):$=e[42];let pe;e[43]!==le||e[44]!==y||e[45]!==h?(pe=le&&n.jsxs(vt,{className:rr,onClick:N=>{N.stopPropagation(),y()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=le,e[44]=y,e[45]=h,e[46]=pe):pe=e[46];let Ce;e[47]!==i||e[48]!==r.isMultivariate||e[49]!==r.isSavedBlock||e[50]!==h?(Ce=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(vt,{onClick:N=>{N.stopPropagation(),i()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=i,e[48]=r.isMultivariate,e[49]=r.isSavedBlock,e[50]=h,e[51]=Ce):Ce=e[51];let be;e[52]!==x?(be=N=>{N.stopPropagation(),x()},e[52]=x,e[53]=be):be=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=n.jsx(_s,{className:"h-4 w-4"}),e[54]=Se):Se=e[54];let q;e[55]!==h?(q=h("sectionsEditor.sectionList.deleteMenuItem"),e[55]=h,e[56]=q):q=e[56];let oe;e[57]!==be||e[58]!==q?(oe=n.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:be,children:[Se,q]}),e[57]=be,e[58]=q,e[59]=oe):oe=e[59];let de;e[60]!==fe||e[61]!==$||e[62]!==pe||e[63]!==Ce||e[64]!==oe?(de=n.jsxs(Rs,{align:"end",className:"w-44",children:[fe,$,pe,Ce,oe]}),e[60]=fe,e[61]=$,e[62]=pe,e[63]=Ce,e[64]=oe,e[65]=de):de=e[65];let Re;e[66]!==Le||e[67]!==ve||e[68]!==de?(Re=n.jsxs(Le,{children:[ve,de]}),e[66]=Le,e[67]=ve,e[68]=de,e[69]=Re):Re=e[69];let me;return e[70]!==H||e[71]!==f||e[72]!==m||e[73]!==A||e[74]!==F||e[75]!==se||e[76]!==L||e[77]!==ze||e[78]!==nt||e[79]!==Re||e[80]!==Z?(me=n.jsxs("div",{ref:A,style:F,...H,...f,role:ye,tabIndex:X,onClick:m,onKeyDown:Z,className:se,children:[L,ze,nt,Re]}),e[70]=H,e[71]=f,e[72]=m,e[73]=A,e[74]=F,e[75]=se,e[76]=L,e[77]=ze,e[78]=nt,e[79]=Re,e[80]=Z,e[81]=me):me=e[81],me}function mr(g){return g.stopPropagation()}function fr(g){return g.stopPropagation()}function pr(g){return g.stopPropagation()}function gr(g){return g.stopPropagation()}function hr(){return!1}function vr(g){const e=Ge.c(104),{listKey:r,rawSections:d,sections:p,meta:b,selectedIndex:S,onSelect:m,onReorder:x,onDelete:u,onDuplicate:y,onMakeReusable:T,onToggleHidden:V,onToggleLazy:E,onAddVariant:i,onDetach:h,onAddSection:o,canAddSection:P}=g,l=P===void 0?!0:P,R=ct();let K;e[0]!==p.length?(K=()=>Un(p.length),e[0]=p.length,e[1]=K):K=e[1];const[O,H]=w.useState(K),[f,A]=w.useState(null),[De,C]=w.useState(r),[ce,B]=w.useState(p.length),ne=w.useRef(!1);De!==r?(C(r),B(p.length),H(Un(p.length))):ce!==p.length&&(B(p.length),H(me=>ir(me,p.length)));let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[2]=F):F=e[2];let ie;e[3]===Symbol.for("react.memo_cache_sentinel")?(ie={coordinateGetter:cs},e[3]=ie):ie=e[3];const le=es(Qt(as,F),Qt(ss,ie));let ye;e[4]!==O?(ye=O.map(br),e[4]=O,e[5]=ye):ye=e[5];const X=ye;let Z;e[6]===Symbol.for("react.memo_cache_sentinel")?(Z=me=>{A(String(me.active.id))},e[6]=Z):Z=e[6];const ge=Z;let se;e[7]!==X||e[8]!==x?(se=me=>{A(null);const{active:N,over:re}=me;if(!re||N.id===re.id)return;const I=X.indexOf(String(N.id)),Be=X.indexOf(String(re.id));I===-1||Be===-1||(H(ut=>ws(Mt([...ut],I,Be))),ne.current=!0,requestAnimationFrame(()=>{ne.current=!1}),x?.(I,Be))},e[7]=X,e[8]=x,e[9]=se):se=e[9];const L=se;let ze;e[10]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{A(null)},e[10]=ze):ze=e[10];const nt=ze;let Le,Me,Y,ee,Fe,Pe,_e,ue,he,je,ke,ve,ae,Ae,Ee;if(e[11]!==f||e[12]!==l||e[13]!==O||e[14]!==X||e[15]!==L||e[16]!==b||e[17]!==o||e[18]!==i||e[19]!==u||e[20]!==h||e[21]!==y||e[22]!==T||e[23]!==m||e[24]!==V||e[25]!==E||e[26]!==d||e[27]!==p||e[28]!==S||e[29]!==le||e[30]!==R){Ae=Symbol.for("react.early_return_sentinel");e:{const me=N=>{ne.current||m(N)};if(e[46]!==f||e[47]!==l||e[48]!==O||e[49]!==o||e[50]!==d||e[51]!==p||e[52]!==R){const N=f?O.find(re=>re.id===f):null;if(ee=N!=null?p[N.index]:null,Y=N!=null?d[N.index]:void 0,O.length===0){let re;e[56]!==R?(re=R("sectionsEditor.sectionList.noSections"),e[56]=R,e[57]=re):re=e[57];let I;e[58]!==re?(I=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:re}),e[58]=re,e[59]=I):I=e[59];const Be=!l;let ut;e[60]===Symbol.for("react.memo_cache_sentinel")?(ut=n.jsx(vn,{size:14}),e[60]=ut):ut=e[60];let Te;e[61]!==R?(Te=R("sectionsEditor.sectionList.addSectionButton"),e[61]=R,e[62]=Te):Te=e[62];let We;e[63]!==o||e[64]!==Be||e[65]!==Te?(We=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Be,onClick:o,children:[ut,Te]}),e[63]=o,e[64]=Be,e[65]=Te,e[66]=We):We=e[66];let Ie;e[67]!==I||e[68]!==We?(Ie=n.jsxs("div",{className:"space-y-2",children:[I,We]}),e[67]=I,e[68]=We,e[69]=Ie):Ie=e[69],Ae=Ie;break e}ae=$e(N&&"cursor-grabbing"),e[46]=f,e[47]=l,e[48]=O,e[49]=o,e[50]=d,e[51]=p,e[52]=R,e[53]=Y,e[54]=ee,e[55]=ae}else Y=e[53],ee=e[54],ae=e[55];Me=us,ue=le,he=ds,je=ge,ke=L,ve=nt,Le=ms,Pe=X,_e=fs,Ee="space-y-1",Fe=O.map(N=>{const re=p[N.index];return re?n.jsx(dr,{sortableId:N.id,section:re,raw:d[N.index],meta:b,selected:S===N.index,onSelect:()=>me(N.index),onDelete:()=>u(N.index),onDuplicate:()=>y(N.index),onMakeReusable:()=>T(N.index),onToggleHidden:()=>V(N.index),onToggleLazy:()=>E(N.index),onAddVariant:()=>i(N.index),onDetach:()=>h(N.index)},N.id):null})}e[11]=f,e[12]=l,e[13]=O,e[14]=X,e[15]=L,e[16]=b,e[17]=o,e[18]=i,e[19]=u,e[20]=h,e[21]=y,e[22]=T,e[23]=m,e[24]=V,e[25]=E,e[26]=d,e[27]=p,e[28]=S,e[29]=le,e[30]=R,e[31]=Le,e[32]=Me,e[33]=Y,e[34]=ee,e[35]=Fe,e[36]=Pe,e[37]=_e,e[38]=ue,e[39]=he,e[40]=je,e[41]=ke,e[42]=ve,e[43]=ae,e[44]=Ae,e[45]=Ee}else Le=e[31],Me=e[32],Y=e[33],ee=e[34],Fe=e[35],Pe=e[36],_e=e[37],ue=e[38],he=e[39],je=e[40],ke=e[41],ve=e[42],ae=e[43],Ae=e[44],Ee=e[45];if(Ae!==Symbol.for("react.early_return_sentinel"))return Ae;let fe;e[70]!==Fe||e[71]!==Ee?(fe=n.jsx("div",{className:Ee,children:Fe}),e[70]=Fe,e[71]=Ee,e[72]=fe):fe=e[72];let $;e[73]!==Le||e[74]!==Pe||e[75]!==_e||e[76]!==fe?($=n.jsx(Le,{items:Pe,strategy:_e,children:fe}),e[73]=Le,e[74]=Pe,e[75]=_e,e[76]=fe,e[77]=$):$=e[77];let pe;e[78]!==Y||e[79]!==ee||e[80]!==b?(pe=ee?n.jsx("div",{className:$e("cursor-grabbing shadow-lg ring-1 ring-border/60",Ts(ee,!1)),children:n.jsx(ks,{section:ee,raw:Y,meta:b})}):null,e[78]=Y,e[79]=ee,e[80]=b,e[81]=pe):pe=e[81];let Ce;e[82]!==pe?(Ce=Xn.createPortal(n.jsx(ts,{dropAnimation:ns,children:pe}),document.body),e[82]=pe,e[83]=Ce):Ce=e[83];let be;e[84]!==Me||e[85]!==ue||e[86]!==he||e[87]!==je||e[88]!==ke||e[89]!==ve||e[90]!==$||e[91]!==Ce?(be=n.jsxs(Me,{sensors:ue,collisionDetection:he,onDragStart:je,onDragEnd:ke,onDragCancel:ve,children:[$,Ce]}),e[84]=Me,e[85]=ue,e[86]=he,e[87]=je,e[88]=ke,e[89]=ve,e[90]=$,e[91]=Ce,e[92]=be):be=e[92];const Se=!l;let q;e[93]===Symbol.for("react.memo_cache_sentinel")?(q=n.jsx(vn,{size:14}),e[93]=q):q=e[93];let oe;e[94]!==R?(oe=R("sectionsEditor.sectionList.addSectionButton"),e[94]=R,e[95]=oe):oe=e[95];let de;e[96]!==o||e[97]!==Se||e[98]!==oe?(de=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Se,onClick:o,children:[q,oe]}),e[96]=o,e[97]=Se,e[98]=oe,e[99]=de):de=e[99];let Re;return e[100]!==ae||e[101]!==be||e[102]!==de?(Re=n.jsxs("div",{className:ae,children:[be,de]}),e[100]=ae,e[101]=be,e[102]=de,e[103]=Re):Re=e[103],Re}function br(g){return g.id}function qn(g){const e=Ge.c(57),{open:r,initialName:d,autoLabel:p,isPending:b,onSubmit:S,onOpenChange:m}=g,x=b===void 0?!1:b,u=ct(),[y,T]=w.useState(d),[V,E]=w.useState(r);r!==V&&(E(r),r&&T(d));let i;e[0]!==x||e[1]!==m?(i=ge=>{!ge&&!x&&m(!1)},e[0]=x,e[1]=m,e[2]=i):i=e[2];const h=i;let o;e[3]!==x||e[4]!==y||e[5]!==S?(o=async ge=>{ge.preventDefault(),!x&&await S(y.trim())},e[3]=x,e[4]=y,e[5]=S,e[6]=o):o=e[6];const P=o;let l;e[7]!==u?(l=u("sectionsEditor.variantRenameDialog.title"),e[7]=u,e[8]=l):l=e[8];let R;e[9]!==l?(R=n.jsx(Co,{children:l}),e[9]=l,e[10]=R):R=e[10];let K;e[11]!==p||e[12]!==u?(K=u("sectionsEditor.variantRenameDialog.description",{fallback:p||u("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=p,e[12]=u,e[13]=K):K=e[13];let O;e[14]!==K?(O=n.jsx(Mo,{children:K}),e[14]=K,e[15]=O):O=e[15];let H;e[16]!==R||e[17]!==O?(H=n.jsxs(Bo,{children:[R,O]}),e[16]=R,e[17]=O,e[18]=H):H=e[18];let f;e[19]!==u?(f=u("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=u,e[20]=f):f=e[20];let A;e[21]!==f?(A=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:f}),e[21]=f,e[22]=A):A=e[22];let De;e[23]===Symbol.for("react.memo_cache_sentinel")?(De=ge=>T(ge.target.value),e[23]=De):De=e[23];let C;e[24]!==p||e[25]!==x||e[26]!==y?(C=n.jsx(Io,{id:"variant-rename-name",value:y,onChange:De,placeholder:p,autoFocus:!0,disabled:x}),e[24]=p,e[25]=x,e[26]=y,e[27]=C):C=e[27];let ce;e[28]!==A||e[29]!==C?(ce=n.jsxs("div",{className:"space-y-1.5 py-4",children:[A,C]}),e[28]=A,e[29]=C,e[30]=ce):ce=e[30];let B;e[31]!==m?(B=()=>m(!1),e[31]=m,e[32]=B):B=e[32];let ne;e[33]!==u?(ne=u("sectionsEditor.variantRenameDialog.cancel"),e[33]=u,e[34]=ne):ne=e[34];let F;e[35]!==x||e[36]!==B||e[37]!==ne?(F=n.jsx(Xe,{type:"button",variant:"outline",onClick:B,disabled:x,children:ne}),e[35]=x,e[36]=B,e[37]=ne,e[38]=F):F=e[38];let ie;e[39]!==x||e[40]!==u?(ie=x?n.jsxs(n.Fragment,{children:[n.jsx(Zn,{size:14,className:"animate-spin"}),u("sectionsEditor.variantRenameDialog.saving")]}):u("sectionsEditor.variantRenameDialog.save"),e[39]=x,e[40]=u,e[41]=ie):ie=e[41];let le;e[42]!==x||e[43]!==ie?(le=n.jsx(Xe,{type:"submit",disabled:x,children:ie}),e[42]=x,e[43]=ie,e[44]=le):le=e[44];let ye;e[45]!==F||e[46]!==le?(ye=n.jsxs(Ko,{children:[F,le]}),e[45]=F,e[46]=le,e[47]=ye):ye=e[47];let X;e[48]!==P||e[49]!==ce||e[50]!==ye||e[51]!==H?(X=n.jsx(Lo,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:P,children:[H,ce,ye]})}),e[48]=P,e[49]=ce,e[50]=ye,e[51]=H,e[52]=X):X=e[52];let Z;return e[53]!==h||e[54]!==r||e[55]!==X?(Z=n.jsx(Fo,{open:r,onOpenChange:h,children:X}),e[53]=h,e[54]=r,e[55]=X,e[56]=Z):Z=e[56],Z}function Ns(g){const e=Ge.c(5),{rule:r,matchers:d}=g,p=r?.__resolveType??"";let b;if(e[0]!==d||e[1]!==p){const u=d.find(y=>y.resolveType===p)?.iconName??za(p);b=No(u),e[0]=d,e[1]=p,e[2]=b}else b=e[2];const S=b;if(!S)return null;let m;return e[3]!==S?(m=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=m):m=e[4],m}function Gn(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
2
  `)}function Wn(g){return g.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Sr(g){return g.map((e,r)=>({...e,index:r}))}function Vs(g){const e=Ge.c(17),{label:r,effectiveRule:d,matchers:p,canDelete:b,dragging:S,onRename:m,onDuplicate:x,onDelete:u}=g,y=ct();let T;e[0]!==d||e[1]!==p?(T=n.jsx(Ns,{rule:d,matchers:p}),e[0]=d,e[1]=p,e[2]=T):T=e[2];let V;e[3]!==r?(V=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=V):V=e[4];let E;e[5]!==b||e[6]!==S||e[7]!==r||e[8]!==u||e[9]!==x||e[10]!==m||e[11]!==y?(E=!S&&n.jsxs(Es,{children:[n.jsx(js,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":y("sectionsEditor.pageVariantTabs.actionsAriaLabel",{label:r}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:yr,onPointerDown:xr,children:n.jsx(vs,{size:14})})}),n.jsxs(Rs,{align:"end",className:"w-36",children:[n.jsxs(vt,{onClick:h=>{h.stopPropagation(),m?.()},children:[n.jsx(Zo,{size:14}),y("sectionsEditor.pageVariantTabs.renameAction")]}),n.jsxs(vt,{onClick:h=>{h.stopPropagation(),x?.()},children:[n.jsx(xs,{size:14}),y("sectionsEditor.pageVariantTabs.duplicateAction")]}),n.jsx(Ho,{}),n.jsxs(vt,{variant:"destructive",disabled:!b,onClick:h=>{h.stopPropagation(),u?.()},children:[n.jsx(_s,{size:14}),y("sectionsEditor.pageVariantTabs.deleteAction")]})]})]}),e[5]=b,e[6]=S,e[7]=r,e[8]=u,e[9]=x,e[10]=m,e[11]=y,e[12]=E):E=e[12];let i;return e[13]!==T||e[14]!==V||e[15]!==E?(i=n.jsxs(n.Fragment,{children:[T,V,E]}),e[13]=T,e[14]=V,e[15]=E,e[16]=i):i=e[16],i}function xr(g){return g.stopPropagation()}function yr(g){return g.stopPropagation()}function _r(g){const e=Ge.c(33),{entry:r,sortableId:d,isActive:p,canDelete:b,decofile:S,meta:m,matchers:x,onSelect:u,onRename:y,onDuplicate:T,onDelete:V}=g;let E;e[0]!==d?(E={id:d,animateLayoutChanges:jr},e[0]=d,e[1]=E):E=e[1];const{attributes:i,listeners:h,setNodeRef:o,transform:P,isDragging:l}=rs(E);let R;e[2]!==P?(R=is.Transform.toString(P?{...P,x:0}:null),e[2]=P,e[3]=R):R=e[3];const K=l?0:void 0;let O;e[4]!==R||e[5]!==K?(O={transform:R,opacity:K},e[4]=R,e[5]=K,e[6]=O):O=e[6];const H=O,f=m??void 0;let A;e[7]!==S||e[8]!==r.variant.rule||e[9]!==f?(A=Bt(r.variant.rule,S,f),e[7]=S,e[8]=r.variant.rule,e[9]=f,e[10]=A):A=e[10];const De=A;let C;e[11]!==u?(C=le=>{le.target===le.currentTarget&&(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),u())},e[11]=u,e[12]=C):C=e[12];const ce=l?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",B=p?ps:ls;let ne;e[13]!==ce||e[14]!==B?(ne=$e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,B),e[13]=ce,e[14]=B,e[15]=ne):ne=e[15];let F;e[16]!==b||e[17]!==De||e[18]!==r.variant.label||e[19]!==x||e[20]!==V||e[21]!==T||e[22]!==y?(F=n.jsx(Vs,{label:r.variant.label,effectiveRule:De,matchers:x,canDelete:b,onRename:y,onDuplicate:T,onDelete:V}),e[16]=b,e[17]=De,e[18]=r.variant.label,e[19]=x,e[20]=V,e[21]=T,e[22]=y,e[23]=F):F=e[23];let ie;return e[24]!==i||e[25]!==h||e[26]!==u||e[27]!==o||e[28]!==H||e[29]!==ne||e[30]!==F||e[31]!==C?(ie=n.jsx("div",{ref:o,style:H,...i,...h,onClick:u,onKeyDown:C,className:ne,children:F}),e[24]=i,e[25]=h,e[26]=u,e[27]=o,e[28]=H,e[29]=ne,e[30]=F,e[31]=C,e[32]=ie):ie=e[32],ie}function jr(){return!1}function Er(g){const e=Ge.c(9),{variant:r,decofile:d,meta:p,matchers:b}=g,S=p??void 0;let m;e[0]!==d||e[1]!==S||e[2]!==r.rule?(m=Bt(r.rule,d,S),e[0]=d,e[1]=S,e[2]=r.rule,e[3]=m):m=e[3];const x=m;let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=$e("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ps),e[4]=u):u=e[4];let y;return e[5]!==x||e[6]!==b||e[7]!==r.label?(y=n.jsx("div",{className:u,children:n.jsx(Vs,{label:r.label,effectiveRule:x,matchers:b,canDelete:!1,dragging:!0})}),e[5]=x,e[6]=b,e[7]=r.label,e[8]=y):y=e[8],y}function Rr(g){const e=Ge.c(91),{listKey:r,variants:d,activeIndex:p,decofile:b,meta:S,matchers:m,onSelect:x,onReorder:u,onRename:y,onDuplicate:T,onDelete:V,onAdd:E}=g,i=ct();let h;e[0]!==d?(h=()=>Wn(d),e[0]=d,e[1]=h):h=e[1];const[o,P]=w.useState(h),[l,R]=w.useState(null),[K,O]=w.useState(r),[H,f]=w.useState(d.length);let A;e[2]!==d?(A=()=>Gn(d),e[2]=d,e[3]=A):A=e[3];const[De,C]=w.useState(A),ce=w.useRef(!1),B=Gn(d);K!==r?(O(r),f(d.length),C(B),P(Wn(d))):(H!==d.length||De!==B)&&(f(d.length),C(B),P(be=>d.map((Se,q)=>({id:be[q]?.id??crypto.randomUUID(),index:q,variant:Se}))));let ne;e[4]===Symbol.for("react.memo_cache_sentinel")?(ne={activationConstraint:{distance:8}},e[4]=ne):ne=e[4];let F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F={coordinateGetter:cs},e[5]=F):F=e[5];const ie=es(Qt(as,ne),Qt(ss,F));let le;e[6]!==o?(le=o.map(wr),e[6]=o,e[7]=le):le=e[7];const ye=le,X=d.length>1;let Z;e[8]!==o?(Z=be=>{const Se=String(be.active.id);R(o.find(q=>q.id===Se)??null)},e[8]=o,e[9]=Z):Z=e[9];const ge=Z;let se;e[10]!==ye||e[11]!==u?(se=be=>{R(null);const{active:Se,over:q}=be;if(!q||Se.id===q.id)return;const oe=ye.indexOf(String(Se.id)),de=ye.indexOf(String(q.id));oe===-1||de===-1||(P(Re=>Sr(Mt([...Re],oe,de))),ce.current=!0,requestAnimationFrame(()=>{ce.current=!1}),u(oe,de))},e[10]=ye,e[11]=u,e[12]=se):se=e[12];const L=se;let ze;e[13]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{R(null)},e[13]=ze):ze=e[13];const nt=ze;let Le,Me,Y,ee,Fe,Pe,_e,ue,he,je,ke,ve,ae;if(e[14]!==p||e[15]!==X||e[16]!==b||e[17]!==o||e[18]!==ye||e[19]!==L||e[20]!==ge||e[21]!==m||e[22]!==S||e[23]!==E||e[24]!==V||e[25]!==T||e[26]!==y||e[27]!==x||e[28]!==ie||e[29]!==i){const be=I=>{ce.current||x(I)};ke="space-y-1 border-b p-2";let Se;e[43]!==i?(Se=i("sectionsEditor.pageVariantTabs.variantsLabel"),e[43]=i,e[44]=Se):Se=e[44];let q;e[45]!==Se?(q=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:Se}),e[45]=Se,e[46]=q):q=e[46];let oe;e[47]!==i?(oe=i("sectionsEditor.pageVariantTabs.addVariantAriaLabel"),e[47]=i,e[48]=oe):oe=e[48];let de;e[49]===Symbol.for("react.memo_cache_sentinel")?(de=n.jsx(vn,{size:14}),e[49]=de):de=e[49];let Re;e[50]!==E||e[51]!==oe?(Re=n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":oe,className:"size-6",onClick:E,children:de})}),e[50]=E,e[51]=oe,e[52]=Re):Re=e[52];let me;e[53]!==i?(me=i("sectionsEditor.pageVariantTabs.addVariantTooltip"),e[53]=i,e[54]=me):me=e[54];let N;e[55]!==me?(N=n.jsx(jt,{children:me}),e[55]=me,e[56]=N):N=e[56];let re;e[57]!==Re||e[58]!==N?(re=n.jsxs(yt,{children:[Re,N]}),e[57]=Re,e[58]=N,e[59]=re):re=e[59],e[60]!==q||e[61]!==re?(ve=n.jsxs("div",{className:"flex items-center justify-between",children:[q,re]}),e[60]=q,e[61]=re,e[62]=ve):ve=e[62],Me=us,Pe=ie,_e=ds,ue=ge,he=L,je=nt,Le=ms,ee=ye,Fe=fs,ae="space-y-0.5",Y=o.map(I=>n.jsx(_r,{sortableId:I.id,entry:I,isActive:I.index===p,canDelete:X,decofile:b,meta:S,matchers:m,onSelect:()=>be(I.index),onRename:()=>y(I.index),onDuplicate:()=>T(I.index),onDelete:()=>V(I.index)},I.id)),e[14]=p,e[15]=X,e[16]=b,e[17]=o,e[18]=ye,e[19]=L,e[20]=ge,e[21]=m,e[22]=S,e[23]=E,e[24]=V,e[25]=T,e[26]=y,e[27]=x,e[28]=ie,e[29]=i,e[30]=Le,e[31]=Me,e[32]=Y,e[33]=ee,e[34]=Fe,e[35]=Pe,e[36]=_e,e[37]=ue,e[38]=he,e[39]=je,e[40]=ke,e[41]=ve,e[42]=ae}else Le=e[30],Me=e[31],Y=e[32],ee=e[33],Fe=e[34],Pe=e[35],_e=e[36],ue=e[37],he=e[38],je=e[39],ke=e[40],ve=e[41],ae=e[42];let Ae;e[63]!==Y||e[64]!==ae?(Ae=n.jsx("div",{className:ae,children:Y}),e[63]=Y,e[64]=ae,e[65]=Ae):Ae=e[65];let Ee;e[66]!==Le||e[67]!==ee||e[68]!==Fe||e[69]!==Ae?(Ee=n.jsx(Le,{items:ee,strategy:Fe,children:Ae}),e[66]=Le,e[67]=ee,e[68]=Fe,e[69]=Ae,e[70]=Ee):Ee=e[70];let fe;e[71]!==l||e[72]!==b||e[73]!==m||e[74]!==S?(fe=l?n.jsx(Er,{variant:l.variant,decofile:b,meta:S,matchers:m}):null,e[71]=l,e[72]=b,e[73]=m,e[74]=S,e[75]=fe):fe=e[75];let $;e[76]!==fe?($=Xn.createPortal(n.jsx(ts,{dropAnimation:ns,children:fe}),document.body),e[76]=fe,e[77]=$):$=e[77];let pe;e[78]!==Me||e[79]!==Pe||e[80]!==_e||e[81]!==ue||e[82]!==he||e[83]!==je||e[84]!==Ee||e[85]!==$?(pe=n.jsxs(Me,{sensors:Pe,collisionDetection:_e,onDragStart:ue,onDragEnd:he,onDragCancel:je,children:[Ee,$]}),e[78]=Me,e[79]=Pe,e[80]=_e,e[81]=ue,e[82]=he,e[83]=je,e[84]=Ee,e[85]=$,e[86]=pe):pe=e[86];let Ce;return e[87]!==ke||e[88]!==ve||e[89]!==pe?(Ce=n.jsxs("div",{className:ke,children:[ve,pe]}),e[87]=ke,e[88]=ve,e[89]=pe,e[90]=Ce):Ce=e[90],Ce}function wr(g){return g.id}function kr(g){const e=Ge.c(16),{schema:r,value:d,onChange:p,meta:b,decofile:S,onSaveReferencedBlock:m,sandbox:x}=g,u=ct();let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0];const[T,V]=w.useState(y);let E;e[1]!==T||e[2]!==u?(E=T.length>0&&n.jsxs("nav",{"aria-label":u("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>V([]),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:u("sectionsEditor.sectionsEditorPanels.backToRule"),children:n.jsx(bs,{className:"size-3.5"})}),T.map((o,P)=>{const l=P===T.length-1,R=hs(o);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[P>0&&n.jsx(Ss,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>V(T.slice(0,P+1)),title:R,className:$e("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",l?"font-medium text-foreground":"text-muted-foreground"),children:R})]},`${R}-${P}`)})]}),e[1]=T,e[2]=u,e[3]=E):E=e[3];let i;e[4]!==T||e[5]!==S||e[6]!==b||e[7]!==p||e[8]!==m||e[9]!==x||e[10]!==r||e[11]!==d?(i=n.jsx(gs,{schema:r,value:d,onChange:p,basePath:"",breadcrumbPath:T,onBreadcrumbChange:V,meta:b,decofile:S,onSaveReferencedBlock:m,sandbox:x}),e[4]=T,e[5]=S,e[6]=b,e[7]=p,e[8]=m,e[9]=x,e[10]=r,e[11]=d,e[12]=i):i=e[12];let h;return e[13]!==E||e[14]!==i?(h=n.jsxs("div",{className:"space-y-2",children:[E,i]}),e[13]=E,e[14]=i,e[15]=h):h=e[15],h}function Yn(g){const e=Ge.c(23),{activeSchema:r,formValue:d,formResetKey:p,onFormChange:b,onBreadcrumbChange:S,breadcrumbPath:m,emptyMessage:x,beforeForm:u,seoResolveType:y,siteDefaultSeo:T,meta:V,decofile:E,onSaveReferencedBlock:i,sandbox:h,previewBaseUrl:o,onRequestAddSection:P}=g;let l;e[0]!==m?(l=m===void 0?[]:m,e[0]=m,e[1]=l):l=e[1];const R=l;let K;e[2]!==r||e[3]!==R||e[4]!==E||e[5]!==p||e[6]!==d||e[7]!==V||e[8]!==S||e[9]!==b||e[10]!==P||e[11]!==i||e[12]!==o||e[13]!==h||e[14]!==y||e[15]!==T?(K=r&&d?y?n.jsx(Uo,{schema:r,resolveType:y,value:d,formResetKey:p,onChange:b,onBreadcrumbChange:S,siteDefaultSeo:T}):n.jsx(gs,{schema:r,value:d,onChange:b,basePath:"",breadcrumbPath:R,onBreadcrumbChange:S,meta:V,decofile:E,onSaveReferencedBlock:i,sandbox:h,previewBaseUrl:o,onRequestAddSection:P},p):null,e[2]=r,e[3]=R,e[4]=E,e[5]=p,e[6]=d,e[7]=V,e[8]=S,e[9]=b,e[10]=P,e[11]=i,e[12]=o,e[13]=h,e[14]=y,e[15]=T,e[16]=K):K=e[16];const O=K;let H;e[17]!==x||e[18]!==O?(H=O??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:x}),e[17]=x,e[18]=O,e[19]=H):H=e[19];let f;return e[20]!==u||e[21]!==H?(f=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[u,H]})}),e[20]=u,e[21]=H,e[22]=f):f=e[22],f}const Tr="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 Nr(g,e){return Ha(g,e,lt)}function Vr(g){const e=Ge.c(19),{pageKey:r,initialName:d,initialPath:p,onFieldChange:b}=g,S=ct(),[m,x]=w.useState(d),[u,y]=w.useState(p),[T,V]=w.useState(r);T!==r&&(V(r),x(d),y(p));let E;e[0]!==b?(E=K=>{x(K.target.value),b("name",K.target.value)},e[0]=b,e[1]=E):E=e[1];let i;e[2]!==S?(i=S("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[2]=S,e[3]=i):i=e[3];let h;e[4]!==m||e[5]!==E||e[6]!==i?(h=n.jsx("input",{type:"text",value:m,onChange:E,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:i}),e[4]=m,e[5]=E,e[6]=i,e[7]=h):h=e[7];let o;e[8]!==b?(o=K=>{y(K.target.value),b("path",K.target.value)},e[8]=b,e[9]=o):o=e[9];let P;e[10]!==S?(P=S("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[10]=S,e[11]=P):P=e[11];let l;e[12]!==u||e[13]!==o||e[14]!==P?(l=n.jsx("input",{type:"text",value:u,onChange:o,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:P}),e[12]=u,e[13]=o,e[14]=P,e[15]=l):l=e[15];let R;return e[16]!==h||e[17]!==l?(R=n.jsxs("div",{className:"space-y-1",children:[h,l]}),e[16]=h,e[17]=l,e[18]=R):R=e[18],R}function Jn(g){const e=Ge.c(13),{onClick:r}=g,d=ct();let p;e[0]!==d?(p=d("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=d,e[1]=p):p=e[1];let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ys,{size:14}),e[2]=b):b=e[2];let S;e[3]!==r||e[4]!==p?(S=n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":p,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:b})}),e[3]=r,e[4]=p,e[5]=S):S=e[5];let m;e[6]!==d?(m=d("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=d,e[7]=m):m=e[7];let x;e[8]!==m?(x=n.jsx(jt,{side:"bottom",children:m}),e[8]=m,e[9]=x):x=e[9];let u;return e[10]!==S||e[11]!==x?(u=n.jsxs(yt,{children:[S,x]}),e[10]=S,e[11]=x,e[12]=u):u=e[12],u}function Qn(g){const e=Ge.c(21),{currentRt:r,currentLabel:d,currentGlobalKey:p,matchers:b,globals:S,onSelect:m,onSelectGlobal:x,schema:u,formValue:y,onChange:T,formKey:V,formWrapperClassName:E,meta:i,decofile:h,onSaveReferencedBlock:o,sandbox:P}=g;let l;e[0]!==p||e[1]!==d||e[2]!==r||e[3]!==S||e[4]!==b||e[5]!==m||e[6]!==x?(l=n.jsx(Ua,{currentRt:r,currentLabel:d,currentGlobalKey:p,matchers:b,globals:S,onSelect:m,onSelectGlobal:x}),e[0]=p,e[1]=d,e[2]=r,e[3]=S,e[4]=b,e[5]=m,e[6]=x,e[7]=l):l=e[7];let R;e[8]!==h||e[9]!==V||e[10]!==y||e[11]!==E||e[12]!==i||e[13]!==T||e[14]!==o||e[15]!==P||e[16]!==u?(R=u&&y&&n.jsx("div",{className:E,children:n.jsx(kr,{schema:u,value:y,onChange:T,meta:i,decofile:h,onSaveReferencedBlock:o,sandbox:P},V)}),e[8]=h,e[9]=V,e[10]=y,e[11]=E,e[12]=i,e[13]=T,e[14]=o,e[15]=P,e[16]=u,e[17]=R):R=e[17];let K;return e[18]!==l||e[19]!==R?(K=n.jsxs(n.Fragment,{children:[l,R]}),e[18]=l,e[19]=R,e[20]=K):K=e[20],K}function jc({orgSlug:g,virtualMcpId:e,branch:r,previewReady:d=!0,previewUrl:p,currentPath:b,activePageBlockKey:S=null,activeGlobalBlockKey:m=null,externalSelection:x,onSaved:u,initialEditSeo:y=!1,onExitSeo:T,onViewJsonFile:V,onVariantPreviewOverride:E}){const i=ct(),h=d?{orgSlug:g,virtualMcpId:e,branch:r,previewUrl:p}:null,{data:o,isLoading:P}=qa(h),{data:l,isLoading:R}=Ga(h),K=Wa(),O=K?.entity?.id===e?K.entity.metadata?.siteSlug??null:null,H=er({virtualMcpId:e,sandboxUrl:p}),[f,A]=w.useState(null),[De,C]=w.useState(null),[ce,B]=w.useState(null),[ne,F]=w.useState(0),[ie,le]=w.useState(void 0),[ye,X]=w.useState(null),[Z,ge]=w.useState(null),[se,L]=w.useState([]),ze=w.useRef(null),[nt,Le]=w.useState(se.length);nt!==se.length&&(Le(se.length),requestAnimationFrame(()=>{ze.current&&(ze.current.scrollTop=0)}));const[Me,Y]=w.useState(0),[ee,Fe]=w.useState(null),[Pe,_e]=w.useState(null),[ue,he]=w.useState(null),[je,ke]=w.useState(!0),[ve,ae]=w.useState(!1),[Ae,Ee]=w.useState(!1),fe=w.useRef(null),[$,pe]=w.useState(y),[Ce,be]=w.useState(y);y&&!Ce&&(be(!0),pe(!0),A(null),C(null),B(null),L([])),!y&&Ce&&be(!1);const[Se,q]=w.useState(null),[oe,de]=w.useState(void 0),[Re,me]=w.useState([]),[N,re]=w.useState(0),[I,Be]=w.useState(0),[ut,Te]=w.useState(null),[We,Ie]=w.useState(null),[bn,Sn]=w.useState(null),Ds=Ca(),Ps=`${g}/${e}/${r}`,Xt=Ya({orgSlug:g,virtualMcpId:e,branch:r}),[As,Cs]=w.useState(b),[Ms,Bs]=w.useState(S),[Ks,Ls]=w.useState(m);(As!==b||Ms!==S||Ks!==m)&&(queueMicrotask(()=>Xt.flush()),Cs(b),Bs(S),Ls(m),A(null),C(null),B(null),F(0),X(null),ge(null),Be(0),Te(null),Ie(null),L([]),Y(t=>t+1),pe(!1),q(null),de(void 0),me([]),re(t=>t+1));const Ne=Ja({orgSlug:g,virtualMcpId:e,branch:r}),Kt=ho((t,s)=>{Ne.mutate({blockKey:t,data:s},{onSuccess:()=>u?.(),onError:a=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),Zt=Qa({orgSlug:g,virtualMcpId:e,branch:r}),[Nt,Lt]=w.useState(!1),He=w.useRef(null),st=w.useRef(null),at=w.useRef(null),en=w.useRef({}),Ze=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!d||P||R)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Zn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!l)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:i("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Fs=Xa(o),Ve=!!m,Ye=Ve?null:Za(Fs,b,S),k=Ve?m:Ye?.key??null,tn=Ve&&m?o[m]:void 0,xn=Ve&&m&&tn?eo(m,tn):Ve&&m?m:"",Ft=!Ve&&k&&o[k]?o[k]:null,nn=$&&o&&l&&k&&Ye?Hn(o,{kind:"page",pageKey:k,pageName:String(Ye.name??""),path:String(Ye.path??"")},l):null,Is=$?Ft?.seo:void 0,sn=oe!==void 0?oe:Is,Os=$?qo(sn):void 0,$s=nn?.seoTypeOptions??[],zs=$&&l?Go(l):"",yn=Se??Os??{},an=$&&nn?Wo(yn,nn):null,Hs=$&&an&&Yo(sn)?qt(an,l):null,Us=$?Jo(o,l)?.seoData:void 0,qe=Ve?[{label:"Default",sections:[{__resolveType:m}]}]:Nr(Ft?.sections,o??{}),It=qe.length>1,Oe=Math.min(ne,qe.length-1),dt=qe[Oe],G=dt?.sections??[],Ue=Gt(G,o),_n=!Ve&&to(Ft?.sections);if(Ve&&m&&bn!==m){Sn(m);const t=G[0],s=Ue[0];if(t&&s){A(0),Be(0),L([]);const a=St(t,s,o);a&&(C(a.data),B(a.resolveType),Ie(null),Te(null))}}!Ve&&bn!==null&&Sn(null),Ze.current={rawSections:G,parsedSections:Ue,decofile:o??{},activePageKey:k,pageVariants:qe,variantIndex:Oe,sectionVariantIndex:I,selectedSectionIndex:f};const qs=()=>({multivariate:_n,index:Oe,variants:qe.map(t=>({rule:t.rule}))}),jn=(t,s)=>{if(!E)return;if(!k||!_n||t.length<=1){E(null);return}const a=zn(k,{multivariate:!0,index:s,variants:t},o,l);E(a.length>0?a:null)},Et=(t,s,a)=>{if(!E)return;if(!k){E(null);return}const c=qs(),v=zn(k,c,o,l);if(!t||s<0){E(v.length>0?v:null);return}const j=yo({pageKey:k,page:c,sectionIndex:s,sectionLazy:Ue[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:o,meta:l}),_=[...v,...j];E(_.length>0?_:null)},mt=(t,s,a,c=f??-1,v=!1)=>{const j=tt(t,s);if(!j){C(null),B(null),Ie(null),Te(null),v&&Et(null,c,a);return}const D=Kn(j,lt)[a];if(!D){C(null),B(null),Ie(null),Te(null),v&&Et(null,c,a);return}const te=io(D.value,o);C(te?.data??null),B(te?.resolveType??null);const{resolveType:M,formValue:z}=Pt(D.rule,o,l??void 0);Ie(M),Te(z),v&&Et(j,c,a)},Vt=x?.index;if(x!==void 0&&(x?.seq??null)!==ie&&(le(x?.seq??null),typeof Vt=="number")){const t=G[Vt],s=Ue[Vt];if(t&&s)if(A(Vt),Be(0),L([]),Y(a=>a+1),s.isMultivariate)mt(t,s,0,Vt);else{const a=St(t,s,o);a?(C(a.data),B(a.resolveType)):(C(null),B(null)),Ie(null),Te(null)}}const Ot={orgSlug:g,virtualMcpId:e,branch:r,previewUrl:p??void 0,siteSlug:O},on=ce&&l?qt(ce,l):null,Je=(t,s)=>{if(!k)return;He.current&&(clearTimeout(He.current),He.current=null),at.current&&(clearTimeout(at.current),at.current=null),st.current&&(clearTimeout(st.current),st.current=null);const a=Ct(o,k,t,Oe,qe);Ne.mutate({blockKey:k,data:a},{onSuccess:()=>s?.onSuccess?.()??u?.(),onError:c=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},Rt=()=>{A(null),C(null),B(null),Be(0),Te(null),Ie(null),L([]),Y(t=>t+1)},Gs=(t,s)=>{He.current&&clearTimeout(He.current);const a=Ze.current.sectionVariantIndex;He.current=setTimeout(()=>{const{rawSections:c,parsedSections:v,decofile:j,activePageKey:_,pageVariants:D,variantIndex:te}=Ze.current,M=c[s];if(!M)return;const z=v[s];if(!z)return;if(z.isSavedBlock){const W=z.isLazy?M.section?.__resolveType??M.__resolveType:M.__resolveType;Ne.mutate({blockKey:W,data:t},{onSuccess:()=>u?.(),onError:J=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:J.message}))});return}if(!_)return;const U={...j[_]},we=[...c];if(z.isMultivariate){const W=tt(M,z);if(!W||!_)return;const J=jo(W,a,t);we[s]=xt(M,z,J)}else if(z.isHidden){const W=os(M.__resolveType),J=W?{...M.section}:{...M},Ke=Array.isArray(J.variants)?[...J.variants]:[];Ke[0]&&(Ke[0]={...Ke[0],value:t}),J.variants=Ke,W?we[s]={...M,section:J}:we[s]=J}else z.isLazy?we[s]={...M,section:t}:we[s]=t;if(D.length>1){const W=U.sections,J=[...W?.variants??[]];J[te]&&(J[te]={...J[te],value:we}),U.sections={...W,variants:J}}else U.sections=we;Ne.mutate({blockKey:_,data:U},{onSuccess:()=>u?.(),onError:W=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:W.message}))})},pn)},Ws=t=>{A(t),Be(0),L([]),Y(v=>v+1);const s=G[t],a=Ue[t];if(!s||!a)return;if(a.isMultivariate){mt(s,a,0,t);return}const c=St(s,a,o);if(!c){C(null),B(null),Ie(null),Te(null),Et(null,t,0);return}C(c.data),B(c.resolveType),Ie(null),Te(null),Et(null,t,0)},En=t=>{const s=t;C(s),f!==null&&Gs(s,f)},rn=t=>{if(!k||!o||!l||!Ye)return;const s={kind:"page",pageKey:k,pageName:String(Ye.name??""),path:String(Ye.path??"")},a=Hn(o,s,l);a&&Xt.save(k,()=>{const c=Ds.getQueryData(Ma.decofile(Ps))?.[k];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const v={...c,...en.current};return en.current={},t?.raw!==void 0?{...v,seo:t.raw}:t?.inner!==void 0?Xo(s,a,v,t.inner):v})},Ys=(t,s)=>{k&&(en.current[t]=s,rn())},Js=(t,s)=>{if(!k)return;const a=Mt([...G],t,s);f!==null&&(f===t?A(s):t<f&&s>=f?A(f-1):t>f&&s<=f&&A(f+1)),Je(a)},Qs=t=>{if(!k)return;const s=G.filter((a,c)=>c!==t);f===t?Rt():f!==null&&f>t&&A(f-1),Je(s)},Xs=t=>{if(!k)return;const s=G[t];if(!s)return;const a=[...G];a.splice(t+1,0,xo(s)),f!==null&&f>t&&A(f+1),Je(a)},Zs=t=>{if(!k)return;const s=G[t],a=Ue[t];if(!s||!a||a.isMultivariate)return;const c=a.isHidden?bo(s):So(s);if(!c)return;const v=[...G];v[t]=c,f===t&&Rt(),Je(v)},ea=t=>{if(!k)return;const s=G[t],a=Ue[t];if(!s||!a||a.isMultivariate)return;const c=vo(s);if(!c)return;const v=[...G];v[t]=c,f===t&&Rt(),Je(v)},ta=t=>{if(!k)return;const s=G[t],a=Ue[t];if(!s||!a?.isSavedBlock)return;const c=St(s,a,o);if(!c?.data)return;const{name:v,...j}=c.data,_=[...G];a.isLazy?_[t]={...s,section:j}:_[t]=j,f===t&&Rt(),Je(_)},na=t=>{if(!k)return;const s=[...G,{__resolveType:t.resolveType}],a=s.length-1;Je(s,{onSuccess:()=>{ae(!1),A(a),Be(0),L([]),Y(_=>_+1);const c=s[a],v=Gt(s,o)[a];if(!c||!v)return;if(v.isMultivariate){mt(c,v,0);return}const j=St(c,v,o);if(!j){C(null),B(null),Ie(null),Te(null);return}C(j.data),B(j.resolveType),Ie(null),Te(null)}})},Rn=t=>{fe.current=t.append,ae(!0)},sa=t=>{const s=fe.current;if(!s){na(t);return}s({__resolveType:t.resolveType}),ae(!1),fe.current=null},aa=t=>{if(f===null)return;const s=G[f],a=Ue[f];!s||!a?.isMultivariate||(Be(t),L([]),Y(c=>c+1),mt(s,a,t,f,!0))},oa=t=>{if(f===null||!k)return;const s=G[f],a=Ue[f];if(!s||!a?.isMultivariate)return;const c=tt(s,a);if(!c)return;const v=po(c,t);if(!v){Q.error(i("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const j=[...G];j[f]=xt(s,a,v);const _=v.variants;let D=I;t===I?D=Math.min(t,_.length-1):t<I&&(D=I-1),Be(D),L([]),Y(te=>te+1),mt(j[f],a,D),Je(j)},ra=t=>{if(f===null||!k)return;const s=G[f],a=Ue[f];if(!s||!a?.isMultivariate)return;const c=tt(s,a);if(!c)return;const v=go(c,t),j=[...G];j[f]=xt(s,a,v);const _=t+1;Be(_),L([]),Y(D=>D+1),mt(j[f],a,_),Je(j)},ia=(t,s)=>{if(f===null||!k||t===s)return;const a=G[f],c=Ue[f];if(!a||!c?.isMultivariate)return;const v=tt(a,c);if(!v)return;const j=mo(v,t,s),_=[...G];_[f]=xt(a,c,j);let D=I;I===t?D=s:t<I&&s>=I?D=I-1:t>I&&s<=I&&(D=I+1),Be(D),mt(_[f],c,D),Je(_)},ln=t=>{const s=t??f;if(s===null||!k)return;const a=G[s],c=Ue[s];if(!a||!c)return;const v=lo(a,c);if(!v){Q.error(i("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const j=[...G];j[s]=v.section;const _=Gt(j,o)[s];if(!_?.isMultivariate){Q.error(i("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}A(s),Be(v.newVariantIndex),L([]),Y(D=>D+1),mt(v.section,_,v.newVariantIndex,s),Je(j)},la=()=>{if(f===null||!k)return;const t=G[f],s=Ue[f];if(!t||!s?.isMultivariate)return;const a=tt(t,s);if(!a)return;const c=fo(t,s,a);if(!c){Q.error(i("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const v=[...G];v[f]=c;const j=Gt(v,o)[f];if(!j)return;Be(0),Ie(null),Te(null),L([]),Y(D=>D+1);const _=St(c,j,o);_?(C(_.data),B(_.resolveType)):(C(null),B(null)),Et(null,f,0),Je(v)},ca=async t=>{if(ee===null||!k)return;const s=fn(t,o);if(s){Q.error(s);return}const a=G[ee],c=Ue[ee];if(!a||!c)return;const v=St(a,c,o);if(!v){Q.error(i("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const j={...v.data,name:t};try{await Ne.mutateAsync({blockKey:t,data:j});const _=[...G];_[ee]={__resolveType:t},await Ne.mutateAsync({blockKey:k,data:Ct(o,k,_,Oe,qe)}),f===ee&&Rt(),Fe(null),Q.success(i("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),u?.()}catch(_){Q.error(_ instanceof Error?_.message:i("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},wn=dt?.rule;if(It&&f===null&&Z===null&&wn){const{resolveType:t,formValue:s}=Pt(wn,o??{},l??void 0);ge(t),X(s)}const $t=l?no(l):[],kn=l&&o?so(l,o):[],ua=!Ve&&!!(H&&l&&o),da=Z&&l?qt(Z,l):null,wt=()=>{st.current&&(clearTimeout(st.current),st.current=null),at.current&&(clearTimeout(at.current),at.current=null)},Dt=async(t,s)=>{if(!(_o(s,t,l)>0))try{await Zt.mutateAsync({blockKey:t})}catch(a){Q.error(a instanceof Error?a.message:i("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},Tn=t=>{st.current&&clearTimeout(st.current),st.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:c}=Ze.current;if(!s)return;const v={...a[s]},j={...v.sections},_=[...j.variants??[]],D=_[c],te=D?.rule;if(kt(te,a,l)){const M=te?.__resolveType??"",z=a[M],U=typeof z?.name=="string"?z.name:M,{__resolveType:we,...W}=t;Ne.mutate({blockKey:M,data:Tt(we??"",W,U)},{onSuccess:()=>u?.(),onError:J=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:J.message}))});return}D&&(_[c]={...D,rule:t}),v.sections={...j,variants:_},Ne.mutate({blockKey:s,data:v},{onSuccess:()=>u?.(),onError:M=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:M.message}))})},pn)},ma=t=>{ge(t);const s=t?Fn(t,l):{__resolveType:In};X(t?s:{}),Tn(s)},fa=t=>{const s=t;X(s);const a=Z?{__resolveType:Z,...s}:{...s};Tn(a)},pa=async t=>{wt();const{activePageKey:s,decofile:a,variantIndex:c}=Ze.current;if(!s)return;const v=a[s],j=v?.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const D=[..._.variants],te=D[c];if(!te)return;const M=At(te.rule,a,l),z=Yt(t);D[c]={...te,rule:z};const U={...a,[s]:{...v,sections:{..._,variants:D}}},{resolveType:we,formValue:W}=Pt(z,U,l??void 0);ge(we),X(W);try{await Ne.mutateAsync({blockKey:s,data:U[s]}),M&&M!==t&&await Dt(M,U),u?.()}catch(J){Q.error(J instanceof Error?J.message:i("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},Nn=t=>{at.current&&clearTimeout(at.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=Ze.current;s!==null&&(at.current=setTimeout(()=>{const{rawSections:c,parsedSections:v,decofile:j,activePageKey:_,pageVariants:D,variantIndex:te}=Ze.current;if(!_)return;const M=c[s],z=v[s];if(!M||!z?.isMultivariate)return;const U=tt(M,z);if(!U)return;const W=(U.variants??[])[a]?.rule;if(kt(W,j,l)){const xe=W?.__resolveType??"",Qe=j[xe],rt=typeof Qe?.name=="string"?Qe.name:xe,{__resolveType:gt,...it}=t;Ne.mutate({blockKey:xe,data:Tt(gt??"",it,rt)},{onSuccess:()=>u?.(),onError:ht=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:ht.message}))});return}const J=Ln(U,a,t),Ke=[...c];Ke[s]=xt(M,z,J);const et=Ct(j,_,Ke,te,D);Ne.mutate({blockKey:_,data:et},{onSuccess:()=>u?.(),onError:xe=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:xe.message}))})},pn))},ga=t=>{Ie(t);const s=t?Fn(t,l):{__resolveType:In};Te(t?s:{}),Nn(s)},ha=t=>{const s=t;Te(s);const a=We?{__resolveType:We,...s}:{...s};Nn(a)},va=async t=>{wt();const{selectedSectionIndex:s,sectionVariantIndex:a,rawSections:c,parsedSections:v,decofile:j,activePageKey:_,pageVariants:D,variantIndex:te}=Ze.current;if(s===null||!_)return;const M=c[s],z=v[s];if(!M||!z?.isMultivariate)return;const U=tt(M,z);if(!U)return;const we=U.variants??[],W=At(we[a]?.rule,j,l),J=Yt(t),Ke=Ln(U,a,J),et=[...c];et[s]=xt(M,z,Ke);const xe=Ct(j,_,et,te,D),Qe={...j,[_]:xe},{resolveType:rt,formValue:gt}=Pt(J,Qe,l??void 0);Ie(rt),Te(gt);try{await Ne.mutateAsync({blockKey:_,data:xe}),W&&W!==t&&await Dt(W,Qe),u?.()}catch(it){Q.error(it instanceof Error?it.message:i("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Ve&&!Ye)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:i("sectionsEditor.sectionsEditor.noPageFound",{currentPath:b})});if(Ve&&!tn)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:i("sectionsEditor.sectionsEditor.globalBlockNotFound")});const ft=f!==null?Ue[f]??null:null,Vn=f!==null?G[f]:null,Dn=Vn&&ft?.isMultivariate?tt(Vn,ft):null,bt=Dn?Kn(Dn,lt):[],cn=Math.min(I,Math.max(bt.length-1,0)),zt=bt[cn]??null,pt=ft?.isMultivariate===!0,Pn=f!==null&&ft!==null,Ht=Pn&&(pt||!!(on&&De)),ba=Ht&&!Ve&&ft?.isSavedBlock===!0,ot=Ve||ba,Sa=Ve?xn:ft?.label??"",xa=We&&l?qt(We,l):null,un=Ht&&(!Ve||se.length>0)?Ve?[xn,...se]:[Ye.name,ft.label,...pt&&zt?[zt.label]:[],...se]:[],ya=$&&Ye?[Ye.name,"SEO",...Re]:[],Ut=$?ya:ot?un.length>0?un:[Sa]:un,_a=!$&&!Ve&&pt&&se.length===0,An=()=>{if(!k)return;wt(),He.current&&(clearTimeout(He.current),He.current=null);const t=o[k],s=co(t.sections,G);if(!s)return;const a=uo(s);Ne.mutate({blockKey:k,data:{...t,sections:s}},{onSuccess:()=>{F(a),A(null),C(null),B(null),L([]),X(null),ge(null)},onError:c=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},dn=(t,s,a)=>{if(!k)return;wt(),He.current&&(clearTimeout(He.current),He.current=null);const c=o[k],v=c.sections;if(!v||typeof v!="object"||Array.isArray(v))return;const j=v;if(!Array.isArray(j.variants))return;const _=t([...j.variants]);if(!_)return;const D=Eo(j,_),te={...o,[k]:{...c,sections:D}};Ne.mutate({blockKey:k,data:te[k]},{onSuccess:()=>{s?.(),a&&Dt(a,te)},onError:M=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:M.message}))})},ja=t=>{_e(null),F(t),A(null),C(null),B(null),L([]);const s=qe[t]?.rule,{resolveType:a,formValue:c}=Pt(s,o??{},l??void 0);ge(a),X(c),jn(qe.map(v=>({rule:v.rule})),t)},Ea=(t,s)=>{if(t===s)return;let a=Oe;Oe===t?a=s:t<Oe&&s>=Oe?a=Oe-1:t>Oe&&s<=Oe&&(a=Oe+1),F(a);const c=Mt(qe.map(v=>({rule:v.rule})),t,s);jn(c,a),dn(v=>Mt(v,t,s))},Ra=t=>{const s=qe[t]?.rule,a=At(s,o??{},l??void 0);dn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{qe.length-1===1?F(0):t<Oe?F(Oe-1):t===Oe&&F(Math.max(0,t-1)),A(null),C(null),B(null),L([]),X(null),ge(null)},a)},wa=t=>{dn(s=>Ro(s,t),()=>{F(t+1),A(null),C(null),B(null),L([]),X(null),ge(null)})},ka=async(t,s)=>{wt(),He.current&&(clearTimeout(He.current),He.current=null);const a=Ze.current.activePageKey,c=Ze.current.decofile;if(!a)return;const v=c[a],j=v.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const D=[..._.variants],te=D[t];if(!te?.rule||typeof te.rule!="object"){Q.error(i("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const M=te.rule,z=s.trim();Lt(!0);try{if(!z){if(!kt(M,c,l)){_e(null);return}const et=M.__resolveType??"";D[t]={...te,rule:On(M,c,l)};const xe={...c,[a]:{...v,sections:{..._,variants:D}}};await Ne.mutateAsync({blockKey:a,data:xe[a]}),await Dt(et,xe),_e(null),u?.();return}const U=$n(M,c,l);if(!U){Q.error(i("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(U.blockKey){await Ne.mutateAsync({blockKey:U.blockKey,data:Tt(U.resolveType,U.data,z)}),_e(null),u?.();return}const we=mn(z),W=fn(we,c);if(W){Q.error(W);return}const J=Tt(U.resolveType,U.data,z);let Ke=null;try{await Ne.mutateAsync({blockKey:we,data:J}),Ke=we,D[t]={...te,rule:Yt(we)},await Ne.mutateAsync({blockKey:a,data:{...v,sections:{..._,variants:D}}}),Ke=null}catch(et){throw Ke&&await Zt.mutateAsync({blockKey:Ke}).catch(()=>{}),et}_e(null),Q.success(i("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:z})),u?.()}catch(U){Q.error(U instanceof Error?U.message:i("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Lt(!1)}},Ta=async(t,s)=>{wt(),He.current&&(clearTimeout(He.current),He.current=null);const{selectedSectionIndex:a,rawSections:c,parsedSections:v,decofile:j,activePageKey:_,pageVariants:D,variantIndex:te}=Ze.current;if(a===null||!_)return;const M=c[a],z=v[a];if(!M||!z?.isMultivariate)return;const U=tt(M,z);if(!U)return;const we=U.variants??[],W=we[t];if(!W?.rule||typeof W.rule!="object"){Q.error(i("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const J=W.rule,Ke=s.trim();Lt(!0);const et=async xe=>{const Qe={...U,variants:xe},rt=[...c];rt[a]=xt(M,z,Qe);const gt=Ct(j,_,rt,te,D);return await Ne.mutateAsync({blockKey:_,data:gt}),{...j,[_]:gt}};try{if(!Ke){if(!kt(J,j,l)){he(null);return}const ht=J.__resolveType??"",Bn=[...we];Bn[t]={...W,rule:On(J,j,l)};const Aa=await et(Bn);await Dt(ht,Aa),he(null),u?.();return}const xe=$n(J,j,l);if(!xe){Q.error(i("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(xe.blockKey){await Ne.mutateAsync({blockKey:xe.blockKey,data:Tt(xe.resolveType,xe.data,Ke)}),he(null),u?.();return}const Qe=mn(Ke),rt=fn(Qe,j);if(rt){Q.error(rt);return}const gt=Tt(xe.resolveType,xe.data,Ke);let it=null;try{await Ne.mutateAsync({blockKey:Qe,data:gt}),it=Qe;const ht=[...we];ht[t]={...W,rule:Yt(Qe)},await et(ht),it=null}catch(ht){throw it&&await Zt.mutateAsync({blockKey:it}).catch(()=>{}),ht}he(null),Q.success(i("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Ke})),u?.()}catch(xe){Q.error(xe instanceof Error?xe.message:i("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Lt(!1)}},Cn=()=>{Rt()},Na=t=>{q(t),rn({inner:t})},Va=t=>{de(t),rn({raw:t})},Da=()=>{q(null),me([])},Pa=()=>re(t=>t+1),Mn=t=>{if($){if(t===0){Xt.flush(),pe(!1),q(null),de(void 0),me([]),re(a=>a+1),T?.();return}if(t===1){me([]),re(a=>a+1);return}me(Re.slice(0,t-1)),re(a=>a+1);return}if(Ve){L(se.slice(0,t)),Y(a=>a+1);return}if(t===0){Cn();return}if(t===1){L([]),Y(a=>a+1);return}if(pt&&t===2){L([]),Y(a=>a+1);return}const s=pt?2:1;L(se.slice(0,t-s))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:ot||Ht||$?n.jsxs("div",{className:$e("border-b px-3 py-2.5",ot&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[Ut.length>1&&n.jsx("button",{type:"button",onClick:()=>Mn(wo(Ut.length,{isMultivariateSectionTop:_a})),title:i("sectionsEditor.sectionsEditor.back"),"aria-label":i("sectionsEditor.sectionsEditor.back"),className:$e("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",ot?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(bs,{className:"size-4"})}),!Ve&&It&&dt&&n.jsxs("button",{type:"button",onClick:Cn,title:i("sectionsEditor.sectionsEditor.editingInVariant",{variant:dt.label}),className:$e("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",Tr),children:[n.jsx(Ns,{rule:Bt(dt.rule,o??{},l??void 0),matchers:$t}),n.jsx("span",{className:"max-w-[160px] truncate",children:dt.label})]}),n.jsx("nav",{"aria-label":i("sectionsEditor.sectionsEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:Ut.map((t,s)=>{const a=s===Ut.length-1,c=hs(t);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&n.jsx(Ss,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Mn(s),title:c,className:$e("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?ot?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":ot?"text-foreground/80":"text-muted-foreground",ot?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:c})]},`${c}-${s}`)})}),ot&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(Ao,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:i("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Pn&&!pt&&!ft?.isHidden&&k&&n.jsx(Jn,{onClick:()=>ln()})]}),ot&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:i("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(Vr,{pageKey:k,initialName:Ye.name,initialPath:Ye.path,onFieldChange:Ys})}),n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":i("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>pe(!0),children:n.jsx(Vo,{size:14})})}),n.jsx(jt,{side:"bottom",children:i("sectionsEditor.sectionsEditor.editSeo")})]}),n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":i("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>V&&k?V(k):Ee(!0),children:n.jsx(Do,{size:14})})}),n.jsx(jt,{side:"bottom",children:i("sectionsEditor.sectionsEditor.viewJson")})]}),n.jsx(Jn,{onClick:An})]})}),$?n.jsx(Jt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ft&&k?n.jsx(Qo,{rawSeo:sn,innerSeo:yn,defaultResolveType:zs,seoSchema:Hs,activeResolveType:an,seoTypeOptions:$s,formResetKey:N,siteDefaultSeo:Us,onBreadcrumbChange:me,onPersistRaw:Va,onInnerChange:Na,onClearForm:Da,onBumpFormKey:Pa}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})}):Ht?n.jsxs(Jt,{viewportRef:ze,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[pt&&bt.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(ao,{listKey:`${k??""}:${f??""}`,variants:bt.map((t,s)=>({index:s,label:t.label})),selectedIndex:cn,onSelect:aa,onRename:he,onDuplicate:ra,onDelete:oa,onRemoveAll:la,onReorder:ia,onAdd:()=>ln()}),pt&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i("sectionsEditor.sectionsEditor.variantRule")}),n.jsx(Qn,{currentRt:We??"",currentLabel:Wt(zt?.rule,o??{},lt,l??void 0),currentGlobalKey:At(zt?.rule,o??{},l??void 0)??void 0,matchers:$t,globals:kn,onSelect:ga,onSelectGlobal:va,schema:xa,formValue:ut,onChange:ha,formKey:`${f??"none"}:${cn}:${We??""}`,formWrapperClassName:"pt-1",meta:l??void 0,decofile:o,onSaveReferencedBlock:Kt,sandbox:Ot})]})]}),n.jsx(Yn,{activeSchema:on,formValue:De,formResetKey:Me,onFormChange:En,onBreadcrumbChange:L,breadcrumbPath:se,emptyMessage:i("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:l,decofile:o,onSaveReferencedBlock:Kt,sandbox:Ot,previewBaseUrl:H,onRequestAddSection:Rn})]}):Ve?n.jsx(Jt,{viewportRef:ze,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Yn,{activeSchema:on,formValue:De,formResetKey:Me,onFormChange:En,onBreadcrumbChange:L,breadcrumbPath:se,emptyMessage:i("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:l,decofile:o,onSaveReferencedBlock:Kt,sandbox:Ot,previewBaseUrl:H,onRequestAddSection:Rn})}):n.jsxs(Jt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[It&&k&&n.jsx(Rr,{listKey:k,variants:qe,activeIndex:Oe,decofile:o??{},meta:l,matchers:$t,onSelect:ja,onReorder:Ea,onRename:_e,onDuplicate:wa,onDelete:Ra,onAdd:An}),It&&Z!==null&&n.jsxs("div",{className:$e("px-3 border-b",je?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":je,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i("sectionsEditor.sectionsEditor.variantRule")}),je?n.jsx(Po,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ko,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),je&&n.jsx("div",{className:$e("space-y-3",Nt&&"pointer-events-none opacity-50"),children:n.jsx(Qn,{currentRt:Z,currentLabel:Wt(dt?.rule,o??{},lt,l??void 0),currentGlobalKey:At(dt?.rule,o??{},l??void 0)??void 0,matchers:$t,globals:kn,onSelect:ma,onSelectGlobal:pa,schema:da,formValue:ye,onChange:fa,formKey:`${Oe}:${Z??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:o,onSaveReferencedBlock:Kt,sandbox:Ot})})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(vr,{listKey:`${k??""}-${Oe}`,rawSections:G,sections:Ue,meta:l,selectedIndex:f,onSelect:Ws,onReorder:Js,onDelete:Qs,onDuplicate:Xs,onMakeReusable:Fe,onToggleHidden:Zs,onToggleLazy:ea,onAddVariant:ln,onDetach:ta,onAddSection:()=>ae(!0),canAddSection:ua})})]}),n.jsx(oo,{open:ee!==null,onOpenChange:t=>{t||Fe(null)},defaultBlockId:ee!==null?mn(Ue[ee]?.label??""):"",isPending:Ne.isPending,onSubmit:ca}),H&&n.jsx(tr,{open:ve,onOpenChange:t=>{ae(t),t||(fe.current=null)},meta:l,decofile:o,previewBaseUrl:H,onSelect:sa}),Ae&&k&&o&&n.jsx(ro,{open:Ae,onOpenChange:Ee,pageKey:k,decofile:o}),Pe!==null&&n.jsx(qn,{open:!0,initialName:kt(qe[Pe]?.rule,o??{},l??void 0)?Wt(qe[Pe]?.rule,o??{},lt,l??void 0):"",autoLabel:lt(Bt(qe[Pe]?.rule,o??{},l??void 0)),isPending:Nt,onSubmit:async t=>{await ka(Pe,t)},onOpenChange:t=>{!t&&!Nt&&_e(null)}}),ue!==null&&n.jsx(qn,{open:!0,initialName:kt(bt[ue]?.rule,o??{},l??void 0)?Wt(bt[ue]?.rule,o??{},lt,l??void 0):"",autoLabel:lt(Bt(bt[ue]?.rule,o??{},l??void 0)),isPending:Nt,onSubmit:async t=>{await Ta(ue,t)},onOpenChange:t=>{!t&&!Nt&&he(null)}})]})}export{jc as SectionsEditor};
@@ -1 +1 @@
1
- import{r as i,aM as nt,aK as Ne,j as d,cY as rt,aO as be,aL as k,cZ as st,aH as j,aN as P,bR as $,c_ as lt,ae as _e,c$ as Ee,aI as at,bI as ct,bT as it,d5 as dt,d6 as ut,d7 as pt,d8 as ft,d0 as mt,aJ as ht,d9 as vt,d1 as gt,d3 as xt,c as ee,m as oe}from"./index-DrMtZH3n.js";import{V as St}from"./tooltip-H0fhJGAw.js";import{i as wt}from"./Check-CQsEmdtb.js";import{t as Re}from"./ChevronDown-l4iG0p-P.js";import{n as Ct}from"./ChevronUp-DOlZYOVw.js";function Pe(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[F,M]=i.useState(!1),re=nt(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[U,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:b,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:P(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,F]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>F(f)),[O,U]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(U(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ce,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[F,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ut;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("notranslate bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e};
1
+ import{r as i,aM as nt,aK as Ne,j as d,cY as rt,aO as be,aL as k,cZ as st,aH as j,aN as P,bR as $,c_ as lt,ae as _e,c$ as Ee,aI as at,bI as ct,bT as it,d5 as dt,d6 as ut,d7 as pt,d8 as ft,d0 as mt,aJ as ht,d9 as vt,d1 as gt,d3 as xt,c as ee,m as oe}from"./index-DDNkkWLs.js";import{V as St}from"./tooltip-11Yrt4wp.js";import{i as wt}from"./Check-BuqR_Kwe.js";import{t as Re}from"./ChevronDown-65wLzJTw.js";import{n as Ct}from"./ChevronUp-BNz5kAIR.js";function Pe(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[F,M]=i.useState(!1),re=nt(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[U,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:b,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:P(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,F]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>F(f)),[O,U]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(U(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ce,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[F,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ut;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("notranslate bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e};
@@ -1,4 +1,4 @@
1
- import{r as $,ae as ut,c as G,b as se,j as s,Z as Be,$ as ve,F as xe,o as we,a2 as We,a1 as Ve,e as je,K as ce,t as ne,B as le,p as ie,m as oe,n as mt,d as ft,E as pt,z as xt}from"./index-DrMtZH3n.js";import{c as He,e as qe,d as Ye,a as gt,b as Ge,h as vt,D as bt}from"./dialog-dwIz7L83.js";import{d as yt,b as jt,a as St,D as Nt}from"./drawer-CgKwyvsH.js";import{u as wt}from"./use-mobile-BpvQFpHJ.js";import{u as Xe}from"./chat-context-WBuSodUL.js";import{C as kt}from"./checkbox-CHPu3dI7.js";import{I as pe}from"./input-B8CuwYhS.js";import{S as _t,a as Ct,b as It,c as Mt,d as Et}from"./select-DwoG3i35.js";import{S as ee}from"./skeleton-BAWjjFCN.js";import{i as Qe}from"./ArrowLeft-aA-FzaCr.js";import{d as Ot,a as At,b as Pt,i as Tt}from"./Tool01-Dc3mraKQ.js";import{i as Lt}from"./Key01-Ch_IQKvS.js";import{i as Je,b as zt,a as Rt,s as Ft}from"./Settings02-DrpZgC_J.js";import{i as Ze}from"./SearchMd-P-qGR4xa.js";import{f as ke,u as Kt,b as Dt}from"./use-ai-providers-BHJZGUc0.js";import{g as _e}from"./ai-providers-logos-DD3qZ33J.js";import{i as Me}from"./Monitor01-BT8u7fos.js";import{i as $t}from"./AlertCircle-WwYKI5Qb.js";import{S as Ee}from"./spinner-DGBqgXCx.js";import{u as Ne}from"./studio-tools-Cl_MnIvi.js";import{i as Ut}from"./ChevronRight-BgMlkNeC.js";import{A as Bt}from"./avatar-z-df-Tey.js";import{S as Oe,a as Ae,b as et}from"./settings-section-BaQE1wG9.js";import{s as tt}from"./Eye-DoysLbE1.js";import{i as Wt,D as Vt}from"./tab-id-Bxlhy6J5.js";import{u as Ht}from"./use-is-desktop-app-BNujXJc_.js";import{t as Pe}from"./ChevronDown-l4iG0p-P.js";import{t as qt}from"./Stars01-DsD31Ln0.js";function fe(n,e,t){let i=t.initialDeps??[],o,l=!0;function a(){var r,h,d;let c;t.key&&((r=t.debug)!=null&&r.call(t))&&(c=Date.now());const f=n();if(!(f.length!==i.length||f.some((m,j)=>i[j]!==m)))return o;i=f;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...f),t.key&&((d=t.debug)!=null&&d.call(t))){const m=Math.round((Date.now()-c)*100)/100,j=Math.round((Date.now()-u)*100)/100,N=j/16,S=(b,I)=>{for(b=String(b);b.length<I;)b=" "+b;return b};console.info(`%c⏱ ${S(j,5)} /${S(m,5)} ms`,`
1
+ import{r as $,ae as ut,c as G,b as se,j as s,Z as Be,$ as ve,F as xe,o as we,a2 as We,a1 as Ve,e as je,K as ce,t as ne,B as le,p as ie,m as oe,n as mt,d as ft,E as pt,z as xt}from"./index-DDNkkWLs.js";import{c as He,e as qe,d as Ye,a as gt,b as Ge,h as vt,D as bt}from"./dialog-Ct9Ey8Rj.js";import{d as yt,b as jt,a as St,D as Nt}from"./drawer-GYAwqNoq.js";import{u as wt}from"./use-mobile-Cavq-ZyH.js";import{u as Xe}from"./chat-context-IReX7DMx.js";import{C as kt}from"./checkbox-BQcYZZpc.js";import{I as pe}from"./input-B6Ue8Gtq.js";import{S as _t,a as Ct,b as It,c as Mt,d as Et}from"./select-Bn2gd7PP.js";import{S as ee}from"./skeleton-BAcj33ku.js";import{i as Qe}from"./ArrowLeft-BqlCFBY7.js";import{d as Ot,a as At,b as Pt,i as Tt}from"./Tool01-CEpJ1e8Z.js";import{i as Lt}from"./Key01-f9O3oH8b.js";import{i as Je,b as zt,a as Rt,s as Ft}from"./Settings02-C6kyxW7G.js";import{i as Ze}from"./SearchMd-CGwyuA_K.js";import{f as ke,u as Kt,b as Dt}from"./use-ai-providers-CUHFWYci.js";import{g as _e}from"./ai-providers-logos-DD3qZ33J.js";import{i as Me}from"./Monitor01-CvmVoJ-i.js";import{i as $t}from"./AlertCircle-Bj0VV7up.js";import{S as Ee}from"./spinner-ws5yutkc.js";import{u as Ne}from"./studio-tools-DM5QBHCQ.js";import{i as Ut}from"./ChevronRight-EyYVLyQY.js";import{A as Bt}from"./avatar-BoobWyQ-.js";import{S as Oe,a as Ae,b as et}from"./settings-section-rIBQA49t.js";import{s as tt}from"./Eye-DA0zzgps.js";import{i as Wt,D as Vt}from"./tab-id-CiGWDuEk.js";import{u as Ht}from"./use-is-desktop-app-BNujXJc_.js";import{t as Pe}from"./ChevronDown-65wLzJTw.js";import{t as qt}from"./Stars01-Cv4Wame5.js";function fe(n,e,t){let i=t.initialDeps??[],o,l=!0;function a(){var r,h,d;let c;t.key&&((r=t.debug)!=null&&r.call(t))&&(c=Date.now());const f=n();if(!(f.length!==i.length||f.some((m,j)=>i[j]!==m)))return o;i=f;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...f),t.key&&((d=t.debug)!=null&&d.call(t))){const m=Math.round((Date.now()-c)*100)/100,j=Math.round((Date.now()-u)*100)/100,N=j/16,S=(b,I)=>{for(b=String(b);b.length<I;)b=" "+b;return b};console.info(`%c⏱ ${S(j,5)} /${S(m,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*N,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(l&&t.skipInitialOnChange)&&t.onChange(o),l=!1,o}return a.updateDeps=r=>{i=r},a}function Te(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Yt=(n,e)=>Math.abs(n-e)<1.01,Gt=(n,e,t)=>{let i;return function(...o){n.clearTimeout(i),i=n.setTimeout(()=>e.apply(this,o),t)}},Le=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},Xt=n=>n,Qt=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let o=e;o<=t;o++)i.push(o);return i},Jt=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;const o=a=>{const{width:r,height:h}=a;e({width:Math.round(r),height:Math.round(h)})};if(o(Le(t)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(a=>{const r=()=>{const h=a[0];if(h?.borderBoxSize){const d=h.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Le(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return l.observe(t,{box:"border-box"}),()=>{l.unobserve(t)}},ze={passive:!0},Re=typeof window>"u"?!0:"onscrollend"in window,Zt=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;let o=0;const l=n.options.useScrollendEvent&&Re?()=>{}:Gt(i,()=>{e(o,!1)},n.options.isScrollingResetDelay),a=c=>()=>{const{horizontal:f,isRtl:p}=n.options;o=f?t.scrollLeft*(p&&-1||1):t.scrollTop,l(),e(o,c)},r=a(!0),h=a(!1);t.addEventListener("scroll",r,ze);const d=n.options.useScrollendEvent&&Re;return d&&t.addEventListener("scrollend",h,ze),()=>{t.removeEventListener("scroll",r),d&&t.removeEventListener("scrollend",h)}},es=(n,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},ts=(n,{adjustments:e=0,behavior:t},i)=>{var o,l;const a=n+e;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:a,behavior:t})};class ss{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,o;return((o=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const a=()=>{const r=l.target,h=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r);return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(r,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),t=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,o])=>{typeof o>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Xt,rangeExtractor:Qt,onChange:()=>{},measureElement:es,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,t)},this.maybeNotify=fe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const o=new Map,l=new Map;for(let a=i-1;a>=0;a--){const r=t[a];if(o.has(r.lane))continue;const h=l.get(r.lane);if(h==null||r.end>h.end?l.set(r.lane,r):r.end<h.end&&o.set(r.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((a,r)=>a.end===r.end?a.index-r.index:a.end-r.end)[0]:void 0},this.getMeasurementOptions=fe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,o,l,a,r,h)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:a,lanes:r,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=fe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:a,lanes:r,laneAssignmentMode:h},d)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const u of this.laneAssignments.keys())u>=t&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,c),p=new Array(r).fill(void 0);for(let u=0;u<c;u++){const m=f[u];m&&(p[m.lane]=u)}for(let u=c;u<t;u++){const m=l(u),j=this.laneAssignments.get(u);let N,S;const b=h==="estimate"||d.has(m);if(j!==void 0&&this.options.lanes>1){N=j;const k=p[N],x=k!==void 0?f[k]:void 0;S=x?x.end+this.options.gap:i+o}else{const k=this.options.lanes===1?f[u-1]:this.getFurthestMeasurement(f,u);S=k?k.end+this.options.gap:i+o,N=k?k.lane:u%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(u,N)}const I=d.get(m),E=typeof I=="number"?I:this.options.estimateSize(u),O=S+E;f[u]={index:u,start:S,size:E,end:O,key:m,lane:N},p[N]=u}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=fe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,o,l)=>this.range=t.length>0&&i>0?is({measurements:t,outerSize:i,scrollOffset:o,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=fe(()=>{let t=null,i=null;const o=this.calculateRange();return o&&(t=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,o,l,a)=>l===null||a===null?[]:t({startIndex:l,endIndex:a,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,o=t.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-l),r=Math.min(this.options.count-1,o+l);return t>=a&&t<=r}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((a,r)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(r))});return}const i=this.indexFromElement(t),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var o;const l=this.measurementsCache[t];if(!l)return;const a=this.itemSizeCache.get(l.key)??l.size,r=i-a;r!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,r,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,i)),this.notify(!1))},this.getVirtualItems=fe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const o=[];for(let l=0,a=t.length;l<a;l++){const r=t[l],h=i[r];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Te(i[st(0,i.length-1,o=>Te(i[o]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),a=this.getScrollOffset();i==="auto"&&(i=t>=a+l?"end":"start"),i==="center"?t+=(o-l)/2:i==="end"&&(t-=l);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),a=this.measurementsCache[t];if(!a)return;if(i==="auto")if(a.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(a.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const r=i==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,i,a.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(t,i),a=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getOffsetForIndex(t,i);if(!l)return;const[a,r]=l,h=this.now();this.scrollState={index:t,align:r,behavior:o,startedAt:h,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+t,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=i[i.length-1])==null?void 0:t.end)??0;else{const l=Array(this.options.lanes).fill(null);let a=i.length-1;for(;a>=0&&l.some(r=>r===null);){const r=i[a];l[r.lane]===null&&(l[r.lane]=r.end),a--}o=Math.max(...l.filter(r=>r!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&Yt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const st=(n,e,t,i)=>{for(;n<=e;){const o=(n+e)/2|0,l=t(o);if(l<i)n=o+1;else if(l>i)e=o-1;else return o}return n>0?n-1:0};function is({measurements:n,outerSize:e,scrollOffset:t,lanes:i}){const o=n.length-1,l=h=>n[h].start;if(n.length<=i)return{startIndex:0,endIndex:o};let a=st(0,o,l,t),r=a;if(i===1)for(;r<o&&n[r].end<t+e;)r++;else if(i>1){const h=Array(i).fill(0);for(;r<o&&h.some(c=>c<t+e);){const c=n[r];h[c.lane]=c.end,r++}const d=Array(i).fill(t+e);for(;a>=0&&d.some(c=>c>=t);){const c=n[a];d[c.lane]=c.start,a--}a=Math.max(0,a-a%i),r=Math.min(o,r+(i-1-r%i))}return{startIndex:a,endIndex:r}}const Fe=typeof document<"u"?$.useLayoutEffect:$.useEffect;function ns({useFlushSync:n=!0,...e}){const t=$.useReducer(()=>({}),{})[1],i={...e,onChange:(l,a)=>{var r;n&&a?ut.flushSync(t):t(),(r=e.onChange)==null||r.call(e,l,a)}},[o]=$.useState(()=>new ss(i));return o.setOptions(i),Fe(()=>o._didMount(),[]),Fe(()=>o._willUpdate()),o}function ls(n){return ns({observeElementRect:Jt,observeElementOffset:Zt,scrollToFn:ts,...n})}const it=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function be(n){if(n)return it.find(e=>e.id===n)}const Ke=4;function ge(n){const e=G.c(8),{logo:t,name:i,description:o,onClick:l}=n;let a;e[0]!==t||e[1]!==i?(a=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Bt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=a):a=e[2];let r;return e[3]!==o||e[4]!==i||e[5]!==l||e[6]!==a?(r=s.jsx(et,{onClick:l,icon:a,title:i,description:o}),e[3]=o,e[4]=i,e[5]=l,e[6]=a,e[7]=r):r=e[7],r}function nt(n){const e=G.c(38),{providers:t,onSelect:i,onShowAll:o}=n,l=se();let a;e[0]!==t?(a=t.find(cs),e[0]=t,e[1]=a):a=e[1];const r=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=h):h=e[2];const d=h;let c;if(e[3]!==i||e[4]!==t||e[5]!==l){let E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=(y,C)=>{const z=d[y.id]??Number.MAX_SAFE_INTEGER,A=d[C.id]??Number.MAX_SAFE_INTEGER;return z-A},e[7]=E):E=e[7];const O=t.filter(as).sort(E);let k;e[8]!==t?(k=t.find(rs),e[8]=t,e[9]=k):k=e[9];const x=k;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=be("openai"),e[10]=w):w=e[10];const _=w;let M;e[11]!==i?(M=y=>s.jsx(ge,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"provider",provider:y})},y.id),e[11]=i,e[12]=M):M=e[12];let v;e[13]!==i||e[14]!==x?(v=x&&_?[s.jsx(ge,{logo:_.logo,name:_.name,description:_.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:_})},_.id)]:[],e[13]=i,e[14]=x,e[15]=v):v=e[15];let g;e[16]!==i||e[17]!==x||e[18]!==l?(g=x?[...it.filter(os).map(y=>s.jsx(ge,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:y})},y.id)),s.jsx(ge,{logo:x.logo,name:l("settings.aiProviders.customOpenAiCompatible"),description:l("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=l,e[19]=g):g=e[19],c=[...O.map(M),...v,...g],e[3]=i,e[4]=t,e[5]=l,e[6]=c}else c=e[6];const f=c,p=f.length-Ke,u=!!o&&p>0;let m;e[20]!==f||e[21]!==u?(m=u?f.slice(0,Ke):f,e[20]=f,e[21]=u,e[22]=m):m=e[22];const j=m;let N;e[23]!==r||e[24]!==i||e[25]!==l?(N=r&&s.jsx(Oe,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:l("settings.aiProviders.recommended")}),s.jsx(Ae,{className:"relative",children:s.jsx(ge,{logo:r.logo,name:r.name,description:r.description,onClick:()=>i({kind:"provider",provider:r})})})]})}),e[23]=r,e[24]=i,e[25]=l,e[26]=N):N=e[26];let S;e[27]!==p||e[28]!==o||e[29]!==u||e[30]!==l?(S=u&&s.jsx(et,{onClick:o,title:l(p===1?"settings.aiProviders.moreProvidersSingular":"settings.aiProviders.moreProvidersPlural",{count:p}),action:s.jsx(Ut,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=u,e[30]=l,e[31]=S):S=e[31];let b;e[32]!==S||e[33]!==j?(b=s.jsx(Oe,{children:s.jsxs(Ae,{children:[j,S]})}),e[32]=S,e[33]=j,e[34]=b):b=e[34];let I;return e[35]!==N||e[36]!==b?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[N,b]}),e[35]=N,e[36]=b,e[37]=I):I=e[37],I}function os(n){return n.id!=="openai"}function rs(n){return n.id==="openai-compatible"}function as(n){return n.id!=="deco"&&n.id!=="openai-compatible"}function cs(n){return n.id==="deco"}const ds=Be({label:ve().optional(),apiKey:ve().min(1,"API key is required")});function hs(n){const e=G.c(87),{providerId:t,onCancel:i,onSuccess:o}=n,{org:l}=xe(),a=Ne(),r=we(),[h,d]=$.useState(!1),c=se();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={resolver:We(ds),defaultValues:{label:"",apiKey:""}},e[0]=f):f=e[0];const{register:p,handleSubmit:u,formState:m}=Ve(f),{errors:j}=m;let N;e[1]!==t||e[2]!==a||e[3]!==c?(N=async Y=>{await a.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:Y.label||c("settings.connectForms.defaultKeyLabel"),apiKey:Y.apiKey})},e[1]=t,e[2]=a,e[3]=c,e[4]=N):N=e[4];let S;e[5]!==o||e[6]!==l||e[7]!==r||e[8]!==c?(S=()=>{r.invalidateQueries({queryKey:ce.aiProviderKeys(l.id)}),r.invalidateQueries({queryKey:ce.aiProviders(l.id)}),ne.success(c("settings.connectForms.keySavedSuccess")),o()},e[5]=o,e[6]=l,e[7]=r,e[8]=c,e[9]=S):S=e[9];let b;e[10]!==c?(b=Y=>{ne.error(c("settings.connectForms.failedSaveKey",{error:Y.message}))},e[10]=c,e[11]=b):b=e[11];let I;e[12]!==N||e[13]!==S||e[14]!==b?(I={mutationFn:N,onSuccess:S,onError:b},e[12]=N,e[13]=S,e[14]=b,e[15]=I):I=e[15];const{mutate:E,isPending:O,error:k}=je(I);let x;e[16]!==E?(x=Y=>E(Y),e[16]=E,e[17]=x):x=e[17];let w;e[18]!==u||e[19]!==x?(w=u(x),e[18]=u,e[19]=x,e[20]=w):w=e[20];let _;e[21]!==c?(_=c("settings.connectForms.labelField"),e[21]=c,e[22]=_):_=e[22];let M;e[23]!==_?(M=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:_}),e[23]=_,e[24]=M):M=e[24];let v;e[25]!==c?(v=c("settings.connectForms.labelPlaceholder"),e[25]=c,e[26]=v):v=e[26];let g;e[27]!==p?(g=p("label"),e[27]=p,e[28]=g):g=e[28];let y;e[29]!==v||e[30]!==g?(y=s.jsx(pe,{placeholder:v,...g,className:"h-8 text-sm"}),e[29]=v,e[30]=g,e[31]=y):y=e[31];let C;e[32]!==M||e[33]!==y?(C=s.jsxs("div",{className:"space-y-1",children:[M,y]}),e[32]=M,e[33]=y,e[34]=C):C=e[34];let z;e[35]!==c?(z=c("settings.connectForms.apiKeyField"),e[35]=c,e[36]=z):z=e[36];let A;e[37]!==z?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:z}),e[37]=z,e[38]=A):A=e[38];const P=h?"text":"password";let T;e[39]!==p?(T=p("apiKey"),e[39]=p,e[40]=T):T=e[40];let L;e[41]!==P||e[42]!==T?(L=s.jsx(pe,{type:P,placeholder:"sk-...",...T,className:"ph-no-capture h-8 text-sm pr-8"}),e[41]=P,e[42]=T,e[43]=L):L=e[43];let F;e[44]!==h?(F=()=>d(!h),e[44]=h,e[45]=F):F=e[45];let K;e[46]!==h||e[47]!==c?(K=c(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[46]=h,e[47]=c,e[48]=K):K=e[48];let X;e[49]!==h?(X=h?s.jsx(Je,{size:14}):s.jsx(tt,{size:14}),e[49]=h,e[50]=X):X=e[50];let V;e[51]!==F||e[52]!==K||e[53]!==X?(V=s.jsx("button",{type:"button",onClick:F,"aria-label":K,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:X}),e[51]=F,e[52]=K,e[53]=X,e[54]=V):V=e[54];let Q;e[55]!==L||e[56]!==V?(Q=s.jsxs("div",{className:"relative",children:[L,V]}),e[55]=L,e[56]=V,e[57]=Q):Q=e[57];let J;e[58]!==j.apiKey?(J=j.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:j.apiKey.message}),e[58]=j.apiKey,e[59]=J):J=e[59];let H;e[60]!==A||e[61]!==Q||e[62]!==J?(H=s.jsxs("div",{className:"space-y-1",children:[A,Q,J]}),e[60]=A,e[61]=Q,e[62]=J,e[63]=H):H=e[63];let U;e[64]!==k?(U=k&&s.jsx("p",{className:"text-xs text-destructive",children:k.message}),e[64]=k,e[65]=U):U=e[65];let B;e[66]!==c?(B=c("settings.connectForms.cancel"),e[66]=c,e[67]=B):B=e[67];let W;e[68]!==O||e[69]!==i||e[70]!==B?(W=s.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:O,children:B}),e[68]=O,e[69]=i,e[70]=B,e[71]=W):W=e[71];let Z;e[72]!==O||e[73]!==c?(Z=c(O?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[72]=O,e[73]=c,e[74]=Z):Z=e[74];let R;e[75]!==O||e[76]!==Z?(R=s.jsx(le,{type:"submit",size:"sm",disabled:O,children:Z}),e[75]=O,e[76]=Z,e[77]=R):R=e[77];let D;e[78]!==W||e[79]!==R?(D=s.jsxs(He,{children:[W,R]}),e[78]=W,e[79]=R,e[80]=D):D=e[80];let q;return e[81]!==C||e[82]!==H||e[83]!==U||e[84]!==D||e[85]!==w?(q=s.jsxs("form",{onSubmit:w,className:"space-y-3",children:[C,H,U,D]}),e[81]=C,e[82]=H,e[83]=U,e[84]=D,e[85]=w,e[86]=q):q=e[86],q}const us=Be({label:ve().optional(),baseUrl:ve().min(1,"Base URL is required"),apiKey:ve().optional()});function ms(n){const e=G.c(105),{preset:t,onCancel:i,onSuccess:o}=n,{org:l}=xe(),a=Ne(),r=we(),[h,d]=$.useState(!1),c=se();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=We(us),e[0]=f):f=e[0];const p=t?.defaultBaseUrl??"";let u;e[1]!==p?(u={resolver:f,defaultValues:{label:"",baseUrl:p,apiKey:""}},e[1]=p,e[2]=u):u=e[2];const{register:m,handleSubmit:j,formState:N}=Ve(u),{errors:S}=N;let b;e[3]!==t||e[4]!==a?(b=async ae=>{const ht=JSON.stringify({baseUrl:ae.baseUrl,apiKey:ae.apiKey||""});await a.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:ae.label||t?.name||ae.baseUrl,apiKey:ht,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=a,e[5]=b):b=e[5];let I;e[6]!==o||e[7]!==l||e[8]!==r||e[9]!==c?(I=()=>{r.invalidateQueries({queryKey:ce.aiProviderKeys(l.id)}),r.invalidateQueries({queryKey:ce.aiProviders(l.id)}),ne.success(c("settings.connectForms.connectionSavedSuccess")),o()},e[6]=o,e[7]=l,e[8]=r,e[9]=c,e[10]=I):I=e[10];let E;e[11]!==c?(E=ae=>{ne.error(c("settings.connectForms.failedSaveConnection",{error:ae.message}))},e[11]=c,e[12]=E):E=e[12];let O;e[13]!==b||e[14]!==I||e[15]!==E?(O={mutationFn:b,onSuccess:I,onError:E},e[13]=b,e[14]=I,e[15]=E,e[16]=O):O=e[16];const{mutate:k,isPending:x,error:w}=je(O);let _;e[17]!==t||e[18]!==c?(_=t?c("settings.connectForms.labelPlaceholderPreset",{name:t.name}):c("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[17]=t,e[18]=c,e[19]=_):_=e[19];const M=_;let v;e[20]!==t?.baseUrlPlaceholder||e[21]!==c?(v=t?.baseUrlPlaceholder??c("settings.connectForms.baseUrlPlaceholder"),e[20]=t?.baseUrlPlaceholder,e[21]=c,e[22]=v):v=e[22];const g=v;let y;e[23]!==k?(y=ae=>k(ae),e[23]=k,e[24]=y):y=e[24];let C;e[25]!==j||e[26]!==y?(C=j(y),e[25]=j,e[26]=y,e[27]=C):C=e[27];let z;e[28]!==c?(z=c("settings.connectForms.labelField"),e[28]=c,e[29]=z):z=e[29];let A;e[30]!==z?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:z}),e[30]=z,e[31]=A):A=e[31];let P;e[32]!==m?(P=m("label"),e[32]=m,e[33]=P):P=e[33];let T;e[34]!==M||e[35]!==P?(T=s.jsx(pe,{placeholder:M,...P,className:"h-8 text-sm"}),e[34]=M,e[35]=P,e[36]=T):T=e[36];let L;e[37]!==A||e[38]!==T?(L=s.jsxs("div",{className:"space-y-1",children:[A,T]}),e[37]=A,e[38]=T,e[39]=L):L=e[39];let F;e[40]!==g||e[41]!==S||e[42]!==t?.defaultBaseUrl||e[43]!==m||e[44]!==c?(F=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...m("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:c("settings.connectForms.baseUrlField")}),s.jsx(pe,{type:"url",placeholder:g,...m("baseUrl"),className:"h-8 text-sm"}),S.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:S.baseUrl.message})]}),e[40]=g,e[41]=S,e[42]=t?.defaultBaseUrl,e[43]=m,e[44]=c,e[45]=F):F=e[45];let K;e[46]!==c?(K=c("settings.connectForms.apiKeyField"),e[46]=c,e[47]=K):K=e[47];let X;e[48]!==t?.apiKeyRecommended||e[49]!==c?(X=t?.apiKeyRecommended?c("settings.connectForms.recommended"):c("settings.connectForms.optional"),e[48]=t?.apiKeyRecommended,e[49]=c,e[50]=X):X=e[50];let V;e[51]!==X?(V=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",X,")"]}),e[51]=X,e[52]=V):V=e[52];let Q;e[53]!==K||e[54]!==V?(Q=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[K," ",V]}),e[53]=K,e[54]=V,e[55]=Q):Q=e[55];const J=h?"text":"password";let H;e[56]!==m?(H=m("apiKey"),e[56]=m,e[57]=H):H=e[57];let U;e[58]!==J||e[59]!==H?(U=s.jsx(pe,{type:J,placeholder:"sk-...",...H,className:"ph-no-capture h-8 text-sm pr-8"}),e[58]=J,e[59]=H,e[60]=U):U=e[60];let B;e[61]!==h?(B=()=>d(!h),e[61]=h,e[62]=B):B=e[62];let W;e[63]!==h||e[64]!==c?(W=c(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[63]=h,e[64]=c,e[65]=W):W=e[65];let Z;e[66]!==h?(Z=h?s.jsx(Je,{size:14}):s.jsx(tt,{size:14}),e[66]=h,e[67]=Z):Z=e[67];let R;e[68]!==B||e[69]!==W||e[70]!==Z?(R=s.jsx("button",{type:"button",onClick:B,"aria-label":W,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Z}),e[68]=B,e[69]=W,e[70]=Z,e[71]=R):R=e[71];let D;e[72]!==U||e[73]!==R?(D=s.jsxs("div",{className:"relative",children:[U,R]}),e[72]=U,e[73]=R,e[74]=D):D=e[74];let q;e[75]!==Q||e[76]!==D?(q=s.jsxs("div",{className:"space-y-1",children:[Q,D]}),e[75]=Q,e[76]=D,e[77]=q):q=e[77];let Y;e[78]!==t?(Y=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[78]=t,e[79]=Y):Y=e[79];let te;e[80]!==w?(te=w&&s.jsx("p",{className:"text-xs text-destructive",children:w.message}),e[80]=w,e[81]=te):te=e[81];let re;e[82]!==c?(re=c("settings.connectForms.cancel"),e[82]=c,e[83]=re):re=e[83];let de;e[84]!==x||e[85]!==i||e[86]!==re?(de=s.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:re}),e[84]=x,e[85]=i,e[86]=re,e[87]=de):de=e[87];let he;e[88]!==x||e[89]!==c?(he=c(x?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[88]=x,e[89]=c,e[90]=he):he=e[90];let ue;e[91]!==x||e[92]!==he?(ue=s.jsx(le,{type:"submit",size:"sm",disabled:x,children:he}),e[91]=x,e[92]=he,e[93]=ue):ue=e[93];let me;e[94]!==de||e[95]!==ue?(me=s.jsxs(He,{children:[de,ue]}),e[94]=de,e[95]=ue,e[96]=me):me=e[96];let ye;return e[97]!==C||e[98]!==L||e[99]!==F||e[100]!==q||e[101]!==Y||e[102]!==te||e[103]!==me?(ye=s.jsxs("form",{onSubmit:C,className:"space-y-3",children:[L,F,q,Y,te,me]}),e[97]=C,e[98]=L,e[99]=F,e[100]=q,e[101]=Y,e[102]=te,e[103]=me,e[104]=ye):ye=e[104],ye}const fs={kind:"closed"};function ps(n,e){switch(e.type){case"open":return n.kind==="closed"?{kind:"grid"}:n;case"close":return{kind:"closed"};case"back":switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return n}case"select-form":return n.kind!=="grid"?n:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return n.kind!=="grid"?n:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return n.kind==="oauth-pending"?{kind:"grid"}:n;case"select-provision":return n.kind!=="grid"?n:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return n.kind!=="provision-pending"?n:{kind:"provision-error",providerId:n.providerId,error:e.error};case"retry-provision":return n.kind!=="provision-error"?n:{kind:"provision-pending",providerId:n.providerId}}}function xs(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function gs({open:n,onOpenChange:e,initialProvider:t}){const i=se(),l=ke()?.providers??[],{org:a}=xe(),r=Ne(),h=we(),[d,c]=$.useReducer(ps,fs),f=$.useRef(!1);$.useEffect(()=>{n&&d.kind==="closed"?c({type:"open"}):!n&&d.kind!=="closed"&&c({type:"close"})},[n,d.kind]);const p=()=>{f.current=!1,c({type:"close"}),e(!1)},u=()=>{h.invalidateQueries({queryKey:ce.aiProviderKeys(a.id)}),h.invalidateQueries({queryKey:ce.aiProviders(a.id)})},{mutate:m}=je({mutationFn:async({providerId:v,code:g,stateToken:y,label:C})=>(await r.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:v,code:g,stateToken:y,label:C}),v),onSuccess:v=>{ie("ai_provider_oauth_succeeded",{provider_id:v}),u();const g=l.find(y=>y.id===v);ne.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ie("ai_provider_oauth_failed",{provider_id:g.providerId,error:v.message}),ne.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:v.message})),c({type:"oauth-failed"})}}),{mutate:j}=je({mutationFn:async v=>(await r.call("AI_PROVIDER_PROVISION_KEY",{providerId:v}),v),onSuccess:v=>{ie("ai_provider_provision_succeeded",{provider_id:v}),u();const g=l.find(y=>y.id===v);ne.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ie("ai_provider_provision_failed",{provider_id:g,error:v.message}),c({type:"provision-error",error:v.message})}}),N=async v=>{const{provider:g}=v,y=v.kind==="openai-compatible"?v.preset?.id??null:null,C=g.supportedMethods.includes("oauth-pkce"),z=g.supportedMethods.includes("api-key");if(g.supportsProvision===!0){ie("ai_provider_connect_clicked",{provider_id:g.id,method:"provision"}),c({type:"select-provision",providerId:g.id}),j(g.id);return}if(C){ie("ai_provider_connect_clicked",{provider_id:g.id,method:"oauth-pkce"});try{const P=await r.call("AI_PROVIDER_OAUTH_URL",{providerId:g.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!P?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");c({type:"select-oauth",providerId:g.id,stateToken:P.stateToken}),window.open(P.url,"AiProviderOAuth","width=600,height=700")}catch(P){ne.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:P instanceof Error?P.message:String(P)}))}return}z&&(ie("ai_provider_connect_clicked",{provider_id:g.id,...y!==null?{preset_id:y}:{},method:"api-key"}),c({type:"select-form",providerId:g.id,presetId:y}))},S=$.useRef(N);S.current=N;const b=$.useRef(t);b.current=t,$.useEffect(()=>{!b.current||d.kind!=="grid"||f.current||(f.current=!0,S.current(b.current))},[d.kind]);const I=d.kind==="oauth-pending"?d.stateToken:null,E=d.kind==="oauth-pending"?d.providerId:null;$.useEffect(()=>{if(d.kind!=="oauth-pending")return;let v=!1;const g=d.stateToken,y=d.providerId,C=A=>{if(A.origin!==window.location.origin||A.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:P,stateToken:T}=A.data;if(T!==g){ne.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),c({type:"oauth-failed"});return}v=!0;const L=l.find(F=>F.id===y);m({providerId:y,code:P,stateToken:g,label:L?.name??y})};window.addEventListener("message",C);const z=setTimeout(()=>{v||(ie("ai_provider_oauth_timeout",{provider_id:y}),c({type:"oauth-failed"}),ne.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",C),clearTimeout(z)}},[d.kind,I,E,m]);const O=xs(d),k=O?l.find(v=>v.id===O):null,w=(d.kind==="form"&&d.presetId?be(d.presetId):null)?.name??k?.name??i("settings.connectProviderDialog.defaultTitle"),_=d.kind!=="grid"&&d.kind!=="closed",M=()=>{t?p():c({type:"back"})};return s.jsx(qe,{open:d.kind!=="closed",onOpenChange:v=>!v&&p(),children:s.jsxs(Ye,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[_&&s.jsx(le,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:M,children:s.jsx(Qe,{size:16})}),s.jsx(Ge,{children:w})]}),d.kind==="grid"&&!t&&s.jsx(vt,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(nt,{providers:l,onSelect:N}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(ms,{preset:d.presetId?be(d.presetId):void 0,onCancel:()=>c({type:"back"}),onSuccess:()=>{u(),p()}}):s.jsx(hs,{providerId:d.providerId,onCancel:()=>c({type:"back"}),onSuccess:()=>{u(),p()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Ee,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Ee,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx($t,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{variant:"outline",size:"sm",onClick:()=>c({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(le,{size:"sm",onClick:()=>{c({type:"retry-provision"}),j(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function vs(){const n=G.c(7),{org:e}=xe(),t=Ne();let i;n[0]!==e.id?(i=ce.defaultBrand(e.id),n[0]=e.id,n[1]=i):i=n[1];let o;n[2]!==t?(o=async()=>{const{items:r}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(r)?r:[]).find(bs)??null},n[2]=t,n[3]=o):o=n[3];let l;n[4]!==i||n[5]!==o?(l={queryKey:i,queryFn:o},n[4]=i,n[5]=o,n[6]=l):l=n[6];const{data:a}=mt(l);return a??null}function bs(n){return n.isDefault&&!n.archivedAt}function ys(n){const e=n.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(o=>typeof o=="object"&&o!==null&&"label"in o&&/primary|brand|main/i.test(o.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function js(n){const e=G.c(49);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:i,description:o}=t,l=se(),{org:a}=xe(),r=vs(),[h,d]=$.useState(null),[c,f]=$.useState(!1),[p,u]=$.useState(!1),m=Ht();let j;e[2]!==m?(j=Wt()&&!m,e[2]=m,e[3]=j):j=e[3];const N=j,S=ke();let b;e[4]!==S?.providers?(b=S?.providers??[],e[4]=S?.providers,e[5]=b):b=e[5];const I=b,E=a.name;let O;e[6]!==r?(O=r?ys(r):null,e[6]=r,e[7]=O):O=e[7];const k=O,x=r?.favicon??r?.logo??null;let w;e[8]!==E||e[9]!==l||e[10]!==i?(w=i??(E?l("chat.noAiProviderEmptyState.headingWithOrg",{org:E}):l("chat.noAiProviderEmptyState.headingDefault")),e[8]=E,e[9]=l,e[10]=i,e[11]=w):w=e[11];const _=w;let M;e[12]!==o||e[13]!==l?(M=o??l("chat.noAiProviderEmptyState.subtitleDefault"),e[12]=o,e[13]=l,e[14]=M):M=e[14];const v=M,g=!!(x||k);let y;e[15]!==k?(y=k?{backgroundColor:`${k}18`,borderColor:`${k}30`}:void 0,e[15]=k,e[16]=y):y=e[16];const C=y,z=g?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";let A;e[17]!==z||e[18]!==C||e[19]!==x||e[20]!==N||e[21]!==k||e[22]!==l?(A=x?s.jsx("div",{className:z,style:C,children:s.jsx("img",{src:x,alt:"",className:"size-7 rounded object-contain"})}):N?s.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":l("downloadApp.openLabel"),className:oe(z,"cursor-pointer transition-colors hover:bg-accent"),style:C,children:s.jsx(Me,{size:24,style:k?{color:k}:void 0,className:oe(!k&&"text-muted-foreground")})}):s.jsx("div",{className:z,style:C,children:s.jsx(Me,{size:24,style:k?{color:k}:void 0,className:oe(!k&&"text-muted-foreground")})}),e[17]=z,e[18]=C,e[19]=x,e[20]=N,e[21]=k,e[22]=l,e[23]=A):A=e[23];let P;e[24]!==_?(P=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:_}),e[24]=_,e[25]=P):P=e[25];let T;e[26]!==v?(T=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:v}),e[26]=v,e[27]=T):T=e[27];let L;e[28]!==T||e[29]!==P?(L=s.jsxs("div",{className:"space-y-2",children:[P,T]}),e[28]=T,e[29]=P,e[30]=L):L=e[30];let F;e[31]!==L||e[32]!==A?(F=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[A,L]}),e[31]=L,e[32]=A,e[33]=F):F=e[33];let K,X;e[34]===Symbol.for("react.memo_cache_sentinel")?(K=Z=>d(Z),X=()=>f(!0),e[34]=K,e[35]=X):(K=e[34],X=e[35]);let V;e[36]!==I?(V=s.jsx("div",{className:"w-full",children:s.jsx(nt,{providers:I,onSelect:K,onShowAll:X})}),e[36]=I,e[37]=V):V=e[37];const Q=h!==null||c;let J;e[38]===Symbol.for("react.memo_cache_sentinel")?(J=Z=>{Z||(d(null),f(!1))},e[38]=J):J=e[38];const H=h??void 0;let U;e[39]!==Q||e[40]!==H?(U=s.jsx(gs,{open:Q,onOpenChange:J,initialProvider:H}),e[39]=Q,e[40]=H,e[41]=U):U=e[41];let B;e[42]!==p?(B=s.jsx(Vt,{open:p,onOpenChange:u}),e[42]=p,e[43]=B):B=e[43];let W;return e[44]!==F||e[45]!==V||e[46]!==U||e[47]!==B?(W=s.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[F,V,U,B]}),e[44]=F,e[45]=V,e[46]=U,e[47]=B,e[48]=W):W=e[48],W}function Ce(n){const e=n.title.includes(": ");return{provider:e?n.title.split(": ")[0]??"":n.modelId.split("/")[0]??"",displayName:e?n.title.split(": ").slice(1).join(": "):n.title}}function Ss(n){return n<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:n<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:n<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const Ns=["bg-destructive","bg-warning","bg-success","bg-success"],ws=["text-success","text-warning","text-warning","text-destructive"];function ks(n,e){const t=Math.round(n*.75/1e3),i=t>=1?`${t}K`:`${Math.round(n*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function _s(n){return n<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:n<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:n<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const Cs={text:{icon:s.jsx(Pt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(At,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(zt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx(Ot,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(qt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(Ze,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function Is(n){const e=G.c(10),{capability:t}=n,i=se(),o=Cs[t];if(o){const h=o.icon;let d;e[0]!==o.labelKey||e[1]!==i?(d=i(o.labelKey),e[0]=o.labelKey,e[1]=i,e[2]=d):d=e[2];let c;return e[3]!==o.icon||e[4]!==d?(c=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[h,d]}),e[3]=o.icon,e[4]=d,e[5]=c):c=e[5],c}let l;e[6]!==t?(l=t.charAt(0).toUpperCase(),e[6]=t,e[7]=l):l=e[7];const a=l+t.slice(1);let r;return e[8]!==a?(r=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:a}),e[8]=a,e[9]=r):r=e[9],r}function Ms(n){const e=G.c(59),{model:t,compact:i}=n,o=i===void 0?!1:i,l=se();if(!t){let x;e[0]!==l?(x=l("chat.shared.hoverToPreview"),e[0]=l,e[1]=x):x=e[1];let w;return e[2]!==x?(w=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=w):w=e[3],w}const a=t.costs?.input!=null?t.costs.input*1e6:null,r=t.costs?.output!=null?t.costs.output*1e6:null;let h;e[4]!==t?(h=Ce(t),e[4]=t,e[5]=h):h=e[5];const{provider:d,displayName:c}=h;if(o){let x;e[6]!==t.limits||e[7]!==l?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=l,e[8]=x):x=e[8];let w;e[9]!==a||e[10]!==l?(w=a!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",a.toFixed(2)," / 1M"]})]}),e[9]=a,e[10]=l,e[11]=w):w=e[11];let _;e[12]!==r||e[13]!==l?(_=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[12]=r,e[13]=l,e[14]=_):_=e[14];let M;e[15]!==t.limits||e[16]!==l?(M=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=l,e[17]=M):M=e[17];let v;return e[18]!==x||e[19]!==w||e[20]!==_||e[21]!==M?(v=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,w,_,M]}),e[18]=x,e[19]=w,e[20]=_,e[21]=M,e[22]=v):v=e[22],v}let f;e[23]!==d?(f=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=f):f=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let u;e[28]!==c?(u=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:c}),e[28]=c,e[29]=u):u=e[29];let m;e[30]!==p||e[31]!==u?(m=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,u]}),e[30]=p,e[31]=u,e[32]=m):m=e[32];let j;e[33]!==t.modelId?(j=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=j):j=e[34];let N;e[35]!==f||e[36]!==m||e[37]!==j?(N=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[f,m,j]}),e[35]=f,e[36]=m,e[37]=j,e[38]=N):N=e[38];let S;e[39]!==t.capabilities?(S=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(Es)}),e[39]=t.capabilities,e[40]=S):S=e[40];let b;e[41]!==t.limits||e[42]!==l?(b=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:w,descriptionKey:_}=Ss(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.contextWindow")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(M=>s.jsx("div",{className:oe("w-2 h-2 rounded-full",M<=x?Ns[x-1]:"bg-muted")},M))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:l(w)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",l(_)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=l,e[43]=b):b=e[43];let I;e[44]!==t.limits||e[45]!==l?(I=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:ks(t.limits.maxOutputTokens,l)})]})]}),e[44]=t.limits,e[45]=l,e[46]=I):I=e[46];let E;e[47]!==a||e[48]!==r||e[49]!==l?(E=(a!=null||r!=null)&&(()=>{const{level:x,labelKey:w}=a!=null?_s(a):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.pricing")}),a!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(_=>s.jsx("span",{className:oe("text-sm font-bold leading-none",_<=x?ws[x-1]:"text-muted-foreground/20"),children:"$"},_))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:w?l(w):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[a!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",a.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]}),r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]})]})]})})(),e[47]=a,e[48]=r,e[49]=l,e[50]=E):E=e[50];let O;e[51]!==b||e[52]!==I||e[53]!==E?(O=s.jsxs("div",{className:"flex flex-col gap-6",children:[b,I,E]}),e[51]=b,e[52]=I,e[53]=E,e[54]=O):O=e[54];let k;return e[55]!==O||e[56]!==N||e[57]!==S?(k=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[N,S,O]}),e[55]=O,e[56]=N,e[57]=S,e[58]=k):k=e[58],k}function Es(n){return s.jsx(Is,{capability:n},n)}function lt(n){const e=G.c(22),{model:t,placeholder:i,isLoading:o}=n,l=o===void 0?!1:o,a=se();let r;e[0]!==i||e[1]!==a?(r=i??a("chat.shared.selectModel"),e[0]=i,e[1]=a,e[2]=r):r=e[2];const h=r;if(l){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ee,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(ee,{className:"w-16 h-3 hidden md:block"})]}),e[3]=S):S=e[3],S}if(!t){let S;e[4]!==h?(S=s.jsx("span",{className:"text-sm text-muted-foreground",children:h}),e[4]=h,e[5]=S):S=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Pe,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=b):b=e[6];let I;return e[7]!==S?(I=s.jsxs("div",{className:"flex items-center gap-1.5",children:[S,b]}),e[7]=S,e[8]=I):I=e[8],I}let d;e[9]!==t?(d=Ce(t),e[9]=t,e[10]=d):d=e[10];const{displayName:c}=d;let f;e[11]!==t?(f=_e(t),e[11]=t,e[12]=f):f=e[12];const p=f;let u;e[13]!==t.title||e[14]!==p?(u=s.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=u):u=e[15];let m;e[16]!==c?(m=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:c}),e[16]=c,e[17]=m):m=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Pe,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=j):j=e[18];let N;return e[19]!==u||e[20]!==m?(N=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,m,j]}),e[19]=u,e[20]=m,e[21]=N):N=e[21],N}const Os=["vision","image","file","audio","video"],ot=["image/png","image/jpeg","image/gif","image/webp"],rt=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Ie(n){const e=n?.capabilities;return e?Os.some(t=>e.includes(t)):!1}function zi(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),o=t.includes("file"),l=t.includes("audio"),a=t.includes("video");return!!(i&&ot.includes(n)||o&&n==="application/pdf"||l&&n.startsWith("audio/")||a&&n.startsWith("video/")||Ie(e)&&rt.includes(n))}function Ri(n){const e=n?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...ot),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Ie(n)&&t.push(...rt),t.join(",")}function Fi(n){const e=n?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Ie(n)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const at=["smarter","faster","cheaper"],As={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},Ps=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ts=Ps.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),Ls="google/gemini-2.5-pro",De=new Map;function zs(n){const e=De.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:o}of Ts)if(n.startsWith(o)){if(o===Ls&&n.length>o.length&&n[o.length]==="-"){const a=n[o.length+1];if(!a||!/\d/.test(a))continue}t=i;break}return De.set(n,t),t}function $e(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const i=zs(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,o)=>i.title.localeCompare(o.title));return e}const ct="studio:model-shortlist:",Rs=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Fs(n){try{const e=localStorage.getItem(ct+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function Ks(n,e){localStorage.setItem(ct+n,JSON.stringify([...e]))}function Ds(n){const e=G.c(21),{model:t,onHover:i}=n;let o;e[0]!==t?(o=Ce(t),e[0]=t,e[1]=o):o=e[1];const{displayName:l,provider:a}=o;let r;e[2]!==t?(r=_e(t),e[2]=t,e[3]=r):r=e[3];const h=r;let d;e[4]!==t||e[5]!==i?(d=()=>i(t),e[4]=t,e[5]=i,e[6]=d):d=e[6];let c;e[7]!==t.title||e[8]!==h?(c=s.jsx("img",{src:h,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=h,e[9]=c):c=e[9];let f;e[10]!==l?(f=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:l}),e[10]=l,e[11]=f):f=e[11];let p;e[12]!==a?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:a}),e[12]=a,e[13]=p):p=e[13];let u;e[14]!==f||e[15]!==p?(u=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[f,p]}),e[14]=f,e[15]=p,e[16]=u):u=e[16];let m;return e[17]!==d||e[18]!==c||e[19]!==u?(m=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[c,u]}),e[17]=d,e[18]=c,e[19]=u,e[20]=m):m=e[20],m}function $s(n){const e=G.c(16),{error:t,onRetry:i}=n,o=se();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(xt,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];const a=o("chat.decopilot.failedToLoadModels");let r;e[1]!==a?(r=s.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e[1]=a,e[2]=r):r=e[2];const h=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let c;e[3]!==h||e[4]!==d?(c=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[h,d]}),e[3]=h,e[4]=d,e[5]=c):c=e[5];let f;e[6]!==r||e[7]!==c?(f=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,c]}),e[6]=r,e[7]=c,e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Ft,{className:"size-3.5"}),e[9]=p):p=e[9];const u=o("chat.decopilot.retry");let m;e[10]!==i||e[11]!==u?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(le,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[p,u]})}),e[10]=i,e[11]=u,e[12]=m):m=e[12];let j;return e[13]!==m||e[14]!==f?(j=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,f,m]}),e[13]=m,e[14]=f,e[15]=j):j=e[15],j}function Us(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Bs)}),n[0]=e):e=n[0],e}function Bs(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(ee,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(ee,{className:"flex-1 h-4"}),s.jsx(ee,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ue(n){const e=G.c(12),{label:t,models:i,onSelect:o,onHover:l}=n;if(i.length===0)return null;let a;e[0]!==t?(a=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=a):a=e[1];let r;if(e[2]!==i||e[3]!==l||e[4]!==o){let d;e[6]!==l||e[7]!==o?(d=c=>s.jsx("button",{type:"button",onClick:()=>o(c),onFocus:()=>l(c),className:"w-full text-left cursor-pointer",children:s.jsx(Ds,{model:c,onHover:l})},c.modelId),e[6]=l,e[7]=o,e[8]=d):d=e[8],r=i.map(d),e[2]=i,e[3]=l,e[4]=o,e[5]=r}else r=e[5];let h;return e[9]!==a||e[10]!==r?(h=s.jsxs("div",{children:[a,r]}),e[9]=a,e[10]=r,e[11]=h):h=e[11],h}function Se(n,e){return e(n==="other"?"chat.decopilot.tierOther":As[n])}function Ws(n){const e=G.c(21),{model:t,isChecked:i,onToggle:o,onHover:l}=n,[a,r]=$.useState(i);a!==i&&r(i);let h;e[0]!==t?(h=_e(t),e[0]=t,e[1]=h):h=e[1];const d=h;let c;e[2]!==t||e[3]!==l?(c=()=>l(t),e[2]=t,e[3]=l,e[4]=c):c=e[4];let f;e[5]!==t.modelId||e[6]!==o?(f=()=>{r(Vs),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=f):f=e[7];let p;e[8]!==a||e[9]!==f?(p=s.jsx(kt,{checked:a,onCheckedChange:f}),e[8]=a,e[9]=f,e[10]=p):p=e[10];let u;e[11]!==d||e[12]!==t.title?(u=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=u):u=e[13];let m;e[14]!==t.title?(m=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=m):m=e[15];let j;return e[16]!==c||e[17]!==p||e[18]!==u||e[19]!==m?(j=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[p,u,m]}),e[16]=c,e[17]=p,e[18]=u,e[19]=m,e[20]=j):j=e[20],j}function Vs(n){return!n}function Hs(n,e){const t=[];for(const i of at)if(n[i].length>0){t.push({type:"header",label:Se(i,e)});for(const o of n[i])t.push({type:"model",model:o})}if(n.other.length>0){t.push({type:"header",label:Se("other",e)});for(const i of n.other)t.push({type:"model",model:i})}return t}function qs({items:n,shortlistSet:e,onToggle:t,onHover:i}){const o=$.useRef(null),l=ls({count:n.length,getScrollElement:()=>o.current,estimateSize:a=>n[a]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:l.getTotalSize()},children:l.getVirtualItems().map(a=>{const r=n[a.index];return r?s.jsx("div",{"data-index":a.index,ref:l.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${a.start}px)`},children:r.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:r.label}):s.jsx(Ws,{model:r.model,isChecked:e.has(r.model.modelId),onToggle:t,onHover:i})},a.key):null})})})}function Ys(n){const e=G.c(30),{keyId:t,searchTerm:i,onHover:o,onModelSelect:l,managing:a,onToggleManage:r,filterModels:h}=n,d=se(),{models:c}=Dt(t),f=h?c.filter(h):c.filter(Gs);let p;e[0]!==t?(p=()=>(t?Fs(t):null)??Rs,e[0]=t,e[1]=p):p=e[1];const[u,m]=$.useState(p),[,j]=$.useTransition();let N;e[2]!==t||e[3]!==j?(N=g=>{t&&j(()=>{m(y=>{const C=new Set(y);return C.has(g)?C.delete(g):C.add(g),Ks(t,C),C})})},e[2]=t,e[3]=j,e[4]=N):N=e[4];const S=N,b=i.toLowerCase().trim(),I=g=>b?g.filter(y=>y.title.toLowerCase().includes(b)||y.modelId.toLowerCase().includes(b)):g;if(a){const g=$e(I(f)),y=Hs(g,d);let C;e[5]!==u?(C=L=>u.has(L.modelId),e[5]=u,e[6]=C):C=e[6];const z=f.filter(C).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Qe,{size:14}),e[7]=A):A=e[7];let P;e[8]!==d?(P=d("chat.decopilot.back"),e[8]=d,e[9]=P):P=e[9];let T;return e[10]!==r||e[11]!==P?(T=s.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[A,P]}),e[10]=r,e[11]=P,e[12]=T):T=e[12],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[T,s.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:z})})]}),s.jsx(qs,{items:y,shortlistSet:u,onToggle:S,onHover:o})]})}let E;e[13]!==u?(E=g=>u.has(g.modelId),e[13]=u,e[14]=E):E=e[14];const O=f.filter(E),k=O.length>0?O:f,x=$e(I(k));let w;e[15]!==x||e[16]!==o||e[17]!==l||e[18]!==d?(w=at.map(g=>s.jsx(Ue,{label:Se(g,d),models:x[g],onSelect:l,onHover:o},g)),e[15]=x,e[16]=o,e[17]=l,e[18]=d,e[19]=w):w=e[19];let _;e[20]!==d?(_=Se("other",d),e[20]=d,e[21]=_):_=e[21];let M;e[22]!==x.other||e[23]!==o||e[24]!==l||e[25]!==_?(M=s.jsx(Ue,{label:_,models:x.other,onSelect:l,onHover:o}),e[22]=x.other,e[23]=o,e[24]=l,e[25]=_,e[26]=M):M=e[26];let v;return e[27]!==w||e[28]!==M?(v=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[w,M]}),e[27]=w,e[28]=M,e[29]=v):v=e[29],v}function Gs(n){return n.asyncResearch!==!0}function Xs(){const n=G.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(ee,{className:"size-4 shrink-0"}),s.jsx(ee,{className:"flex-1 h-6"}),s.jsx(ee,{className:"w-[140px] h-8 shrink-0"})]})}),n[0]=e):e=n[0];let t;n[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(Qs)})]}),n[1]=t):t=n[1];let i;n[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ee,{className:"size-6 shrink-0"}),s.jsx(ee,{className:"h-6 w-32"})]}),n[2]=i):i=n[2];let o;n[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ee,{className:"h-6 w-20 rounded-md"}),s.jsx(ee,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=o):o=n[3];let l;n[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(ee,{className:"h-4 w-24"}),s.jsx(ee,{className:"h-4 w-32"})]}),n[4]=l):l=n[4];let a;return n[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[o,s.jsxs("div",{className:"flex flex-col gap-4",children:[l,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(ee,{className:"h-4 w-16"}),s.jsx(ee,{className:"h-4 w-40"})]})]})]})})]}),n[5]=a):a=n[5],a}function Qs(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(ee,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(ee,{className:"flex-1 h-4"}),s.jsx(ee,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function dt(n){const e=G.c(66),{onClose:t,credentialId:i,onCredentialChange:o,selectedModel:l,onModelChange:a,filterModels:r,compact:h}=n,d=se(),[c,f]=$.useState(null),[p,u]=$.useState(""),[m,j]=$.useState(!1),N=$.useRef(null),S=ke(),b=Kt();let I;e[0]!==S?.providers?(I=Object.fromEntries((S?.providers??[]).map(ei)),e[0]=S?.providers,e[1]=I):I=e[1];const E=I,O=ft(),{org:k}=xe();let x;e[2]!==o?(x=R=>{o(R),f(null)},e[2]=o,e[3]=x):x=e[3];const w=x;let _;e[4]!==i||e[5]!==t||e[6]!==a?(_=R=>{i&&(a(R),u(""),t())},e[4]=i,e[5]=t,e[6]=a,e[7]=_):_=e[7];const M=_;if(b.length===0){const R=!h&&"sm:w-[740px]";let D;e[8]!==R?(D=oe("flex items-center justify-center p-8 w-full",R),e[8]=R,e[9]=D):D=e[9];let q;e[10]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(js,{}),e[10]=q):q=e[10];let Y;return e[11]!==D?(Y=s.jsx("div",{className:D,children:q}),e[11]=D,e[12]=Y):Y=e[12],Y}const v=h?"sm:h-[420px]":"sm:h-[460px]";let g;e[13]!==v?(g=oe("flex flex-col md:flex-row h-full min-h-0",v),e[13]=v,e[14]=g):g=e[14];const y=h?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let C;e[15]!==y?(C=oe("flex-1 flex flex-col min-h-0 overflow-hidden",y),e[15]=y,e[16]=C):C=e[16];let z;e[17]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Ze,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=z):z=e[17];let A;e[18]!==m||e[19]!==d?(A=d(m?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=m,e[19]=d,e[20]=A):A=e[20];let P;e[21]===Symbol.for("react.memo_cache_sentinel")?(P=R=>u(R.target.value),e[21]=P):P=e[21];let T;e[22]!==p||e[23]!==A?(T=s.jsx(pe,{ref:N,type:"text",placeholder:A,value:p,onChange:P,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=A,e[24]=T):T=e[24];let L;e[25]!==i||e[26]!==w||e[27]!==b||e[28]!==E||e[29]!==d?(L=b.length>0&&s.jsxs(_t,{value:i??"",onValueChange:w,children:[s.jsxs(Ct,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Zs,children:[s.jsx(It,{placeholder:d("chat.decopilot.key"),children:(()=>{const R=b.find(re=>re.id===i),D=R?E[R.providerId]:void 0,q=be(R?.presetId),Y=q?.logo??D?.logo,te=q?.name??D?.name??R?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[Y?s.jsx("img",{src:Y,alt:te,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:te.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:te})]})})()}),s.jsx(Tt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(Mt,{children:b.map(R=>{const D=E[R.providerId],q=be(R.presetId),Y=q?.logo??D?.logo,te=q?.name??D?.name??R.providerId;return s.jsx(Et,{value:R.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[Y?s.jsx("img",{src:Y,alt:te,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:te.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[te," — ",R.label]})]})},R.id)})})]}),e[25]=i,e[26]=w,e[27]=b,e[28]=E,e[29]=d,e[30]=L):L=e[30];let F;e[31]!==T||e[32]!==L?(F=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[z,T,L]})}),e[31]=T,e[32]=L,e[33]=F):F=e[33];let K;e[34]!==i?(K=R=>{const{error:D,resetError:q}=R;return s.jsx($s,{error:D,onRetry:q,credentialId:i??void 0})},e[34]=i,e[35]=K):K=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Us,{}),e[36]=X):X=e[36];const V=i??void 0;let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>j(Js),e[37]=Q):Q=e[37];let J;e[38]!==r||e[39]!==M||e[40]!==m||e[41]!==p||e[42]!==V?(J=s.jsx($.Suspense,{fallback:X,children:s.jsx(Ys,{keyId:V,searchTerm:p,onHover:f,onModelSelect:M,managing:m,onToggleManage:Q,filterModels:r})}),e[38]=r,e[39]=M,e[40]=m,e[41]=p,e[42]=V,e[43]=J):J=e[43];let H;e[44]!==i||e[45]!==K||e[46]!==J?(H=s.jsx(pt,{fallback:K,children:J},i),e[44]=i,e[45]=K,e[46]=J,e[47]=H):H=e[47];let U;e[48]!==m||e[49]!==O||e[50]!==k||e[51]!==d?(U=!m&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>$.startTransition(()=>j(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Rt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>O({to:"/$org/settings/ai-providers",params:{org:k.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Lt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=m,e[49]=O,e[50]=k,e[51]=d,e[52]=U):U=e[52];let B;e[53]!==F||e[54]!==H||e[55]!==U||e[56]!==C?(B=s.jsxs("div",{className:C,children:[F,H,U]}),e[53]=F,e[54]=H,e[55]=U,e[56]=C,e[57]=B):B=e[57];let W;e[58]!==h||e[59]!==c||e[60]!==l?(W=!h&&s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Ms,{model:c??l??null})}),e[58]=h,e[59]=c,e[60]=l,e[61]=W):W=e[61];let Z;return e[62]!==B||e[63]!==W||e[64]!==g?(Z=s.jsxs("div",{className:g,children:[B,W]}),e[62]=B,e[63]=W,e[64]=g,e[65]=Z):Z=e[65],Z}function Js(n){return!n}function Zs(n){return n.stopPropagation()}function ei(n){return[n.id,n]}function ti(n){const e=G.c(12),{onClose:t}=n,{credentialId:i,setCredentialId:o,selectedModel:l,setModel:a}=Xe();let r;e[0]!==o?(r=c=>{ie("chat_credential_changed",{credential_id:c}),o(c)},e[0]=o,e[1]=r):r=e[1];let h;e[2]!==i||e[3]!==l?.modelId||e[4]!==a?(h=c=>{i&&(ie("chat_model_changed",{from_model_id:l?.modelId??null,to_model_id:c.modelId,to_model_provider:c.providerId??null,credential_id:i}),a({...c,keyId:i}))},e[2]=i,e[3]=l?.modelId,e[4]=a,e[5]=h):h=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==l||e[9]!==r||e[10]!==h?(d=s.jsx(dt,{onClose:t,credentialId:i,onCredentialChange:r,selectedModel:l,onModelChange:h}),e[6]=i,e[7]=t,e[8]=l,e[9]=r,e[10]=h,e[11]=d):d=e[11],d}function si(n){const e=G.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(ti,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ii(n){const e=G.c(2);let t;return e[0]!==n?(t=s.jsx(dt,{...n}),e[0]=n,e[1]=t):t=e[1],t}function ni(n){const e=G.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(si,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function li(n){const e=G.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let i;return e[2]!==t?(i=s.jsx(ii,{...t}),e[2]=t,e[3]=i):i=e[3],i}function Ki(n){const e=G.c(48),{variant:t,className:i,placeholder:o,model:l,isLoading:a,credentialId:r,onCredentialChange:h,onModelChange:d,filterModels:c}=n,f=t===void 0?"borderless":t,p=o===void 0?"Select model":o,u=se(),[m,j]=$.useState(!1),N=d!==void 0,S=wt(),b=f==="borderless"?"ghost":"outline",I=f==="borderless"&&"md:border-none";let E;e[0]!==i||e[1]!==I?(E=oe("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",I,i),e[0]=i,e[1]=I,e[2]=E):E=e[2];let O;e[3]!==a||e[4]!==l||e[5]!==p||e[6]!==N?(O=N?s.jsx(lt,{model:l??null,placeholder:p,isLoading:a}):s.jsx(ri,{placeholder:p}),e[3]=a,e[4]=l,e[5]=p,e[6]=N,e[7]=O):O=e[7];let k;e[8]!==b||e[9]!==E||e[10]!==O?(k=s.jsx(le,{variant:b,size:"sm",className:E,children:O}),e[8]=b,e[9]=E,e[10]=O,e[11]=k):k=e[11];const x=k;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Xs,{}),e[12]=w):w=e[12];let _;e[13]!==r||e[14]!==c||e[15]!==l||e[16]!==h||e[17]!==d||e[18]!==N?(_=s.jsx($.Suspense,{fallback:w,children:N?s.jsx(li,{onClose:()=>j(!1),credentialId:r??null,onCredentialChange:h??oi,selectedModel:l??null,onModelChange:d,filterModels:c}):s.jsx(ni,{onClose:()=>j(!1)})}),e[13]=r,e[14]=c,e[15]=l,e[16]=h,e[17]=d,e[18]=N,e[19]=_):_=e[19];const M=_;if(S){let A;e[20]!==x?(A=s.jsx(yt,{asChild:!0,children:x}),e[20]=x,e[21]=A):A=e[21];let P;e[22]!==u?(P=u("chat.selectModel.selectModel"),e[22]=u,e[23]=P):P=e[23];let T;e[24]!==P?(T=s.jsx(jt,{className:"sr-only",children:P}),e[24]=P,e[25]=T):T=e[25];let L;e[26]!==M?(L=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:M}),e[26]=M,e[27]=L):L=e[27];let F;e[28]!==T||e[29]!==L?(F=s.jsxs(St,{className:"p-0 flex flex-col max-h-[95vh]",children:[T,L]}),e[28]=T,e[29]=L,e[30]=F):F=e[30];let K;return e[31]!==m||e[32]!==A||e[33]!==F?(K=s.jsxs(Nt,{open:m,onOpenChange:j,children:[A,F]}),e[31]=m,e[32]=A,e[33]=F,e[34]=K):K=e[34],K}let v;e[35]!==x?(v=s.jsx(bt,{asChild:!0,children:x}),e[35]=x,e[36]=v):v=e[36];let g;e[37]!==u?(g=u("chat.selectModel.selectModel"),e[37]=u,e[38]=g):g=e[38];let y;e[39]!==g?(y=s.jsx(Ge,{className:"sr-only",children:g}),e[39]=g,e[40]=y):y=e[40];let C;e[41]!==M||e[42]!==y?(C=s.jsxs(Ye,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[y,M]}),e[41]=M,e[42]=y,e[43]=C):C=e[43];let z;return e[44]!==m||e[45]!==v||e[46]!==C?(z=s.jsxs(qe,{open:m,onOpenChange:j,children:[v,C]}),e[44]=m,e[45]=v,e[46]=C,e[47]=z):z=e[47],z}function oi(){}function ri(n){const e=G.c(4),{placeholder:t}=n,{selectedModel:i,isModelsLoading:o}=Xe();let l;return e[0]!==o||e[1]!==i||e[2]!==t?(l=s.jsx(lt,{model:i,placeholder:t,isLoading:o}),e[0]=o,e[1]=i,e[2]=t,e[3]=l):l=e[3],l}export{gs as C,li as M,js as N,nt as P,Xs as a,Ri as b,Ki as c,be as d,Fi as g,zi as i,Ie as m};