decocms 4.192.2 → 4.192.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/client/assets/{AlertCircle-CLEU--nA.js → AlertCircle-BE9cwxbY.js} +1 -1
  2. package/dist/client/assets/{AreaChart-B-4YjNHU.js → AreaChart-C-PbxICv.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-Djn4d8KI.js → ArrowUp-Ds1wmuPm.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-neyqCdIy.js → ArrowUpRight-BCNapAob.js} +1 -1
  5. package/dist/client/assets/{Check-CvMAG72f.js → Check-OfLKWLIS.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-C-3XqyO6.js → CheckCircle-CEieoa-t.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-DLngVaqr.js → ChevronDown-DG2izocU.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-D09evVMh.js → ChevronRight-CBhPdqes.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-Bc9cUdsp.js → ChevronUp-BPyz6G9W.js} +1 -1
  10. package/dist/client/assets/{Copy01-hVLYA900.js → Copy01-B3Wf1E9q.js} +1 -1
  11. package/dist/client/assets/{CpuChip01-DvUkwfUQ.js → CpuChip01-I_a_caNM.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-CiV-ruso.js → CreditCard01-B71Apbtq.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-CclRNTmp.js → DotsVertical-BEI2MUPC.js} +1 -1
  14. package/dist/client/assets/{Eye-B5pxEZ_-.js → Eye-BMvp9akN.js} +1 -1
  15. package/dist/client/assets/{FilterLines-C7Vf1L8m.js → FilterLines-DiwOhXlj.js} +1 -1
  16. package/dist/client/assets/{HardDrive-DeEjbEpx.js → HardDrive-sbNJL3hW.js} +1 -1
  17. package/dist/client/assets/{Key01-DYVpRV_Q.js → Key01-Br_ZaWJe.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-DBu9dOfI.js → LayoutLeft-CpjqlQLa.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-BZjmbCl9.js → LinkExternal01-ALijI2HY.js} +1 -1
  20. package/dist/client/assets/{LogOut01-B8ffIoiU.js → LogOut01-BwsbH5Qi.js} +1 -1
  21. package/dist/client/assets/{Monitor01-C2nbZk_0.js → Monitor01-BZKncdrP.js} +1 -1
  22. package/dist/client/assets/{Palette-D8WtfHKh.js → Palette-BPL3pYAR.js} +1 -1
  23. package/dist/client/assets/{Play-CvtgUROI.js → Play-XbioRe7w.js} +1 -1
  24. package/dist/client/assets/{Plus-bsMQGcB1.js → Plus-MaxuuPv-.js} +1 -1
  25. package/dist/client/assets/{SearchLg-DEUF3Idz.js → SearchLg-DsJvP5Uk.js} +1 -1
  26. package/dist/client/assets/{SearchMd-_MwtuM1U.js → SearchMd-BxZJthWG.js} +1 -1
  27. package/dist/client/assets/{Settings02-D2EsO4FX.js → Settings02-CMCVr6kz.js} +1 -1
  28. package/dist/client/assets/{Shield01-GhghIa_Y.js → Shield01-C3-Qr1jT.js} +1 -1
  29. package/dist/client/assets/{Star01-Cimhyf4P.js → Star01-BBjfR1Gz.js} +1 -1
  30. package/dist/client/assets/{Stars01-A7IjRvsz.js → Stars01-Bm6X-ikf.js} +1 -1
  31. package/dist/client/assets/{Stars02-CcuKRD2c.js → Stars02-1ZGHV5NS.js} +1 -1
  32. package/dist/client/assets/{Sun-Bjz93MKf.js → Sun-DdXtK5fE.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-BKsxDY4F.js → SwitchHorizontal01-DI_Kp6ba.js} +1 -1
  34. package/dist/client/assets/{Tool01-BBnOx5id.js → Tool01-DB6QU2VF.js} +1 -1
  35. package/dist/client/assets/{Tool02-DBQMgvl9.js → Tool02-BEZavEDr.js} +1 -1
  36. package/dist/client/assets/{Trash01-_O8mwzM1.js → Trash01-DxSJv4Ri.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-BKbEdwN5.js → TrendUp01-CtoXe0aL.js} +1 -1
  38. package/dist/client/assets/{Upload01-DJIrW6gz.js → Upload01-BkU1NwYd.js} +1 -1
  39. package/dist/client/assets/{User01-vfZU1X4J.js → User01-B1Wt1dct.js} +1 -1
  40. package/dist/client/assets/{Users01-BGHB6jNk.js → Users01-F-abmy5R.js} +1 -1
  41. package/dist/client/assets/{Users03-DYqY0KWd.js → Users03-K6a0LDxs.js} +1 -1
  42. package/dist/client/assets/{X-B0orEySp.js → X-BYstzMvF.js} +1 -1
  43. package/dist/client/assets/{XCircle-CVI-wyNG.js → XCircle-_n7bmIfy.js} +1 -1
  44. package/dist/client/assets/{XClose-CgjTFcOh.js → XClose-CKQrGZ3n.js} +1 -1
  45. package/dist/client/assets/{Zap-JYOLf8t1.js → Zap-BL2TGhS_.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-C9zD-wtQ.js → ZapSquare-xaKjGVlS.js} +1 -1
  47. package/dist/client/assets/{access-gate-KyPlWLCw.js → access-gate-BJOOEasJ.js} +1 -1
  48. package/dist/client/assets/{agent-icon-C1suJJDi.js → agent-icon-CU1Jut04.js} +1 -1
  49. package/dist/client/assets/{agents-list-Of85GEWn.js → agents-list-K_WVGFKu.js} +1 -1
  50. package/dist/client/assets/{ai-providers-Cg8bSfNW.js → ai-providers-Bj8bWAP8.js} +1 -1
  51. package/dist/client/assets/{alert-8YfWDmPS.js → alert-0MpDvdTv.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-C-P_QUhM.js → alert-dialog-D-DTayBa.js} +1 -1
  53. package/dist/client/assets/{app-editor-CALOno0g.js → app-editor-g_6HF1tR.js} +1 -1
  54. package/dist/client/assets/{auth-iPYwyjbN.js → auth-B4Tuvjw-.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-C4eD45pB.js → auth-catchall-CSxavBXs.js} +1 -1
  56. package/dist/client/assets/{auth-entry-BzVCt0TZ.js → auth-entry-L6y48H6g.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-C3-TvNq5.js → auth-split-layout-CxREXTKS.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-QrcEE3GI.js → authenticate-and-persist-oauth-B0inhLYK.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-Cik2RsJD.js → automation-list-row-BYvUImpu.js} +1 -1
  60. package/dist/client/assets/{automation-runs-ab45bhyu.js → automation-runs-CO_BywJs.js} +1 -1
  61. package/dist/client/assets/{automations-Ccdknsfk.js → automations-CrolhoOD.js} +1 -1
  62. package/dist/client/assets/{avatar-BlvVoNC_.js → avatar-B355jkWe.js} +1 -1
  63. package/dist/client/assets/{badge-D9uSU8iL.js → badge-DjIbiYIu.js} +1 -1
  64. package/dist/client/assets/{billing-LmWp4qy8.js → billing-DyGLxLuU.js} +1 -1
  65. package/dist/client/assets/{block-document-YmtjeDIn.js → block-document-DxIy80Ti.js} +1 -1
  66. package/dist/client/assets/{brand-context-4kBe-8LN.js → brand-context-qrPDskI8.js} +1 -1
  67. package/dist/client/assets/{buckets-3IRJeRTy.js → buckets-DbMuLpu9.js} +1 -1
  68. package/dist/client/assets/{bulk-category-panel-gdzchFRi.js → bulk-category-panel-DrxbXf3X.js} +1 -1
  69. package/dist/client/assets/{capability-load-error-DWxOOqt9.js → capability-load-error-DbfVRfUv.js} +1 -1
  70. package/dist/client/assets/{card-DQK8qWPP.js → card-CaZg9MCd.js} +1 -1
  71. package/dist/client/assets/{category-editor-CT1feCOR.js → category-editor-CHeUNiBA.js} +1 -1
  72. package/dist/client/assets/{chat-context-DD2GGpgq.js → chat-context-B_tZWBTD.js} +1 -1
  73. package/dist/client/assets/{checkbox-BF5-RitT.js → checkbox-bwR35z7M.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-BXWzJgk_.js → cli-auth-success-DEJsrHrG.js} +1 -1
  75. package/dist/client/assets/{collection-detail-B59IddOk.js → collection-detail-DuinPr1g.js} +1 -1
  76. package/dist/client/assets/{collection-display-button-DABedrgS.js → collection-display-button-ChyC1R1O.js} +1 -1
  77. package/dist/client/assets/{collection-search-DuYuXPAL.js → collection-search-sQiJRgn2.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-CnN3JHFY.js → collection-table-wrapper-CU4ivPdS.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-BzUDvU2P.js → collection-tabs-BYuiH8u6.js} +1 -1
  80. package/dist/client/assets/{command-B3Sd5Roe.js → command-xCGOuDfu.js} +1 -1
  81. package/dist/client/assets/{commerce-onboarding-YQ285bhJ.js → commerce-onboarding-e1WHG7dD.js} +1 -1
  82. package/dist/client/assets/{connect-BqmnCT0x.js → connect-CqMEo-kN.js} +1 -1
  83. package/dist/client/assets/{connection-DIzZ8uZW.js → connection-DpsTn5Dy.js} +1 -1
  84. package/dist/client/assets/{connection-card-ChBGCUQs.js → connection-card-C-QNQcTj.js} +1 -1
  85. package/dist/client/assets/{connection-detail-KRil1Vf_.js → connection-detail-zLKPlele.js} +1 -1
  86. package/dist/client/assets/{connection-form-helpers-CIOX5bW6.js → connection-form-helpers-0TTscf9V.js} +1 -1
  87. package/dist/client/assets/{connections-BD-P6Uvg.js → connections-M1USFYFj.js} +1 -1
  88. package/dist/client/assets/{decopilot-sse-pool-BINukIkA.js → decopilot-sse-pool-fIsmwyiW.js} +1 -1
  89. package/dist/client/assets/{dialog-CkWup0NZ.js → dialog-CNbhzS-L.js} +1 -1
  90. package/dist/client/assets/{domain-settings-BsgwIPt-.js → domain-settings-DSThuKbO.js} +1 -1
  91. package/dist/client/assets/{drawer-D52THX3T.js → drawer-BJ_osQEN.js} +1 -1
  92. package/dist/client/assets/{dropdown-menu-DrJ1LmUI.js → dropdown-menu-CU58UYBd.js} +1 -1
  93. package/dist/client/assets/{empty-state-CTftNmz2.js → empty-state-Qwv5D4la.js} +1 -1
  94. package/dist/client/assets/{extract-connection-data-D9OMaSKu.js → extract-connection-data-7dK6vjzP.js} +1 -1
  95. package/dist/client/assets/{file-explorer-C2uoAyIl.js → file-explorer-Bnwyg2rh.js} +1 -1
  96. package/dist/client/assets/{form-DnHUZKRT.js → form-Ct8AvLWq.js} +1 -1
  97. package/dist/client/assets/{general-DupZYtOw.js → general-BFVXr2tq.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-Dntpew_g.js → github-repo-picker-lwuwDrCB.js} +1 -1
  99. package/dist/client/assets/{hooks-C4wVvE7D.js → hooks-CVGqVdkK.js} +1 -1
  100. package/dist/client/assets/{index-nuua5tXA.js → index-BVH5RHL7.js} +5 -5
  101. package/dist/client/assets/{index-D6yKFLRI.js → index-BlTwEzlc.js} +1 -1
  102. package/dist/client/assets/{index-DffPz5jC.js → index-C8T991zV.js} +1 -1
  103. package/dist/client/assets/{index-DaTZgJoD.js → index-CSFAAr_D.js} +1 -1
  104. package/dist/client/assets/{index-jqMdklUw.js → index-Cbc0L8Jt.js} +1 -1
  105. package/dist/client/assets/{index-CfPtS3uT.js → index-CqbRQ2y1.js} +49 -49
  106. package/dist/client/assets/{index-BuNeJwTd.js → index-D-7iQ8Z9.js} +1 -1
  107. package/dist/client/assets/{index-B0p-NITw.js → index-D0em2Dp3.js} +1 -1
  108. package/dist/client/assets/{index-BmyiwPrH.js → index-DNECUB-x.js} +1 -1
  109. package/dist/client/assets/{index-redirect-Cu9PXU01.js → index-redirect-B3VLoxI6.js} +1 -1
  110. package/dist/client/assets/{index-D4n0dWbK.js → index-uFneV78z.js} +1 -1
  111. package/dist/client/assets/{index-LqVOLGfG.js → index-x1Htz3iA.js} +1 -1
  112. package/dist/client/assets/{input-ChceT-NF.js → input-Cp1_AyjP.js} +1 -1
  113. package/dist/client/assets/{integration-icon-nmS3w6hN.js → integration-icon-r017IlLX.js} +1 -1
  114. package/dist/client/assets/{invite-member-dialog-BOzXoofz.js → invite-member-dialog-2tsFwA84.js} +1 -1
  115. package/dist/client/assets/{label-UzICiYA1.js → label-d_7A1dUh.js} +1 -1
  116. package/dist/client/assets/{layout-CDAIUxLo.js → layout-Ds5sPeDq.js} +1 -1
  117. package/dist/client/assets/{login-D_eVjmPh.js → login-B8LBadqb.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-CaCK3Mid.js → mcp-oauth-DVsinH-i.js} +1 -1
  119. package/dist/client/assets/{members-KkmFeybj.js → members-BPbU19ZC.js} +1 -1
  120. package/dist/client/assets/{monaco-editor-DOz_5Yz3.js → monaco-editor-CT77mqUS.js} +1 -1
  121. package/dist/client/assets/{monitoring-stats-row-BbF0ULdg.js → monitoring-stats-row-C9RAYLWI.js} +1 -1
  122. package/dist/client/assets/{multi-select-hC5fZfOu.js → multi-select-CHr6wS8z.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-Jg9xFWN8.js → oauth-callback-ai-provider-5dQO34nB.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-BbmaSIi-.js → oauth-callback-veH5S416.js} +1 -1
  125. package/dist/client/assets/{onboarding-B2XpEJKH.js → onboarding-DjTXy8S3.js} +1 -1
  126. package/dist/client/assets/{org-layout-ZN4E-3Wh.js → org-layout-DeA020gY.js} +1 -1
  127. package/dist/client/assets/{organization-choice-CmR3KoUH.js → organization-choice-BygXAkGT.js} +1 -1
  128. package/dist/client/assets/{orgs-DyKhGmo1.js → orgs-DvrCD--S.js} +1 -1
  129. package/dist/client/assets/{page-seo-form-Bf30uZ8_.js → page-seo-form-BWznEwAc.js} +1 -1
  130. package/dist/client/assets/{popover-DmsKcVtX.js → popover-C5RIUioH.js} +1 -1
  131. package/dist/client/assets/{post-editor-CMVHKDUd.js → post-editor-DvlGr8Vk.js} +1 -1
  132. package/dist/client/assets/{primitives-Cl37LnQY.js → primitives-CYGdWSzA.js} +1 -1
  133. package/dist/client/assets/{profile-BKGTDr8S.js → profile-A9Hj0h-A.js} +1 -1
  134. package/dist/client/assets/project-app-view-_EfktjmJ.js +1 -0
  135. package/dist/client/assets/record-editor-CvzzfiRU.js +1 -0
  136. package/dist/client/assets/{redirect-editor-DIBwpu1f.js → redirect-editor-BIy5_s2l.js} +1 -1
  137. package/dist/client/assets/registry-CTQH37WP.js +2 -0
  138. package/dist/client/assets/{registry-layout-CeQaFuRH.js → registry-layout-C82y0tWb.js} +1 -1
  139. package/dist/client/assets/{reports-OAv5dIi8.js → reports-D6ggyVk1.js} +1 -1
  140. package/dist/client/assets/{require-capability-BeN-XO2J.js → require-capability-DEOYjD39.js} +1 -1
  141. package/dist/client/assets/{required-auth-layout-DCd86yg6.js → required-auth-layout-CRr2ORAR.js} +1 -1
  142. package/dist/client/assets/{reset-password-BFQa_wax.js → reset-password-B-f_ePIw.js} +1 -1
  143. package/dist/client/assets/{roles-DNdeIZbe.js → roles-BNjkjMEj.js} +1 -1
  144. package/dist/client/assets/{search-input-BWH502k6.js → search-input-CgxYt1gG.js} +1 -1
  145. package/dist/client/assets/{secrets-B9s-ky-L.js → secrets-CKHJGJvj.js} +1 -1
  146. package/dist/client/assets/{sections-editor-DrGrc5pW.js → sections-editor-Dw8neNU8.js} +1 -1
  147. package/dist/client/assets/{select-Dg5PjuH9.js → select-Cpac6Pp5.js} +1 -1
  148. package/dist/client/assets/{select-model-wCUD7SK0.js → select-model-BNthrPxK.js} +1 -1
  149. package/dist/client/assets/self-tool-result-CMFmheA7.js +1 -0
  150. package/dist/client/assets/{seo-editor-D4x6mH0L.js → seo-editor-CynIO-fv.js} +1 -1
  151. package/dist/client/assets/{settings-layout-u6KtXptG.js → settings-layout-CSIHpxjH.js} +1 -1
  152. package/dist/client/assets/{settings-section-jAfKLWCD.js → settings-section-8XkBf8NP.js} +1 -1
  153. package/dist/client/assets/{shell-controls-4WhV3oXG.js → shell-controls-Df3fBbTd.js} +1 -1
  154. package/dist/client/assets/{shell-layout-C2dYEZHa.js → shell-layout-BRuAh2KL.js} +1 -1
  155. package/dist/client/assets/{sidebar-CF-8iVhL.js → sidebar-Dy8F7QtW.js} +1 -1
  156. package/dist/client/assets/{skeleton-DXztGuq3.js → skeleton-BR1mr2_B.js} +1 -1
  157. package/dist/client/assets/{spinner-CuWOKKNk.js → spinner-CDhLcZP6.js} +1 -1
  158. package/dist/client/assets/{sso-F4odHzYr.js → sso-BMru9Qee.js} +1 -1
  159. package/dist/client/assets/{store-DAeU-N6k.js → store-BSxJEYwv.js} +1 -1
  160. package/dist/client/assets/store-registry-uHnQouRN.js +2 -0
  161. package/dist/client/assets/{studio-tools-CvEcX9oj.js → studio-tools-D_KNHI3Y.js} +1 -1
  162. package/dist/client/assets/{switch-CuoBQKcC.js → switch-Ck7kJtiP.js} +1 -1
  163. package/dist/client/assets/{tab-id-C4U4dy_l.js → tab-id-DUZlzOBf.js} +1 -1
  164. package/dist/client/assets/{table-DHNgML67.js → table-1_DuCuHd.js} +1 -1
  165. package/dist/client/assets/{tabs-GrVvJwo3.js → tabs-DkWhfZ42.js} +1 -1
  166. package/dist/client/assets/{textarea-13Ok5QoW.js → textarea-U7YYs3UU.js} +1 -1
  167. package/dist/client/assets/{toggle-group-755BFWKw.js → toggle-group-CMVWs0hQ.js} +1 -1
  168. package/dist/client/assets/{toolbar-wN7Sy4uk.js → toolbar-Cg2HVBh0.js} +1 -1
  169. package/dist/client/assets/{tooltip-BTk8baer.js → tooltip-B9FVlGn0.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-BulTw0Dd.js → use-ai-providers-C5CLpBgy.js} +1 -1
  171. package/dist/client/assets/{use-automations-CLptGAT5.js → use-automations-wGuwVzCZ.js} +1 -1
  172. package/dist/client/assets/{use-autosave-Buc5YrDE.js → use-autosave-Ss2pi-yR.js} +1 -1
  173. package/dist/client/assets/{use-capability-E1oEeJu8.js → use-capability-e_5b-RsW.js} +1 -1
  174. package/dist/client/assets/{use-clock-tick-c4tWu6ea.js → use-clock-tick-B0PFDRxc.js} +1 -1
  175. package/dist/client/assets/{use-connection-C5j5Kq0V.js → use-connection-kpVcxz3e.js} +1 -1
  176. package/dist/client/assets/{use-copy-CXG2fMuX.js → use-copy-CRnP3b98.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-B5VW_IOa.js → use-create-virtual-mcp-B3v26Zyc.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-CeBOedZe.js → use-debounced-autosave-wi1UwoZe.js} +1 -1
  179. package/dist/client/assets/{use-debounced-value-B50RR74E.js → use-debounced-value-SOqknhMf.js} +1 -1
  180. package/dist/client/assets/{use-deco-credits-DjxmuPQ6.js → use-deco-credits-DG6sr5rz.js} +1 -1
  181. package/dist/client/assets/{use-decopilot-events-CuUuSWgD.js → use-decopilot-events-BTnC7oF5.js} +1 -1
  182. package/dist/client/assets/{use-delete-connection-DxVXQmlt.js → use-delete-connection-BH_p5OgW.js} +1 -1
  183. package/dist/client/assets/{use-deployment-admin-DBZhe1NG.js → use-deployment-admin-BfQMIfj0.js} +1 -1
  184. package/dist/client/assets/{use-file-configs-C_qfVqmG.js → use-file-configs-DZhBH5cw.js} +1 -1
  185. package/dist/client/assets/{use-infinite-scroll-CuamDZFD.js → use-infinite-scroll-CB25zH8h.js} +1 -1
  186. package/dist/client/assets/{use-join-requests-C5NpTTaJ.js → use-join-requests-3pAjiKzD.js} +1 -1
  187. package/dist/client/assets/{use-mcp-client-Bd4_NLDb.js → use-mcp-client-BNbhB5Os.js} +1 -1
  188. package/dist/client/assets/{use-mcp-tools-BpywMAex.js → use-mcp-tools-Cu5ZLUPD.js} +1 -1
  189. package/dist/client/assets/{use-members-DQs5QOEK.js → use-members-qoQcp8kg.js} +1 -1
  190. package/dist/client/assets/{use-mobile-BpGy3Jo4.js → use-mobile-D7z05tVc.js} +1 -1
  191. package/dist/client/assets/{use-navigate-to-agent-CLI8IGLD.js → use-navigate-to-agent-BY6DZZ17.js} +1 -1
  192. package/dist/client/assets/{use-open-billing-url-BH1EFCjF.js → use-open-billing-url-BtSozBCh.js} +1 -1
  193. package/dist/client/assets/{use-org-auth-client-DmrtspwY.js → use-org-auth-client-ChzS4M1Q.js} +1 -1
  194. package/dist/client/assets/{use-org-sso-75a3ealu.js → use-org-sso-B8YxSzof.js} +1 -1
  195. package/dist/client/assets/{use-organization-roles-DTBrRNVu.js → use-organization-roles-ltESonxb.js} +1 -1
  196. package/dist/client/assets/{use-organization-settings-DuKIPrnF.js → use-organization-settings-BgGv29eV.js} +1 -1
  197. package/dist/client/assets/{use-registry-connections-DC6SxViE.js → use-registry-connections-BwumcPNT.js} +1 -1
  198. package/dist/client/assets/{use-secrets-DjgqpGbt.js → use-secrets-D8rRajjb.js} +1 -1
  199. package/dist/client/assets/{use-section-preview-base-D-msxILc.js → use-section-preview-base-cv-X29yE.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-Bfs-iqmb.js → use-status-sounds-DzobNfP6.js} +1 -1
  201. package/dist/client/assets/{use-tags-B3NY2vJO.js → use-tags-DinGPX1b.js} +1 -1
  202. package/dist/client/assets/{use-view-mode-tbrLIAgX.js → use-view-mode-Cpv4ukYK.js} +1 -1
  203. package/dist/client/assets/{use-virtual-mcp-BOm_o_vy.js → use-virtual-mcp-YTwdm2O4.js} +1 -1
  204. package/dist/client/assets/useInfiniteQuery-BYyJ1kY3.js +1 -0
  205. package/dist/client/assets/{useRouterState-DlIts8X2.js → useRouterState-BzEQkYQm.js} +1 -1
  206. package/dist/client/assets/useSuspenseInfiniteQuery-DL-BpFoU.js +1 -0
  207. package/dist/client/assets/{users-1lD6BpLd.js → users-6_BIlYUY.js} +1 -1
  208. package/dist/client/assets/{variant-calendar-DzMkbrsG.js → variant-calendar-CbMdjDjQ.js} +1 -1
  209. package/dist/client/assets/{view-mode-toggle-DtD3hEHm.js → view-mode-toggle-Cg7Kk-OD.js} +1 -1
  210. package/dist/client/index.html +1 -1
  211. package/dist/server/cli.js +1 -1
  212. package/dist/server/server.js +1 -1
  213. package/package.json +1 -1
  214. package/dist/client/assets/project-app-view-CtHhghU3.js +0 -1
  215. package/dist/client/assets/record-editor-B6Uefive.js +0 -1
  216. package/dist/client/assets/registry-CuaHdtjY.js +0 -2
  217. package/dist/client/assets/self-tool-result-B2ycP3ub.js +0 -1
  218. package/dist/client/assets/store-registry-8UvZ50CZ.js +0 -2
  219. package/dist/client/assets/useInfiniteQuery-D7w4DUHd.js +0 -1
  220. package/dist/client/assets/useSuspenseInfiniteQuery-CYMVW4nJ.js +0 -1
@@ -1,2 +1,2 @@
1
- import{c as We,b as ct,r as R,m as $e,j as s,ae as Js,B as Xe,k as Qs,o as Po,t as Q,K as Ao}from"./index-nuua5tXA.js";import{ao as Co,ap as Mo,aq as Bo,a3 as Xs,a4 as Jt,ar as Zs,as as en,a5 as tn,a6 as sn,at as nn,au as Ko,ad as on,ae as an,av as Lo,aw as Fo,N as Oo,a7 as rn,a8 as Ct,ab as ln,ac as cn,a9 as un,aj as dn,ax as Io,ay as Mt,az as $o,S as mn,aA as lt,aB as zo,aC as Ho,aD as Uo,aE as Go,D as Wo,F as qo,aF as Yo,aG as Jo,aH as Qo,aI as Xo,ah as Ut,aJ as Gt,aK as Zo,aL as St,aM as Dt,aN as ea,aO as ta,aP as tt,aQ as Bs,aR as sa,aS as Pt,aT as Wt,aU as na,aV as us,aW as oa,aX as wt,aY as aa,aZ as ra,a_ as ia,a$ as la,b0 as ca,b1 as xt,b2 as ua,b3 as da,b4 as ma,H as fa,b5 as Ks,b6 as At,b7 as Ls,b8 as Fs,b9 as pa,ba as ga,bb as ha,bc as va,bd as ds,be as Os,bf as Is,bg as Nt,bh as qt,bi as $s,bj as ba,bk as ms,bl as Sa,bm as xa,bn as ya,bo as _a,bp as ja}from"./index-CfPtS3uT.js";import{t as Ea}from"./ChevronDown-DLngVaqr.js";import{ag as gs,v as ka,W as fn,G as Ra,u as pn,ai as wa,a1 as Na}from"./agent-icon-C1suJJDi.js";import{i as gn}from"./ChevronRight-D09evVMh.js";import{n as Ta}from"./ChevronUp-Bc9cUdsp.js";import{i as Va}from"./Tool02-DBQMgvl9.js";import{C as Yt}from"./automation-runs-ab45bhyu.js";import{c as yt,T as _t,a as jt}from"./tooltip-BTk8baer.js";import{b as Da,h as Pa,a as Aa,c as Ca,d as Ma,e as Ba}from"./dialog-CkWup0NZ.js";import{I as Ka}from"./input-ChceT-NF.js";import{a as hn}from"./Copy01-hVLYA900.js";import{b as La}from"./Settings02-D2EsO4FX.js";import{s as Fa}from"./Eye-B5pxEZ_-.js";import{s as vn}from"./TrendUp01-BKbEdwN5.js";import{s as hs}from"./Plus-bsMQGcB1.js";import{s as bn}from"./Trash01-_O8mwzM1.js";import{i as Oa}from"./Zap-JYOLf8t1.js";import{D as Sn,a as vt,c as xn,b as yn,i as Ia}from"./dropdown-menu-DrJ1LmUI.js";import{S as $a,r as zs,u as za,d as Ha,a as Ua,i as Ga,f as Wa,P as qa,b as Ya}from"./page-seo-form-Bf30uZ8_.js";import{c as Ja}from"./Tool01-BBnOx5id.js";import{u as Qa,A as Xa}from"./use-section-preview-base-D-msxILc.js";import"./ArrowUp-Djn4d8KI.js";import"./chat-context-DD2GGpgq.js";import"./tab-id-C4U4dy_l.js";import"./Check-CvMAG72f.js";import"./hooks-C4wVvE7D.js";import"./use-mcp-client-Bd4_NLDb.js";import"./auth-iPYwyjbN.js";import"./decopilot-sse-pool-BINukIkA.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-BOm_o_vy.js";import"./use-ai-providers-BulTw0Dd.js";import"./studio-tools-CvEcX9oj.js";import"./use-decopilot-events-CuUuSWgD.js";import"./use-organization-settings-DuKIPrnF.js";import"./spinner-CuWOKKNk.js";import"./drawer-D52THX3T.js";import"./collection-search-DuYuXPAL.js";import"./SearchMd-_MwtuM1U.js";import"./use-mobile-BpGy3Jo4.js";import"./AreaChart-B-4YjNHU.js";import"./index-BmyiwPrH.js";import"./X-B0orEySp.js";import"./shell-layout-C2dYEZHa.js";import"./avatar-BlvVoNC_.js";import"./User01-vfZU1X4J.js";import"./Users03-DYqY0KWd.js";import"./SearchLg-DEUF3Idz.js";import"./Stars02-CcuKRD2c.js";import"./XClose-CgjTFcOh.js";import"./CheckCircle-C-3XqyO6.js";import"./CpuChip01-DvUkwfUQ.js";import"./FilterLines-C7Vf1L8m.js";import"./Monitor01-C2nbZk_0.js";import"./required-auth-layout-DCd86yg6.js";import"./use-org-sso-75a3ealu.js";import"./ZapSquare-C9zD-wtQ.js";import"./Star01-Cimhyf4P.js";import"./Upload01-DJIrW6gz.js";import"./AlertCircle-CLEU--nA.js";import"./form-DnHUZKRT.js";import"./label-UzICiYA1.js";import"./select-Dg5PjuH9.js";import"./XCircle-CVI-wyNG.js";import"./tabs-GrVvJwo3.js";import"./toggle-group-755BFWKw.js";import"./use-deco-credits-DjxmuPQ6.js";import"./sidebar-CF-8iVhL.js";import"./LayoutLeft-DBu9dOfI.js";import"./popover-DmsKcVtX.js";import"./alert-dialog-C-P_QUhM.js";import"./toolbar-wN7Sy4uk.js";import"./skeleton-DXztGuq3.js";import"./github-repo-picker-Dntpew_g.js";import"./use-debounced-value-B50RR74E.js";import"./use-connection-C5j5Kq0V.js";import"./authenticate-and-persist-oauth-QrcEE3GI.js";import"./mcp-oauth-CaCK3Mid.js";import"./LinkExternal01-BZjmbCl9.js";import"./use-mcp-tools-BpywMAex.js";import"./extract-connection-data-D9OMaSKu.js";import"./metadata-dUsYcpuu.js";import"./use-navigate-to-agent-CLI8IGLD.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-ChBGCUQs.js";import"./use-registry-connections-DC6SxViE.js";import"./useInfiniteQuery-D7w4DUHd.js";import"./use-infinite-scroll-CuamDZFD.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-DQK8qWPP.js";import"./integration-icon-nmS3w6hN.js";import"./textarea-13Ok5QoW.js";import"./connection-form-helpers-CIOX5bW6.js";import"./collection-tabs-BzUDvU2P.js";import"./badge-D9uSU8iL.js";import"./useSuspenseInfiniteQuery-CYMVW4nJ.js";import"./use-open-billing-url-BH1EFCjF.js";import"./select-model-wCUD7SK0.js";import"./checkbox-BF5-RitT.js";import"./Key01-DYVpRV_Q.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-jAfKLWCD.js";import"./ArrowUpRight-neyqCdIy.js";import"./Stars01-A7IjRvsz.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-Bfs-iqmb.js";import"./empty-state-CTftNmz2.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-E1oEeJu8.js";import"./monaco-editor-DOz_5Yz3.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./switch-CuoBQKcC.js";import"./Play-CvtgUROI.js";import"./use-debounced-autosave-CeBOedZe.js";import"./index-DffPz5jC.js";import"./search-input-BWH502k6.js";import"./index-DaTZgJoD.js";import"./Users01-BGHB6jNk.js";import"./use-secrets-DjgqpGbt.js";import"./DotsVertical-CclRNTmp.js";import"./self-tool-result-B2ycP3ub.js";import"./format-time-BnbuEtat.js";import"./use-members-DQs5QOEK.js";import"./use-org-auth-client-DmrtspwY.js";import"./use-copy-CXG2fMuX.js";import"./SwitchHorizontal01-BKsxDY4F.js";import"./use-tags-B3NY2vJO.js";import"./get-initials-D-f_fDFw.js";import"./command-B3Sd5Roe.js";import"./index-D4n0dWbK.js";import"./Palette-D8WtfHKh.js";import"./use-file-configs-C_qfVqmG.js";import"./use-automations-CLptGAT5.js";import"./automation-list-row-Cik2RsJD.js";import"./CreditCard01-CiV-ruso.js";import"./HardDrive-DeEjbEpx.js";import"./LogOut01-B8ffIoiU.js";import"./Sun-Bjz93MKf.js";import"./Shield01-GhghIa_Y.js";import"./table-DHNgML67.js";import"./use-clock-tick-c4tWu6ea.js";function Za(g){return g.schema?.definitions??g.schema?.$defs??{}}function er(g,e){const r=Za(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 S=d.allOf.find(x=>typeof x.$ref=="string")?.$ref;if(typeof S=="string"){const x=S.replace("#/definitions/",""),m=r[x];p=typeof m?.image=="string"?m.image:void 0}}if(p?.includes("{{{"))return p}function tr(g,e){if(!e)return;const r=Co(g);if(!r)return;const d=er(r.resolveType,e);if(!d)return;const p=Mo(d,r.data);if(p)return Bo(p)}const sr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",nr="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 Hs(g){return Array.from({length:g},(e,r)=>({id:crypto.randomUUID(),index:r}))}function _n(g){return g.map((e,r)=>({...e,index:r}))}function or(g,e){if(e===g.length)return g;if(e<g.length)return _n(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 jn(g){const e=We.c(20),{section:r,raw:d,meta:p}=g,S=r.isSavedBlock===!0,x=r.isMultivariate===!0;let m;e[0]!==p||e[1]!==d?(m=d&&p?tr(d,p):void 0,e[0]=p,e[1]=d,e[2]=m):m=e[2];const h=m;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ka,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=u):u=e[3];let y;e[4]!==h?(y=h&&s.jsx("img",{src:h,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=h,e[5]=y):y=e[5];let N;e[6]!==x||e[7]!==S?(N=S?{color:Oo}:x?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=x,e[7]=S,e[8]=N):N=e[8];let V;e[9]!==N?(V=s.jsx(gs,{className:"h-4 w-4 shrink-0",style:N}),e[9]=N,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 v;e[13]!==r.label||e[14]!==i?(v=s.jsx("span",{className:i,children:r.label}),e[13]=r.label,e[14]=i,e[15]=v):v=e[15];let a;return e[16]!==y||e[17]!==V||e[18]!==v?(a=s.jsxs(s.Fragment,{children:[u,y,V,v]}),e[16]=y,e[17]=V,e[18]=v,e[19]=a):a=e[19],a}const ar="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",rr="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]",ir="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 fs(g,e){return $e("h-7 shrink-0 overflow-hidden",e?ar:g?ir:rr)}function En(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?sr:d?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function lr(g){const e=We.c(82),{section:r,raw:d,meta:p,sortableId:S,selected:x,onSelect:m,onDelete:h,onDuplicate:u,onMakeReusable:y,onToggleHidden:N,onToggleLazy:V,onAddVariant:E,onDetach:i}=g,v=ct(),a=d?nn(d.__resolveType??""):!1,D=r.isHidden===!0,l=a||D;let k;e[0]!==r?(k=Ko(r),e[0]=r,e[1]=k):k=e[1];const K=k;let I;e[2]!==S?(I={id:S,animateLayoutChanges:fr},e[2]=S,e[3]=I):I=e[3];const{attributes:H,listeners:f,setNodeRef:C,transform:De,isDragging:A}=on(I);let ce;e[4]!==De?(ce=an.Transform.toString(De?{...De,x:0}:null),e[4]=De,e[5]=ce):ce=e[5];const M=A?0:void 0;let se;e[6]!==ce||e[7]!==M?(se={transform:ce,opacity:M},e[6]=ce,e[7]=M,e[8]=se):se=e[8];const F=se;let ie;e[9]!==r?(ie=Lo(r),e[9]=r,e[10]=ie):ie=e[10];const le=ie,ye="button",X=0;let Z;e[11]!==m?(Z=T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),m())},e[11]=m,e[12]=Z):Z=e[12];const ge=A?"cursor-grabbing":"cursor-pointer";let ne;e[13]!==r||e[14]!==x||e[15]!==ge?(ne=$e("touch-none transition-colors",ge,En(r,x)),e[13]=r,e[14]=x,e[15]=ge,e[16]=ne):ne=e[16];let L;e[17]!==p||e[18]!==d||e[19]!==r?(L=s.jsx(jn,{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&&s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":v(a?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:$e(fs(l,a)),onClick:T=>{T.stopPropagation(),V()},onPointerDown:mr,children:s.jsx(Oa,{className:$e("h-3.5 w-3.5",a&&"text-yellow-500")})})}),s.jsx(jt,{side:"bottom",children:v(a?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),st=!r.isMultivariate&&s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":v(D?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:$e(fs(l,D)),onClick:T=>{T.stopPropagation(),N()},onPointerDown:dr,children:D?s.jsx(La,{className:"h-3.5 w-3.5"}):s.jsx(Fa,{className:"h-3.5 w-3.5"})})}),s.jsx(jt,{side:"bottom",children:v(D?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),Le=xn,Me=Sn,Y=!0,ee=Xe,Fe="button",Pe="ghost",_e="icon";let ue;e[21]!==v?(ue=v("sectionsEditor.sectionList.sectionActionsMenu"),e[21]=v,e[22]=ue):ue=e[22];const he=$e(fs(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=s.jsx(fn,{className:"h-3.5 w-3.5"}),e[23]=je):je=e[23];let we;e[24]!==ee||e[25]!==ue||e[26]!==he?(we=s.jsx(ee,{type:Fe,variant:Pe,size:_e,"aria-label":ue,className:he,onClick:ur,onPointerDown:cr,children:je}),e[24]=ee,e[25]=ue,e[26]=he,e[27]=we):we=e[27];let ve;e[28]!==Me||e[29]!==we?(ve=s.jsx(Me,{asChild:Y,children:we}),e[28]=Me,e[29]=we,e[30]=ve):ve=e[30];let oe;e[31]!==u?(oe=T=>{T.stopPropagation(),u()},e[31]=u,e[32]=oe):oe=e[32];let Ae;e[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx(hn,{className:"h-4 w-4"}),e[33]=Ae):Ae=e[33];let Ee;e[34]!==v?(Ee=v("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=v,e[35]=Ee):Ee=e[35];let fe;e[36]!==oe||e[37]!==Ee?(fe=s.jsxs(vt,{onClick:oe,children:[Ae,Ee]}),e[36]=oe,e[37]=Ee,e[38]=fe):fe=e[38];let $;e[39]!==K||e[40]!==E||e[41]!==v?($=K&&s.jsxs(vt,{className:Fo,onClick:T=>{T.stopPropagation(),E()},children:[s.jsx(vn,{className:"h-4 w-4"}),v("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=K,e[40]=E,e[41]=v,e[42]=$):$=e[42];let pe;e[43]!==le||e[44]!==y||e[45]!==v?(pe=le&&s.jsxs(vt,{className:nr,onClick:T=>{T.stopPropagation(),y()},children:[s.jsx(gs,{className:"h-4 w-4"}),v("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=le,e[44]=y,e[45]=v,e[46]=pe):pe=e[46];let Ce;e[47]!==i||e[48]!==r.isMultivariate||e[49]!==r.isSavedBlock||e[50]!==v?(Ce=r.isSavedBlock===!0&&!r.isMultivariate&&s.jsxs(vt,{onClick:T=>{T.stopPropagation(),i()},children:[s.jsx(gs,{className:"h-4 w-4"}),v("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=i,e[48]=r.isMultivariate,e[49]=r.isSavedBlock,e[50]=v,e[51]=Ce):Ce=e[51];let be;e[52]!==h?(be=T=>{T.stopPropagation(),h()},e[52]=h,e[53]=be):be=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx(bn,{className:"h-4 w-4"}),e[54]=Se):Se=e[54];let G;e[55]!==v?(G=v("sectionsEditor.sectionList.deleteMenuItem"),e[55]=v,e[56]=G):G=e[56];let ae;e[57]!==be||e[58]!==G?(ae=s.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:be,children:[Se,G]}),e[57]=be,e[58]=G,e[59]=ae):ae=e[59];let de;e[60]!==fe||e[61]!==$||e[62]!==pe||e[63]!==Ce||e[64]!==ae?(de=s.jsxs(yn,{align:"end",className:"w-44",children:[fe,$,pe,Ce,ae]}),e[60]=fe,e[61]=$,e[62]=pe,e[63]=Ce,e[64]=ae,e[65]=de):de=e[65];let ke;e[66]!==Le||e[67]!==ve||e[68]!==de?(ke=s.jsxs(Le,{children:[ve,de]}),e[66]=Le,e[67]=ve,e[68]=de,e[69]=ke):ke=e[69];let me;return e[70]!==H||e[71]!==f||e[72]!==m||e[73]!==C||e[74]!==F||e[75]!==ne||e[76]!==L||e[77]!==ze||e[78]!==st||e[79]!==ke||e[80]!==Z?(me=s.jsxs("div",{ref:C,style:F,...H,...f,role:ye,tabIndex:X,onClick:m,onKeyDown:Z,className:ne,children:[L,ze,st,ke]}),e[70]=H,e[71]=f,e[72]=m,e[73]=C,e[74]=F,e[75]=ne,e[76]=L,e[77]=ze,e[78]=st,e[79]=ke,e[80]=Z,e[81]=me):me=e[81],me}function cr(g){return g.stopPropagation()}function ur(g){return g.stopPropagation()}function dr(g){return g.stopPropagation()}function mr(g){return g.stopPropagation()}function fr(){return!1}function pr(g){const e=We.c(104),{listKey:r,rawSections:d,sections:p,meta:S,selectedIndex:x,onSelect:m,onReorder:h,onDelete:u,onDuplicate:y,onMakeReusable:N,onToggleHidden:V,onToggleLazy:E,onAddVariant:i,onDetach:v,onAddSection:a,canAddSection:D}=g,l=D===void 0?!0:D,k=ct();let K;e[0]!==p.length?(K=()=>Hs(p.length),e[0]=p.length,e[1]=K):K=e[1];const[I,H]=R.useState(K),[f,C]=R.useState(null),[De,A]=R.useState(r),[ce,M]=R.useState(p.length),se=R.useRef(!1);De!==r?(A(r),M(p.length),H(Hs(p.length))):ce!==p.length&&(M(p.length),H(me=>or(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:rn},e[3]=ie):ie=e[3];const le=Xs(Jt(sn,F),Jt(tn,ie));let ye;e[4]!==I?(ye=I.map(gr),e[4]=I,e[5]=ye):ye=e[5];const X=ye;let Z;e[6]===Symbol.for("react.memo_cache_sentinel")?(Z=me=>{C(String(me.active.id))},e[6]=Z):Z=e[6];const ge=Z;let ne;e[7]!==X||e[8]!==h?(ne=me=>{C(null);const{active:T,over:re}=me;if(!re||T.id===re.id)return;const O=X.indexOf(String(T.id)),Be=X.indexOf(String(re.id));O===-1||Be===-1||(H(ut=>_n(Ct([...ut],O,Be))),se.current=!0,requestAnimationFrame(()=>{se.current=!1}),h?.(O,Be))},e[7]=X,e[8]=h,e[9]=ne):ne=e[9];const L=ne;let ze;e[10]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{C(null)},e[10]=ze):ze=e[10];const st=ze;let Le,Me,Y,ee,Fe,Pe,_e,ue,he,je,we,ve,oe,Ae,Ee;if(e[11]!==f||e[12]!==l||e[13]!==I||e[14]!==X||e[15]!==L||e[16]!==S||e[17]!==a||e[18]!==i||e[19]!==u||e[20]!==v||e[21]!==y||e[22]!==N||e[23]!==m||e[24]!==V||e[25]!==E||e[26]!==d||e[27]!==p||e[28]!==x||e[29]!==le||e[30]!==k){Ae=Symbol.for("react.early_return_sentinel");e:{const me=T=>{se.current||m(T)};if(e[46]!==f||e[47]!==l||e[48]!==I||e[49]!==a||e[50]!==d||e[51]!==p||e[52]!==k){const T=f?I.find(re=>re.id===f):null;if(ee=T!=null?p[T.index]:null,Y=T!=null?d[T.index]:void 0,I.length===0){let re;e[56]!==k?(re=k("sectionsEditor.sectionList.noSections"),e[56]=k,e[57]=re):re=e[57];let O;e[58]!==re?(O=s.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:re}),e[58]=re,e[59]=O):O=e[59];const Be=!l;let ut;e[60]===Symbol.for("react.memo_cache_sentinel")?(ut=s.jsx(hs,{size:14}),e[60]=ut):ut=e[60];let Ne;e[61]!==k?(Ne=k("sectionsEditor.sectionList.addSectionButton"),e[61]=k,e[62]=Ne):Ne=e[62];let qe;e[63]!==a||e[64]!==Be||e[65]!==Ne?(qe=s.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Be,onClick:a,children:[ut,Ne]}),e[63]=a,e[64]=Be,e[65]=Ne,e[66]=qe):qe=e[66];let Oe;e[67]!==O||e[68]!==qe?(Oe=s.jsxs("div",{className:"space-y-2",children:[O,qe]}),e[67]=O,e[68]=qe,e[69]=Oe):Oe=e[69],Ae=Oe;break e}oe=$e(T&&"cursor-grabbing"),e[46]=f,e[47]=l,e[48]=I,e[49]=a,e[50]=d,e[51]=p,e[52]=k,e[53]=Y,e[54]=ee,e[55]=oe}else Y=e[53],ee=e[54],oe=e[55];Me=ln,ue=le,he=cn,je=ge,we=L,ve=st,Le=un,Pe=X,_e=dn,Ee="space-y-1",Fe=I.map(T=>{const re=p[T.index];return re?s.jsx(lr,{sortableId:T.id,section:re,raw:d[T.index],meta:S,selected:x===T.index,onSelect:()=>me(T.index),onDelete:()=>u(T.index),onDuplicate:()=>y(T.index),onMakeReusable:()=>N(T.index),onToggleHidden:()=>V(T.index),onToggleLazy:()=>E(T.index),onAddVariant:()=>i(T.index),onDetach:()=>v(T.index)},T.id):null})}e[11]=f,e[12]=l,e[13]=I,e[14]=X,e[15]=L,e[16]=S,e[17]=a,e[18]=i,e[19]=u,e[20]=v,e[21]=y,e[22]=N,e[23]=m,e[24]=V,e[25]=E,e[26]=d,e[27]=p,e[28]=x,e[29]=le,e[30]=k,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]=we,e[42]=ve,e[43]=oe,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],we=e[41],ve=e[42],oe=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=s.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?($=s.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]!==S?(pe=ee?s.jsx("div",{className:$e("cursor-grabbing shadow-lg ring-1 ring-border/60",En(ee,!1)),children:s.jsx(jn,{section:ee,raw:Y,meta:S})}):null,e[78]=Y,e[79]=ee,e[80]=S,e[81]=pe):pe=e[81];let Ce;e[82]!==pe?(Ce=Js.createPortal(s.jsx(Zs,{dropAnimation:en,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]!==we||e[89]!==ve||e[90]!==$||e[91]!==Ce?(be=s.jsxs(Me,{sensors:ue,collisionDetection:he,onDragStart:je,onDragEnd:we,onDragCancel:ve,children:[$,Ce]}),e[84]=Me,e[85]=ue,e[86]=he,e[87]=je,e[88]=we,e[89]=ve,e[90]=$,e[91]=Ce,e[92]=be):be=e[92];const Se=!l;let G;e[93]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(hs,{size:14}),e[93]=G):G=e[93];let ae;e[94]!==k?(ae=k("sectionsEditor.sectionList.addSectionButton"),e[94]=k,e[95]=ae):ae=e[95];let de;e[96]!==a||e[97]!==Se||e[98]!==ae?(de=s.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Se,onClick:a,children:[G,ae]}),e[96]=a,e[97]=Se,e[98]=ae,e[99]=de):de=e[99];let ke;return e[100]!==oe||e[101]!==be||e[102]!==de?(ke=s.jsxs("div",{className:oe,children:[be,de]}),e[100]=oe,e[101]=be,e[102]=de,e[103]=ke):ke=e[103],ke}function gr(g){return g.id}function Us(g){const e=We.c(57),{open:r,initialName:d,autoLabel:p,isPending:S,onSubmit:x,onOpenChange:m}=g,h=S===void 0?!1:S,u=ct(),[y,N]=R.useState(d),[V,E]=R.useState(r);r!==V&&(E(r),r&&N(d));let i;e[0]!==h||e[1]!==m?(i=ge=>{!ge&&!h&&m(!1)},e[0]=h,e[1]=m,e[2]=i):i=e[2];const v=i;let a;e[3]!==h||e[4]!==y||e[5]!==x?(a=async ge=>{ge.preventDefault(),!h&&await x(y.trim())},e[3]=h,e[4]=y,e[5]=x,e[6]=a):a=e[6];const D=a;let l;e[7]!==u?(l=u("sectionsEditor.variantRenameDialog.title"),e[7]=u,e[8]=l):l=e[8];let k;e[9]!==l?(k=s.jsx(Da,{children:l}),e[9]=l,e[10]=k):k=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 I;e[14]!==K?(I=s.jsx(Pa,{children:K}),e[14]=K,e[15]=I):I=e[15];let H;e[16]!==k||e[17]!==I?(H=s.jsxs(Aa,{children:[k,I]}),e[16]=k,e[17]=I,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 C;e[21]!==f?(C=s.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:f}),e[21]=f,e[22]=C):C=e[22];let De;e[23]===Symbol.for("react.memo_cache_sentinel")?(De=ge=>N(ge.target.value),e[23]=De):De=e[23];let A;e[24]!==p||e[25]!==h||e[26]!==y?(A=s.jsx(Ka,{id:"variant-rename-name",value:y,onChange:De,placeholder:p,autoFocus:!0,disabled:h}),e[24]=p,e[25]=h,e[26]=y,e[27]=A):A=e[27];let ce;e[28]!==C||e[29]!==A?(ce=s.jsxs("div",{className:"space-y-1.5 py-4",children:[C,A]}),e[28]=C,e[29]=A,e[30]=ce):ce=e[30];let M;e[31]!==m?(M=()=>m(!1),e[31]=m,e[32]=M):M=e[32];let se;e[33]!==u?(se=u("sectionsEditor.variantRenameDialog.cancel"),e[33]=u,e[34]=se):se=e[34];let F;e[35]!==h||e[36]!==M||e[37]!==se?(F=s.jsx(Xe,{type:"button",variant:"outline",onClick:M,disabled:h,children:se}),e[35]=h,e[36]=M,e[37]=se,e[38]=F):F=e[38];let ie;e[39]!==h||e[40]!==u?(ie=h?s.jsxs(s.Fragment,{children:[s.jsx(Qs,{size:14,className:"animate-spin"}),u("sectionsEditor.variantRenameDialog.saving")]}):u("sectionsEditor.variantRenameDialog.save"),e[39]=h,e[40]=u,e[41]=ie):ie=e[41];let le;e[42]!==h||e[43]!==ie?(le=s.jsx(Xe,{type:"submit",disabled:h,children:ie}),e[42]=h,e[43]=ie,e[44]=le):le=e[44];let ye;e[45]!==F||e[46]!==le?(ye=s.jsxs(Ca,{children:[F,le]}),e[45]=F,e[46]=le,e[47]=ye):ye=e[47];let X;e[48]!==D||e[49]!==ce||e[50]!==ye||e[51]!==H?(X=s.jsx(Ma,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:D,children:[H,ce,ye]})}),e[48]=D,e[49]=ce,e[50]=ye,e[51]=H,e[52]=X):X=e[52];let Z;return e[53]!==v||e[54]!==r||e[55]!==X?(Z=s.jsx(Ba,{open:r,onOpenChange:v,children:X}),e[53]=v,e[54]=r,e[55]=X,e[56]=Z):Z=e[56],Z}const hr="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",kn="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]";function Rn(g){const e=We.c(5),{rule:r,matchers:d}=g,p=r?.__resolveType??"";let S;if(e[0]!==d||e[1]!==p){const u=d.find(y=>y.resolveType===p)?.iconName??Io(p);S=Ra(u),e[0]=d,e[1]=p,e[2]=S}else S=e[2];const x=S;if(!x)return null;let m;return e[3]!==x?(m=s.jsx(x,{size:14,className:"shrink-0"}),e[3]=x,e[4]=m):m=e[4],m}function Gs(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
1
+ import{c as We,b as ct,r as R,m as $e,j as s,ae as Js,B as Xe,k as Qs,o as Po,t as Q,K as Ao}from"./index-BVH5RHL7.js";import{ao as Co,ap as Mo,aq as Bo,a3 as Xs,a4 as Jt,ar as Zs,as as en,a5 as tn,a6 as sn,at as nn,au as Ko,ad as on,ae as an,av as Lo,aw as Fo,N as Oo,a7 as rn,a8 as Ct,ab as ln,ac as cn,a9 as un,aj as dn,ax as Io,ay as Mt,az as $o,S as mn,aA as lt,aB as zo,aC as Ho,aD as Uo,aE as Go,D as Wo,F as qo,aF as Yo,aG as Jo,aH as Qo,aI as Xo,ah as Ut,aJ as Gt,aK as Zo,aL as St,aM as Dt,aN as ea,aO as ta,aP as tt,aQ as Bs,aR as sa,aS as Pt,aT as Wt,aU as na,aV as us,aW as oa,aX as wt,aY as aa,aZ as ra,a_ as ia,a$ as la,b0 as ca,b1 as xt,b2 as ua,b3 as da,b4 as ma,H as fa,b5 as Ks,b6 as At,b7 as Ls,b8 as Fs,b9 as pa,ba as ga,bb as ha,bc as va,bd as ds,be as Os,bf as Is,bg as Nt,bh as qt,bi as $s,bj as ba,bk as ms,bl as Sa,bm as xa,bn as ya,bo as _a,bp as ja}from"./index-CqbRQ2y1.js";import{t as Ea}from"./ChevronDown-DG2izocU.js";import{ag as gs,v as ka,W as fn,G as Ra,u as pn,ai as wa,a1 as Na}from"./agent-icon-CU1Jut04.js";import{i as gn}from"./ChevronRight-CBhPdqes.js";import{n as Ta}from"./ChevronUp-BPyz6G9W.js";import{i as Va}from"./Tool02-BEZavEDr.js";import{C as Yt}from"./automation-runs-CO_BywJs.js";import{c as yt,T as _t,a as jt}from"./tooltip-B9FVlGn0.js";import{b as Da,h as Pa,a as Aa,c as Ca,d as Ma,e as Ba}from"./dialog-CNbhzS-L.js";import{I as Ka}from"./input-Cp1_AyjP.js";import{a as hn}from"./Copy01-B3Wf1E9q.js";import{b as La}from"./Settings02-CMCVr6kz.js";import{s as Fa}from"./Eye-BMvp9akN.js";import{s as vn}from"./TrendUp01-CtoXe0aL.js";import{s as hs}from"./Plus-MaxuuPv-.js";import{s as bn}from"./Trash01-DxSJv4Ri.js";import{i as Oa}from"./Zap-BL2TGhS_.js";import{D as Sn,a as vt,c as xn,b as yn,i as Ia}from"./dropdown-menu-CU58UYBd.js";import{S as $a,r as zs,u as za,d as Ha,a as Ua,i as Ga,f as Wa,P as qa,b as Ya}from"./page-seo-form-BWznEwAc.js";import{c as Ja}from"./Tool01-DB6QU2VF.js";import{u as Qa,A as Xa}from"./use-section-preview-base-cv-X29yE.js";import"./ArrowUp-Ds1wmuPm.js";import"./chat-context-B_tZWBTD.js";import"./tab-id-DUZlzOBf.js";import"./Check-OfLKWLIS.js";import"./hooks-CVGqVdkK.js";import"./use-mcp-client-BNbhB5Os.js";import"./auth-B4Tuvjw-.js";import"./decopilot-sse-pool-fIsmwyiW.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-YTwdm2O4.js";import"./use-ai-providers-C5CLpBgy.js";import"./studio-tools-D_KNHI3Y.js";import"./use-decopilot-events-BTnC7oF5.js";import"./use-organization-settings-BgGv29eV.js";import"./spinner-CDhLcZP6.js";import"./drawer-BJ_osQEN.js";import"./collection-search-sQiJRgn2.js";import"./SearchMd-BxZJthWG.js";import"./use-mobile-D7z05tVc.js";import"./AreaChart-C-PbxICv.js";import"./index-DNECUB-x.js";import"./X-BYstzMvF.js";import"./shell-layout-BRuAh2KL.js";import"./avatar-B355jkWe.js";import"./User01-B1Wt1dct.js";import"./Users03-K6a0LDxs.js";import"./SearchLg-DsJvP5Uk.js";import"./Stars02-1ZGHV5NS.js";import"./XClose-CKQrGZ3n.js";import"./CheckCircle-CEieoa-t.js";import"./CpuChip01-I_a_caNM.js";import"./FilterLines-DiwOhXlj.js";import"./Monitor01-BZKncdrP.js";import"./required-auth-layout-CRr2ORAR.js";import"./use-org-sso-B8YxSzof.js";import"./ZapSquare-xaKjGVlS.js";import"./Star01-BBjfR1Gz.js";import"./Upload01-BkU1NwYd.js";import"./AlertCircle-BE9cwxbY.js";import"./form-Ct8AvLWq.js";import"./label-d_7A1dUh.js";import"./select-Cpac6Pp5.js";import"./XCircle-_n7bmIfy.js";import"./tabs-DkWhfZ42.js";import"./toggle-group-CMVWs0hQ.js";import"./use-deco-credits-DG6sr5rz.js";import"./sidebar-Dy8F7QtW.js";import"./LayoutLeft-CpjqlQLa.js";import"./popover-C5RIUioH.js";import"./alert-dialog-D-DTayBa.js";import"./toolbar-Cg2HVBh0.js";import"./skeleton-BR1mr2_B.js";import"./github-repo-picker-lwuwDrCB.js";import"./use-debounced-value-SOqknhMf.js";import"./use-connection-kpVcxz3e.js";import"./authenticate-and-persist-oauth-B0inhLYK.js";import"./mcp-oauth-DVsinH-i.js";import"./LinkExternal01-ALijI2HY.js";import"./use-mcp-tools-Cu5ZLUPD.js";import"./extract-connection-data-7dK6vjzP.js";import"./metadata-dUsYcpuu.js";import"./use-navigate-to-agent-BY6DZZ17.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-C-QNQcTj.js";import"./use-registry-connections-BwumcPNT.js";import"./useInfiniteQuery-BYyJ1kY3.js";import"./use-infinite-scroll-CB25zH8h.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-CaZg9MCd.js";import"./integration-icon-r017IlLX.js";import"./textarea-U7YYs3UU.js";import"./connection-form-helpers-0TTscf9V.js";import"./collection-tabs-BYuiH8u6.js";import"./badge-DjIbiYIu.js";import"./useSuspenseInfiniteQuery-DL-BpFoU.js";import"./use-open-billing-url-BtSozBCh.js";import"./select-model-BNthrPxK.js";import"./checkbox-bwR35z7M.js";import"./Key01-Br_ZaWJe.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-8XkBf8NP.js";import"./ArrowUpRight-BCNapAob.js";import"./Stars01-Bm6X-ikf.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DzobNfP6.js";import"./empty-state-Qwv5D4la.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-e_5b-RsW.js";import"./monaco-editor-CT77mqUS.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./switch-Ck7kJtiP.js";import"./Play-XbioRe7w.js";import"./use-debounced-autosave-wi1UwoZe.js";import"./index-C8T991zV.js";import"./search-input-CgxYt1gG.js";import"./index-CSFAAr_D.js";import"./Users01-F-abmy5R.js";import"./use-secrets-D8rRajjb.js";import"./DotsVertical-BEI2MUPC.js";import"./self-tool-result-CMFmheA7.js";import"./format-time-BnbuEtat.js";import"./use-members-qoQcp8kg.js";import"./use-org-auth-client-ChzS4M1Q.js";import"./use-copy-CRnP3b98.js";import"./SwitchHorizontal01-DI_Kp6ba.js";import"./use-tags-DinGPX1b.js";import"./get-initials-D-f_fDFw.js";import"./command-xCGOuDfu.js";import"./index-uFneV78z.js";import"./Palette-BPL3pYAR.js";import"./use-file-configs-DZhBH5cw.js";import"./use-automations-wGuwVzCZ.js";import"./automation-list-row-BYvUImpu.js";import"./CreditCard01-B71Apbtq.js";import"./HardDrive-sbNJL3hW.js";import"./LogOut01-BwsbH5Qi.js";import"./Sun-DdXtK5fE.js";import"./Shield01-C3-Qr1jT.js";import"./table-1_DuCuHd.js";import"./use-clock-tick-B0PFDRxc.js";function Za(g){return g.schema?.definitions??g.schema?.$defs??{}}function er(g,e){const r=Za(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 S=d.allOf.find(x=>typeof x.$ref=="string")?.$ref;if(typeof S=="string"){const x=S.replace("#/definitions/",""),m=r[x];p=typeof m?.image=="string"?m.image:void 0}}if(p?.includes("{{{"))return p}function tr(g,e){if(!e)return;const r=Co(g);if(!r)return;const d=er(r.resolveType,e);if(!d)return;const p=Mo(d,r.data);if(p)return Bo(p)}const sr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",nr="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 Hs(g){return Array.from({length:g},(e,r)=>({id:crypto.randomUUID(),index:r}))}function _n(g){return g.map((e,r)=>({...e,index:r}))}function or(g,e){if(e===g.length)return g;if(e<g.length)return _n(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 jn(g){const e=We.c(20),{section:r,raw:d,meta:p}=g,S=r.isSavedBlock===!0,x=r.isMultivariate===!0;let m;e[0]!==p||e[1]!==d?(m=d&&p?tr(d,p):void 0,e[0]=p,e[1]=d,e[2]=m):m=e[2];const h=m;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ka,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=u):u=e[3];let y;e[4]!==h?(y=h&&s.jsx("img",{src:h,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=h,e[5]=y):y=e[5];let N;e[6]!==x||e[7]!==S?(N=S?{color:Oo}:x?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=x,e[7]=S,e[8]=N):N=e[8];let V;e[9]!==N?(V=s.jsx(gs,{className:"h-4 w-4 shrink-0",style:N}),e[9]=N,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 v;e[13]!==r.label||e[14]!==i?(v=s.jsx("span",{className:i,children:r.label}),e[13]=r.label,e[14]=i,e[15]=v):v=e[15];let a;return e[16]!==y||e[17]!==V||e[18]!==v?(a=s.jsxs(s.Fragment,{children:[u,y,V,v]}),e[16]=y,e[17]=V,e[18]=v,e[19]=a):a=e[19],a}const ar="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",rr="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]",ir="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 fs(g,e){return $e("h-7 shrink-0 overflow-hidden",e?ar:g?ir:rr)}function En(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?sr:d?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function lr(g){const e=We.c(82),{section:r,raw:d,meta:p,sortableId:S,selected:x,onSelect:m,onDelete:h,onDuplicate:u,onMakeReusable:y,onToggleHidden:N,onToggleLazy:V,onAddVariant:E,onDetach:i}=g,v=ct(),a=d?nn(d.__resolveType??""):!1,D=r.isHidden===!0,l=a||D;let k;e[0]!==r?(k=Ko(r),e[0]=r,e[1]=k):k=e[1];const K=k;let I;e[2]!==S?(I={id:S,animateLayoutChanges:fr},e[2]=S,e[3]=I):I=e[3];const{attributes:H,listeners:f,setNodeRef:C,transform:De,isDragging:A}=on(I);let ce;e[4]!==De?(ce=an.Transform.toString(De?{...De,x:0}:null),e[4]=De,e[5]=ce):ce=e[5];const M=A?0:void 0;let se;e[6]!==ce||e[7]!==M?(se={transform:ce,opacity:M},e[6]=ce,e[7]=M,e[8]=se):se=e[8];const F=se;let ie;e[9]!==r?(ie=Lo(r),e[9]=r,e[10]=ie):ie=e[10];const le=ie,ye="button",X=0;let Z;e[11]!==m?(Z=T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),m())},e[11]=m,e[12]=Z):Z=e[12];const ge=A?"cursor-grabbing":"cursor-pointer";let ne;e[13]!==r||e[14]!==x||e[15]!==ge?(ne=$e("touch-none transition-colors",ge,En(r,x)),e[13]=r,e[14]=x,e[15]=ge,e[16]=ne):ne=e[16];let L;e[17]!==p||e[18]!==d||e[19]!==r?(L=s.jsx(jn,{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&&s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":v(a?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:$e(fs(l,a)),onClick:T=>{T.stopPropagation(),V()},onPointerDown:mr,children:s.jsx(Oa,{className:$e("h-3.5 w-3.5",a&&"text-yellow-500")})})}),s.jsx(jt,{side:"bottom",children:v(a?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),st=!r.isMultivariate&&s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":v(D?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:$e(fs(l,D)),onClick:T=>{T.stopPropagation(),N()},onPointerDown:dr,children:D?s.jsx(La,{className:"h-3.5 w-3.5"}):s.jsx(Fa,{className:"h-3.5 w-3.5"})})}),s.jsx(jt,{side:"bottom",children:v(D?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),Le=xn,Me=Sn,Y=!0,ee=Xe,Fe="button",Pe="ghost",_e="icon";let ue;e[21]!==v?(ue=v("sectionsEditor.sectionList.sectionActionsMenu"),e[21]=v,e[22]=ue):ue=e[22];const he=$e(fs(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=s.jsx(fn,{className:"h-3.5 w-3.5"}),e[23]=je):je=e[23];let we;e[24]!==ee||e[25]!==ue||e[26]!==he?(we=s.jsx(ee,{type:Fe,variant:Pe,size:_e,"aria-label":ue,className:he,onClick:ur,onPointerDown:cr,children:je}),e[24]=ee,e[25]=ue,e[26]=he,e[27]=we):we=e[27];let ve;e[28]!==Me||e[29]!==we?(ve=s.jsx(Me,{asChild:Y,children:we}),e[28]=Me,e[29]=we,e[30]=ve):ve=e[30];let oe;e[31]!==u?(oe=T=>{T.stopPropagation(),u()},e[31]=u,e[32]=oe):oe=e[32];let Ae;e[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx(hn,{className:"h-4 w-4"}),e[33]=Ae):Ae=e[33];let Ee;e[34]!==v?(Ee=v("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=v,e[35]=Ee):Ee=e[35];let fe;e[36]!==oe||e[37]!==Ee?(fe=s.jsxs(vt,{onClick:oe,children:[Ae,Ee]}),e[36]=oe,e[37]=Ee,e[38]=fe):fe=e[38];let $;e[39]!==K||e[40]!==E||e[41]!==v?($=K&&s.jsxs(vt,{className:Fo,onClick:T=>{T.stopPropagation(),E()},children:[s.jsx(vn,{className:"h-4 w-4"}),v("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=K,e[40]=E,e[41]=v,e[42]=$):$=e[42];let pe;e[43]!==le||e[44]!==y||e[45]!==v?(pe=le&&s.jsxs(vt,{className:nr,onClick:T=>{T.stopPropagation(),y()},children:[s.jsx(gs,{className:"h-4 w-4"}),v("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=le,e[44]=y,e[45]=v,e[46]=pe):pe=e[46];let Ce;e[47]!==i||e[48]!==r.isMultivariate||e[49]!==r.isSavedBlock||e[50]!==v?(Ce=r.isSavedBlock===!0&&!r.isMultivariate&&s.jsxs(vt,{onClick:T=>{T.stopPropagation(),i()},children:[s.jsx(gs,{className:"h-4 w-4"}),v("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=i,e[48]=r.isMultivariate,e[49]=r.isSavedBlock,e[50]=v,e[51]=Ce):Ce=e[51];let be;e[52]!==h?(be=T=>{T.stopPropagation(),h()},e[52]=h,e[53]=be):be=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx(bn,{className:"h-4 w-4"}),e[54]=Se):Se=e[54];let G;e[55]!==v?(G=v("sectionsEditor.sectionList.deleteMenuItem"),e[55]=v,e[56]=G):G=e[56];let ae;e[57]!==be||e[58]!==G?(ae=s.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:be,children:[Se,G]}),e[57]=be,e[58]=G,e[59]=ae):ae=e[59];let de;e[60]!==fe||e[61]!==$||e[62]!==pe||e[63]!==Ce||e[64]!==ae?(de=s.jsxs(yn,{align:"end",className:"w-44",children:[fe,$,pe,Ce,ae]}),e[60]=fe,e[61]=$,e[62]=pe,e[63]=Ce,e[64]=ae,e[65]=de):de=e[65];let ke;e[66]!==Le||e[67]!==ve||e[68]!==de?(ke=s.jsxs(Le,{children:[ve,de]}),e[66]=Le,e[67]=ve,e[68]=de,e[69]=ke):ke=e[69];let me;return e[70]!==H||e[71]!==f||e[72]!==m||e[73]!==C||e[74]!==F||e[75]!==ne||e[76]!==L||e[77]!==ze||e[78]!==st||e[79]!==ke||e[80]!==Z?(me=s.jsxs("div",{ref:C,style:F,...H,...f,role:ye,tabIndex:X,onClick:m,onKeyDown:Z,className:ne,children:[L,ze,st,ke]}),e[70]=H,e[71]=f,e[72]=m,e[73]=C,e[74]=F,e[75]=ne,e[76]=L,e[77]=ze,e[78]=st,e[79]=ke,e[80]=Z,e[81]=me):me=e[81],me}function cr(g){return g.stopPropagation()}function ur(g){return g.stopPropagation()}function dr(g){return g.stopPropagation()}function mr(g){return g.stopPropagation()}function fr(){return!1}function pr(g){const e=We.c(104),{listKey:r,rawSections:d,sections:p,meta:S,selectedIndex:x,onSelect:m,onReorder:h,onDelete:u,onDuplicate:y,onMakeReusable:N,onToggleHidden:V,onToggleLazy:E,onAddVariant:i,onDetach:v,onAddSection:a,canAddSection:D}=g,l=D===void 0?!0:D,k=ct();let K;e[0]!==p.length?(K=()=>Hs(p.length),e[0]=p.length,e[1]=K):K=e[1];const[I,H]=R.useState(K),[f,C]=R.useState(null),[De,A]=R.useState(r),[ce,M]=R.useState(p.length),se=R.useRef(!1);De!==r?(A(r),M(p.length),H(Hs(p.length))):ce!==p.length&&(M(p.length),H(me=>or(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:rn},e[3]=ie):ie=e[3];const le=Xs(Jt(sn,F),Jt(tn,ie));let ye;e[4]!==I?(ye=I.map(gr),e[4]=I,e[5]=ye):ye=e[5];const X=ye;let Z;e[6]===Symbol.for("react.memo_cache_sentinel")?(Z=me=>{C(String(me.active.id))},e[6]=Z):Z=e[6];const ge=Z;let ne;e[7]!==X||e[8]!==h?(ne=me=>{C(null);const{active:T,over:re}=me;if(!re||T.id===re.id)return;const O=X.indexOf(String(T.id)),Be=X.indexOf(String(re.id));O===-1||Be===-1||(H(ut=>_n(Ct([...ut],O,Be))),se.current=!0,requestAnimationFrame(()=>{se.current=!1}),h?.(O,Be))},e[7]=X,e[8]=h,e[9]=ne):ne=e[9];const L=ne;let ze;e[10]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{C(null)},e[10]=ze):ze=e[10];const st=ze;let Le,Me,Y,ee,Fe,Pe,_e,ue,he,je,we,ve,oe,Ae,Ee;if(e[11]!==f||e[12]!==l||e[13]!==I||e[14]!==X||e[15]!==L||e[16]!==S||e[17]!==a||e[18]!==i||e[19]!==u||e[20]!==v||e[21]!==y||e[22]!==N||e[23]!==m||e[24]!==V||e[25]!==E||e[26]!==d||e[27]!==p||e[28]!==x||e[29]!==le||e[30]!==k){Ae=Symbol.for("react.early_return_sentinel");e:{const me=T=>{se.current||m(T)};if(e[46]!==f||e[47]!==l||e[48]!==I||e[49]!==a||e[50]!==d||e[51]!==p||e[52]!==k){const T=f?I.find(re=>re.id===f):null;if(ee=T!=null?p[T.index]:null,Y=T!=null?d[T.index]:void 0,I.length===0){let re;e[56]!==k?(re=k("sectionsEditor.sectionList.noSections"),e[56]=k,e[57]=re):re=e[57];let O;e[58]!==re?(O=s.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:re}),e[58]=re,e[59]=O):O=e[59];const Be=!l;let ut;e[60]===Symbol.for("react.memo_cache_sentinel")?(ut=s.jsx(hs,{size:14}),e[60]=ut):ut=e[60];let Ne;e[61]!==k?(Ne=k("sectionsEditor.sectionList.addSectionButton"),e[61]=k,e[62]=Ne):Ne=e[62];let qe;e[63]!==a||e[64]!==Be||e[65]!==Ne?(qe=s.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Be,onClick:a,children:[ut,Ne]}),e[63]=a,e[64]=Be,e[65]=Ne,e[66]=qe):qe=e[66];let Oe;e[67]!==O||e[68]!==qe?(Oe=s.jsxs("div",{className:"space-y-2",children:[O,qe]}),e[67]=O,e[68]=qe,e[69]=Oe):Oe=e[69],Ae=Oe;break e}oe=$e(T&&"cursor-grabbing"),e[46]=f,e[47]=l,e[48]=I,e[49]=a,e[50]=d,e[51]=p,e[52]=k,e[53]=Y,e[54]=ee,e[55]=oe}else Y=e[53],ee=e[54],oe=e[55];Me=ln,ue=le,he=cn,je=ge,we=L,ve=st,Le=un,Pe=X,_e=dn,Ee="space-y-1",Fe=I.map(T=>{const re=p[T.index];return re?s.jsx(lr,{sortableId:T.id,section:re,raw:d[T.index],meta:S,selected:x===T.index,onSelect:()=>me(T.index),onDelete:()=>u(T.index),onDuplicate:()=>y(T.index),onMakeReusable:()=>N(T.index),onToggleHidden:()=>V(T.index),onToggleLazy:()=>E(T.index),onAddVariant:()=>i(T.index),onDetach:()=>v(T.index)},T.id):null})}e[11]=f,e[12]=l,e[13]=I,e[14]=X,e[15]=L,e[16]=S,e[17]=a,e[18]=i,e[19]=u,e[20]=v,e[21]=y,e[22]=N,e[23]=m,e[24]=V,e[25]=E,e[26]=d,e[27]=p,e[28]=x,e[29]=le,e[30]=k,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]=we,e[42]=ve,e[43]=oe,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],we=e[41],ve=e[42],oe=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=s.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?($=s.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]!==S?(pe=ee?s.jsx("div",{className:$e("cursor-grabbing shadow-lg ring-1 ring-border/60",En(ee,!1)),children:s.jsx(jn,{section:ee,raw:Y,meta:S})}):null,e[78]=Y,e[79]=ee,e[80]=S,e[81]=pe):pe=e[81];let Ce;e[82]!==pe?(Ce=Js.createPortal(s.jsx(Zs,{dropAnimation:en,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]!==we||e[89]!==ve||e[90]!==$||e[91]!==Ce?(be=s.jsxs(Me,{sensors:ue,collisionDetection:he,onDragStart:je,onDragEnd:we,onDragCancel:ve,children:[$,Ce]}),e[84]=Me,e[85]=ue,e[86]=he,e[87]=je,e[88]=we,e[89]=ve,e[90]=$,e[91]=Ce,e[92]=be):be=e[92];const Se=!l;let G;e[93]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(hs,{size:14}),e[93]=G):G=e[93];let ae;e[94]!==k?(ae=k("sectionsEditor.sectionList.addSectionButton"),e[94]=k,e[95]=ae):ae=e[95];let de;e[96]!==a||e[97]!==Se||e[98]!==ae?(de=s.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Se,onClick:a,children:[G,ae]}),e[96]=a,e[97]=Se,e[98]=ae,e[99]=de):de=e[99];let ke;return e[100]!==oe||e[101]!==be||e[102]!==de?(ke=s.jsxs("div",{className:oe,children:[be,de]}),e[100]=oe,e[101]=be,e[102]=de,e[103]=ke):ke=e[103],ke}function gr(g){return g.id}function Us(g){const e=We.c(57),{open:r,initialName:d,autoLabel:p,isPending:S,onSubmit:x,onOpenChange:m}=g,h=S===void 0?!1:S,u=ct(),[y,N]=R.useState(d),[V,E]=R.useState(r);r!==V&&(E(r),r&&N(d));let i;e[0]!==h||e[1]!==m?(i=ge=>{!ge&&!h&&m(!1)},e[0]=h,e[1]=m,e[2]=i):i=e[2];const v=i;let a;e[3]!==h||e[4]!==y||e[5]!==x?(a=async ge=>{ge.preventDefault(),!h&&await x(y.trim())},e[3]=h,e[4]=y,e[5]=x,e[6]=a):a=e[6];const D=a;let l;e[7]!==u?(l=u("sectionsEditor.variantRenameDialog.title"),e[7]=u,e[8]=l):l=e[8];let k;e[9]!==l?(k=s.jsx(Da,{children:l}),e[9]=l,e[10]=k):k=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 I;e[14]!==K?(I=s.jsx(Pa,{children:K}),e[14]=K,e[15]=I):I=e[15];let H;e[16]!==k||e[17]!==I?(H=s.jsxs(Aa,{children:[k,I]}),e[16]=k,e[17]=I,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 C;e[21]!==f?(C=s.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:f}),e[21]=f,e[22]=C):C=e[22];let De;e[23]===Symbol.for("react.memo_cache_sentinel")?(De=ge=>N(ge.target.value),e[23]=De):De=e[23];let A;e[24]!==p||e[25]!==h||e[26]!==y?(A=s.jsx(Ka,{id:"variant-rename-name",value:y,onChange:De,placeholder:p,autoFocus:!0,disabled:h}),e[24]=p,e[25]=h,e[26]=y,e[27]=A):A=e[27];let ce;e[28]!==C||e[29]!==A?(ce=s.jsxs("div",{className:"space-y-1.5 py-4",children:[C,A]}),e[28]=C,e[29]=A,e[30]=ce):ce=e[30];let M;e[31]!==m?(M=()=>m(!1),e[31]=m,e[32]=M):M=e[32];let se;e[33]!==u?(se=u("sectionsEditor.variantRenameDialog.cancel"),e[33]=u,e[34]=se):se=e[34];let F;e[35]!==h||e[36]!==M||e[37]!==se?(F=s.jsx(Xe,{type:"button",variant:"outline",onClick:M,disabled:h,children:se}),e[35]=h,e[36]=M,e[37]=se,e[38]=F):F=e[38];let ie;e[39]!==h||e[40]!==u?(ie=h?s.jsxs(s.Fragment,{children:[s.jsx(Qs,{size:14,className:"animate-spin"}),u("sectionsEditor.variantRenameDialog.saving")]}):u("sectionsEditor.variantRenameDialog.save"),e[39]=h,e[40]=u,e[41]=ie):ie=e[41];let le;e[42]!==h||e[43]!==ie?(le=s.jsx(Xe,{type:"submit",disabled:h,children:ie}),e[42]=h,e[43]=ie,e[44]=le):le=e[44];let ye;e[45]!==F||e[46]!==le?(ye=s.jsxs(Ca,{children:[F,le]}),e[45]=F,e[46]=le,e[47]=ye):ye=e[47];let X;e[48]!==D||e[49]!==ce||e[50]!==ye||e[51]!==H?(X=s.jsx(Ma,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:D,children:[H,ce,ye]})}),e[48]=D,e[49]=ce,e[50]=ye,e[51]=H,e[52]=X):X=e[52];let Z;return e[53]!==v||e[54]!==r||e[55]!==X?(Z=s.jsx(Ba,{open:r,onOpenChange:v,children:X}),e[53]=v,e[54]=r,e[55]=X,e[56]=Z):Z=e[56],Z}const hr="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",kn="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]";function Rn(g){const e=We.c(5),{rule:r,matchers:d}=g,p=r?.__resolveType??"";let S;if(e[0]!==d||e[1]!==p){const u=d.find(y=>y.resolveType===p)?.iconName??Io(p);S=Ra(u),e[0]=d,e[1]=p,e[2]=S}else S=e[2];const x=S;if(!x)return null;let m;return e[3]!==x?(m=s.jsx(x,{size:14,className:"shrink-0"}),e[3]=x,e[4]=m):m=e[4],m}function Gs(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
2
  `)}function ps(g){return g.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function vr(g){return g.map((e,r)=>({...e,index:r}))}function wn(g){const e=We.c(17),{label:r,effectiveRule:d,matchers:p,canDelete:S,dragging:x,onRename:m,onDuplicate:h,onDelete:u}=g,y=ct();let N;e[0]!==d||e[1]!==p?(N=s.jsx(Rn,{rule:d,matchers:p}),e[0]=d,e[1]=p,e[2]=N):N=e[2];let V;e[3]!==r?(V=s.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]!==S||e[6]!==x||e[7]!==r||e[8]!==u||e[9]!==h||e[10]!==m||e[11]!==y?(E=!x&&s.jsxs(xn,{children:[s.jsx(Sn,{asChild:!0,children:s.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:Sr,onPointerDown:br,children:s.jsx(fn,{size:14})})}),s.jsxs(yn,{align:"end",className:"w-36",children:[s.jsxs(vt,{onClick:v=>{v.stopPropagation(),m?.()},children:[s.jsx(Ja,{size:14}),y("sectionsEditor.pageVariantTabs.renameAction")]}),s.jsxs(vt,{onClick:v=>{v.stopPropagation(),h?.()},children:[s.jsx(hn,{size:14}),y("sectionsEditor.pageVariantTabs.duplicateAction")]}),s.jsx(Ia,{}),s.jsxs(vt,{variant:"destructive",disabled:!S,onClick:v=>{v.stopPropagation(),u?.()},children:[s.jsx(bn,{size:14}),y("sectionsEditor.pageVariantTabs.deleteAction")]})]})]}),e[5]=S,e[6]=x,e[7]=r,e[8]=u,e[9]=h,e[10]=m,e[11]=y,e[12]=E):E=e[12];let i;return e[13]!==N||e[14]!==V||e[15]!==E?(i=s.jsxs(s.Fragment,{children:[N,V,E]}),e[13]=N,e[14]=V,e[15]=E,e[16]=i):i=e[16],i}function br(g){return g.stopPropagation()}function Sr(g){return g.stopPropagation()}function xr(g){const e=We.c(33),{entry:r,sortableId:d,isActive:p,canDelete:S,decofile:x,meta:m,matchers:h,onSelect:u,onRename:y,onDuplicate:N,onDelete:V}=g;let E;e[0]!==d?(E={id:d,animateLayoutChanges:yr},e[0]=d,e[1]=E):E=e[1];const{attributes:i,listeners:v,setNodeRef:a,transform:D,isDragging:l}=on(E);let k;e[2]!==D?(k=an.Transform.toString(D?{...D,x:0}:null),e[2]=D,e[3]=k):k=e[3];const K=l?0:void 0;let I;e[4]!==k||e[5]!==K?(I={transform:k,opacity:K},e[4]=k,e[5]=K,e[6]=I):I=e[6];const H=I,f=m??void 0;let C;e[7]!==x||e[8]!==r.variant.rule||e[9]!==f?(C=Mt(r.variant.rule,x,f),e[7]=x,e[8]=r.variant.rule,e[9]=f,e[10]=C):C=e[10];const De=C;let A;e[11]!==u?(A=le=>{le.target===le.currentTarget&&(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),u())},e[11]=u,e[12]=A):A=e[12];const ce=l?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",M=p?kn:hr;let se;e[13]!==ce||e[14]!==M?(se=$e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,M),e[13]=ce,e[14]=M,e[15]=se):se=e[15];let F;e[16]!==S||e[17]!==De||e[18]!==r.variant.label||e[19]!==h||e[20]!==V||e[21]!==N||e[22]!==y?(F=s.jsx(wn,{label:r.variant.label,effectiveRule:De,matchers:h,canDelete:S,onRename:y,onDuplicate:N,onDelete:V}),e[16]=S,e[17]=De,e[18]=r.variant.label,e[19]=h,e[20]=V,e[21]=N,e[22]=y,e[23]=F):F=e[23];let ie;return e[24]!==i||e[25]!==v||e[26]!==u||e[27]!==a||e[28]!==H||e[29]!==se||e[30]!==F||e[31]!==A?(ie=s.jsx("div",{ref:a,style:H,...i,...v,onClick:u,onKeyDown:A,className:se,children:F}),e[24]=i,e[25]=v,e[26]=u,e[27]=a,e[28]=H,e[29]=se,e[30]=F,e[31]=A,e[32]=ie):ie=e[32],ie}function yr(){return!1}function _r(g){const e=We.c(9),{variant:r,decofile:d,meta:p,matchers:S}=g,x=p??void 0;let m;e[0]!==d||e[1]!==x||e[2]!==r.rule?(m=Mt(r.rule,d,x),e[0]=d,e[1]=x,e[2]=r.rule,e[3]=m):m=e[3];const h=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",kn),e[4]=u):u=e[4];let y;return e[5]!==h||e[6]!==S||e[7]!==r.label?(y=s.jsx("div",{className:u,children:s.jsx(wn,{label:r.label,effectiveRule:h,matchers:S,canDelete:!1,dragging:!0})}),e[5]=h,e[6]=S,e[7]=r.label,e[8]=y):y=e[8],y}function jr(g){const e=We.c(91),{listKey:r,variants:d,activeIndex:p,decofile:S,meta:x,matchers:m,onSelect:h,onReorder:u,onRename:y,onDuplicate:N,onDelete:V,onAdd:E}=g,i=ct();let v;e[0]!==d?(v=()=>ps(d),e[0]=d,e[1]=v):v=e[1];const[a,D]=R.useState(v),[l,k]=R.useState(null),[K,I]=R.useState(r),[H,f]=R.useState(d.length);let C;e[2]!==d?(C=()=>Gs(d),e[2]=d,e[3]=C):C=e[3];const[De,A]=R.useState(C),ce=R.useRef(!1),M=Gs(d);K!==r?(I(r),f(d.length),A(M),D(ps(d))):H!==d.length?(f(d.length),A(M),D(ps(d))):De!==M&&(A(M),D(be=>d.map((Se,G)=>({id:be[G]?.id??crypto.randomUUID(),index:G,variant:Se}))));let se;e[4]===Symbol.for("react.memo_cache_sentinel")?(se={activationConstraint:{distance:8}},e[4]=se):se=e[4];let F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F={coordinateGetter:rn},e[5]=F):F=e[5];const ie=Xs(Jt(sn,se),Jt(tn,F));let le;e[6]!==a?(le=a.map(Er),e[6]=a,e[7]=le):le=e[7];const ye=le,X=d.length>1;let Z;e[8]!==a?(Z=be=>{const Se=String(be.active.id);k(a.find(G=>G.id===Se)??null)},e[8]=a,e[9]=Z):Z=e[9];const ge=Z;let ne;e[10]!==ye||e[11]!==u?(ne=be=>{k(null);const{active:Se,over:G}=be;if(!G||Se.id===G.id)return;const ae=ye.indexOf(String(Se.id)),de=ye.indexOf(String(G.id));ae===-1||de===-1||(D(ke=>vr(Ct([...ke],ae,de))),ce.current=!0,requestAnimationFrame(()=>{ce.current=!1}),u(ae,de))},e[10]=ye,e[11]=u,e[12]=ne):ne=e[12];const L=ne;let ze;e[13]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{k(null)},e[13]=ze):ze=e[13];const st=ze;let Le,Me,Y,ee,Fe,Pe,_e,ue,he,je,we,ve,oe;if(e[14]!==p||e[15]!==X||e[16]!==S||e[17]!==a||e[18]!==ye||e[19]!==L||e[20]!==ge||e[21]!==m||e[22]!==x||e[23]!==E||e[24]!==V||e[25]!==N||e[26]!==y||e[27]!==h||e[28]!==ie||e[29]!==i){const be=O=>{ce.current||h(O)};we="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 G;e[45]!==Se?(G=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:Se}),e[45]=Se,e[46]=G):G=e[46];let ae;e[47]!==i?(ae=i("sectionsEditor.pageVariantTabs.addVariantAriaLabel"),e[47]=i,e[48]=ae):ae=e[48];let de;e[49]===Symbol.for("react.memo_cache_sentinel")?(de=s.jsx(hs,{size:14}),e[49]=de):de=e[49];let ke;e[50]!==E||e[51]!==ae?(ke=s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":ae,className:"size-6",onClick:E,children:de})}),e[50]=E,e[51]=ae,e[52]=ke):ke=e[52];let me;e[53]!==i?(me=i("sectionsEditor.pageVariantTabs.addVariantTooltip"),e[53]=i,e[54]=me):me=e[54];let T;e[55]!==me?(T=s.jsx(jt,{children:me}),e[55]=me,e[56]=T):T=e[56];let re;e[57]!==ke||e[58]!==T?(re=s.jsxs(yt,{children:[ke,T]}),e[57]=ke,e[58]=T,e[59]=re):re=e[59],e[60]!==G||e[61]!==re?(ve=s.jsxs("div",{className:"flex items-center justify-between",children:[G,re]}),e[60]=G,e[61]=re,e[62]=ve):ve=e[62],Me=ln,Pe=ie,_e=cn,ue=ge,he=L,je=st,Le=un,ee=ye,Fe=dn,oe="space-y-0.5",Y=a.map(O=>s.jsx(xr,{sortableId:O.id,entry:O,isActive:O.index===p,canDelete:X,decofile:S,meta:x,matchers:m,onSelect:()=>be(O.index),onRename:()=>y(O.index),onDuplicate:()=>N(O.index),onDelete:()=>V(O.index)},O.id)),e[14]=p,e[15]=X,e[16]=S,e[17]=a,e[18]=ye,e[19]=L,e[20]=ge,e[21]=m,e[22]=x,e[23]=E,e[24]=V,e[25]=N,e[26]=y,e[27]=h,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]=we,e[41]=ve,e[42]=oe}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],we=e[40],ve=e[41],oe=e[42];let Ae;e[63]!==Y||e[64]!==oe?(Ae=s.jsx("div",{className:oe,children:Y}),e[63]=Y,e[64]=oe,e[65]=Ae):Ae=e[65];let Ee;e[66]!==Le||e[67]!==ee||e[68]!==Fe||e[69]!==Ae?(Ee=s.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]!==S||e[73]!==m||e[74]!==x?(fe=l?s.jsx(_r,{variant:l.variant,decofile:S,meta:x,matchers:m}):null,e[71]=l,e[72]=S,e[73]=m,e[74]=x,e[75]=fe):fe=e[75];let $;e[76]!==fe?($=Js.createPortal(s.jsx(Zs,{dropAnimation:en,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=s.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]!==we||e[88]!==ve||e[89]!==pe?(Ce=s.jsxs("div",{className:we,children:[ve,pe]}),e[87]=we,e[88]=ve,e[89]=pe,e[90]=Ce):Ce=e[90],Ce}function Er(g){return g.id}function kr(g){const e=We.c(16),{schema:r,value:d,onChange:p,meta:S,decofile:x,onSaveReferencedBlock:m,sandbox:h}=g,u=ct();let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0];const[N,V]=R.useState(y);let E;e[1]!==N||e[2]!==u?(E=N.length>0&&s.jsxs("nav",{"aria-label":u("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[s.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:s.jsx(pn,{className:"size-3.5"})}),N.map((a,D)=>{const l=D===N.length-1;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[D>0&&s.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),s.jsx("button",{type:"button",onClick:()=>V(N.slice(0,D+1)),title:a,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:a})]},`${a}-${D}`)})]}),e[1]=N,e[2]=u,e[3]=E):E=e[3];let i;e[4]!==N||e[5]!==x||e[6]!==S||e[7]!==p||e[8]!==m||e[9]!==h||e[10]!==r||e[11]!==d?(i=s.jsx(mn,{schema:r,value:d,onChange:p,basePath:"",breadcrumbPath:N,onBreadcrumbChange:V,meta:S,decofile:x,onSaveReferencedBlock:m,sandbox:h}),e[4]=N,e[5]=x,e[6]=S,e[7]=p,e[8]=m,e[9]=h,e[10]=r,e[11]=d,e[12]=i):i=e[12];let v;return e[13]!==E||e[14]!==i?(v=s.jsxs("div",{className:"space-y-2",children:[E,i]}),e[13]=E,e[14]=i,e[15]=v):v=e[15],v}function Ws(g){const e=We.c(23),{activeSchema:r,formValue:d,formResetKey:p,onFormChange:S,onBreadcrumbChange:x,breadcrumbPath:m,emptyMessage:h,beforeForm:u,seoResolveType:y,siteDefaultSeo:N,meta:V,decofile:E,onSaveReferencedBlock:i,sandbox:v,previewBaseUrl:a,onRequestAddSection:D}=g;let l;e[0]!==m?(l=m===void 0?[]:m,e[0]=m,e[1]=l):l=e[1];const k=l;let K;e[2]!==r||e[3]!==k||e[4]!==E||e[5]!==p||e[6]!==d||e[7]!==V||e[8]!==x||e[9]!==S||e[10]!==D||e[11]!==i||e[12]!==a||e[13]!==v||e[14]!==y||e[15]!==N?(K=r&&d?y?s.jsx($a,{schema:r,resolveType:y,value:d,formResetKey:p,onChange:S,onBreadcrumbChange:x,siteDefaultSeo:N}):s.jsx(mn,{schema:r,value:d,onChange:S,basePath:"",breadcrumbPath:k,onBreadcrumbChange:x,meta:V,decofile:E,onSaveReferencedBlock:i,sandbox:v,previewBaseUrl:a,onRequestAddSection:D},p):null,e[2]=r,e[3]=k,e[4]=E,e[5]=p,e[6]=d,e[7]=V,e[8]=x,e[9]=S,e[10]=D,e[11]=i,e[12]=a,e[13]=v,e[14]=y,e[15]=N,e[16]=K):K=e[16];const I=K;let H;e[17]!==h||e[18]!==I?(H=I??s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:h}),e[17]=h,e[18]=I,e[19]=H):H=e[19];let f;return e[20]!==u||e[21]!==H?(f=s.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:s.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 Rr="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 wr(g,e){return $o(g,e,lt)}function Nr(g){const e=We.c(19),{pageKey:r,initialName:d,initialPath:p,onFieldChange:S}=g,x=ct(),[m,h]=R.useState(d),[u,y]=R.useState(p),[N,V]=R.useState(r);N!==r&&(V(r),h(d),y(p));let E;e[0]!==S?(E=K=>{h(K.target.value),S("name",K.target.value)},e[0]=S,e[1]=E):E=e[1];let i;e[2]!==x?(i=x("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[2]=x,e[3]=i):i=e[3];let v;e[4]!==m||e[5]!==E||e[6]!==i?(v=s.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]=v):v=e[7];let a;e[8]!==S?(a=K=>{y(K.target.value),S("path",K.target.value)},e[8]=S,e[9]=a):a=e[9];let D;e[10]!==x?(D=x("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[10]=x,e[11]=D):D=e[11];let l;e[12]!==u||e[13]!==a||e[14]!==D?(l=s.jsx("input",{type:"text",value:u,onChange:a,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:D}),e[12]=u,e[13]=a,e[14]=D,e[15]=l):l=e[15];let k;return e[16]!==v||e[17]!==l?(k=s.jsxs("div",{className:"space-y-1",children:[v,l]}),e[16]=v,e[17]=l,e[18]=k):k=e[18],k}function qs(g){const e=We.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 S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(vn,{size:14}),e[2]=S):S=e[2];let x;e[3]!==r||e[4]!==p?(x=s.jsx(_t,{asChild:!0,children:s.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:S})}),e[3]=r,e[4]=p,e[5]=x):x=e[5];let m;e[6]!==d?(m=d("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=d,e[7]=m):m=e[7];let h;e[8]!==m?(h=s.jsx(jt,{side:"bottom",children:m}),e[8]=m,e[9]=h):h=e[9];let u;return e[10]!==x||e[11]!==h?(u=s.jsxs(yt,{children:[x,h]}),e[10]=x,e[11]=h,e[12]=u):u=e[12],u}function Ys(g){const e=We.c(21),{currentRt:r,currentLabel:d,currentGlobalKey:p,matchers:S,globals:x,onSelect:m,onSelectGlobal:h,schema:u,formValue:y,onChange:N,formKey:V,formWrapperClassName:E,meta:i,decofile:v,onSaveReferencedBlock:a,sandbox:D}=g;let l;e[0]!==p||e[1]!==d||e[2]!==r||e[3]!==x||e[4]!==S||e[5]!==m||e[6]!==h?(l=s.jsx(zo,{currentRt:r,currentLabel:d,currentGlobalKey:p,matchers:S,globals:x,onSelect:m,onSelectGlobal:h}),e[0]=p,e[1]=d,e[2]=r,e[3]=x,e[4]=S,e[5]=m,e[6]=h,e[7]=l):l=e[7];let k;e[8]!==v||e[9]!==V||e[10]!==y||e[11]!==E||e[12]!==i||e[13]!==N||e[14]!==a||e[15]!==D||e[16]!==u?(k=u&&y&&s.jsx("div",{className:E,children:s.jsx(kr,{schema:u,value:y,onChange:N,meta:i,decofile:v,onSaveReferencedBlock:a,sandbox:D},V)}),e[8]=v,e[9]=V,e[10]=y,e[11]=E,e[12]=i,e[13]=N,e[14]=a,e[15]=D,e[16]=u,e[17]=k):k=e[17];let K;return e[18]!==l||e[19]!==k?(K=s.jsxs(s.Fragment,{children:[l,k]}),e[18]=l,e[19]=k,e[20]=K):K=e[20],K}function gc({orgSlug:g,virtualMcpId:e,branch:r,previewReady:d=!0,previewUrl:p,currentPath:S,activePageBlockKey:x=null,activeGlobalBlockKey:m=null,externalSelectedIndex:h,onSaved:u,initialEditSeo:y=!1,onExitSeo:N,onViewJsonFile:V,onVariantPreviewOverride:E}){const i=ct(),v=d?{orgSlug:g,virtualMcpId:e,branch:r,previewUrl:p}:null,{data:a,isLoading:D}=Ho(v),{data:l,isLoading:k}=Uo(v),K=Go(),I=K?.entity?.id===e?K.entity.metadata?.siteSlug??null:null,H=Qa({virtualMcpId:e,sandboxUrl:p}),[f,C]=R.useState(null),[De,A]=R.useState(null),[ce,M]=R.useState(null),[se,F]=R.useState(0),[ie,le]=R.useState(void 0),[ye,X]=R.useState(null),[Z,ge]=R.useState(null),[ne,L]=R.useState([]),ze=R.useRef(null),[st,Le]=R.useState(ne.length);st!==ne.length&&(Le(ne.length),requestAnimationFrame(()=>{ze.current&&(ze.current.scrollTop=0)}));const[Me,Y]=R.useState(0),[ee,Fe]=R.useState(null),[Pe,_e]=R.useState(null),[ue,he]=R.useState(null),[je,we]=R.useState(!0),[ve,oe]=R.useState(!1),[Ae,Ee]=R.useState(!1),fe=R.useRef(null),[$,pe]=R.useState(y),[Ce,be]=R.useState(y);y&&!Ce&&(be(!0),pe(!0),C(null),A(null),M(null),L([])),!y&&Ce&&be(!1);const[Se,G]=R.useState(null),[ae,de]=R.useState(void 0),[ke,me]=R.useState([]),[T,re]=R.useState(0),[O,Be]=R.useState(0),[ut,Ne]=R.useState(null),[qe,Oe]=R.useState(null),[vs,bs]=R.useState(null),Nn=Po(),Tn=`${g}/${e}/${r}`,Qt=Wo({orgSlug:g,virtualMcpId:e,branch:r}),[Vn,Dn]=R.useState(S),[Pn,An]=R.useState(x),[Cn,Mn]=R.useState(m);(Vn!==S||Pn!==x||Cn!==m)&&(queueMicrotask(()=>Qt.flush()),Dn(S),An(x),Mn(m),C(null),A(null),M(null),F(0),X(null),ge(null),Be(0),Ne(null),Oe(null),L([]),Y(t=>t+1),pe(!1),G(null),de(void 0),me([]),re(t=>t+1));const Te=qo({orgSlug:g,virtualMcpId:e,branch:r}),Bt=fa((t,n)=>{Te.mutate({blockKey:t,data:n},{onSuccess:()=>u?.(),onError:o=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:o.message}))})}),Xt=Yo({orgSlug:g,virtualMcpId:e,branch:r}),[Tt,Kt]=R.useState(!1),He=R.useRef(null),nt=R.useRef(null),ot=R.useRef(null),Zt=R.useRef({}),Ze=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!d||D||k)return s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:s.jsx(Qs,{size:20,className:"animate-spin text-muted-foreground"})});if(!a||!l)return s.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:i("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Bn=Jo(a),Ve=!!m,Ye=Ve?null:Qo(Bn,S,x),w=Ve?m:Ye?.key??null,es=Ve&&m?a[m]:void 0,Ss=Ve&&m&&es?Xo(m,es):Ve&&m?m:"",Lt=!Ve&&w&&a[w]?a[w]:null,ts=$&&a&&l&&w&&Ye?zs(a,{kind:"page",pageKey:w,pageName:String(Ye.name??""),path:String(Ye.path??"")},l):null,Kn=$?Lt?.seo:void 0,ss=ae!==void 0?ae:Kn,Ln=$?za(ss):void 0,Fn=ts?.seoTypeOptions??[],On=$&&l?Ha(l):"",xs=Se??Ln??{},ns=$&&ts?Ua(xs,ts):null,In=$&&ns&&Ga(ss)?Ut(ns,l):null,$n=$?Wa(a,l)?.seoData:void 0,Ge=Ve?[{label:"Default",sections:[{__resolveType:m}]}]:wr(Lt?.sections,a??{}),Ft=Ge.length>1,Ie=Math.min(se,Ge.length-1),dt=Ge[Ie],W=dt?.sections??[],Ue=Gt(W,a),ys=!Ve&&Zo(Lt?.sections);if(Ve&&m&&vs!==m){bs(m);const t=W[0],n=Ue[0];if(t&&n){C(0),Be(0),L([]);const o=St(t,n,a);o&&(A(o.data),M(o.resolveType),Oe(null),Ne(null))}}!Ve&&vs!==null&&bs(null),Ze.current={rawSections:W,parsedSections:Ue,decofile:a??{},activePageKey:w,pageVariants:Ge,variantIndex:Ie,sectionVariantIndex:O,selectedSectionIndex:f};const zn=()=>({multivariate:ys,index:Ie,variants:Ge.map(t=>({rule:t.rule}))}),_s=(t,n)=>{if(!E)return;if(!w||!ys||t.length<=1){E(null);return}const o=$s(w,{multivariate:!0,index:n,variants:t},a,l);E(o.length>0?o:null)},Et=(t,n,o)=>{if(!E)return;if(!w){E(null);return}const c=zn(),b=$s(w,c,a,l);if(!t||n<0){E(b.length>0?b:null);return}const j=ba({pageKey:w,page:c,sectionIndex:n,sectionLazy:Ue[n]?.isLazy??!1,mvObj:t,selectedVariantIndex:o,decofile:a,meta:l}),_=[...b,...j];E(_.length>0?_:null)},mt=(t,n,o,c=f??-1,b=!1)=>{const j=tt(t,n);if(!j){A(null),M(null),Oe(null),Ne(null),b&&Et(null,c,o);return}const P=Bs(j,lt)[o];if(!P){A(null),M(null),Oe(null),Ne(null),b&&Et(null,c,o);return}const te=aa(P.value,a);A(te?.data??null),M(te?.resolveType??null);const{resolveType:B,formValue:z}=Dt(P.rule,a,l??void 0);Oe(B),Ne(z),b&&Et(j,c,o)};if(h!==void 0&&h!==ie&&(le(h??null),typeof h=="number")){const t=W[h],n=Ue[h];if(t&&n)if(C(h),Be(0),L([]),Y(o=>o+1),n.isMultivariate)mt(t,n,0,h);else{const o=St(t,n,a);o?(A(o.data),M(o.resolveType)):(A(null),M(null)),Oe(null),Ne(null)}}const Ot={orgSlug:g,virtualMcpId:e,branch:r,previewUrl:p??void 0,siteSlug:I},os=ce&&l?Ut(ce,l):null,Je=(t,n)=>{if(!w)return;He.current&&(clearTimeout(He.current),He.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null),nt.current&&(clearTimeout(nt.current),nt.current=null);const o=At(a,w,t,Ie,Ge);Te.mutate({blockKey:w,data:o},{onSuccess:()=>n?.onSuccess?.()??u?.(),onError:c=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},kt=()=>{C(null),A(null),M(null),Be(0),Ne(null),Oe(null),L([]),Y(t=>t+1)},Hn=(t,n)=>{He.current&&clearTimeout(He.current);const o=Ze.current.sectionVariantIndex;He.current=setTimeout(()=>{const{rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:te}=Ze.current,B=c[n];if(!B)return;const z=b[n];if(!z)return;if(z.isSavedBlock){const q=z.isLazy?B.section?.__resolveType??B.__resolveType:B.__resolveType;Te.mutate({blockKey:q,data:t},{onSuccess:()=>u?.(),onError:J=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:J.message}))});return}if(!_)return;const U={...j[_]},Re=[...c];if(z.isMultivariate){const q=tt(B,z);if(!q||!_)return;const J=xa(q,o,t);Re[n]=xt(B,z,J)}else if(z.isHidden){const q=nn(B.__resolveType),J=q?{...B.section}:{...B},Ke=Array.isArray(J.variants)?[...J.variants]:[];Ke[0]&&(Ke[0]={...Ke[0],value:t}),J.variants=Ke,q?Re[n]={...B,section:J}:Re[n]=J}else z.isLazy?Re[n]={...B,section:t}:Re[n]=t;if(P.length>1){const q=U.sections,J=[...q?.variants??[]];J[te]&&(J[te]={...J[te],value:Re}),U.sections={...q,variants:J}}else U.sections=Re;Te.mutate({blockKey:_,data:U},{onSuccess:()=>u?.(),onError:q=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:q.message}))})},ms)},Un=t=>{C(t),Be(0),L([]),Y(b=>b+1);const n=W[t],o=Ue[t];if(!n||!o)return;if(o.isMultivariate){mt(n,o,0,t);return}const c=St(n,o,a);if(!c){A(null),M(null),Oe(null),Ne(null),Et(null,t,0);return}A(c.data),M(c.resolveType),Oe(null),Ne(null),Et(null,t,0)},js=t=>{const n=t;A(n),f!==null&&Hn(n,f)},as=t=>{if(!w||!a||!l||!Ye)return;const n={kind:"page",pageKey:w,pageName:String(Ye.name??""),path:String(Ye.path??"")},o=zs(a,n,l);o&&Qt.save(w,()=>{const c=Nn.getQueryData(Ao.decofile(Tn))?.[w];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const b={...c,...Zt.current};return Zt.current={},t?.raw!==void 0?{...b,seo:t.raw}:t?.inner!==void 0?Ya(n,o,b,t.inner):b})},Gn=(t,n)=>{w&&(Zt.current[t]=n,as())},Wn=(t,n)=>{if(!w)return;const o=Ct([...W],t,n);f!==null&&(f===t?C(n):t<f&&n>=f?C(f-1):t>f&&n<=f&&C(f+1)),Je(o)},qn=t=>{if(!w)return;const n=W.filter((o,c)=>c!==t);f===t?kt():f!==null&&f>t&&C(f-1),Je(n)},Yn=t=>{if(!w)return;const n=W[t];if(!n)return;const o=[...W];o.splice(t+1,0,va(n)),f!==null&&f>t&&C(f+1),Je(o)},Jn=t=>{if(!w)return;const n=W[t],o=Ue[t];if(!n||!o||o.isMultivariate)return;const c=o.isHidden?ga(n):ha(n);if(!c)return;const b=[...W];b[t]=c,f===t&&kt(),Je(b)},Qn=t=>{if(!w)return;const n=W[t],o=Ue[t];if(!n||!o||o.isMultivariate)return;const c=pa(n);if(!c)return;const b=[...W];b[t]=c,f===t&&kt(),Je(b)},Xn=t=>{if(!w)return;const n=W[t],o=Ue[t];if(!n||!o?.isSavedBlock)return;const c=St(n,o,a);if(!c?.data)return;const{name:b,...j}=c.data,_=[...W];o.isLazy?_[t]={...n,section:j}:_[t]=j,f===t&&kt(),Je(_)},Zn=t=>{if(!w)return;const n=[...W,{__resolveType:t.resolveType}],o=n.length-1;Je(n,{onSuccess:()=>{oe(!1),C(o),Be(0),L([]),Y(_=>_+1);const c=n[o],b=Gt(n,a)[o];if(!c||!b)return;if(b.isMultivariate){mt(c,b,0);return}const j=St(c,b,a);if(!j){A(null),M(null),Oe(null),Ne(null);return}A(j.data),M(j.resolveType),Oe(null),Ne(null)}})},Es=t=>{fe.current=t.append,oe(!0)},eo=t=>{const n=fe.current;if(!n){Zn(t);return}n({__resolveType:t.resolveType}),oe(!1),fe.current=null},to=t=>{if(f===null)return;const n=W[f],o=Ue[f];!n||!o?.isMultivariate||(Be(t),L([]),Y(c=>c+1),mt(n,o,t,f,!0))},so=t=>{if(f===null||!w)return;const n=W[f],o=Ue[f];if(!n||!o?.isMultivariate)return;const c=tt(n,o);if(!c)return;const b=da(c,t);if(!b){Q.error(i("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const j=[...W];j[f]=xt(n,o,b);const _=b.variants;let P=O;t===O?P=Math.min(t,_.length-1):t<O&&(P=O-1),Be(P),L([]),Y(te=>te+1),mt(j[f],o,P),Je(j)},no=t=>{if(f===null||!w)return;const n=W[f],o=Ue[f];if(!n||!o?.isMultivariate)return;const c=tt(n,o);if(!c)return;const b=ma(c,t),j=[...W];j[f]=xt(n,o,b);const _=t+1;Be(_),L([]),Y(P=>P+1),mt(j[f],o,_),Je(j)},oo=(t,n)=>{if(f===null||!w||t===n)return;const o=W[f],c=Ue[f];if(!o||!c?.isMultivariate)return;const b=tt(o,c);if(!b)return;const j=ca(b,t,n),_=[...W];_[f]=xt(o,c,j);let P=O;O===t?P=n:t<O&&n>=O?P=O-1:t>O&&n<=O&&(P=O+1),Be(P),mt(_[f],c,P),Je(_)},rs=t=>{const n=t??f;if(n===null||!w)return;const o=W[n],c=Ue[n];if(!o||!c)return;const b=ra(o,c);if(!b){Q.error(i("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const j=[...W];j[n]=b.section;const _=Gt(j,a)[n];if(!_?.isMultivariate){Q.error(i("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}C(n),Be(b.newVariantIndex),L([]),Y(P=>P+1),mt(b.section,_,b.newVariantIndex,n),Je(j)},ao=()=>{if(f===null||!w)return;const t=W[f],n=Ue[f];if(!t||!n?.isMultivariate)return;const o=tt(t,n);if(!o)return;const c=ua(t,n,o);if(!c){Q.error(i("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const b=[...W];b[f]=c;const j=Gt(b,a)[f];if(!j)return;Be(0),Oe(null),Ne(null),L([]),Y(P=>P+1);const _=St(c,j,a);_?(A(_.data),M(_.resolveType)):(A(null),M(null)),Et(null,f,0),Je(b)},ro=async t=>{if(ee===null||!w)return;const n=ds(t,a);if(n){Q.error(n);return}const o=W[ee],c=Ue[ee];if(!o||!c)return;const b=St(o,c,a);if(!b){Q.error(i("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const j={...b.data,name:t};try{await Te.mutateAsync({blockKey:t,data:j});const _=[...W];_[ee]={__resolveType:t},await Te.mutateAsync({blockKey:w,data:At(a,w,_,Ie,Ge)}),f===ee&&kt(),Fe(null),Q.success(i("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),u?.()}catch(_){Q.error(_ instanceof Error?_.message:i("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},ks=dt?.rule;if(Ft&&f===null&&Z===null&&ks){const{resolveType:t,formValue:n}=Dt(ks,a??{},l??void 0);ge(t),X(n)}const It=l?ea(l):[],Rs=l&&a?ta(l,a):[],io=!Ve&&!!(H&&l&&a),lo=Z&&l?Ut(Z,l):null,Rt=()=>{nt.current&&(clearTimeout(nt.current),nt.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null)},Vt=async(t,n)=>{if(!(Sa(n,t,l)>0))try{await Xt.mutateAsync({blockKey:t})}catch(o){Q.error(o instanceof Error?o.message:i("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},ws=t=>{nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>{const{activePageKey:n,decofile:o,variantIndex:c}=Ze.current;if(!n)return;const b={...o[n]},j={...b.sections},_=[...j.variants??[]],P=_[c],te=P?.rule;if(wt(te,o,l)){const B=te?.__resolveType??"",z=o[B],U=typeof z?.name=="string"?z.name:B,{__resolveType:Re,...q}=t;Te.mutate({blockKey:B,data:Nt(Re??"",q,U)},{onSuccess:()=>u?.(),onError:J=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:J.message}))});return}P&&(_[c]={...P,rule:t}),b.sections={...j,variants:_},Te.mutate({blockKey:n,data:b},{onSuccess:()=>u?.(),onError:B=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:B.message}))})},ms)},co=t=>{ge(t);const n=t?Ls(t,l):{__resolveType:Fs};X(t?n:{}),ws(n)},uo=t=>{const n=t;X(n);const o=Z?{__resolveType:Z,...n}:{...n};ws(o)},mo=async t=>{Rt();const{activePageKey:n,decofile:o,variantIndex:c}=Ze.current;if(!n)return;const b=o[n],j=b?.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const P=[..._.variants],te=P[c];if(!te)return;const B=Pt(te.rule,o,l),z=qt(t);P[c]={...te,rule:z};const U={...o,[n]:{...b,sections:{..._,variants:P}}},{resolveType:Re,formValue:q}=Dt(z,U,l??void 0);ge(Re),X(q);try{await Te.mutateAsync({blockKey:n,data:U[n]}),B&&B!==t&&await Vt(B,U),u?.()}catch(J){Q.error(J instanceof Error?J.message:i("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},Ns=t=>{ot.current&&clearTimeout(ot.current);const{selectedSectionIndex:n,sectionVariantIndex:o}=Ze.current;n!==null&&(ot.current=setTimeout(()=>{const{rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:te}=Ze.current;if(!_)return;const B=c[n],z=b[n];if(!B||!z?.isMultivariate)return;const U=tt(B,z);if(!U)return;const q=(U.variants??[])[o]?.rule;if(wt(q,j,l)){const xe=q?.__resolveType??"",Qe=j[xe],rt=typeof Qe?.name=="string"?Qe.name:xe,{__resolveType:gt,...it}=t;Te.mutate({blockKey:xe,data:Nt(gt??"",it,rt)},{onSuccess:()=>u?.(),onError:ht=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:ht.message}))});return}const J=Ks(U,o,t),Ke=[...c];Ke[n]=xt(B,z,J);const et=At(j,_,Ke,te,P);Te.mutate({blockKey:_,data:et},{onSuccess:()=>u?.(),onError:xe=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:xe.message}))})},ms))},fo=t=>{Oe(t);const n=t?Ls(t,l):{__resolveType:Fs};Ne(t?n:{}),Ns(n)},po=t=>{const n=t;Ne(n);const o=qe?{__resolveType:qe,...n}:{...n};Ns(o)},go=async t=>{Rt();const{selectedSectionIndex:n,sectionVariantIndex:o,rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:te}=Ze.current;if(n===null||!_)return;const B=c[n],z=b[n];if(!B||!z?.isMultivariate)return;const U=tt(B,z);if(!U)return;const Re=U.variants??[],q=Pt(Re[o]?.rule,j,l),J=qt(t),Ke=Ks(U,o,J),et=[...c];et[n]=xt(B,z,Ke);const xe=At(j,_,et,te,P),Qe={...j,[_]:xe},{resolveType:rt,formValue:gt}=Dt(J,Qe,l??void 0);Oe(rt),Ne(gt);try{await Te.mutateAsync({blockKey:_,data:xe}),q&&q!==t&&await Vt(q,Qe),u?.()}catch(it){Q.error(it instanceof Error?it.message:i("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Ve&&!Ye)return s.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:i("sectionsEditor.sectionsEditor.noPageFound",{currentPath:S})});if(Ve&&!es)return s.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,Ts=f!==null?W[f]:null,Vs=Ts&&ft?.isMultivariate?tt(Ts,ft):null,bt=Vs?Bs(Vs,lt):[],is=Math.min(O,Math.max(bt.length-1,0)),$t=bt[is]??null,pt=ft?.isMultivariate===!0,Ds=f!==null&&ft!==null,zt=Ds&&(pt||!!(os&&De)),ho=zt&&!Ve&&ft?.isSavedBlock===!0,at=Ve||ho,vo=Ve?Ss:ft?.label??"",bo=qe&&l?Ut(qe,l):null,ls=zt&&(!Ve||ne.length>0)?Ve?[Ss,...ne]:[Ye.name,ft.label,...pt&&$t?[$t.label]:[],...ne]:[],So=$&&Ye?[Ye.name,"SEO",...ke]:[],Ht=$?So:at?ls.length>0?ls:[vo]:ls,xo=!$&&!Ve&&pt&&ne.length===0,Ps=()=>{if(!w)return;Rt(),He.current&&(clearTimeout(He.current),He.current=null);const t=a[w],n=ia(t.sections,W);if(!n)return;const o=la(n);Te.mutate({blockKey:w,data:{...t,sections:n}},{onSuccess:()=>{F(o),C(null),A(null),M(null),L([]),X(null),ge(null)},onError:c=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},cs=(t,n,o)=>{if(!w)return;Rt(),He.current&&(clearTimeout(He.current),He.current=null);const c=a[w],b=c.sections;if(!b||typeof b!="object"||Array.isArray(b))return;const j=b;if(!Array.isArray(j.variants))return;const _=t([...j.variants]);if(!_)return;const P=ya(j,_),te={...a,[w]:{...c,sections:P}};Te.mutate({blockKey:w,data:te[w]},{onSuccess:()=>{n?.(),o&&Vt(o,te)},onError:B=>Q.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:B.message}))})},yo=t=>{_e(null),F(t),C(null),A(null),M(null),L([]);const n=Ge[t]?.rule,{resolveType:o,formValue:c}=Dt(n,a??{},l??void 0);ge(o),X(c),_s(Ge.map(b=>({rule:b.rule})),t)},_o=(t,n)=>{if(t===n)return;let o=Ie;Ie===t?o=n:t<Ie&&n>=Ie?o=Ie-1:t>Ie&&n<=Ie&&(o=Ie+1),F(o);const c=Ct(Ge.map(b=>({rule:b.rule})),t,n);_s(c,o),cs(b=>Ct(b,t,n))},jo=t=>{const n=Ge[t]?.rule,o=Pt(n,a??{},l??void 0);cs(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Ge.length-1===1?F(0):t<Ie?F(Ie-1):t===Ie&&F(Math.max(0,t-1)),C(null),A(null),M(null),L([]),X(null),ge(null)},o)},Eo=t=>{cs(n=>_a(n,t),()=>{F(t+1),C(null),A(null),M(null),L([]),X(null),ge(null)})},ko=async(t,n)=>{Rt(),He.current&&(clearTimeout(He.current),He.current=null);const o=Ze.current.activePageKey,c=Ze.current.decofile;if(!o)return;const b=c[o],j=b.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const P=[..._.variants],te=P[t];if(!te?.rule||typeof te.rule!="object"){Q.error(i("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const B=te.rule,z=n.trim();Kt(!0);try{if(!z){if(!wt(B,c,l)){_e(null);return}const et=B.__resolveType??"";P[t]={...te,rule:Os(B,c,l)};const xe={...c,[o]:{...b,sections:{..._,variants:P}}};await Te.mutateAsync({blockKey:o,data:xe[o]}),await Vt(et,xe),_e(null),u?.();return}const U=Is(B,c,l);if(!U){Q.error(i("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(U.blockKey){await Te.mutateAsync({blockKey:U.blockKey,data:Nt(U.resolveType,U.data,z)}),_e(null),u?.();return}const Re=us(z),q=ds(Re,c);if(q){Q.error(q);return}const J=Nt(U.resolveType,U.data,z);let Ke=null;try{await Te.mutateAsync({blockKey:Re,data:J}),Ke=Re,P[t]={...te,rule:qt(Re)},await Te.mutateAsync({blockKey:o,data:{...b,sections:{..._,variants:P}}}),Ke=null}catch(et){throw Ke&&await Xt.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{Kt(!1)}},Ro=async(t,n)=>{Rt(),He.current&&(clearTimeout(He.current),He.current=null);const{selectedSectionIndex:o,rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:te}=Ze.current;if(o===null||!_)return;const B=c[o],z=b[o];if(!B||!z?.isMultivariate)return;const U=tt(B,z);if(!U)return;const Re=U.variants??[],q=Re[t];if(!q?.rule||typeof q.rule!="object"){Q.error(i("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const J=q.rule,Ke=n.trim();Kt(!0);const et=async xe=>{const Qe={...U,variants:xe},rt=[...c];rt[o]=xt(B,z,Qe);const gt=At(j,_,rt,te,P);return await Te.mutateAsync({blockKey:_,data:gt}),{...j,[_]:gt}};try{if(!Ke){if(!wt(J,j,l)){he(null);return}const ht=J.__resolveType??"",Ms=[...Re];Ms[t]={...q,rule:Os(J,j,l)};const Do=await et(Ms);await Vt(ht,Do),he(null),u?.();return}const xe=Is(J,j,l);if(!xe){Q.error(i("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(xe.blockKey){await Te.mutateAsync({blockKey:xe.blockKey,data:Nt(xe.resolveType,xe.data,Ke)}),he(null),u?.();return}const Qe=us(Ke),rt=ds(Qe,j);if(rt){Q.error(rt);return}const gt=Nt(xe.resolveType,xe.data,Ke);let it=null;try{await Te.mutateAsync({blockKey:Qe,data:gt}),it=Qe;const ht=[...Re];ht[t]={...q,rule:qt(Qe)},await et(ht),it=null}catch(ht){throw it&&await Xt.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{Kt(!1)}},As=()=>{kt()},wo=t=>{G(t),as({inner:t})},No=t=>{de(t),as({raw:t})},To=()=>{G(null),me([])},Vo=()=>re(t=>t+1),Cs=t=>{if($){if(t===0){Qt.flush(),pe(!1),G(null),de(void 0),me([]),re(o=>o+1),N?.();return}if(t===1){me([]),re(o=>o+1);return}me(ke.slice(0,t-1)),re(o=>o+1);return}if(Ve){L(ne.slice(0,t)),Y(o=>o+1);return}if(t===0){As();return}if(t===1){L([]),Y(o=>o+1);return}if(pt&&t===2){L([]),Y(o=>o+1);return}const n=pt?2:1;L(ne.slice(0,t-n))};return s.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[s.jsx("div",{className:"shrink-0",children:at||zt||$?s.jsxs("div",{className:$e("border-b px-3 py-2.5",at&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[Ht.length>1&&s.jsx("button",{type:"button",onClick:()=>Cs(ja(Ht.length,{isMultivariateSectionTop:xo})),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",at?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:s.jsx(pn,{className:"size-4"})}),!Ve&&Ft&&dt&&s.jsxs("button",{type:"button",onClick:As,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",Rr),children:[s.jsx(Rn,{rule:Mt(dt.rule,a??{},l??void 0),matchers:It}),s.jsx("span",{className:"max-w-[160px] truncate",children:dt.label})]}),s.jsx("nav",{"aria-label":i("sectionsEditor.sectionsEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:Ht.map((t,n)=>{const o=n===Ht.length-1;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[n>0&&s.jsx(gn,{className:"size-3 shrink-0 text-muted-foreground/60"}),s.jsx("button",{type:"button",onClick:()=>Cs(n),title:t,className:$e("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",o?at?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":at?"text-foreground/80":"text-muted-foreground",at?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${n}`)})}),at&&s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx("span",{className:"shrink-0 cursor-help",children:s.jsx(Va,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),s.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:i("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Ds&&!pt&&!ft?.isHidden&&w&&s.jsx(qs,{onClick:()=>rs()})]}),at&&s.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:i("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):s.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(Nr,{pageKey:w,initialName:Ye.name,initialPath:Ye.path,onFieldChange:Gn})}),s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":i("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>pe(!0),children:s.jsx(wa,{size:14})})}),s.jsx(jt,{side:"bottom",children:i("sectionsEditor.sectionsEditor.editSeo")})]}),s.jsxs(yt,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":i("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>V&&w?V(w):Ee(!0),children:s.jsx(Na,{size:14})})}),s.jsx(jt,{side:"bottom",children:i("sectionsEditor.sectionsEditor.viewJson")})]}),s.jsx(qs,{onClick:Ps})]})}),$?s.jsx(Yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:s.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:s.jsx("div",{className:"mx-auto max-w-2xl",children:Lt&&w?s.jsx(qa,{rawSeo:ss,innerSeo:xs,defaultResolveType:On,seoSchema:In,activeResolveType:ns,seoTypeOptions:Fn,formResetKey:T,siteDefaultSeo:$n,onBreadcrumbChange:me,onPersistRaw:No,onInnerChange:wo,onClearForm:To,onBumpFormKey:Vo}):s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})}):zt?s.jsxs(Yt,{viewportRef:ze,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[pt&&bt.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(sa,{listKey:`${w??""}:${f??""}`,variants:bt.map((t,n)=>({index:n,label:t.label})),selectedIndex:is,onSelect:to,onRename:he,onDuplicate:no,onDelete:so,onRemoveAll:ao,onReorder:oo,onAdd:()=>rs()}),pt&&s.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i("sectionsEditor.sectionsEditor.variantRule")}),s.jsx(Ys,{currentRt:qe??"",currentLabel:Wt($t?.rule,a??{},lt,l??void 0),currentGlobalKey:Pt($t?.rule,a??{},l??void 0)??void 0,matchers:It,globals:Rs,onSelect:fo,onSelectGlobal:go,schema:bo,formValue:ut,onChange:po,formKey:`${f??"none"}:${is}:${qe??""}`,formWrapperClassName:"pt-1",meta:l??void 0,decofile:a,onSaveReferencedBlock:Bt,sandbox:Ot})]})]}),s.jsx(Ws,{activeSchema:os,formValue:De,formResetKey:Me,onFormChange:js,onBreadcrumbChange:L,breadcrumbPath:ne,emptyMessage:i("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:l,decofile:a,onSaveReferencedBlock:Bt,sandbox:Ot,previewBaseUrl:H,onRequestAddSection:Es})]}):Ve?s.jsx(Yt,{viewportRef:ze,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:s.jsx(Ws,{activeSchema:os,formValue:De,formResetKey:Me,onFormChange:js,onBreadcrumbChange:L,breadcrumbPath:ne,emptyMessage:i("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:l,decofile:a,onSaveReferencedBlock:Bt,sandbox:Ot,previewBaseUrl:H,onRequestAddSection:Es})}):s.jsxs(Yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Ft&&w&&s.jsx(jr,{listKey:w,variants:Ge,activeIndex:Ie,decofile:a??{},meta:l,matchers:It,onSelect:yo,onReorder:_o,onRename:_e,onDuplicate:Eo,onDelete:jo,onAdd:Ps}),Ft&&Z!==null&&s.jsxs("div",{className:$e("px-3 border-b",je?"pt-3 pb-5 space-y-3":"py-2"),children:[s.jsxs("button",{type:"button",onClick:()=>we(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:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i("sectionsEditor.sectionsEditor.variantRule")}),je?s.jsx(Ta,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),je&&s.jsx("div",{className:$e("space-y-3",Tt&&"pointer-events-none opacity-50"),children:s.jsx(Ys,{currentRt:Z,currentLabel:Wt(dt?.rule,a??{},lt,l??void 0),currentGlobalKey:Pt(dt?.rule,a??{},l??void 0)??void 0,matchers:It,globals:Rs,onSelect:co,onSelectGlobal:mo,schema:lo,formValue:ye,onChange:uo,formKey:`${Ie}:${Z??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:a,onSaveReferencedBlock:Bt,sandbox:Ot})})]}),s.jsx("div",{className:"p-2 pt-3",children:s.jsx(pr,{listKey:`${w??""}-${Ie}`,rawSections:W,sections:Ue,meta:l,selectedIndex:f,onSelect:Un,onReorder:Wn,onDelete:qn,onDuplicate:Yn,onMakeReusable:Fe,onToggleHidden:Jn,onToggleLazy:Qn,onAddVariant:rs,onDetach:Xn,onAddSection:()=>oe(!0),canAddSection:io})})]}),s.jsx(na,{open:ee!==null,onOpenChange:t=>{t||Fe(null)},defaultBlockId:ee!==null?us(Ue[ee]?.label??""):"",isPending:Te.isPending,onSubmit:ro}),H&&s.jsx(Xa,{open:ve,onOpenChange:t=>{oe(t),t||(fe.current=null)},meta:l,decofile:a,previewBaseUrl:H,onSelect:eo}),Ae&&w&&a&&s.jsx(oa,{open:Ae,onOpenChange:Ee,pageKey:w,decofile:a}),Pe!==null&&s.jsx(Us,{open:!0,initialName:wt(Ge[Pe]?.rule,a??{},l??void 0)?Wt(Ge[Pe]?.rule,a??{},lt,l??void 0):"",autoLabel:lt(Mt(Ge[Pe]?.rule,a??{},l??void 0)),isPending:Tt,onSubmit:async t=>{await ko(Pe,t)},onOpenChange:t=>{!t&&!Tt&&_e(null)}}),ue!==null&&s.jsx(Us,{open:!0,initialName:wt(bt[ue]?.rule,a??{},l??void 0)?Wt(bt[ue]?.rule,a??{},lt,l??void 0):"",autoLabel:lt(Mt(bt[ue]?.rule,a??{},l??void 0)),isPending:Tt,onSubmit:async t=>{await Ro(ue,t)},onOpenChange:t=>{!t&&!Tt&&he(null)}})]})}export{gc as SectionsEditor};
@@ -1 +1 @@
1
- import{r as i,aM as nt,aK as Ne,j as d,d0 as rt,aO as be,aL as k,d1 as st,aH as j,aN as P,bR as $,d2 as lt,ae as _e,d3 as Ee,aI as at,bI as ct,bT as it,d9 as dt,da as ut,db as pt,dc as ft,d4 as mt,aJ as ht,dd as vt,d5 as gt,d7 as xt,c as ee,m as oe}from"./index-nuua5tXA.js";import{V as St}from"./tooltip-BTk8baer.js";import{i as wt}from"./Check-CvMAG72f.js";import{t as Re}from"./ChevronDown-DLngVaqr.js";import{n as Ct}from"./ChevronUp-Bc9cUdsp.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,X=_.left-N,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,X=window.innerWidth-_.right-N,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"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,X=Math.max(ce,se+(I?he:0)+N+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"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",Xe=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});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=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});Ze.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,Xt=Be,Zt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Xe,oo=Ze;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(Zt,{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(Xt,{"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,d0 as rt,aO as be,aL as k,d1 as st,aH as j,aN as P,bR as $,d2 as lt,ae as _e,d3 as Ee,aI as at,bI as ct,bT as it,d9 as dt,da as ut,db as pt,dc as ft,d4 as mt,aJ as ht,dd as vt,d5 as gt,d7 as xt,c as ee,m as oe}from"./index-BVH5RHL7.js";import{V as St}from"./tooltip-B9FVlGn0.js";import{i as wt}from"./Check-OfLKWLIS.js";import{t as Re}from"./ChevronDown-DG2izocU.js";import{n as Ct}from"./ChevronUp-BPyz6G9W.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,X=_.left-N,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,X=window.innerWidth-_.right-N,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"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,X=Math.max(ce,se+(I?he:0)+N+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"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",Xe=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});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=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});Ze.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,Xt=Be,Zt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Xe,oo=Ze;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(Zt,{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(Xt,{"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-nuua5tXA.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-CkWup0NZ.js";import{d as yt,b as jt,a as St,D as Nt}from"./drawer-D52THX3T.js";import{u as wt}from"./use-mobile-BpGy3Jo4.js";import{u as Xe}from"./chat-context-DD2GGpgq.js";import{C as kt}from"./checkbox-BF5-RitT.js";import{I as pe}from"./input-ChceT-NF.js";import{S as _t,a as Ct,b as It,c as Mt,d as Et}from"./select-Dg5PjuH9.js";import{S as ee}from"./skeleton-DXztGuq3.js";import{b as Qe,i as Je,c as Ot,a as At,s as Pt}from"./Settings02-D2EsO4FX.js";import{d as Tt,a as Lt,b as zt,i as Rt}from"./Tool01-BBnOx5id.js";import{i as Ft}from"./Key01-DYVpRV_Q.js";import{i as Ze}from"./SearchMd-_MwtuM1U.js";import{f as ke,u as Kt,b as Dt}from"./use-ai-providers-BulTw0Dd.js";import{g as _e}from"./ai-providers-logos-DD3qZ33J.js";import{i as Me}from"./Monitor01-C2nbZk_0.js";import{i as $t}from"./AlertCircle-CLEU--nA.js";import{S as Ee}from"./spinner-CuWOKKNk.js";import{u as Ne}from"./studio-tools-CvEcX9oj.js";import{i as Ut}from"./ChevronRight-D09evVMh.js";import{A as Bt}from"./avatar-BlvVoNC_.js";import{S as Oe,a as Ae,b as et}from"./settings-section-jAfKLWCD.js";import{s as tt}from"./Eye-B5pxEZ_-.js";import{i as Wt,D as Vt}from"./tab-id-C4U4dy_l.js";import{u as Ht}from"./use-is-desktop-app-BNujXJc_.js";import{t as Pe}from"./ChevronDown-DLngVaqr.js";import{t as qt}from"./Stars01-A7IjRvsz.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-BVH5RHL7.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-CNbhzS-L.js";import{d as yt,b as jt,a as St,D as Nt}from"./drawer-BJ_osQEN.js";import{u as wt}from"./use-mobile-D7z05tVc.js";import{u as Xe}from"./chat-context-B_tZWBTD.js";import{C as kt}from"./checkbox-bwR35z7M.js";import{I as pe}from"./input-Cp1_AyjP.js";import{S as _t,a as Ct,b as It,c as Mt,d as Et}from"./select-Cpac6Pp5.js";import{S as ee}from"./skeleton-BR1mr2_B.js";import{b as Qe,i as Je,c as Ot,a as At,s as Pt}from"./Settings02-CMCVr6kz.js";import{d as Tt,a as Lt,b as zt,i as Rt}from"./Tool01-DB6QU2VF.js";import{i as Ft}from"./Key01-Br_ZaWJe.js";import{i as Ze}from"./SearchMd-BxZJthWG.js";import{f as ke,u as Kt,b as Dt}from"./use-ai-providers-C5CLpBgy.js";import{g as _e}from"./ai-providers-logos-DD3qZ33J.js";import{i as Me}from"./Monitor01-BZKncdrP.js";import{i as $t}from"./AlertCircle-BE9cwxbY.js";import{S as Ee}from"./spinner-CDhLcZP6.js";import{u as Ne}from"./studio-tools-D_KNHI3Y.js";import{i as Ut}from"./ChevronRight-CBhPdqes.js";import{A as Bt}from"./avatar-B355jkWe.js";import{S as Oe,a as Ae,b as et}from"./settings-section-8XkBf8NP.js";import{s as tt}from"./Eye-BMvp9akN.js";import{i as Wt,D as Vt}from"./tab-id-DUZlzOBf.js";import{u as Ht}from"./use-is-desktop-app-BNujXJc_.js";import{t as Pe}from"./ChevronDown-DG2izocU.js";import{t as qt}from"./Stars01-Bm6X-ikf.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(Qe,{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(Qe,{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(Je,{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(zt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Lt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Ot,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx(Tt,{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 Li(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 zi(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 Ri(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(Pt,{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(Je,{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(Rt,{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(At,{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(Ft,{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 Fi(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,zi as b,Fi as c,be as d,Ri as g,Li as i,Ie as m};