decocms 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/client/assets/{AlertCircle-HztvGgEK.js → AlertCircle-DC-zDzV-.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-CD45Pqa3.js → ArrowUpRight-OJZisFPQ.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-B93tZkib.js → CheckCircle-Cgnheu-R.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-BHp2n33E.js → ChevronDown-DyHvxYlc.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-CkLGnzyI.js → ChevronLeft-dyRjFCmp.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-HkVZWjVD.js → ChevronRight-Cpfh3gza.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-DLoyITzq.js → ChevronUp-DBpw6M-L.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-DBVnta3o.js → DotsVertical-5jSu3d1f.js} +1 -1
  9. package/dist/client/assets/{Eye-BuXBYPNx.js → Eye-bojNLUjA.js} +1 -1
  10. package/dist/client/assets/{FilterLines-JdWf41nd.js → FilterLines-CFl65nng.js} +1 -1
  11. package/dist/client/assets/{Globe01-DbyYsbkQ.js → Globe01-CyfpzbeQ.js} +1 -1
  12. package/dist/client/assets/{Globe04-ht6-fzwU.js → Globe04-DFpdKSRI.js} +1 -1
  13. package/dist/client/assets/{HardDrive-QsbiOkra.js → HardDrive-B1mtnaeA.js} +1 -1
  14. package/dist/client/assets/{Key01-B-rzooWI.js → Key01-CwrJlZo0.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-CvZZnjM_.js → LayoutLeft-fsm0LcB8.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-C75h4nTA.js → LinkExternal01-BHwVyDja.js} +1 -1
  17. package/dist/client/assets/{Monitor01-C751a6VH.js → Monitor01-ChA6ov2I.js} +1 -1
  18. package/dist/client/assets/{Palette-Cw4TmFXF.js → Palette-DusYqL0W.js} +1 -1
  19. package/dist/client/assets/{Play-BaPiITj6.js → Play-CnXG8qqP.js} +1 -1
  20. package/dist/client/assets/{Plus-cqzweyhV.js → Plus-eGxBB1d8.js} +1 -1
  21. package/dist/client/assets/{SearchLg-BgcbIGrG.js → SearchLg-CDpA_lbT.js} +1 -1
  22. package/dist/client/assets/{SearchMd-B_E38g9S.js → SearchMd-ujiTPCmg.js} +1 -1
  23. package/dist/client/assets/{Settings02-HJQMPAnK.js → Settings02-BcAnTzm5.js} +1 -1
  24. package/dist/client/assets/{Shield01-CYOeouzJ.js → Shield01-ZxmFmrvL.js} +1 -1
  25. package/dist/client/assets/{Star01-BLuwEqBm.js → Star01-DHEkWySe.js} +1 -1
  26. package/dist/client/assets/{Stars01-bmKEIBXR.js → Stars01-BdCaKqhF.js} +1 -1
  27. package/dist/client/assets/{Stars02-CO1akjaP.js → Stars02-qnq-_X9g.js} +1 -1
  28. package/dist/client/assets/{Sun-DGf33qzc.js → Sun-lTiqxOzH.js} +1 -1
  29. package/dist/client/assets/{SwitchHorizontal01-CtPAye2M.js → SwitchHorizontal01-DAZXInW8.js} +1 -1
  30. package/dist/client/assets/{Tool01-Dc5WA1H4.js → Tool01-CvnpFI53.js} +1 -1
  31. package/dist/client/assets/{Trash01-Dn19EDIc.js → Trash01-ByxlxTiZ.js} +1 -1
  32. package/dist/client/assets/{Upload01-AmIm4zQN.js → Upload01-Z77n1bV8.js} +1 -1
  33. package/dist/client/assets/{User01-CYnD1B0h.js → User01-COQtf360.js} +1 -1
  34. package/dist/client/assets/{Users01-B3f8K1I8.js → Users01-wtRJYQKX.js} +1 -1
  35. package/dist/client/assets/{Users03-B7auzTEh.js → Users03-DknrDMtT.js} +1 -1
  36. package/dist/client/assets/{X-BJ5AK9_B.js → X-DrMVHLcw.js} +1 -1
  37. package/dist/client/assets/{XCircle-BEhXc7sQ.js → XCircle-Ct0eqqsw.js} +1 -1
  38. package/dist/client/assets/{XClose-BaODJMh0.js → XClose-BaZ908gw.js} +1 -1
  39. package/dist/client/assets/{Zap-CDSogr5w.js → Zap-wRIFSWIq.js} +1 -1
  40. package/dist/client/assets/{ZapSquare-CmmJkOPb.js → ZapSquare-PMiGcZpW.js} +1 -1
  41. package/dist/client/assets/{ZoomOut-9WiOjKDc.js → ZoomOut-6ix2H92j.js} +1 -1
  42. package/dist/client/assets/{access-gate-Bwf2CoM1.js → access-gate-D6dGDGRI.js} +1 -1
  43. package/dist/client/assets/{add-section-modal-CmQEBOgZ.js → add-section-modal-DOhGqRCL.js} +1 -1
  44. package/dist/client/assets/{agent-icon-Ba-0ZYgG.js → agent-icon-oDx9Z_Be.js} +1 -1
  45. package/dist/client/assets/{agents-list-D5VkOHIG.js → agents-list-BgSM_QG_.js} +1 -1
  46. package/dist/client/assets/{ai-providers-CZ5SMOKO.js → ai-providers-Crp7kidL.js} +1 -1
  47. package/dist/client/assets/{alert-nxT5lZho.js → alert-CKj_5smu.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-Bqe6OAIL.js → alert-dialog-CYizItFp.js} +2 -2
  49. package/dist/client/assets/app-editor-Xoia35dq.js +1 -0
  50. package/dist/client/assets/{auth-CqOhN4mO.js → auth-Bej0Tx2Y.js} +1 -1
  51. package/dist/client/assets/{auth-catchall-CNFrjBAq.js → auth-catchall-CmNVpp-8.js} +1 -1
  52. package/dist/client/assets/{auth-entry-DPV3aDXY.js → auth-entry-PwLVm-jX.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-Dp0-2xO6.js → auth-split-layout-5YwPgbAb.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-BkWGH7gY.js → authenticate-and-persist-oauth-DoPUB_Bh.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-CjVzmIPj.js → automation-list-row-CsTyBm4M.js} +1 -1
  56. package/dist/client/assets/{automation-runs-DIDLqvYF.js → automation-runs-B-dNDEWH.js} +1 -1
  57. package/dist/client/assets/{automations-DEtrS6hH.js → automations-D395202A.js} +1 -1
  58. package/dist/client/assets/{avatar-DUFWGs9Z.js → avatar-CJP1BOq4.js} +1 -1
  59. package/dist/client/assets/{badge-ULvYE549.js → badge-DhpSM7g_.js} +1 -1
  60. package/dist/client/assets/{block-document-Cl3urvMb.js → block-document-B2vhG8Ii.js} +1 -1
  61. package/dist/client/assets/{brand-context-DU7I0d5o.js → brand-context-BRpHgxfT.js} +1 -1
  62. package/dist/client/assets/{buckets-4u7bKclV.js → buckets-DDR0G33f.js} +1 -1
  63. package/dist/client/assets/{bulk-category-panel-Bqpqm_Qj.js → bulk-category-panel-CM1bMunr.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-Xikv63T6.js → capability-load-error-CCgNL5xi.js} +1 -1
  65. package/dist/client/assets/{card-DuZccs_2.js → card-BFb5m83e.js} +1 -1
  66. package/dist/client/assets/category-editor-2T4Y_ABL.js +1 -0
  67. package/dist/client/assets/{chat-context-Ba1J4Wbr.js → chat-context-n9syhvq-.js} +4 -4
  68. package/dist/client/assets/{checkbox-CZumSc8B.js → checkbox-DmOzmKLP.js} +1 -1
  69. package/dist/client/assets/{cli-auth-success-Ca86Sm5z.js → cli-auth-success-BVPtMYcv.js} +1 -1
  70. package/dist/client/assets/{collection-detail-2DizOat2.js → collection-detail-BQKV3UU7.js} +1 -1
  71. package/dist/client/assets/{collection-display-button-DTaFqStv.js → collection-display-button-Bf9dlJRy.js} +1 -1
  72. package/dist/client/assets/{collection-search-D2jsOcE8.js → collection-search-8iNXnGlM.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-BlI5WHJs.js → collection-tabs-KA2be3wH.js} +1 -1
  74. package/dist/client/assets/{command-ClUS1KMM.js → command-C34397s2.js} +1 -1
  75. package/dist/client/assets/{commerce-onboarding-C9kK24Mf.js → commerce-onboarding-D2H83R0U.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-DPJKYCn-.js → connect-desktop-dialog-Brra3cMC.js} +1 -1
  77. package/dist/client/assets/{connection-card-CEtBve6r.js → connection-card-C6NYo4Gp.js} +1 -1
  78. package/dist/client/assets/{connection-detail-dUoqAHFY.js → connection-detail-gJ5ITUXe.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-DtWH2w6r.js → connection-form-helpers-CwZx7WkC.js} +1 -1
  80. package/dist/client/assets/{connections-SZjaegFI.js → connections-CicrEJbU.js} +1 -1
  81. package/dist/client/assets/{context-menu-VSlW1NY7.js → context-menu-BW_OZBmV.js} +1 -1
  82. package/dist/client/assets/{decopilot-Y0nnLngo.js → decopilot-BItqS11w.js} +1 -1
  83. package/dist/client/assets/{decopilot-sse-pool-BR9ewfWR.js → decopilot-sse-pool-CvYk1hkc.js} +1 -1
  84. package/dist/client/assets/{dialog-onqVrhoh.js → dialog-BAqFyO8a.js} +1 -1
  85. package/dist/client/assets/{domain-settings-D6CfPi24.js → domain-settings-r_E3rHsG.js} +1 -1
  86. package/dist/client/assets/{drawer-D6-83PZ_.js → drawer-CFkqEC3w.js} +1 -1
  87. package/dist/client/assets/{dropdown-menu-D9g8Sl4X.js → dropdown-menu-C62KNjwK.js} +1 -1
  88. package/dist/client/assets/{empty-state-0bsCiepl.js → empty-state-Sh_DuDcy.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-Dk45baha.js → extract-connection-data-D6bQrejT.js} +1 -1
  90. package/dist/client/assets/file-explorer-C8pgfKCz.js +2 -0
  91. package/dist/client/assets/{file-type-icon-B1XEm_9k.js → file-type-icon-DPWxBpNL.js} +1 -1
  92. package/dist/client/assets/{files-BvKHt3eY.js → files-B9ekmQa_.js} +1 -1
  93. package/dist/client/assets/{form-Dvd73W2C.js → form-DGE2mWLL.js} +1 -1
  94. package/dist/client/assets/{general-DrBGUycq.js → general-BMDKtyZB.js} +1 -1
  95. package/dist/client/assets/{github-repo-picker-CB-ypGEp.js → github-repo-picker-B5tZucJa.js} +1 -1
  96. package/dist/client/assets/{hooks-tDbCB3C5.js → hooks-CUSV6Enf.js} +1 -1
  97. package/dist/client/assets/{import-from-deco-dialog-wTIFbH1Y.js → import-from-deco-dialog-M3CP3Gmn.js} +1 -1
  98. package/dist/client/assets/index-B2yJy2sB.js +1 -0
  99. package/dist/client/assets/{index-1nPke5TY.js → index-B6hcksS9.js} +1 -1
  100. package/dist/client/assets/{index-DrUwfEHA.js → index-Bb-tYGNK.js} +1 -1
  101. package/dist/client/assets/index-BqKQnks_.css +1 -0
  102. package/dist/client/assets/{index-DmjWDqcd.js → index-CFiyU0D9.js} +3 -3
  103. package/dist/client/assets/index-CRxAjd1d.js +513 -0
  104. package/dist/client/assets/{index-DkjetCaY.js → index-CkTyYAY1.js} +1 -1
  105. package/dist/client/assets/{index-BFlpjafk.js → index-DGzNvPy2.js} +1 -1
  106. package/dist/client/assets/{index-D3WaYPH4.js → index-DIBoN36v.js} +1 -1
  107. package/dist/client/assets/{index-BTZwvNmT.js → index-DQnTjiix.js} +1 -1
  108. package/dist/client/assets/{index-DeiWC-uz.js → index-D_S_Rq8A.js} +1 -1
  109. package/dist/client/assets/{index-Ftnw_1Xy.js → index-Dj7TxcSd.js} +1 -1
  110. package/dist/client/assets/{index-B_kMLuGG.js → index-hmJjUPum.js} +1 -1
  111. package/dist/client/assets/{index--njjOK24.js → index-jBUpmiBg.js} +1 -1
  112. package/dist/client/assets/{index-D3mRtkEB.js → index-mEtg0zTM.js} +1 -1
  113. package/dist/client/assets/{index-redirect-B6SIDrdt.js → index-redirect-C9Kkmz45.js} +1 -1
  114. package/dist/client/assets/{input-BlaLo4Ee.js → input-BwRH-Gsz.js} +1 -1
  115. package/dist/client/assets/{integration-icon-BF4ETuj8.js → integration-icon-LQhkkaLl.js} +1 -1
  116. package/dist/client/assets/{label-GEC2UjFS.js → label-CdBSUJpf.js} +1 -1
  117. package/dist/client/assets/{login-DiR83Uim.js → login-d0UWtw9N.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-sGspCuYg.js → mcp-oauth-IblqU9XT.js} +1 -1
  119. package/dist/client/assets/{members-BDtCBiR9.js → members-Bpdrl2e9.js} +1 -1
  120. package/dist/client/assets/{monaco-editor-BKh1966p.js → monaco-editor-5JIc-lnc.js} +1 -1
  121. package/dist/client/assets/{monitoring-stats-row-Bdo8nd6T.js → monitoring-stats-row-DPsQ-OAn.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-BexQI-2W.js → oauth-callback-B1AvYYRn.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-1VSCaYAB.js → oauth-callback-ai-provider-BtGHmjpp.js} +1 -1
  124. package/dist/client/assets/{onboarding-CZfsqsuP.js → onboarding-DfUmI7F5.js} +1 -1
  125. package/dist/client/assets/{org-install-BCHSGKR9.js → org-install-CpJAFt1s.js} +1 -1
  126. package/dist/client/assets/{org-layout-D5zV7CtT.js → org-layout-BsuFzdH_.js} +1 -1
  127. package/dist/client/assets/{organization-choice-B_qzGE3r.js → organization-choice-DrxWffZp.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-Cg3EP0Kg.js → page-seo-form-BLqpZnj6.js} +1 -1
  129. package/dist/client/assets/page-seo-sheet-C7jjKuEW.js +1 -0
  130. package/dist/client/assets/{popover-BxWSrnHV.js → popover-BXFiEQtN.js} +1 -1
  131. package/dist/client/assets/post-editor-Tve7DmSa.js +1 -0
  132. package/dist/client/assets/{preview-dialog-B6mTIXuI.js → preview-dialog-CQgf0QcR.js} +2 -2
  133. package/dist/client/assets/{primitives-DikyHxBV.js → primitives-BF1opf4F.js} +1 -1
  134. package/dist/client/assets/{profile-CR2pTbhO.js → profile-C8meo3ry.js} +1 -1
  135. package/dist/client/assets/project-app-view-BR2-hR46.js +1 -0
  136. package/dist/client/assets/record-editor-DbXO7U7E.js +1 -0
  137. package/dist/client/assets/registry-jjhvqeDq.js +2 -0
  138. package/dist/client/assets/{registry-layout-BQTxWcaj.js → registry-layout-C4UMhzml.js} +1 -1
  139. package/dist/client/assets/{require-capability-B1UdIHXr.js → require-capability--mIKExbX.js} +1 -1
  140. package/dist/client/assets/{required-auth-layout-CykGSzYq.js → required-auth-layout-DDJmFi3U.js} +1 -1
  141. package/dist/client/assets/{reset-password-BKTSF6vw.js → reset-password-CuNa1ife.js} +1 -1
  142. package/dist/client/assets/{roles-tVsESxlL.js → roles-BMhGnq_F.js} +1 -1
  143. package/dist/client/assets/{scroll-area-B8CDvPWi.js → scroll-area-BM-54tW1.js} +1 -1
  144. package/dist/client/assets/{search-input-L82tU3Bd.js → search-input-M7ubuBMG.js} +1 -1
  145. package/dist/client/assets/{secrets-BPwXng2k.js → secrets-BN1JMG5V.js} +1 -1
  146. package/dist/client/assets/{sections-editor-CuKTooG7.js → sections-editor-Buouhx1S.js} +2 -2
  147. package/dist/client/assets/{select-ySr8WoR1.js → select-C6v8Xcth.js} +1 -1
  148. package/dist/client/assets/{select-model-DdjL4UVJ.js → select-model-Cz9R_UN3.js} +1 -1
  149. package/dist/client/assets/seo-editor-D9o3utSQ.js +1 -0
  150. package/dist/client/assets/{settings-layout-BBsWbAB4.js → settings-layout-CSaUQUXv.js} +1 -1
  151. package/dist/client/assets/{settings-section-ysOtzM09.js → settings-section-MeT61nuY.js} +1 -1
  152. package/dist/client/assets/{sheet-X3VztLnq.js → sheet-DyU03ddw.js} +1 -1
  153. package/dist/client/assets/{shell-controls-DTY4r0Sw.js → shell-controls-DtGb6E4l.js} +1 -1
  154. package/dist/client/assets/{shell-layout-CdseotG7.js → shell-layout-Nyz7GHu7.js} +1 -1
  155. package/dist/client/assets/{shell-route-loading-DNSXVK6N.js → shell-route-loading-BRcTX0VT.js} +1 -1
  156. package/dist/client/assets/{sidebar-H8VlLCcE.js → sidebar-BNrafefE.js} +1 -1
  157. package/dist/client/assets/{skeleton-DknPHMRJ.js → skeleton-B0I93PJP.js} +1 -1
  158. package/dist/client/assets/{sortable.esm-Ctxa79RM.js → sortable.esm-MymOIPKk.js} +1 -1
  159. package/dist/client/assets/{sso-WkG_Ya3-.js → sso-CfyYgWAs.js} +1 -1
  160. package/dist/client/assets/{store-BisoAFLO.js → store-T7GJ1SPI.js} +1 -1
  161. package/dist/client/assets/store-registry-B-YJeGRV.js +2 -0
  162. package/dist/client/assets/{studio-tools-BWRE75AX.js → studio-tools-CNO5iCKk.js} +1 -1
  163. package/dist/client/assets/{switch-DR4CkZQD.js → switch-CCMIMmOF.js} +1 -1
  164. package/dist/client/assets/{table-C4Cy5HHY.js → table-DeNuxLMl.js} +1 -1
  165. package/dist/client/assets/{tabs-C77-FnFK.js → tabs-Ca0vDJqc.js} +1 -1
  166. package/dist/client/assets/{task-status-DIimAguz.js → task-status-B3nPzwP7.js} +1 -1
  167. package/dist/client/assets/{textarea-DzC7ppsf.js → textarea-BYT525JZ.js} +1 -1
  168. package/dist/client/assets/{toggle-group-DUz2fIQy.js → toggle-group-9TrYMc69.js} +1 -1
  169. package/dist/client/assets/toolbar-p8VcpV1N.js +1 -0
  170. package/dist/client/assets/{tools-list-CTCIGteU.js → tools-list-uWC3Ij6C.js} +1 -1
  171. package/dist/client/assets/{tooltip-Cr9AJTu1.js → tooltip-DrpiSbRG.js} +1 -1
  172. package/dist/client/assets/{types-DIYYFrZY.js → types-C7syjwde.js} +4 -4
  173. package/dist/client/assets/{use-ai-providers-DnoPML_E.js → use-ai-providers-C7KmiuqP.js} +1 -1
  174. package/dist/client/assets/{use-automations-B4dRXrYb.js → use-automations-RMjkwkxX.js} +1 -1
  175. package/dist/client/assets/{use-capability-CDOjpxJe.js → use-capability-C6Dwri-U.js} +1 -1
  176. package/dist/client/assets/{use-clock-tick-DfB4yM8e.js → use-clock-tick-BcxdOJLx.js} +1 -1
  177. package/dist/client/assets/{use-collections-C6o5d0Mn.js → use-collections-B4atckEK.js} +1 -1
  178. package/dist/client/assets/{use-connection-RPVug9uL.js → use-connection-Dz29RF9P.js} +1 -1
  179. package/dist/client/assets/{use-copy-DByELpSB.js → use-copy-Xy0buIqd.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-DYyOoMN3.js → use-create-virtual-mcp-DVmI--_C.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-D9laFBFB.js → use-debounced-autosave-B4mbwJnu.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-Bs78etny.js → use-debounced-value-C6U3mliE.js} +1 -1
  183. package/dist/client/assets/{use-decopilot-events-DavYF-aF.js → use-decopilot-events-CpQNzv3e.js} +1 -1
  184. package/dist/client/assets/{use-delete-connection-9x3-oXog.js → use-delete-connection-CqeuxO_6.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-YQp2GWKp.js → use-file-configs-CFCmr--W.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-BmnUwDlC.js → use-infinite-scroll-BX1nHHVY.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-wdTUrAXP.js → use-join-requests-j9WpmFq7.js} +1 -1
  188. package/dist/client/assets/{use-mcp-client-NDJy9UEP.js → use-mcp-client-xOK-OF8p.js} +2 -2
  189. package/dist/client/assets/{use-mcp-prompts-ziW0oQXD.js → use-mcp-prompts-Crr3H7P7.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-ByN1fg_5.js → use-mcp-tools-C8tMWwG9.js} +1 -1
  191. package/dist/client/assets/{use-members-CqCv95kS.js → use-members-BMNjJExY.js} +1 -1
  192. package/dist/client/assets/{use-mobile-C1ok2Oda.js → use-mobile-NlF-3RoP.js} +1 -1
  193. package/dist/client/assets/{use-navigate-to-agent-GB89TSmS.js → use-navigate-to-agent-DZubxUSm.js} +1 -1
  194. package/dist/client/assets/{use-org-auth-client-a0tV0I4a.js → use-org-auth-client-C_UJ3Vg_.js} +1 -1
  195. package/dist/client/assets/{use-org-fs-C4An_fXX.js → use-org-fs-DyK8omii.js} +1 -1
  196. package/dist/client/assets/{use-org-sso-DXOaOrbn.js → use-org-sso-DkqH8Zpz.js} +1 -1
  197. package/dist/client/assets/{use-organization-roles-CsUVzen8.js → use-organization-roles-Cu69Rnex.js} +1 -1
  198. package/dist/client/assets/{use-organization-settings-rqcqUUeR.js → use-organization-settings-DksiQdGc.js} +1 -1
  199. package/dist/client/assets/{use-registry-connections-BHtQ89zr.js → use-registry-connections-BOZLpkM5.js} +1 -1
  200. package/dist/client/assets/{use-secrets-CQoqzufN.js → use-secrets-CLmhH-Rb.js} +1 -1
  201. package/dist/client/assets/{use-status-sounds-yeVUNOcg.js → use-status-sounds-DxV7deix.js} +1 -1
  202. package/dist/client/assets/{use-view-mode-D7GDuIV9.js → use-view-mode-C2dllj6L.js} +1 -1
  203. package/dist/client/assets/{use-virtual-mcp-DQxIBquV.js → use-virtual-mcp-2U_MnYnK.js} +1 -1
  204. package/dist/client/assets/useInfiniteQuery-RUqqRph1.js +1 -0
  205. package/dist/client/assets/useSuspenseInfiniteQuery-fRYRtDkY.js +1 -0
  206. package/dist/client/assets/{useSuspenseQueries-DM2UC-1d.js → useSuspenseQueries-Cysvk68n.js} +1 -1
  207. package/dist/client/assets/{variant-calendar-Dkf9XIru.js → variant-calendar-mZn_D1Zo.js} +1 -1
  208. package/dist/client/assets/{view-mode-toggle-1VKSbXaL.js → view-mode-toggle-4CQodGfa.js} +1 -1
  209. package/dist/client/index.html +2 -2
  210. package/dist/server/cli.js +1 -1
  211. package/package.json +1 -1
  212. package/dist/client/assets/app-editor-Cfln2sHr.js +0 -1
  213. package/dist/client/assets/category-editor-BT4Cxoo3.js +0 -1
  214. package/dist/client/assets/file-explorer-BtYpNmrX.js +0 -2
  215. package/dist/client/assets/index-1MQY-aKx.css +0 -1
  216. package/dist/client/assets/index-DL5xoOQh.js +0 -513
  217. package/dist/client/assets/index-PHpiDror.js +0 -1
  218. package/dist/client/assets/page-seo-sheet-fP6EiExR.js +0 -1
  219. package/dist/client/assets/post-editor-CpIwB3m_.js +0 -1
  220. package/dist/client/assets/project-app-view-AkqKN49v.js +0 -1
  221. package/dist/client/assets/record-editor-Dm0nCNn9.js +0 -1
  222. package/dist/client/assets/registry-DhcyXlrd.js +0 -2
  223. package/dist/client/assets/seo-editor-BXwxtymi.js +0 -1
  224. package/dist/client/assets/store-registry-DKSrdFtG.js +0 -2
  225. package/dist/client/assets/toolbar-1nBak56S.js +0 -1
  226. package/dist/client/assets/useInfiniteQuery-BiSAb_zK.js +0 -1
  227. package/dist/client/assets/useSuspenseInfiniteQuery-9J-jWStM.js +0 -1
@@ -1 +1 @@
1
- import{c as b,l as w,j as a,i as j}from"./index-DmjWDqcd.js";import{i as N}from"./SearchMd-B_E38g9S.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
1
+ import{c as b,l as w,j as a,i as j}from"./index-CFiyU0D9.js";import{i as N}from"./SearchMd-ujiTPCmg.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
@@ -1 +1 @@
1
- import{c as p,j as t,E as P,r as j,ag as w,B as S,t as y}from"./index-DmjWDqcd.js";import{i as k}from"./AlertCircle-HztvGgEK.js";import{s as z}from"./Plus-cqzweyhV.js";import{s as E}from"./User01-CYnD1B0h.js";import{t as F}from"./Users01-B3f8K1I8.js";import{e as $,d as I,c as O,a as A,b as R,D as T}from"./dialog-onqVrhoh.js";import{I as N}from"./input-BlaLo4Ee.js";import{L as g}from"./label-GEC2UjFS.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-ySr8WoR1.js";import{S as H}from"./skeleton-DknPHMRJ.js";import{T as K}from"./textarea-DzC7ppsf.js";import{P as b}from"./index-DrUwfEHA.js";import{c as W}from"./settings-section-ysOtzM09.js";import{u as Y,a as G}from"./use-secrets-CQoqzufN.js";import{R as J}from"./require-capability-B1UdIHXr.js";import"./X-BJ5AK9_B.js";import"./tooltip-Cr9AJTu1.js";import"./ChevronUp-DLoyITzq.js";import"./ChevronDown-BHp2n33E.js";import"./sidebar-H8VlLCcE.js";import"./LayoutLeft-CvZZnjM_.js";import"./use-mobile-C1ok2Oda.js";import"./sheet-X3VztLnq.js";import"./card-DuZccs_2.js";import"./ArrowUpRight-CD45Pqa3.js";import"./studio-tools-BWRE75AX.js";import"./use-capability-CDOjpxJe.js";import"./access-gate-Bwf2CoM1.js";import"./capability-load-error-Xikv63T6.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?E:F,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
1
+ import{c as p,j as t,E as P,r as j,ag as w,B as S,t as y}from"./index-CFiyU0D9.js";import{i as k}from"./AlertCircle-DC-zDzV-.js";import{s as z}from"./Plus-eGxBB1d8.js";import{s as E}from"./User01-COQtf360.js";import{t as F}from"./Users01-wtRJYQKX.js";import{e as $,d as I,c as O,a as A,b as R,D as T}from"./dialog-BAqFyO8a.js";import{I as N}from"./input-BwRH-Gsz.js";import{L as g}from"./label-CdBSUJpf.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-C6v8Xcth.js";import{S as H}from"./skeleton-B0I93PJP.js";import{T as K}from"./textarea-BYT525JZ.js";import{P as b}from"./index-Bb-tYGNK.js";import{c as W}from"./settings-section-MeT61nuY.js";import{u as Y,a as G}from"./use-secrets-CLmhH-Rb.js";import{R as J}from"./require-capability--mIKExbX.js";import"./X-DrMVHLcw.js";import"./tooltip-DrpiSbRG.js";import"./ChevronUp-DBpw6M-L.js";import"./ChevronDown-DyHvxYlc.js";import"./sidebar-BNrafefE.js";import"./LayoutLeft-fsm0LcB8.js";import"./use-mobile-NlF-3RoP.js";import"./sheet-DyU03ddw.js";import"./card-BFb5m83e.js";import"./ArrowUpRight-OJZisFPQ.js";import"./studio-tools-CNO5iCKk.js";import"./use-capability-C6Dwri-U.js";import"./access-gate-D6dGDGRI.js";import"./capability-load-error-CCgNL5xi.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?E:F,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
@@ -1,2 +1,2 @@
1
- import{c as He,r as w,l as Be,j as n,B as Ge,i as zn,m as vs,t as W,K as Ss}from"./index-DmjWDqcd.js";import{r as xs,a as ys,s as bs,i as Hn,c as _s,b as js,G as ks,V as ws,d as Rs,e as Rt,f as Ds,g as Ns,h as Vs,j as Cs,k as Ps,l as Ts,m as As,n as Ms,o as Es,p as $t,q as Ot,t as Ks,v as ut,w as jt,x as $s,y as Os,z as Je,A as Vn,S as Bs,M as Cn,B as kt,C as Bt,D as Ls,E as an,P as Fs,F as et,H as xt,I as Is,J as zs,K as Hs,L as Us,N as Ws,O as Gs,Q as dt,R as Ys,T as qs,U as Js,W as Pn,X as wt,Y as Qs,Z as Xs,_ as Zs,$ as er,a0 as tr,a1 as sn,a2 as Tn,a3 as An,a4 as yt,a5 as Lt,a6 as Mn,a7 as nr,a8 as ar,a9 as rn,aa as sr,ab as rr,ac as Un,ad as En,ae as or}from"./index-DL5xoOQh.js";import{t as ir}from"./ChevronDown-BHp2n33E.js";import{n as lr}from"./ChevronLeft-CkLGnzyI.js";import{i as Wn}from"./ChevronRight-HkVZWjVD.js";import{n as cr}from"./ChevronUp-DLoyITzq.js";import{L as ln,E as Gn,Y as Yn,l as ur,M as dr,N as mr}from"./agent-icon-Ba-0ZYgG.js";import{i as fr}from"./Globe01-DbyYsbkQ.js";import{S as Ft}from"./scroll-area-B8CDvPWi.js";import{T as mt,a as ft,b as pt}from"./tooltip-Cr9AJTu1.js";import{a as pr,c as hr,b as gr,D as vr,d as Sr,e as xr}from"./dialog-onqVrhoh.js";import{I as yr}from"./input-BlaLo4Ee.js";import{s as br,a as qn}from"./Eye-BuXBYPNx.js";import{c as _r}from"./ZoomOut-9WiOjKDc.js";import{i as jr}from"./Settings02-HJQMPAnK.js";import{s as cn}from"./Plus-cqzweyhV.js";import{s as Jn}from"./Trash01-Dn19EDIc.js";import{i as kr}from"./Zap-CDSogr5w.js";import{c as it,a as Qn,D as Xn,b as Zn,g as wr}from"./dropdown-menu-D9g8Sl4X.js";import{b as ea,c as It,K as ta,P as na,e as aa,C as sa,s as ra,l as Dt,D as oa,d as ia,S as la,v as ca,k as ua}from"./sortable.esm-Ctxa79RM.js";import{r as Kn,u as Rr,d as Dr,a as Nr,i as Vr,f as Cr,P as Pr,b as Tr,S as Ar}from"./page-seo-form-Cg3EP0Kg.js";import{b as Mr}from"./Tool01-Dc5WA1H4.js";import{A as Er}from"./add-section-modal-CmQEBOgZ.js";import"./index-D3mRtkEB.js";import"./SwitchHorizontal01-CtPAye2M.js";import"./chat-context-Ba1J4Wbr.js";import"./hooks-tDbCB3C5.js";import"./use-mcp-client-NDJy9UEP.js";import"./auth-CqOhN4mO.js";import"./decopilot-sse-pool-BR9ewfWR.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-DQxIBquV.js";import"./use-collections-C6o5d0Mn.js";import"./use-ai-providers-DnoPML_E.js";import"./studio-tools-BWRE75AX.js";import"./use-decopilot-events-DavYF-aF.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-rqcqUUeR.js";import"./drawer-D6-83PZ_.js";import"./collection-search-D2jsOcE8.js";import"./SearchMd-B_E38g9S.js";import"./use-mobile-C1ok2Oda.js";import"./use-mcp-prompts-ziW0oQXD.js";import"./X-BJ5AK9_B.js";import"./shell-layout-CdseotG7.js";import"./avatar-DUFWGs9Z.js";import"./User01-CYnD1B0h.js";import"./Users03-B7auzTEh.js";import"./SearchLg-BgcbIGrG.js";import"./Stars02-CO1akjaP.js";import"./XClose-BaODJMh0.js";import"./CheckCircle-B93tZkib.js";import"./FilterLines-JdWf41nd.js";import"./required-auth-layout-CykGSzYq.js";import"./use-org-sso-DXOaOrbn.js";import"./ZapSquare-CmmJkOPb.js";import"./Star01-BLuwEqBm.js";import"./Upload01-AmIm4zQN.js";import"./AlertCircle-HztvGgEK.js";import"./form-Dvd73W2C.js";import"./label-GEC2UjFS.js";import"./select-ySr8WoR1.js";import"./XCircle-BEhXc7sQ.js";import"./tabs-C77-FnFK.js";import"./toggle-group-DUz2fIQy.js";import"./Monitor01-C751a6VH.js";import"./connect-desktop-dialog-DPJKYCn-.js";import"./decopilot-Y0nnLngo.js";import"./checkbox-CZumSc8B.js";import"./skeleton-DknPHMRJ.js";import"./Key01-B-rzooWI.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-ysOtzM09.js";import"./card-DuZccs_2.js";import"./ArrowUpRight-CD45Pqa3.js";import"./Stars01-bmKEIBXR.js";import"./popover-BxWSrnHV.js";import"./command-ClUS1KMM.js";import"./index--njjOK24.js";import"./useInfiniteQuery-BiSAb_zK.js";import"./use-infinite-scroll-BmnUwDlC.js";import"./use-org-fs-C4An_fXX.js";import"./question-004-sINsf4GQ.js";import"./integration-icon-BF4ETuj8.js";import"./use-status-sounds-yeVUNOcg.js";import"./empty-state-0bsCiepl.js";import"./toolbar-1nBak56S.js";import"./preview-dialog-B6mTIXuI.js";import"./LinkExternal01-C75h4nTA.js";import"./index-1nPke5TY.js";import"./file-type-icon-B1XEm_9k.js";import"./LayoutLeft-CvZZnjM_.js";import"./use-connection-RPVug9uL.js";import"./use-mcp-tools-ByN1fg_5.js";import"./types-DIYYFrZY.js";import"./use-capability-CDOjpxJe.js";import"./textarea-DzC7ppsf.js";import"./shell-route-loading-DNSXVK6N.js";import"./extract-connection-data-Dk45baha.js";import"./tools-list-CTCIGteU.js";import"./mcp-oauth-sGspCuYg.js";import"./badge-ULvYE549.js";import"./connection-slug-eyAPH6o3.js";import"./alert-dialog-Bqe6OAIL.js";import"./switch-DR4CkZQD.js";import"./Play-BaPiITj6.js";import"./use-debounced-autosave-D9laFBFB.js";import"./index-DrUwfEHA.js";import"./sidebar-H8VlLCcE.js";import"./sheet-X3VztLnq.js";import"./search-input-L82tU3Bd.js";import"./collection-tabs-BlI5WHJs.js";import"./github-repo-picker-CB-ypGEp.js";import"./use-debounced-value-Bs78etny.js";import"./authenticate-and-persist-oauth-BkWGH7gY.js";import"./use-navigate-to-agent-GB89TSmS.js";import"./github-installations-DzN1UQ4x.js";import"./Users01-B3f8K1I8.js";import"./use-secrets-CQoqzufN.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-1VKSbXaL.js";import"./automation-runs-DIDLqvYF.js";import"./table-C4Cy5HHY.js";import"./use-members-CqCv95kS.js";import"./use-org-auth-client-a0tV0I4a.js";import"./task-status-DIimAguz.js";import"./DotsVertical-DBVnta3o.js";import"./use-automations-B4dRXrYb.js";import"./useSuspenseInfiniteQuery-9J-jWStM.js";import"./use-file-configs-YQp2GWKp.js";import"./monaco-editor-BKh1966p.js";import"./select-model-DdjL4UVJ.js";import"./automation-list-row-CjVzmIPj.js";import"./Globe04-ht6-fzwU.js";import"./HardDrive-QsbiOkra.js";import"./Sun-DGf33qzc.js";import"./Palette-Cw4TmFXF.js";import"./Shield01-CYOeouzJ.js";import"./use-clock-tick-DfB4yM8e.js";import"./use-copy-DByELpSB.js";import"./content-blocks-o63cs2vh.js";import"./connection-card-CEtBve6r.js";import"./use-registry-connections-BHtQ89zr.js";import"./connection-form-helpers-DtWH2w6r.js";function Kr(m){return m.schema?.definitions??m.schema?.$defs??{}}function $r(m,e){const r=Kr(e),c=r[btoa(m)];if(!c)return;let d=typeof c.image=="string"?c.image:void 0;if(!d&&Array.isArray(c.allOf)){const h=c.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof h=="string"){const S=h.replace("#/definitions/",""),p=r[S];d=typeof p?.image=="string"?p.image:void 0}}if(d?.includes("{{{"))return d}function Or(m,e){if(!e)return;const r=xs(m);if(!r)return;const c=$r(r.resolveType,e);if(!c)return;const d=ys(c,r.data);if(d)return bs(d)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="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 $n(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function da(m){return m.map((e,r)=>({...e,index:r}))}function Fr(m,e){if(e===m.length)return m;if(e<m.length)return da(m.slice(0,e));const r=Array.from({length:e-m.length},(c,d)=>({id:crypto.randomUUID(),index:m.length+d}));return[...m,...r]}function ma(m){const e=He.c(20),{section:r,raw:c,meta:d}=m,h=r.isSavedBlock===!0,S=r.isMultivariate===!0;let p;e[0]!==d||e[1]!==c?(p=c&&d?Or(c,d):void 0,e[0]=d,e[1]=c,e[2]=p):p=e[2];const v=p;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(_r,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let b;e[4]!==v?(b=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=b):b=e[5];let C;e[6]!==S||e[7]!==h?(C=h?{color:ks}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=h,e[8]=C):C=e[8];let R;e[9]!==C?(R=n.jsx(ln,{className:"h-4 w-4 shrink-0",style:C}),e[9]=C,e[10]=R):R=e[10];const _=r.isHidden&&"line-through opacity-50";let k;e[11]!==_?(k=Be("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=k):k=e[12];let o;e[13]!==r.label||e[14]!==k?(o=n.jsx("span",{className:k,children:r.label}),e[13]=r.label,e[14]=k,e[15]=o):o=e[15];let D;return e[16]!==b||e[17]!==R||e[18]!==o?(D=n.jsxs(n.Fragment,{children:[g,b,R,o]}),e[16]=b,e[17]=R,e[18]=o,e[19]=D):D=e[19],D}function fa(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:c?"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 Ir(m){const e=He.c(64),{section:r,raw:c,meta:d,sortableId:h,selected:S,onSelect:p,onDelete:v,onDuplicate:g,onMakeReusable:b,onToggleHidden:C,onToggleLazy:R,onAddVariant:_,onDetach:k}=m,o=c?Hn(c.__resolveType??""):!1;let D;e[0]!==r?(D=_s(r),e[0]=r,e[1]=D):D=e[1];const l=D;let J;e[2]!==h?(J={id:h,animateLayoutChanges:Gr},e[2]=h,e[3]=J):J=e[3];const{attributes:H,listeners:K,setNodeRef:u,transform:P,isDragging:se}=aa(J);let T;e[4]!==P?(T=sa.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=se?0:void 0;let N;e[6]!==T||e[7]!==pe?(N={transform:T,opacity:pe},e[6]=T,e[7]=pe,e[8]=N):N=e[8];const ce=N;let B;e[9]!==r?(B=js(r),e[9]=r,e[10]=B):B=e[10];const te=B,oe="button",Ce=0;let E;e[11]!==p?(E=$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),p())},e[11]=p,e[12]=E):E=e[12];const ue=se?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Be("touch-none transition-colors",ue,fa(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==d||e[18]!==c||e[19]!==r?(je=n.jsx(ma,{section:r,raw:c,meta:d}),e[17]=d,e[18]=c,e[19]=r,e[20]=je):je=e[20];const M=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Be("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:$=>{$.stopPropagation(),R()},onPointerDown:Wr,children:n.jsx(kr,{className:Be("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==C||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Be("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:$=>{$.stopPropagation(),C()},onPointerDown:Ur,children:r.isHidden?n.jsx(jr,{className:"h-3.5 w-3.5"}):n.jsx(br,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=C,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Qn,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(Gn,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let Ne;e[26]!==g?(Ne=$=>{$.stopPropagation(),g()},e[26]=g,e[27]=Ne):Ne=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(qn,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let re;e[29]!==Ne?(re=n.jsxs(it,{onClick:Ne,children:[ve,"Duplicate"]}),e[29]=Ne,e[30]=re):re=e[30];let G;e[31]!==l||e[32]!==_?(G=l&&n.jsxs(it,{className:ws,onClick:$=>{$.stopPropagation(),_()},children:[n.jsx(Yn,{className:"h-4 w-4"}),"Add variant"]}),e[31]=l,e[32]=_,e[33]=G):G=e[33];let Y;e[34]!==te||e[35]!==b?(Y=te&&n.jsxs(it,{className:Lr,onClick:$=>{$.stopPropagation(),b()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=b,e[36]=Y):Y=e[36];let ne;e[37]!==k||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:$=>{$.stopPropagation(),k()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Detach"]}),e[37]=k,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=$=>{$.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(Jn,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==re||e[47]!==G||e[48]!==Y||e[49]!==ne||e[50]!==Se?(de=n.jsxs(Xn,{children:[X,n.jsxs(Zn,{align:"end",className:"w-44",children:[re,G,Y,ne,Se]})]}),e[46]=re,e[47]=G,e[48]=Y,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let be;return e[52]!==H||e[53]!==K||e[54]!==p||e[55]!==u||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==M||e[60]!==Ae||e[61]!==de||e[62]!==E?(be=n.jsxs("div",{ref:u,style:ce,...H,...K,role:oe,tabIndex:Ce,onClick:p,onKeyDown:E,className:ie,children:[je,M,Ae,de]}),e[52]=H,e[53]=K,e[54]=p,e[55]=u,e[56]=ce,e[57]=ie,e[58]=je,e[59]=M,e[60]=Ae,e[61]=de,e[62]=E,e[63]=be):be=e[63],be}function zr(m){return m.stopPropagation()}function Hr(m){return m.stopPropagation()}function Ur(m){return m.stopPropagation()}function Wr(m){return m.stopPropagation()}function Gr(){return!1}function Yr(m){const e=He.c(90),{listKey:r,rawSections:c,sections:d,meta:h,selectedIndex:S,onSelect:p,onReorder:v,onDelete:g,onDuplicate:b,onMakeReusable:C,onToggleHidden:R,onToggleLazy:_,onAddVariant:k,onDetach:o,onAddSection:D,canAddSection:l}=m,J=l===void 0?!0:l;let H;e[0]!==d.length?(H=()=>$n(d.length),e[0]=d.length,e[1]=H):H=e[1];const[K,u]=w.useState(H),[P,se]=w.useState(null),[T,pe]=w.useState(r),[N,ce]=w.useState(d.length),B=w.useRef(!1);T!==r?(pe(r),ce(d.length),u($n(d.length))):N!==d.length&&(ce(d.length),u(L=>Fr(L,d.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:ra},e[3]=oe):oe=e[3];const Ce=ea(It(na,te),It(ta,oe));let E;e[4]!==K?(E=K.map(qr),e[4]=K,e[5]=E):E=e[5];const ue=E;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=L=>{se(String(L.active.id))},e[6]=ie):ie=e[6];const je=ie;let M;e[7]!==ue||e[8]!==v?(M=L=>{se(null);const{active:ae,over:Q}=L;if(!Q||ae.id===Q.id)return;const Ie=ue.indexOf(String(ae.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(u(Qe=>da(Dt([...Qe],Ie,he))),B.current=!0,requestAnimationFrame(()=>{B.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=M):M=e[9];const Ae=M;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{se(null)},e[10]=X):X=e[10];const Ne=X;let ve,re,G,Y,ne,le,ke,Se,de,be,$,Z,we,Ee,Ke;if(e[11]!==P||e[12]!==J||e[13]!==K||e[14]!==ue||e[15]!==Ae||e[16]!==h||e[17]!==D||e[18]!==k||e[19]!==g||e[20]!==o||e[21]!==b||e[22]!==C||e[23]!==p||e[24]!==R||e[25]!==_||e[26]!==c||e[27]!==d||e[28]!==S||e[29]!==Ce){Ee=Symbol.for("react.early_return_sentinel");e:{const L=ae=>{B.current||p(ae)};if(e[45]!==P||e[46]!==J||e[47]!==K||e[48]!==D||e[49]!==c||e[50]!==d){const ae=P?K.find(Q=>Q.id===P):null;if(Y=ae!=null?d[ae.index]:null,G=ae!=null?c[ae.index]:void 0,K.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!J;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(cn,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==D||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:D,children:[he,"Add section"]})]}),e[56]=D,e[57]=Ie,e[58]=Qe):Qe=e[58],Ee=Qe;break e}we=Be(ae&&"cursor-grabbing"),e[45]=P,e[46]=J,e[47]=K,e[48]=D,e[49]=c,e[50]=d,e[51]=G,e[52]=Y,e[53]=we}else G=e[51],Y=e[52],we=e[53];re=oa,Se=Ce,de=ia,be=je,$=Ae,Z=Ne,ve=la,le=ue,ke=ca,Ke="space-y-1",ne=K.map(ae=>{const Q=d[ae.index];return Q?n.jsx(Ir,{sortableId:ae.id,section:Q,raw:c[ae.index],meta:h,selected:S===ae.index,onSelect:()=>L(ae.index),onDelete:()=>g(ae.index),onDuplicate:()=>b(ae.index),onMakeReusable:()=>C(ae.index),onToggleHidden:()=>R(ae.index),onToggleLazy:()=>_(ae.index),onAddVariant:()=>k(ae.index),onDetach:()=>o(ae.index)},ae.id):null})}e[11]=P,e[12]=J,e[13]=K,e[14]=ue,e[15]=Ae,e[16]=h,e[17]=D,e[18]=k,e[19]=g,e[20]=o,e[21]=b,e[22]=C,e[23]=p,e[24]=R,e[25]=_,e[26]=c,e[27]=d,e[28]=S,e[29]=Ce,e[30]=ve,e[31]=re,e[32]=G,e[33]=Y,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=be,e[40]=$,e[41]=Z,e[42]=we,e[43]=Ee,e[44]=Ke}else ve=e[30],re=e[31],G=e[32],Y=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],be=e[39],$=e[40],Z=e[41],we=e[42],Ee=e[43],Ke=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Le;e[59]!==ne||e[60]!==Ke?(Le=n.jsx("div",{className:Ke,children:ne}),e[59]=ne,e[60]=Ke,e[61]=Le):Le=e[61];let Pe;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Le?(Pe=n.jsx(ve,{items:le,strategy:ke,children:Le}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Le,e[66]=Pe):Pe=e[66];let $e;e[67]!==G||e[68]!==Y||e[69]!==h?($e=Y?n.jsx("div",{className:Be("cursor-grabbing shadow-lg ring-1 ring-border/60",fa(Y,!1)),children:n.jsx(ma,{section:Y,raw:G,meta:h})}):null,e[67]=G,e[68]=Y,e[69]=h,e[70]=$e):$e=e[70];let Fe;e[71]!==$e?(Fe=n.jsx(ua,{dropAnimation:null,children:$e}),e[71]=$e,e[72]=Fe):Fe=e[72];let Me;e[73]!==re||e[74]!==Se||e[75]!==de||e[76]!==be||e[77]!==$||e[78]!==Z||e[79]!==Pe||e[80]!==Fe?(Me=n.jsxs(re,{sensors:Se,collisionDetection:de,onDragStart:be,onDragEnd:$,onDragCancel:Z,children:[Pe,Fe]}),e[73]=re,e[74]=Se,e[75]=de,e[76]=be,e[77]=$,e[78]=Z,e[79]=Pe,e[80]=Fe,e[81]=Me):Me=e[81];const xe=!J;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==D||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:D,children:[Re,"Add section"]}),e[83]=D,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function qr(m){return m.id}function On(m){const e=He.c(38),{open:r,initialName:c,autoLabel:d,isPending:h,onSubmit:S,onOpenChange:p}=m,v=h===void 0?!1:h,[g,b]=w.useState(c),[C,R]=w.useState(r);r!==C&&(R(r),r&&b(c));let _;e[0]!==v||e[1]!==p?(_=oe=>{!oe&&!v&&p(!1)},e[0]=v,e[1]=p,e[2]=_):_=e[2];const k=_;let o;e[3]!==v||e[4]!==g||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(g.trim())},e[3]=v,e[4]=g,e[5]=S,e[6]=o):o=e[6];const D=o;let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(pr,{children:"Rename variant"}),e[7]=l):l=e[7];const J=d||"the rule";let H;e[8]!==J?(H=n.jsxs(hr,{children:[l,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:J}),"."]})]}),e[8]=J,e[9]=H):H=e[9];let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=K):K=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=oe=>b(oe.target.value),e[11]=u):u=e[11];let P;e[12]!==d||e[13]!==v||e[14]!==g?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[K,n.jsx(yr,{id:"variant-rename-name",value:g,onChange:u,placeholder:d,autoFocus:!0,disabled:v})]}),e[12]=d,e[13]=v,e[14]=g,e[15]=P):P=e[15];let se;e[16]!==p?(se=()=>p(!1),e[16]=p,e[17]=se):se=e[17];let T;e[18]!==v||e[19]!==se?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:se,disabled:v,children:"Cancel"}),e[18]=v,e[19]=se,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(zn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let N;e[23]!==v||e[24]!==pe?(N=n.jsx(Ge,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=N):N=e[25];let ce;e[26]!==T||e[27]!==N?(ce=n.jsxs(vr,{children:[T,N]}),e[26]=T,e[27]=N,e[28]=ce):ce=e[28];let B;e[29]!==D||e[30]!==ce||e[31]!==H||e[32]!==P?(B=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:D,children:[H,P,ce]})}),e[29]=D,e[30]=ce,e[31]=H,e[32]=P,e[33]=B):B=e[33];let te;return e[34]!==k||e[35]!==r||e[36]!==B?(te=n.jsx(xr,{open:r,onOpenChange:k,children:B}),e[34]=k,e[35]=r,e[36]=B,e[37]=te):te=e[37],te}const Jr="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)]",pa="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 ha(m){const e=He.c(5),{rule:r,matchers:c}=m,d=r?.__resolveType??"";let h;if(e[0]!==c||e[1]!==d){const g=c.find(b=>b.resolveType===d)?.iconName??Rs(d);h=ur(g),e[0]=c,e[1]=d,e[2]=h}else h=e[2];const S=h;if(!S)return null;let p;return e[3]!==S?(p=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=p):p=e[4],p}function Bn(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
- `)}function on(m){return m.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(m){return m.map((e,r)=>({...e,index:r}))}function ga(m){const e=He.c(16),{label:r,effectiveRule:c,matchers:d,canDelete:h,dragging:S,onRename:p,onDuplicate:v,onDelete:g}=m;let b;e[0]!==c||e[1]!==d?(b=n.jsx(ha,{rule:c,matchers:d}),e[0]=c,e[1]=d,e[2]=b):b=e[2];let C;e[3]!==r?(C=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=C):C=e[4];let R;e[5]!==h||e[6]!==S||e[7]!==r||e[8]!==g||e[9]!==v||e[10]!==p?(R=!S&&n.jsxs(Xn,{children:[n.jsx(Qn,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":`Actions for ${r}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:Zr,onPointerDown:Xr,children:n.jsx(Gn,{size:14})})}),n.jsxs(Zn,{align:"end",className:"w-36",children:[n.jsxs(it,{onClick:k=>{k.stopPropagation(),p?.()},children:[n.jsx(Mr,{size:14}),"Rename"]}),n.jsxs(it,{onClick:k=>{k.stopPropagation(),v?.()},children:[n.jsx(qn,{size:14}),"Duplicate"]}),n.jsx(wr,{}),n.jsxs(it,{variant:"destructive",disabled:!h,onClick:k=>{k.stopPropagation(),g?.()},children:[n.jsx(Jn,{size:14}),"Delete"]})]})]}),e[5]=h,e[6]=S,e[7]=r,e[8]=g,e[9]=v,e[10]=p,e[11]=R):R=e[11];let _;return e[12]!==b||e[13]!==C||e[14]!==R?(_=n.jsxs(n.Fragment,{children:[b,C,R]}),e[12]=b,e[13]=C,e[14]=R,e[15]=_):_=e[15],_}function Xr(m){return m.stopPropagation()}function Zr(m){return m.stopPropagation()}function eo(m){const e=He.c(33),{entry:r,sortableId:c,isActive:d,canDelete:h,decofile:S,meta:p,matchers:v,onSelect:g,onRename:b,onDuplicate:C,onDelete:R}=m;let _;e[0]!==c?(_={id:c,animateLayoutChanges:to},e[0]=c,e[1]=_):_=e[1];const{attributes:k,listeners:o,setNodeRef:D,transform:l,isDragging:J}=aa(_);let H;e[2]!==l?(H=sa.Transform.toString(l?{...l,x:0}:null),e[2]=l,e[3]=H):H=e[3];const K=J?0:void 0;let u;e[4]!==H||e[5]!==K?(u={transform:H,opacity:K},e[4]=H,e[5]=K,e[6]=u):u=e[6];const P=u,se=p??void 0;let T;e[7]!==S||e[8]!==r.variant.rule||e[9]!==se?(T=Rt(r.variant.rule,S,se),e[7]=S,e[8]=r.variant.rule,e[9]=se,e[10]=T):T=e[10];const pe=T;let N;e[11]!==g?(N=E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),g())},e[11]=g,e[12]=N):N=e[12];const ce=J?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",B=d?pa:Jr;let te;e[13]!==ce||e[14]!==B?(te=Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,B),e[13]=ce,e[14]=B,e[15]=te):te=e[15];let oe;e[16]!==h||e[17]!==pe||e[18]!==r.variant.label||e[19]!==v||e[20]!==R||e[21]!==C||e[22]!==b?(oe=n.jsx(ga,{label:r.variant.label,effectiveRule:pe,matchers:v,canDelete:h,onRename:b,onDuplicate:C,onDelete:R}),e[16]=h,e[17]=pe,e[18]=r.variant.label,e[19]=v,e[20]=R,e[21]=C,e[22]=b,e[23]=oe):oe=e[23];let Ce;return e[24]!==k||e[25]!==o||e[26]!==g||e[27]!==D||e[28]!==P||e[29]!==te||e[30]!==oe||e[31]!==N?(Ce=n.jsx("div",{ref:D,style:P,...k,...o,onClick:g,onKeyDown:N,className:te,children:oe}),e[24]=k,e[25]=o,e[26]=g,e[27]=D,e[28]=P,e[29]=te,e[30]=oe,e[31]=N,e[32]=Ce):Ce=e[32],Ce}function to(){return!1}function no(m){const e=He.c(9),{variant:r,decofile:c,meta:d,matchers:h}=m,S=d??void 0;let p;e[0]!==c||e[1]!==S||e[2]!==r.rule?(p=Rt(r.rule,c,S),e[0]=c,e[1]=S,e[2]=r.rule,e[3]=p):p=e[3];const v=p;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=Be("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",pa),e[4]=g):g=e[4];let b;return e[5]!==v||e[6]!==h||e[7]!==r.label?(b=n.jsx("div",{className:g,children:n.jsx(ga,{label:r.label,effectiveRule:v,matchers:h,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=h,e[7]=r.label,e[8]=b):b=e[8],b}function ao(m){const e=He.c(77),{listKey:r,variants:c,activeIndex:d,decofile:h,meta:S,matchers:p,onSelect:v,onReorder:g,onRename:b,onDuplicate:C,onDelete:R,onAdd:_}=m;let k;e[0]!==c?(k=()=>on(c),e[0]=c,e[1]=k):k=e[1];const[o,D]=w.useState(k),[l,J]=w.useState(null),[H,K]=w.useState(r),[u,P]=w.useState(c.length);let se;e[2]!==c?(se=()=>Bn(c),e[2]=c,e[3]=se):se=e[3];const[T,pe]=w.useState(se),N=w.useRef(!1),ce=Bn(c);H!==r?(K(r),P(c.length),pe(ce),D(on(c))):u!==c.length?(P(c.length),pe(ce),D(on(c))):T!==ce&&(pe(ce),D(Me=>c.map((xe,Re)=>({id:Me[Re]?.id??crypto.randomUUID(),index:Re,variant:xe}))));let B;e[4]===Symbol.for("react.memo_cache_sentinel")?(B={activationConstraint:{distance:8}},e[4]=B):B=e[4];let te;e[5]===Symbol.for("react.memo_cache_sentinel")?(te={coordinateGetter:ra},e[5]=te):te=e[5];const oe=ea(It(na,B),It(ta,te));let Ce;e[6]!==o?(Ce=o.map(so),e[6]=o,e[7]=Ce):Ce=e[7];const E=Ce,ue=c.length>1;let ie;e[8]!==o?(ie=Me=>{const xe=String(Me.active.id);J(o.find(Re=>Re.id===xe)??null)},e[8]=o,e[9]=ie):ie=e[9];const je=ie;let M;e[10]!==E||e[11]!==g?(M=Me=>{J(null);const{active:xe,over:Re}=Me;if(!Re||xe.id===Re.id)return;const me=E.indexOf(String(xe.id)),ee=E.indexOf(String(Re.id));me===-1||ee===-1||(D(L=>Qr(Dt([...L],me,ee))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),g(me,ee))},e[10]=E,e[11]=g,e[12]=M):M=e[12];const Ae=M;let X;e[13]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{J(null)},e[13]=X):X=e[13];const Ne=X;let ve,re,G,Y,ne,le,ke,Se,de,be,$,Z,we;if(e[14]!==d||e[15]!==ue||e[16]!==h||e[17]!==o||e[18]!==E||e[19]!==Ae||e[20]!==je||e[21]!==p||e[22]!==S||e[23]!==_||e[24]!==R||e[25]!==C||e[26]!==b||e[27]!==v||e[28]!==oe){const Me=L=>{N.current||v(L)};$="space-y-1 border-b p-2";let xe;e[42]===Symbol.for("react.memo_cache_sentinel")?(xe=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[42]=xe):xe=e[42];let Re;e[43]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[43]=Re):Re=e[43];let me;e[44]!==_?(me=n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:_,children:Re})}),e[44]=_,e[45]=me):me=e[45];let ee;e[46]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(pt,{children:"Add variant"}),e[46]=ee):ee=e[46],e[47]!==me?(Z=n.jsxs("div",{className:"flex items-center justify-between",children:[xe,n.jsxs(mt,{children:[me,ee]})]}),e[47]=me,e[48]=Z):Z=e[48],re=oa,le=oe,ke=ia,Se=je,de=Ae,be=Ne,ve=la,Y=E,ne=ca,we="space-y-0.5",G=o.map(L=>n.jsx(eo,{sortableId:L.id,entry:L,isActive:L.index===d,canDelete:ue,decofile:h,meta:S,matchers:p,onSelect:()=>Me(L.index),onRename:()=>b(L.index),onDuplicate:()=>C(L.index),onDelete:()=>R(L.index)},L.id)),e[14]=d,e[15]=ue,e[16]=h,e[17]=o,e[18]=E,e[19]=Ae,e[20]=je,e[21]=p,e[22]=S,e[23]=_,e[24]=R,e[25]=C,e[26]=b,e[27]=v,e[28]=oe,e[29]=ve,e[30]=re,e[31]=G,e[32]=Y,e[33]=ne,e[34]=le,e[35]=ke,e[36]=Se,e[37]=de,e[38]=be,e[39]=$,e[40]=Z,e[41]=we}else ve=e[29],re=e[30],G=e[31],Y=e[32],ne=e[33],le=e[34],ke=e[35],Se=e[36],de=e[37],be=e[38],$=e[39],Z=e[40],we=e[41];let Ee;e[49]!==G||e[50]!==we?(Ee=n.jsx("div",{className:we,children:G}),e[49]=G,e[50]=we,e[51]=Ee):Ee=e[51];let Ke;e[52]!==ve||e[53]!==Y||e[54]!==ne||e[55]!==Ee?(Ke=n.jsx(ve,{items:Y,strategy:ne,children:Ee}),e[52]=ve,e[53]=Y,e[54]=ne,e[55]=Ee,e[56]=Ke):Ke=e[56];let Le;e[57]!==l||e[58]!==h||e[59]!==p||e[60]!==S?(Le=l?n.jsx(no,{variant:l.variant,decofile:h,meta:S,matchers:p}):null,e[57]=l,e[58]=h,e[59]=p,e[60]=S,e[61]=Le):Le=e[61];let Pe;e[62]!==Le?(Pe=n.jsx(ua,{dropAnimation:null,children:Le}),e[62]=Le,e[63]=Pe):Pe=e[63];let $e;e[64]!==re||e[65]!==le||e[66]!==ke||e[67]!==Se||e[68]!==de||e[69]!==be||e[70]!==Ke||e[71]!==Pe?($e=n.jsxs(re,{sensors:le,collisionDetection:ke,onDragStart:Se,onDragEnd:de,onDragCancel:be,children:[Ke,Pe]}),e[64]=re,e[65]=le,e[66]=ke,e[67]=Se,e[68]=de,e[69]=be,e[70]=Ke,e[71]=Pe,e[72]=$e):$e=e[72];let Fe;return e[73]!==$||e[74]!==Z||e[75]!==$e?(Fe=n.jsxs("div",{className:$,children:[Z,$e]}),e[73]=$,e[74]=Z,e[75]=$e,e[76]=Fe):Fe=e[76],Fe}function so(m){return m.id}function Ln(m){const e=He.c(15),{schema:r,value:c,onChange:d,meta:h,decofile:S,onSaveReferencedBlock:p,sandbox:v}=m;let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[b,C]=w.useState(g);let R;e[1]!==b?(R=b.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>C([]),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:"Back to rule",children:n.jsx(lr,{className:"size-3.5"})}),b.map((o,D)=>{const l=D===b.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[D>0&&n.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>C(b.slice(0,D+1)),title:o,className:Be("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:o})]},`${o}-${D}`)})]}),e[1]=b,e[2]=R):R=e[2];let _;e[3]!==b||e[4]!==S||e[5]!==h||e[6]!==d||e[7]!==p||e[8]!==v||e[9]!==r||e[10]!==c?(_=n.jsx(Un,{schema:r,value:c,onChange:d,basePath:"",breadcrumbPath:b,onBreadcrumbChange:C,meta:h,decofile:S,onSaveReferencedBlock:p,sandbox:v}),e[3]=b,e[4]=S,e[5]=h,e[6]=d,e[7]=p,e[8]=v,e[9]=r,e[10]=c,e[11]=_):_=e[11];let k;return e[12]!==R||e[13]!==_?(k=n.jsxs("div",{className:"space-y-2",children:[R,_]}),e[12]=R,e[13]=_,e[14]=k):k=e[14],k}function Fn(m){const e=He.c(21),{activeSchema:r,formValue:c,formResetKey:d,onFormChange:h,onBreadcrumbChange:S,breadcrumbPath:p,emptyMessage:v,beforeForm:g,seoResolveType:b,siteDefaultSeo:C,meta:R,decofile:_,onSaveReferencedBlock:k,sandbox:o}=m;let D;e[0]!==p?(D=p===void 0?[]:p,e[0]=p,e[1]=D):D=e[1];const l=D;let J;e[2]!==r||e[3]!==l||e[4]!==_||e[5]!==d||e[6]!==c||e[7]!==R||e[8]!==S||e[9]!==h||e[10]!==k||e[11]!==o||e[12]!==b||e[13]!==C?(J=r&&c?b?n.jsx(Ar,{schema:r,resolveType:b,value:c,formResetKey:d,onChange:h,onBreadcrumbChange:S,siteDefaultSeo:C}):n.jsx(Un,{schema:r,value:c,onChange:h,basePath:"",breadcrumbPath:l,onBreadcrumbChange:S,meta:R,decofile:_,onSaveReferencedBlock:k,sandbox:o},d):null,e[2]=r,e[3]=l,e[4]=_,e[5]=d,e[6]=c,e[7]=R,e[8]=S,e[9]=h,e[10]=k,e[11]=o,e[12]=b,e[13]=C,e[14]=J):J=e[14];const H=J;let K;e[15]!==v||e[16]!==H?(K=H??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=H,e[17]=K):K=e[17];let u;return e[18]!==g||e[19]!==K?(u=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[g,K]})}),e[18]=g,e[19]=K,e[20]=u):u=e[20],u}const ro="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 oo(m,e){return Is(m,e,et)}function io(m){const e=He.c(13),{pageKey:r,initialName:c,initialPath:d,onFieldChange:h}=m,[S,p]=w.useState(c),[v,g]=w.useState(d),[b,C]=w.useState(r);b!==r&&(C(r),p(c),g(d));let R;e[0]!==h?(R=l=>{p(l.target.value),h("name",l.target.value)},e[0]=h,e[1]=R):R=e[1];let _;e[2]!==S||e[3]!==R?(_=n.jsx("input",{type:"text",value:S,onChange:R,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=S,e[3]=R,e[4]=_):_=e[4];let k;e[5]!==h?(k=l=>{g(l.target.value),h("path",l.target.value)},e[5]=h,e[6]=k):k=e[6];let o;e[7]!==v||e[8]!==k?(o=n.jsx("input",{type:"text",value:v,onChange:k,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:"/path"}),e[7]=v,e[8]=k,e[9]=o):o=e[9];let D;return e[10]!==_||e[11]!==o?(D=n.jsxs("div",{className:"space-y-1",children:[_,o]}),e[10]=_,e[11]=o,e[12]=D):D=e[12],D}function In(m){const e=He.c(6),{onClick:r}=m;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Yn,{size:14}),e[0]=c):c=e[0];let d;e[1]!==r?(d=n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:c})}),e[1]=r,e[2]=d):d=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[3]=h):h=e[3];let S;return e[4]!==d?(S=n.jsxs(mt,{children:[d,h]}),e[4]=d,e[5]=S):S=e[5],S}function Gl({orgSlug:m,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:d,currentPath:h,activePageBlockKey:S=null,activeGlobalBlockKey:p=null,externalSelectedIndex:v,onSaved:g,initialEditSeo:b=!1,onExitSeo:C,onViewJsonFile:R,onVariantPreviewOverride:_}){const k=c?{orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d}:null,{data:o,isLoading:D}=Ds(k),{data:l,isLoading:J}=Ns(k),H=Vs(),K=H?.entity?.id===e?H.entity.metadata?.siteSlug??null:null,[u,P]=w.useState(null),[se,T]=w.useState(null),[pe,N]=w.useState(null),[ce,B]=w.useState(0),[te,oe]=w.useState(void 0),[Ce,E]=w.useState(null),[ue,ie]=w.useState(null),[je,M]=w.useState([]),[Ae,X]=w.useState(0),[Ne,ve]=w.useState(null),[re,G]=w.useState(null),[Y,ne]=w.useState(null),[le,ke]=w.useState(!0),[Se,de]=w.useState(!1),[be,$]=w.useState(!1),[Z,we]=w.useState(b),[Ee,Ke]=w.useState(b);b&&!Ee&&(Ke(!0),we(!0),P(null),T(null),N(null),M([])),!b&&Ee&&Ke(!1);const[Le,Pe]=w.useState(null),[$e,Fe]=w.useState(void 0),[Me,xe]=w.useState([]),[Re,me]=w.useState(0),[ee,L]=w.useState(0),[ae,Q]=w.useState(null),[Ie,he]=w.useState(null),[Qe,un]=w.useState(null),va=vs(),Sa=`${m}/${e}/${r}`,zt=Cs({orgSlug:m,virtualMcpId:e,branch:r}),[xa,ya]=w.useState(h),[ba,_a]=w.useState(S),[ja,ka]=w.useState(p);(xa!==h||ba!==S||ja!==p)&&(queueMicrotask(()=>zt.flush()),ya(h),_a(S),ka(p),P(null),T(null),N(null),B(0),E(null),ie(null),L(0),Q(null),he(null),M([]),X(t=>t+1),we(!1),Pe(null),Fe(void 0),xe([]),me(t=>t+1));const ye=Ps({orgSlug:m,virtualMcpId:e,branch:r}),Nt=Qs((t,a)=>{ye.mutate({blockKey:t,data:a},{onSuccess:()=>g?.(),onError:s=>W.error(`Save failed: ${s.message}`)})}),Ht=Ts({orgSlug:m,virtualMcpId:e,branch:r}),[bt,Vt]=w.useState(!1),Ut=w.useRef(null),ht=w.useRef(null),gt=w.useRef(null),Wt=w.useRef({}),Ye=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||D||J)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(zn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!l)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const wa=As(o),_e=!!p,ze=_e?null:Ms(wa,h,S),j=_e?p:ze?.key??null,Gt=_e&&p?o[p]:void 0,dn=_e&&p&&Gt?Es(p,Gt):_e&&p?p:"",Ct=!_e&&j&&o[j]?o[j]:null,Yt=Z&&o&&l&&j&&ze?Kn(o,{kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},l):null,Ra=Z?Ct?.seo:void 0,qt=$e!==void 0?$e:Ra,Da=Z?Rr(qt):void 0,Na=Yt?.seoTypeOptions??[],Va=Z&&l?Dr(l):"",mn=Le??Da??{},Jt=Z&&Yt?Nr(mn,Yt):null,Ca=Z&&Jt&&Vr(qt)?$t(Jt,l):null,Pa=Z?Cr(o,l)?.seoData:void 0,Oe=_e?[{label:"Default",sections:[{__resolveType:p}]}]:oo(Ct?.sections,o??{}),Pt=Oe.length>1,Ve=Math.min(ce,Oe.length-1),tt=Oe[Ve],I=tt?.sections??[],Te=Ot(I,o),fn=!_e&&Ks(Ct?.sections);if(_e&&p&&Qe!==p){un(p);const t=I[0],a=Te[0];if(t&&a){P(0),L(0),M([]);const s=ut(t,a,o);s&&(T(s.data),N(s.resolveType),he(null),Q(null))}}!_e&&Qe!==null&&un(null),Ye.current={rawSections:I,parsedSections:Te,decofile:o??{},activePageKey:j,pageVariants:Oe,variantIndex:Ve,sectionVariantIndex:ee,selectedSectionIndex:u};const Ta=()=>({multivariate:fn,index:Ve,variants:Oe.map(t=>({rule:t.rule}))}),pn=(t,a)=>{if(!_)return;if(!j||!fn||t.length<=1){_(null);return}const s=Mn(j,{multivariate:!0,index:a,variants:t},o,l);_(s.length>0?s:null)},vt=(t,a,s)=>{if(!_)return;if(!j){_(null);return}const i=Ta(),f=Mn(j,i,o,l);if(!t||a<0){_(f.length>0?f:null);return}const y=nr({pageKey:j,page:i,sectionIndex:a,sectionLazy:Te[a]?.isLazy??!1,mvObj:t,selectedVariantIndex:s,decofile:o,meta:l}),x=[...f,...y];_(x.length>0?x:null)},nt=(t,a,s,i=u??-1,f=!1)=>{const y=Je(t,a);if(!y){T(null),N(null),he(null),Q(null),f&&vt(null,i,s);return}const V=Vn(y,et)[s];if(!V){T(null),N(null),he(null),Q(null),f&&vt(null,i,s);return}const q=zs(V.value,o);T(q?.data??null),N(q?.resolveType??null);const{resolveType:A,formValue:O}=jt(V.rule,o,l??void 0);he(A),Q(O),f&&vt(y,i,s)};if(v!==void 0&&v!==te&&(oe(v??null),typeof v=="number")){const t=I[v],a=Te[v];if(t&&a)if(P(v),L(0),M([]),X(s=>s+1),a.isMultivariate)nt(t,a,0,v);else{const s=ut(t,a,o);s?(T(s.data),N(s.resolveType)):(T(null),N(null)),he(null),Q(null)}}const Tt={orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d??void 0,siteSlug:K},Qt=pe&&l?$t(pe,l):null,Ue=(t,a)=>{if(!j)return;const s=wt(o,j,t,Ve,Oe);ye.mutate({blockKey:j,data:s},{onSuccess:()=>a?.onSuccess?.()??g?.(),onError:i=>W.error(`Save failed: ${i.message}`)})},St=()=>{P(null),T(null),N(null),L(0),Q(null),he(null),M([]),X(t=>t+1)},Aa=(t,a)=>{Ut.current&&clearTimeout(Ut.current);const s=Ye.current.sectionVariantIndex;Ut.current=setTimeout(()=>{const{rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current,A=i[a];if(!A)return;const O=f[a];if(!O)return;if(O.isSavedBlock){const z=O.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;ye.mutate({blockKey:z,data:t},{onSuccess:()=>g?.(),onError:U=>W.error(`Save failed: ${U.message}`)});return}if(!x)return;const F={...y[x]},ge=[...i];if(O.isMultivariate){const z=Je(A,O);if(!z||!x)return;const U=sr(z,s,t);ge[a]=dt(A,O,U)}else if(O.isHidden){const z=Hn(A.__resolveType),U=z?{...A.section}:{...A},De=Array.isArray(U.variants)?[...U.variants]:[];De[0]&&(De[0]={...De[0],value:t}),U.variants=De,z?ge[a]={...A,section:U}:ge[a]=U}else O.isLazy?ge[a]={...A,section:t}:ge[a]=t;if(V.length>1){const z=F.sections,U=[...z?.variants??[]];U[q]&&(U[q]={...U[q],value:ge}),F.sections={...z,variants:U}}else F.sections=ge;ye.mutate({blockKey:x,data:F},{onSuccess:()=>g?.(),onError:z=>W.error(`Save failed: ${z.message}`)})},rn)},Ma=t=>{P(t),L(0),M([]),X(f=>f+1);const a=I[t],s=Te[t];if(!a||!s)return;if(s.isMultivariate){nt(a,s,0,t);return}const i=ut(a,s,o);if(!i){T(null),N(null),he(null),Q(null),vt(null,t,0);return}T(i.data),N(i.resolveType),he(null),Q(null),vt(null,t,0)},hn=t=>{const a=t;T(a),u!==null&&Aa(a,u)},Xt=t=>{if(!j||!o||!l||!ze)return;const a={kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},s=Kn(o,a,l);s&&zt.save(j,()=>{const i=va.getQueryData(Ss.decofile(Sa))?.[j];if(!i||typeof i!="object"||i===null||Array.isArray(i))return null;const f={...i,...Wt.current};return Wt.current={},t?.raw!==void 0?{...f,seo:t.raw}:t?.inner!==void 0?Tr(a,s,f,t.inner):f})},Ea=(t,a)=>{j&&(Wt.current[t]=a,Xt())},Ka=(t,a)=>{if(!j)return;const s=Dt([...I],t,a);u!==null&&(u===t?P(a):t<u&&a>=u?P(u-1):t>u&&a<=u&&P(u+1)),Ue(s)},$a=t=>{if(!j)return;const a=I.filter((s,i)=>i!==t);u===t?St():u!==null&&u>t&&P(u-1),Ue(a)},Oa=t=>{if(!j)return;const a=I[t];if(!a)return;const s=[...I];s.splice(t+1,0,tr(a)),u!==null&&u>t&&P(u+1),Ue(s)},Ba=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s||s.isMultivariate)return;const i=s.isHidden?Zs(a):er(a);if(!i)return;const f=[...I];f[t]=i,u===t&&St(),Ue(f)},La=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s||s.isMultivariate)return;const i=Xs(a);if(!i)return;const f=[...I];f[t]=i,u===t&&St(),Ue(f)},Fa=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s?.isSavedBlock)return;const i=ut(a,s,o);if(!i?.data)return;const{name:f,...y}=i.data,x=[...I];s.isLazy?x[t]={...a,section:y}:x[t]=y,u===t&&St(),Ue(x)},Ia=t=>{if(!j)return;const a=[...I,{__resolveType:t.resolveType}],s=a.length-1;Ue(a,{onSuccess:()=>{de(!1),P(s),L(0),M([]),X(x=>x+1);const i=a[s],f=Ot(a,o)[s];if(!i||!f)return;if(f.isMultivariate){nt(i,f,0);return}const y=ut(i,f,o);if(!y){T(null),N(null),he(null),Q(null);return}T(y.data),N(y.resolveType),he(null),Q(null)}})},za=t=>{if(u===null)return;const a=I[u],s=Te[u];!a||!s?.isMultivariate||(L(t),M([]),X(i=>i+1),nt(a,s,t,u,!0))},Ha=t=>{if(u===null||!j)return;const a=I[u],s=Te[u];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const f=qs(i,t);if(!f){W.error("Cannot delete the only variant.");return}const y=[...I];y[u]=dt(a,s,f);const x=f.variants;let V=ee;t===ee?V=Math.min(t,x.length-1):t<ee&&(V=ee-1),L(V),M([]),X(q=>q+1),nt(y[u],s,V),Ue(y)},Ua=t=>{if(u===null||!j)return;const a=I[u],s=Te[u];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const f=Js(i,t),y=[...I];y[u]=dt(a,s,f);const x=t+1;L(x),M([]),X(V=>V+1),nt(y[u],s,x),Ue(y)},Wa=(t,a)=>{if(u===null||!j||t===a)return;const s=I[u],i=Te[u];if(!s||!i?.isMultivariate)return;const f=Je(s,i);if(!f)return;const y=Gs(f,t,a),x=[...I];x[u]=dt(s,i,y);let V=ee;ee===t?V=a:t<ee&&a>=ee?V=ee-1:t>ee&&a<=ee&&(V=ee+1),L(V),nt(x[u],i,V),Ue(x)},Zt=t=>{const a=t??u;if(a===null||!j)return;const s=I[a],i=Te[a];if(!s||!i)return;const f=Hs(s,i);if(!f){W.error("This section cannot have variants.");return}const y=[...I];y[a]=f.section;const x=Ot(y,o)[a];if(!x?.isMultivariate){W.error("Could not add variant.");return}P(a),L(f.newVariantIndex),M([]),X(V=>V+1),nt(f.section,x,f.newVariantIndex,a),Ue(y)},Ga=()=>{if(u===null||!j)return;const t=I[u],a=Te[u];if(!t||!a?.isMultivariate)return;const s=Je(t,a);if(!s)return;const i=Ys(t,a,s);if(!i){W.error("Could not remove variants.");return}const f=[...I];f[u]=i;const y=Ot(f,o)[u];if(!y)return;L(0),he(null),Q(null),M([]),X(V=>V+1);const x=ut(i,y,o);x?(T(x.data),N(x.resolveType)):(T(null),N(null)),vt(null,u,0),Ue(f)},Ya=async t=>{if(Ne===null||!j)return;const a=sn(t,o);if(a){W.error(a);return}const s=I[Ne],i=Te[Ne];if(!s||!i)return;const f=ut(s,i,o);if(!f){W.error("This section cannot be saved as global.");return}const y={...f.data,name:t};try{await ye.mutateAsync({blockKey:t,data:y});const x=[...I];x[Ne]={__resolveType:t},await ye.mutateAsync({blockKey:j,data:wt(o,j,x,Ve,Oe)}),u===Ne&&St(),ve(null),W.success(`Saved global block "${t}"`),g?.()}catch(x){W.error(x instanceof Error?x.message:"Failed to save global block")}},gn=tt?.rule;if(Pt&&u===null&&ue===null&&gn){const{resolveType:t,formValue:a}=jt(gn,o??{},l??void 0);ie(t),E(a)}const At=l?$s(l):[],vn=l&&o?Os(l,o):[],qa=!_e&&!!(d&&l&&o),Sn=ue&&l?$t(ue,l):null,Mt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},_t=async(t,a)=>{if(!(ar(a,t,l)>0))try{await Ht.mutateAsync({blockKey:t})}catch(s){W.error(s instanceof Error?s.message:"Could not delete matcher block")}},xn=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:a,decofile:s,variantIndex:i}=Ye.current;if(!a)return;const f={...s[a]},y={...f.sections},x=[...y.variants??[]],V=x[i],q=V?.rule;if(xt(q,s,l)){const A=q?.__resolveType??"",O=s[A],F=typeof O?.name=="string"?O.name:A,{__resolveType:ge,...z}=t;ye.mutate({blockKey:A,data:yt(ge??"",z,F)},{onSuccess:()=>g?.(),onError:U=>W.error(`Save failed: ${U.message}`)});return}V&&(x[i]={...V,rule:t}),f.sections={...y,variants:x},ye.mutate({blockKey:a,data:f},{onSuccess:()=>g?.(),onError:A=>W.error(`Save failed: ${A.message}`)})},rn)},Ja=t=>{ie(t);const a=t?{__resolveType:t}:{__resolveType:En};E({}),xn(a)},Qa=t=>{const a=t;E(a);const s=ue?{__resolveType:ue,...a}:{...a};xn(s)},Xa=async t=>{Mt();const{activePageKey:a,decofile:s,variantIndex:i}=Ye.current;if(!a)return;const f=s[a],y=f?.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const x=y;if(!Array.isArray(x.variants))return;const V=[...x.variants],q=V[i];if(!q)return;const A=kt(q.rule,s,l),O=Lt(t);V[i]={...q,rule:O};const F={...s,[a]:{...f,sections:{...x,variants:V}}},{resolveType:ge,formValue:z}=jt(O,F,l??void 0);ie(ge),E(z);try{await ye.mutateAsync({blockKey:a,data:F[a]}),A&&A!==t&&await _t(A,F),g?.()}catch(U){W.error(U instanceof Error?U.message:"Could not apply saved rule")}},yn=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:a,sectionVariantIndex:s}=Ye.current;a!==null&&(gt.current=setTimeout(()=>{const{rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current;if(!x)return;const A=i[a],O=f[a];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const z=(F.variants??[])[s]?.rule;if(xt(z,y,l)){const fe=z?.__resolveType??"",We=y[fe],Xe=typeof We?.name=="string"?We.name:fe,{__resolveType:rt,...Ze}=t;ye.mutate({blockKey:fe,data:yt(rt??"",Ze,Xe)},{onSuccess:()=>g?.(),onError:ot=>W.error(`Save failed: ${ot.message}`)});return}const U=Pn(F,s,t),De=[...i];De[a]=dt(A,O,U);const qe=wt(y,x,De,q,V);ye.mutate({blockKey:x,data:qe},{onSuccess:()=>g?.(),onError:fe=>W.error(`Save failed: ${fe.message}`)})},rn))},Za=t=>{he(t),Q({}),yn(t?{__resolveType:t}:{__resolveType:En})},es=t=>{const a=t;Q(a);const s=Ie?{__resolveType:Ie,...a}:{...a};yn(s)},ts=async t=>{Mt();const{selectedSectionIndex:a,sectionVariantIndex:s,rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current;if(a===null||!x)return;const A=i[a],O=f[a];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const ge=F.variants??[],z=kt(ge[s]?.rule,y,l),U=Lt(t),De=Pn(F,s,U),qe=[...i];qe[a]=dt(A,O,De);const fe=wt(y,x,qe,q,V),We={...y,[x]:fe},{resolveType:Xe,formValue:rt}=jt(U,We,l??void 0);he(Xe),Q(rt);try{await ye.mutateAsync({blockKey:x,data:fe}),z&&z!==t&&await _t(z,We),g?.()}catch(Ze){W.error(Ze instanceof Error?Ze.message:"Could not apply saved rule")}};if(!_e&&!ze)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",h]});if(_e&&!Gt)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const at=u!==null?Te[u]??null:null,bn=u!==null?I[u]:null,_n=bn&&at?.isMultivariate?Je(bn,at):null,lt=_n?Vn(_n,et):[],en=Math.min(ee,Math.max(lt.length-1,0)),Et=lt[en]??null,ct=at?.isMultivariate===!0,jn=u!==null&&at!==null,Kt=jn&&(ct||!!(Qt&&se)),ns=Kt&&!_e&&at?.isSavedBlock===!0,st=_e||ns,as=_e?dn:at?.label??"",kn=Ie&&l?$t(Ie,l):null,tn=Kt&&(!_e||je.length>0)?_e?[dn,...je]:[ze.name,at.label,...ct&&Et?[Et.label]:[],...je]:[],ss=Z&&ze?[ze.name,"SEO",...Me]:[],wn=Z?ss:st?tn.length>0?tn:[as]:tn,Rn=()=>{if(!j)return;const t=o[j],a=Us(t.sections,I);if(!a)return;const s=Ws(a);ye.mutate({blockKey:j,data:{...t,sections:a}},{onSuccess:()=>{B(s),P(null),T(null),N(null),M([]),E(null),ie(null)},onError:i=>W.error(`Save failed: ${i.message}`)})},nn=(t,a,s)=>{if(!j)return;const i=o[j],f=i.sections;if(!f||typeof f!="object"||Array.isArray(f))return;const y=f;if(!Array.isArray(y.variants))return;const x=t([...y.variants]);if(!x)return;const V=rr(y,x),q={...o,[j]:{...i,sections:V}};ye.mutate({blockKey:j,data:q[j]},{onSuccess:()=>{a?.(),s&&_t(s,q)},onError:A=>W.error(`Save failed: ${A.message}`)})},rs=t=>{G(null),B(t),P(null),T(null),N(null),M([]);const a=Oe[t]?.rule,{resolveType:s,formValue:i}=jt(a,o??{},l??void 0);ie(s),E(i),pn(Oe.map(f=>({rule:f.rule})),t)},os=(t,a)=>{if(t===a)return;let s=Ve;Ve===t?s=a:t<Ve&&a>=Ve?s=Ve-1:t>Ve&&a<=Ve&&(s=Ve+1),B(s);const i=Dt(Oe.map(f=>({rule:f.rule})),t,a);pn(i,s),nn(f=>Dt(f,t,a))},is=t=>{const a=Oe[t]?.rule,s=kt(a,o??{},l??void 0);nn(i=>i.length<=1?null:(i.splice(t,1),i),()=>{Oe.length-1===1?B(0):t<Ve?B(Ve-1):t===Ve&&B(Math.max(0,t-1)),P(null),T(null),N(null),M([]),E(null),ie(null)},s)},ls=t=>{nn(a=>or(a,t),()=>{B(t+1),P(null),T(null),N(null),M([]),E(null),ie(null)})},cs=async(t,a)=>{Mt();const s=Ye.current.activePageKey,i=Ye.current.decofile;if(!s)return;const f=i[s],y=f.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const x=y;if(!Array.isArray(x.variants))return;const V=[...x.variants],q=V[t];if(!q?.rule||typeof q.rule!="object"){W.error("This variant has no matcher rule to rename.");return}const A=q.rule,O=a.trim();Vt(!0);try{if(!O){if(!xt(A,i,l)){G(null);return}const qe=A.__resolveType??"";V[t]={...q,rule:Tn(A,i,l)};const fe={...i,[s]:{...f,sections:{...x,variants:V}}};await ye.mutateAsync({blockKey:s,data:fe[s]}),await _t(qe,fe),G(null),g?.();return}const F=An(A,i,l);if(!F){W.error("Could not read this variant's matcher rule.");return}if(F.blockKey){await ye.mutateAsync({blockKey:F.blockKey,data:yt(F.resolveType,F.data,O)}),G(null),g?.();return}const ge=an(O),z=sn(ge,i);if(z){W.error(z);return}const U=yt(F.resolveType,F.data,O);let De=null;try{await ye.mutateAsync({blockKey:ge,data:U}),De=ge,V[t]={...q,rule:Lt(ge)},await ye.mutateAsync({blockKey:s,data:{...f,sections:{...x,variants:V}}}),De=null}catch(qe){throw De&&await Ht.mutateAsync({blockKey:De}).catch(()=>{}),qe}G(null),W.success(`Saved matcher as global block "${O}"`),g?.()}catch(F){W.error(F instanceof Error?F.message:"Failed to rename variant")}finally{Vt(!1)}},us=async(t,a)=>{Mt();const{selectedSectionIndex:s,rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current;if(s===null||!x)return;const A=i[s],O=f[s];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const ge=F.variants??[],z=ge[t];if(!z?.rule||typeof z.rule!="object"){W.error("This variant has no matcher rule to rename.");return}const U=z.rule,De=a.trim();Vt(!0);const qe=async fe=>{const We={...F,variants:fe},Xe=[...i];Xe[s]=dt(A,O,We);const rt=wt(y,x,Xe,q,V);return await ye.mutateAsync({blockKey:x,data:rt}),{...y,[x]:rt}};try{if(!De){if(!xt(U,y,l)){ne(null);return}const ot=U.__resolveType??"",Nn=[...ge];Nn[t]={...z,rule:Tn(U,y,l)};const gs=await qe(Nn);await _t(ot,gs),ne(null),g?.();return}const fe=An(U,y,l);if(!fe){W.error("Could not read this variant's matcher rule.");return}if(fe.blockKey){await ye.mutateAsync({blockKey:fe.blockKey,data:yt(fe.resolveType,fe.data,De)}),ne(null),g?.();return}const We=an(De),Xe=sn(We,y);if(Xe){W.error(Xe);return}const rt=yt(fe.resolveType,fe.data,De);let Ze=null;try{await ye.mutateAsync({blockKey:We,data:rt}),Ze=We;const ot=[...ge];ot[t]={...z,rule:Lt(We)},await qe(ot),Ze=null}catch(ot){throw Ze&&await Ht.mutateAsync({blockKey:Ze}).catch(()=>{}),ot}ne(null),W.success(`Saved matcher as global block "${De}"`),g?.()}catch(fe){W.error(fe instanceof Error?fe.message:"Failed to rename variant")}finally{Vt(!1)}},Dn=()=>{St()},ds=t=>{Pe(t),Xt({inner:t})},ms=t=>{Fe(t),Xt({raw:t})},fs=()=>{Pe(null),xe([])},ps=()=>me(t=>t+1),hs=t=>{if(Z){if(t===0){zt.flush(),we(!1),Pe(null),Fe(void 0),xe([]),me(s=>s+1),C?.();return}if(t===1){xe([]),me(s=>s+1);return}xe(Me.slice(0,t-1)),me(s=>s+1);return}if(_e){M(je.slice(0,t)),X(s=>s+1);return}if(t===0){Dn();return}if(t===1){M([]),X(s=>s+1);return}if(ct&&t===2){M([]),X(s=>s+1);return}const a=ct?2:1;M(je.slice(0,t-a))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:st||Kt||Z?n.jsxs("div",{className:Be("border-b px-3 py-2.5",st&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!_e&&Pt&&tt&&n.jsxs("button",{type:"button",onClick:Dn,title:`Editing in variant: ${tt.label}`,className:Be("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",ro),children:[n.jsx(ha,{rule:Rt(tt.rule,o??{},l??void 0),matchers:At}),n.jsx("span",{className:"max-w-[160px] truncate",children:tt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:wn.map((t,a)=>{const s=a===wn.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&n.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>hs(a),title:t,className:Be("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",s?st?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":st?"text-foreground/80":"text-muted-foreground",st?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${a}`)})}),st&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(fr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(pt,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),jn&&!ct&&!at?.isHidden&&j&&n.jsx(In,{onClick:()=>Zt()})]}),st&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(io,{pageKey:j,initialName:ze.name,initialPath:ze.path,onFieldChange:Ea})}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>we(!0),children:n.jsx(dr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>R&&j?R(j):$(!0),children:n.jsx(mr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"View JSON"})]}),n.jsx(In,{onClick:Rn})]})}),Z?n.jsx(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ct&&j?n.jsx(Pr,{rawSeo:qt,innerSeo:mn,defaultResolveType:Va,seoSchema:Ca,activeResolveType:Jt,seoTypeOptions:Na,formResetKey:Re,siteDefaultSeo:Pa,onBreadcrumbChange:xe,onPersistRaw:ms,onInnerChange:ds,onClearForm:fs,onBumpFormKey:ps}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):Kt?n.jsxs(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ct&&lt.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Bs,{listKey:`${j??""}:${u??""}`,variants:lt.map((t,a)=>({index:a,label:t.label})),selectedIndex:en,onSelect:za,onRename:ne,onDuplicate:Ua,onDelete:Ha,onRemoveAll:Ga,onReorder:Wa,onAdd:()=>Zt()}),ct&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(Cn,{currentRt:Ie??"",currentLabel:Bt(Et?.rule,o??{},et,l??void 0),currentGlobalKey:kt(Et?.rule,o??{},l??void 0)??void 0,matchers:At,globals:vn,onSelect:Za,onSelectGlobal:ts}),kn&&ae&&n.jsx("div",{className:"pt-1",children:n.jsx(Ln,{schema:kn,value:ae,onChange:es,meta:l??void 0,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt},`${u??"none"}:${en}:${Ie??""}`)})]})]}),n.jsx(Fn,{activeSchema:Qt,formValue:se,formResetKey:Ae,onFormChange:hn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this variant.",meta:l,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt})]}):_e?n.jsx(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Fn,{activeSchema:Qt,formValue:se,formResetKey:Ae,onFormChange:hn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this global block.",meta:l,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt})}):n.jsxs(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Pt&&j&&n.jsx(ao,{listKey:j,variants:Oe,activeIndex:Ve,decofile:o??{},meta:l,matchers:At,onSelect:rs,onReorder:os,onRename:G,onDuplicate:ls,onDelete:is,onAdd:Rn}),Pt&&ue!==null&&n.jsxs("div",{className:Be("px-3 border-b",le?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":le,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),le?n.jsx(cr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ir,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),le&&n.jsxs("div",{className:Be("space-y-3",bt&&"pointer-events-none opacity-50"),children:[n.jsx(Cn,{currentRt:ue,currentLabel:Bt(tt?.rule,o??{},et,l??void 0),currentGlobalKey:kt(tt?.rule,o??{},l??void 0)??void 0,matchers:At,globals:vn,onSelect:Ja,onSelectGlobal:Xa}),Sn&&Ce&&n.jsx("div",{className:"space-y-3",children:n.jsx(Ln,{schema:Sn,value:Ce,onChange:Qa,meta:l??void 0,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt},`${Ve}:${ue??""}`)})]})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(Yr,{listKey:`${j??""}-${Ve}`,rawSections:I,sections:Te,meta:l,selectedIndex:u,onSelect:Ma,onReorder:Ka,onDelete:$a,onDuplicate:Oa,onMakeReusable:ve,onToggleHidden:Ba,onToggleLazy:La,onAddVariant:Zt,onDetach:Fa,onAddSection:()=>de(!0),canAddSection:qa})})]}),n.jsx(Ls,{open:Ne!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:Ne!==null?an(Te[Ne]?.label??""):"",isPending:ye.isPending,onSubmit:Ya}),d&&n.jsx(Er,{open:Se,onOpenChange:de,meta:l,decofile:o,previewBaseUrl:d,onSelect:Ia}),be&&j&&o&&n.jsx(Fs,{open:be,onOpenChange:$,pageKey:j,decofile:o}),re!==null&&n.jsx(On,{open:!0,initialName:xt(Oe[re]?.rule,o??{},l??void 0)?Bt(Oe[re]?.rule,o??{},et,l??void 0):"",autoLabel:et(Rt(Oe[re]?.rule,o??{},l??void 0)),isPending:bt,onSubmit:async t=>{await cs(re,t)},onOpenChange:t=>{!t&&!bt&&G(null)}}),Y!==null&&n.jsx(On,{open:!0,initialName:xt(lt[Y]?.rule,o??{},l??void 0)?Bt(lt[Y]?.rule,o??{},et,l??void 0):"",autoLabel:et(Rt(lt[Y]?.rule,o??{},l??void 0)),isPending:bt,onSubmit:async t=>{await us(Y,t)},onOpenChange:t=>{!t&&!bt&&ne(null)}})]})}export{Gl as SectionsEditor};
1
+ import{c as He,r as w,l as Be,j as n,B as Ge,i as zn,m as vs,t as W,K as Ss}from"./index-CFiyU0D9.js";import{r as xs,a as ys,s as bs,i as Hn,c as _s,b as js,G as ks,V as ws,d as Rs,e as Rt,f as Ds,g as Ns,h as Vs,j as Cs,k as Ps,l as Ts,m as As,n as Ms,o as Es,p as $t,q as Ot,t as Ks,v as ut,w as jt,x as $s,y as Os,z as Je,A as Vn,S as Bs,M as Cn,B as kt,C as Bt,D as Ls,E as an,P as Fs,F as et,H as xt,I as Is,J as zs,K as Hs,L as Us,N as Ws,O as Gs,Q as dt,R as Ys,T as qs,U as Js,W as Pn,X as wt,Y as Qs,Z as Xs,_ as Zs,$ as er,a0 as tr,a1 as sn,a2 as Tn,a3 as An,a4 as yt,a5 as Lt,a6 as Mn,a7 as nr,a8 as ar,a9 as rn,aa as sr,ab as rr,ac as Un,ad as En,ae as or}from"./index-CRxAjd1d.js";import{t as ir}from"./ChevronDown-DyHvxYlc.js";import{n as lr}from"./ChevronLeft-dyRjFCmp.js";import{i as Wn}from"./ChevronRight-Cpfh3gza.js";import{n as cr}from"./ChevronUp-DBpw6M-L.js";import{H as ln,E as Gn,Y as Yn,l as ur,I as dr,J as mr}from"./agent-icon-oDx9Z_Be.js";import{i as fr}from"./Globe01-CyfpzbeQ.js";import{S as Ft}from"./scroll-area-BM-54tW1.js";import{T as mt,a as ft,b as pt}from"./tooltip-DrpiSbRG.js";import{a as pr,c as hr,b as gr,D as vr,d as Sr,e as xr}from"./dialog-BAqFyO8a.js";import{I as yr}from"./input-BwRH-Gsz.js";import{s as br,a as qn}from"./Eye-bojNLUjA.js";import{c as _r}from"./ZoomOut-6ix2H92j.js";import{i as jr}from"./Settings02-BcAnTzm5.js";import{s as cn}from"./Plus-eGxBB1d8.js";import{s as Jn}from"./Trash01-ByxlxTiZ.js";import{i as kr}from"./Zap-wRIFSWIq.js";import{c as it,a as Qn,D as Xn,b as Zn,g as wr}from"./dropdown-menu-C62KNjwK.js";import{b as ea,c as It,K as ta,P as na,e as aa,C as sa,s as ra,l as Dt,D as oa,d as ia,S as la,v as ca,k as ua}from"./sortable.esm-MymOIPKk.js";import{r as Kn,u as Rr,d as Dr,a as Nr,i as Vr,f as Cr,P as Pr,b as Tr,S as Ar}from"./page-seo-form-BLqpZnj6.js";import{b as Mr}from"./Tool01-CvnpFI53.js";import{A as Er}from"./add-section-modal-DOhGqRCL.js";import"./index-mEtg0zTM.js";import"./SwitchHorizontal01-DAZXInW8.js";import"./chat-context-n9syhvq-.js";import"./hooks-CUSV6Enf.js";import"./use-mcp-client-xOK-OF8p.js";import"./auth-Bej0Tx2Y.js";import"./decopilot-sse-pool-CvYk1hkc.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-2U_MnYnK.js";import"./use-collections-B4atckEK.js";import"./use-ai-providers-C7KmiuqP.js";import"./studio-tools-CNO5iCKk.js";import"./use-decopilot-events-CpQNzv3e.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-DksiQdGc.js";import"./drawer-CFkqEC3w.js";import"./collection-search-8iNXnGlM.js";import"./SearchMd-ujiTPCmg.js";import"./use-mobile-NlF-3RoP.js";import"./use-mcp-prompts-Crr3H7P7.js";import"./X-DrMVHLcw.js";import"./shell-layout-Nyz7GHu7.js";import"./avatar-CJP1BOq4.js";import"./User01-COQtf360.js";import"./Users03-DknrDMtT.js";import"./SearchLg-CDpA_lbT.js";import"./Stars02-qnq-_X9g.js";import"./XClose-BaZ908gw.js";import"./CheckCircle-Cgnheu-R.js";import"./FilterLines-CFl65nng.js";import"./required-auth-layout-DDJmFi3U.js";import"./use-org-sso-DkqH8Zpz.js";import"./ZapSquare-PMiGcZpW.js";import"./Star01-DHEkWySe.js";import"./Upload01-Z77n1bV8.js";import"./AlertCircle-DC-zDzV-.js";import"./form-DGE2mWLL.js";import"./label-CdBSUJpf.js";import"./select-C6v8Xcth.js";import"./XCircle-Ct0eqqsw.js";import"./tabs-Ca0vDJqc.js";import"./toggle-group-9TrYMc69.js";import"./Monitor01-ChA6ov2I.js";import"./connect-desktop-dialog-Brra3cMC.js";import"./decopilot-BItqS11w.js";import"./checkbox-DmOzmKLP.js";import"./skeleton-B0I93PJP.js";import"./Key01-CwrJlZo0.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-MeT61nuY.js";import"./card-BFb5m83e.js";import"./ArrowUpRight-OJZisFPQ.js";import"./Stars01-BdCaKqhF.js";import"./popover-BXFiEQtN.js";import"./command-C34397s2.js";import"./index-jBUpmiBg.js";import"./useInfiniteQuery-RUqqRph1.js";import"./use-infinite-scroll-BX1nHHVY.js";import"./use-org-fs-DyK8omii.js";import"./question-004-sINsf4GQ.js";import"./integration-icon-LQhkkaLl.js";import"./use-status-sounds-DxV7deix.js";import"./empty-state-Sh_DuDcy.js";import"./toolbar-p8VcpV1N.js";import"./preview-dialog-CQgf0QcR.js";import"./LinkExternal01-BHwVyDja.js";import"./index-B6hcksS9.js";import"./file-type-icon-DPWxBpNL.js";import"./LayoutLeft-fsm0LcB8.js";import"./use-connection-Dz29RF9P.js";import"./use-mcp-tools-C8tMWwG9.js";import"./types-C7syjwde.js";import"./use-capability-C6Dwri-U.js";import"./textarea-BYT525JZ.js";import"./shell-route-loading-BRcTX0VT.js";import"./extract-connection-data-D6bQrejT.js";import"./tools-list-uWC3Ij6C.js";import"./mcp-oauth-IblqU9XT.js";import"./badge-DhpSM7g_.js";import"./connection-slug-eyAPH6o3.js";import"./alert-dialog-CYizItFp.js";import"./switch-CCMIMmOF.js";import"./Play-CnXG8qqP.js";import"./use-debounced-autosave-B4mbwJnu.js";import"./index-Bb-tYGNK.js";import"./sidebar-BNrafefE.js";import"./sheet-DyU03ddw.js";import"./search-input-M7ubuBMG.js";import"./collection-tabs-KA2be3wH.js";import"./github-repo-picker-B5tZucJa.js";import"./use-debounced-value-C6U3mliE.js";import"./authenticate-and-persist-oauth-DoPUB_Bh.js";import"./use-navigate-to-agent-DZubxUSm.js";import"./github-installations-DzN1UQ4x.js";import"./Users01-wtRJYQKX.js";import"./use-secrets-CLmhH-Rb.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./automation-runs-B-dNDEWH.js";import"./table-DeNuxLMl.js";import"./use-members-BMNjJExY.js";import"./use-org-auth-client-C_UJ3Vg_.js";import"./task-status-B3nPzwP7.js";import"./DotsVertical-5jSu3d1f.js";import"./use-automations-RMjkwkxX.js";import"./useSuspenseInfiniteQuery-fRYRtDkY.js";import"./use-file-configs-CFCmr--W.js";import"./monaco-editor-5JIc-lnc.js";import"./select-model-Cz9R_UN3.js";import"./automation-list-row-CsTyBm4M.js";import"./Globe04-DFpdKSRI.js";import"./HardDrive-B1mtnaeA.js";import"./Sun-lTiqxOzH.js";import"./Palette-DusYqL0W.js";import"./Shield01-ZxmFmrvL.js";import"./use-clock-tick-BcxdOJLx.js";import"./use-copy-Xy0buIqd.js";import"./content-blocks-o63cs2vh.js";import"./connection-card-C6NYo4Gp.js";import"./use-registry-connections-BOZLpkM5.js";import"./connection-form-helpers-CwZx7WkC.js";function Kr(m){return m.schema?.definitions??m.schema?.$defs??{}}function $r(m,e){const r=Kr(e),c=r[btoa(m)];if(!c)return;let d=typeof c.image=="string"?c.image:void 0;if(!d&&Array.isArray(c.allOf)){const h=c.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof h=="string"){const S=h.replace("#/definitions/",""),p=r[S];d=typeof p?.image=="string"?p.image:void 0}}if(d?.includes("{{{"))return d}function Or(m,e){if(!e)return;const r=xs(m);if(!r)return;const c=$r(r.resolveType,e);if(!c)return;const d=ys(c,r.data);if(d)return bs(d)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="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 $n(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function da(m){return m.map((e,r)=>({...e,index:r}))}function Fr(m,e){if(e===m.length)return m;if(e<m.length)return da(m.slice(0,e));const r=Array.from({length:e-m.length},(c,d)=>({id:crypto.randomUUID(),index:m.length+d}));return[...m,...r]}function ma(m){const e=He.c(20),{section:r,raw:c,meta:d}=m,h=r.isSavedBlock===!0,S=r.isMultivariate===!0;let p;e[0]!==d||e[1]!==c?(p=c&&d?Or(c,d):void 0,e[0]=d,e[1]=c,e[2]=p):p=e[2];const v=p;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(_r,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let b;e[4]!==v?(b=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=b):b=e[5];let C;e[6]!==S||e[7]!==h?(C=h?{color:ks}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=h,e[8]=C):C=e[8];let R;e[9]!==C?(R=n.jsx(ln,{className:"h-4 w-4 shrink-0",style:C}),e[9]=C,e[10]=R):R=e[10];const _=r.isHidden&&"line-through opacity-50";let k;e[11]!==_?(k=Be("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=k):k=e[12];let o;e[13]!==r.label||e[14]!==k?(o=n.jsx("span",{className:k,children:r.label}),e[13]=r.label,e[14]=k,e[15]=o):o=e[15];let D;return e[16]!==b||e[17]!==R||e[18]!==o?(D=n.jsxs(n.Fragment,{children:[g,b,R,o]}),e[16]=b,e[17]=R,e[18]=o,e[19]=D):D=e[19],D}function fa(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:c?"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 Ir(m){const e=He.c(64),{section:r,raw:c,meta:d,sortableId:h,selected:S,onSelect:p,onDelete:v,onDuplicate:g,onMakeReusable:b,onToggleHidden:C,onToggleLazy:R,onAddVariant:_,onDetach:k}=m,o=c?Hn(c.__resolveType??""):!1;let D;e[0]!==r?(D=_s(r),e[0]=r,e[1]=D):D=e[1];const l=D;let J;e[2]!==h?(J={id:h,animateLayoutChanges:Gr},e[2]=h,e[3]=J):J=e[3];const{attributes:H,listeners:K,setNodeRef:u,transform:P,isDragging:se}=aa(J);let T;e[4]!==P?(T=sa.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=se?0:void 0;let N;e[6]!==T||e[7]!==pe?(N={transform:T,opacity:pe},e[6]=T,e[7]=pe,e[8]=N):N=e[8];const ce=N;let B;e[9]!==r?(B=js(r),e[9]=r,e[10]=B):B=e[10];const te=B,oe="button",Ce=0;let E;e[11]!==p?(E=$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),p())},e[11]=p,e[12]=E):E=e[12];const ue=se?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Be("touch-none transition-colors",ue,fa(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==d||e[18]!==c||e[19]!==r?(je=n.jsx(ma,{section:r,raw:c,meta:d}),e[17]=d,e[18]=c,e[19]=r,e[20]=je):je=e[20];const M=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Be("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:$=>{$.stopPropagation(),R()},onPointerDown:Wr,children:n.jsx(kr,{className:Be("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==C||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Be("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:$=>{$.stopPropagation(),C()},onPointerDown:Ur,children:r.isHidden?n.jsx(jr,{className:"h-3.5 w-3.5"}):n.jsx(br,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=C,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Qn,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(Gn,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let Ne;e[26]!==g?(Ne=$=>{$.stopPropagation(),g()},e[26]=g,e[27]=Ne):Ne=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(qn,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let re;e[29]!==Ne?(re=n.jsxs(it,{onClick:Ne,children:[ve,"Duplicate"]}),e[29]=Ne,e[30]=re):re=e[30];let G;e[31]!==l||e[32]!==_?(G=l&&n.jsxs(it,{className:ws,onClick:$=>{$.stopPropagation(),_()},children:[n.jsx(Yn,{className:"h-4 w-4"}),"Add variant"]}),e[31]=l,e[32]=_,e[33]=G):G=e[33];let Y;e[34]!==te||e[35]!==b?(Y=te&&n.jsxs(it,{className:Lr,onClick:$=>{$.stopPropagation(),b()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=b,e[36]=Y):Y=e[36];let ne;e[37]!==k||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:$=>{$.stopPropagation(),k()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Detach"]}),e[37]=k,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=$=>{$.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(Jn,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==re||e[47]!==G||e[48]!==Y||e[49]!==ne||e[50]!==Se?(de=n.jsxs(Xn,{children:[X,n.jsxs(Zn,{align:"end",className:"w-44",children:[re,G,Y,ne,Se]})]}),e[46]=re,e[47]=G,e[48]=Y,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let be;return e[52]!==H||e[53]!==K||e[54]!==p||e[55]!==u||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==M||e[60]!==Ae||e[61]!==de||e[62]!==E?(be=n.jsxs("div",{ref:u,style:ce,...H,...K,role:oe,tabIndex:Ce,onClick:p,onKeyDown:E,className:ie,children:[je,M,Ae,de]}),e[52]=H,e[53]=K,e[54]=p,e[55]=u,e[56]=ce,e[57]=ie,e[58]=je,e[59]=M,e[60]=Ae,e[61]=de,e[62]=E,e[63]=be):be=e[63],be}function zr(m){return m.stopPropagation()}function Hr(m){return m.stopPropagation()}function Ur(m){return m.stopPropagation()}function Wr(m){return m.stopPropagation()}function Gr(){return!1}function Yr(m){const e=He.c(90),{listKey:r,rawSections:c,sections:d,meta:h,selectedIndex:S,onSelect:p,onReorder:v,onDelete:g,onDuplicate:b,onMakeReusable:C,onToggleHidden:R,onToggleLazy:_,onAddVariant:k,onDetach:o,onAddSection:D,canAddSection:l}=m,J=l===void 0?!0:l;let H;e[0]!==d.length?(H=()=>$n(d.length),e[0]=d.length,e[1]=H):H=e[1];const[K,u]=w.useState(H),[P,se]=w.useState(null),[T,pe]=w.useState(r),[N,ce]=w.useState(d.length),B=w.useRef(!1);T!==r?(pe(r),ce(d.length),u($n(d.length))):N!==d.length&&(ce(d.length),u(L=>Fr(L,d.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:ra},e[3]=oe):oe=e[3];const Ce=ea(It(na,te),It(ta,oe));let E;e[4]!==K?(E=K.map(qr),e[4]=K,e[5]=E):E=e[5];const ue=E;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=L=>{se(String(L.active.id))},e[6]=ie):ie=e[6];const je=ie;let M;e[7]!==ue||e[8]!==v?(M=L=>{se(null);const{active:ae,over:Q}=L;if(!Q||ae.id===Q.id)return;const Ie=ue.indexOf(String(ae.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(u(Qe=>da(Dt([...Qe],Ie,he))),B.current=!0,requestAnimationFrame(()=>{B.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=M):M=e[9];const Ae=M;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{se(null)},e[10]=X):X=e[10];const Ne=X;let ve,re,G,Y,ne,le,ke,Se,de,be,$,Z,we,Ee,Ke;if(e[11]!==P||e[12]!==J||e[13]!==K||e[14]!==ue||e[15]!==Ae||e[16]!==h||e[17]!==D||e[18]!==k||e[19]!==g||e[20]!==o||e[21]!==b||e[22]!==C||e[23]!==p||e[24]!==R||e[25]!==_||e[26]!==c||e[27]!==d||e[28]!==S||e[29]!==Ce){Ee=Symbol.for("react.early_return_sentinel");e:{const L=ae=>{B.current||p(ae)};if(e[45]!==P||e[46]!==J||e[47]!==K||e[48]!==D||e[49]!==c||e[50]!==d){const ae=P?K.find(Q=>Q.id===P):null;if(Y=ae!=null?d[ae.index]:null,G=ae!=null?c[ae.index]:void 0,K.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!J;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(cn,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==D||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:D,children:[he,"Add section"]})]}),e[56]=D,e[57]=Ie,e[58]=Qe):Qe=e[58],Ee=Qe;break e}we=Be(ae&&"cursor-grabbing"),e[45]=P,e[46]=J,e[47]=K,e[48]=D,e[49]=c,e[50]=d,e[51]=G,e[52]=Y,e[53]=we}else G=e[51],Y=e[52],we=e[53];re=oa,Se=Ce,de=ia,be=je,$=Ae,Z=Ne,ve=la,le=ue,ke=ca,Ke="space-y-1",ne=K.map(ae=>{const Q=d[ae.index];return Q?n.jsx(Ir,{sortableId:ae.id,section:Q,raw:c[ae.index],meta:h,selected:S===ae.index,onSelect:()=>L(ae.index),onDelete:()=>g(ae.index),onDuplicate:()=>b(ae.index),onMakeReusable:()=>C(ae.index),onToggleHidden:()=>R(ae.index),onToggleLazy:()=>_(ae.index),onAddVariant:()=>k(ae.index),onDetach:()=>o(ae.index)},ae.id):null})}e[11]=P,e[12]=J,e[13]=K,e[14]=ue,e[15]=Ae,e[16]=h,e[17]=D,e[18]=k,e[19]=g,e[20]=o,e[21]=b,e[22]=C,e[23]=p,e[24]=R,e[25]=_,e[26]=c,e[27]=d,e[28]=S,e[29]=Ce,e[30]=ve,e[31]=re,e[32]=G,e[33]=Y,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=be,e[40]=$,e[41]=Z,e[42]=we,e[43]=Ee,e[44]=Ke}else ve=e[30],re=e[31],G=e[32],Y=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],be=e[39],$=e[40],Z=e[41],we=e[42],Ee=e[43],Ke=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Le;e[59]!==ne||e[60]!==Ke?(Le=n.jsx("div",{className:Ke,children:ne}),e[59]=ne,e[60]=Ke,e[61]=Le):Le=e[61];let Pe;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Le?(Pe=n.jsx(ve,{items:le,strategy:ke,children:Le}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Le,e[66]=Pe):Pe=e[66];let $e;e[67]!==G||e[68]!==Y||e[69]!==h?($e=Y?n.jsx("div",{className:Be("cursor-grabbing shadow-lg ring-1 ring-border/60",fa(Y,!1)),children:n.jsx(ma,{section:Y,raw:G,meta:h})}):null,e[67]=G,e[68]=Y,e[69]=h,e[70]=$e):$e=e[70];let Fe;e[71]!==$e?(Fe=n.jsx(ua,{dropAnimation:null,children:$e}),e[71]=$e,e[72]=Fe):Fe=e[72];let Me;e[73]!==re||e[74]!==Se||e[75]!==de||e[76]!==be||e[77]!==$||e[78]!==Z||e[79]!==Pe||e[80]!==Fe?(Me=n.jsxs(re,{sensors:Se,collisionDetection:de,onDragStart:be,onDragEnd:$,onDragCancel:Z,children:[Pe,Fe]}),e[73]=re,e[74]=Se,e[75]=de,e[76]=be,e[77]=$,e[78]=Z,e[79]=Pe,e[80]=Fe,e[81]=Me):Me=e[81];const xe=!J;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==D||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:D,children:[Re,"Add section"]}),e[83]=D,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function qr(m){return m.id}function On(m){const e=He.c(38),{open:r,initialName:c,autoLabel:d,isPending:h,onSubmit:S,onOpenChange:p}=m,v=h===void 0?!1:h,[g,b]=w.useState(c),[C,R]=w.useState(r);r!==C&&(R(r),r&&b(c));let _;e[0]!==v||e[1]!==p?(_=oe=>{!oe&&!v&&p(!1)},e[0]=v,e[1]=p,e[2]=_):_=e[2];const k=_;let o;e[3]!==v||e[4]!==g||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(g.trim())},e[3]=v,e[4]=g,e[5]=S,e[6]=o):o=e[6];const D=o;let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(pr,{children:"Rename variant"}),e[7]=l):l=e[7];const J=d||"the rule";let H;e[8]!==J?(H=n.jsxs(hr,{children:[l,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:J}),"."]})]}),e[8]=J,e[9]=H):H=e[9];let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=K):K=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=oe=>b(oe.target.value),e[11]=u):u=e[11];let P;e[12]!==d||e[13]!==v||e[14]!==g?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[K,n.jsx(yr,{id:"variant-rename-name",value:g,onChange:u,placeholder:d,autoFocus:!0,disabled:v})]}),e[12]=d,e[13]=v,e[14]=g,e[15]=P):P=e[15];let se;e[16]!==p?(se=()=>p(!1),e[16]=p,e[17]=se):se=e[17];let T;e[18]!==v||e[19]!==se?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:se,disabled:v,children:"Cancel"}),e[18]=v,e[19]=se,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(zn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let N;e[23]!==v||e[24]!==pe?(N=n.jsx(Ge,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=N):N=e[25];let ce;e[26]!==T||e[27]!==N?(ce=n.jsxs(vr,{children:[T,N]}),e[26]=T,e[27]=N,e[28]=ce):ce=e[28];let B;e[29]!==D||e[30]!==ce||e[31]!==H||e[32]!==P?(B=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:D,children:[H,P,ce]})}),e[29]=D,e[30]=ce,e[31]=H,e[32]=P,e[33]=B):B=e[33];let te;return e[34]!==k||e[35]!==r||e[36]!==B?(te=n.jsx(xr,{open:r,onOpenChange:k,children:B}),e[34]=k,e[35]=r,e[36]=B,e[37]=te):te=e[37],te}const Jr="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)]",pa="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 ha(m){const e=He.c(5),{rule:r,matchers:c}=m,d=r?.__resolveType??"";let h;if(e[0]!==c||e[1]!==d){const g=c.find(b=>b.resolveType===d)?.iconName??Rs(d);h=ur(g),e[0]=c,e[1]=d,e[2]=h}else h=e[2];const S=h;if(!S)return null;let p;return e[3]!==S?(p=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=p):p=e[4],p}function Bn(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
+ `)}function on(m){return m.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(m){return m.map((e,r)=>({...e,index:r}))}function ga(m){const e=He.c(16),{label:r,effectiveRule:c,matchers:d,canDelete:h,dragging:S,onRename:p,onDuplicate:v,onDelete:g}=m;let b;e[0]!==c||e[1]!==d?(b=n.jsx(ha,{rule:c,matchers:d}),e[0]=c,e[1]=d,e[2]=b):b=e[2];let C;e[3]!==r?(C=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=C):C=e[4];let R;e[5]!==h||e[6]!==S||e[7]!==r||e[8]!==g||e[9]!==v||e[10]!==p?(R=!S&&n.jsxs(Xn,{children:[n.jsx(Qn,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":`Actions for ${r}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:Zr,onPointerDown:Xr,children:n.jsx(Gn,{size:14})})}),n.jsxs(Zn,{align:"end",className:"w-36",children:[n.jsxs(it,{onClick:k=>{k.stopPropagation(),p?.()},children:[n.jsx(Mr,{size:14}),"Rename"]}),n.jsxs(it,{onClick:k=>{k.stopPropagation(),v?.()},children:[n.jsx(qn,{size:14}),"Duplicate"]}),n.jsx(wr,{}),n.jsxs(it,{variant:"destructive",disabled:!h,onClick:k=>{k.stopPropagation(),g?.()},children:[n.jsx(Jn,{size:14}),"Delete"]})]})]}),e[5]=h,e[6]=S,e[7]=r,e[8]=g,e[9]=v,e[10]=p,e[11]=R):R=e[11];let _;return e[12]!==b||e[13]!==C||e[14]!==R?(_=n.jsxs(n.Fragment,{children:[b,C,R]}),e[12]=b,e[13]=C,e[14]=R,e[15]=_):_=e[15],_}function Xr(m){return m.stopPropagation()}function Zr(m){return m.stopPropagation()}function eo(m){const e=He.c(33),{entry:r,sortableId:c,isActive:d,canDelete:h,decofile:S,meta:p,matchers:v,onSelect:g,onRename:b,onDuplicate:C,onDelete:R}=m;let _;e[0]!==c?(_={id:c,animateLayoutChanges:to},e[0]=c,e[1]=_):_=e[1];const{attributes:k,listeners:o,setNodeRef:D,transform:l,isDragging:J}=aa(_);let H;e[2]!==l?(H=sa.Transform.toString(l?{...l,x:0}:null),e[2]=l,e[3]=H):H=e[3];const K=J?0:void 0;let u;e[4]!==H||e[5]!==K?(u={transform:H,opacity:K},e[4]=H,e[5]=K,e[6]=u):u=e[6];const P=u,se=p??void 0;let T;e[7]!==S||e[8]!==r.variant.rule||e[9]!==se?(T=Rt(r.variant.rule,S,se),e[7]=S,e[8]=r.variant.rule,e[9]=se,e[10]=T):T=e[10];const pe=T;let N;e[11]!==g?(N=E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),g())},e[11]=g,e[12]=N):N=e[12];const ce=J?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",B=d?pa:Jr;let te;e[13]!==ce||e[14]!==B?(te=Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,B),e[13]=ce,e[14]=B,e[15]=te):te=e[15];let oe;e[16]!==h||e[17]!==pe||e[18]!==r.variant.label||e[19]!==v||e[20]!==R||e[21]!==C||e[22]!==b?(oe=n.jsx(ga,{label:r.variant.label,effectiveRule:pe,matchers:v,canDelete:h,onRename:b,onDuplicate:C,onDelete:R}),e[16]=h,e[17]=pe,e[18]=r.variant.label,e[19]=v,e[20]=R,e[21]=C,e[22]=b,e[23]=oe):oe=e[23];let Ce;return e[24]!==k||e[25]!==o||e[26]!==g||e[27]!==D||e[28]!==P||e[29]!==te||e[30]!==oe||e[31]!==N?(Ce=n.jsx("div",{ref:D,style:P,...k,...o,onClick:g,onKeyDown:N,className:te,children:oe}),e[24]=k,e[25]=o,e[26]=g,e[27]=D,e[28]=P,e[29]=te,e[30]=oe,e[31]=N,e[32]=Ce):Ce=e[32],Ce}function to(){return!1}function no(m){const e=He.c(9),{variant:r,decofile:c,meta:d,matchers:h}=m,S=d??void 0;let p;e[0]!==c||e[1]!==S||e[2]!==r.rule?(p=Rt(r.rule,c,S),e[0]=c,e[1]=S,e[2]=r.rule,e[3]=p):p=e[3];const v=p;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=Be("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",pa),e[4]=g):g=e[4];let b;return e[5]!==v||e[6]!==h||e[7]!==r.label?(b=n.jsx("div",{className:g,children:n.jsx(ga,{label:r.label,effectiveRule:v,matchers:h,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=h,e[7]=r.label,e[8]=b):b=e[8],b}function ao(m){const e=He.c(77),{listKey:r,variants:c,activeIndex:d,decofile:h,meta:S,matchers:p,onSelect:v,onReorder:g,onRename:b,onDuplicate:C,onDelete:R,onAdd:_}=m;let k;e[0]!==c?(k=()=>on(c),e[0]=c,e[1]=k):k=e[1];const[o,D]=w.useState(k),[l,J]=w.useState(null),[H,K]=w.useState(r),[u,P]=w.useState(c.length);let se;e[2]!==c?(se=()=>Bn(c),e[2]=c,e[3]=se):se=e[3];const[T,pe]=w.useState(se),N=w.useRef(!1),ce=Bn(c);H!==r?(K(r),P(c.length),pe(ce),D(on(c))):u!==c.length?(P(c.length),pe(ce),D(on(c))):T!==ce&&(pe(ce),D(Me=>c.map((xe,Re)=>({id:Me[Re]?.id??crypto.randomUUID(),index:Re,variant:xe}))));let B;e[4]===Symbol.for("react.memo_cache_sentinel")?(B={activationConstraint:{distance:8}},e[4]=B):B=e[4];let te;e[5]===Symbol.for("react.memo_cache_sentinel")?(te={coordinateGetter:ra},e[5]=te):te=e[5];const oe=ea(It(na,B),It(ta,te));let Ce;e[6]!==o?(Ce=o.map(so),e[6]=o,e[7]=Ce):Ce=e[7];const E=Ce,ue=c.length>1;let ie;e[8]!==o?(ie=Me=>{const xe=String(Me.active.id);J(o.find(Re=>Re.id===xe)??null)},e[8]=o,e[9]=ie):ie=e[9];const je=ie;let M;e[10]!==E||e[11]!==g?(M=Me=>{J(null);const{active:xe,over:Re}=Me;if(!Re||xe.id===Re.id)return;const me=E.indexOf(String(xe.id)),ee=E.indexOf(String(Re.id));me===-1||ee===-1||(D(L=>Qr(Dt([...L],me,ee))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),g(me,ee))},e[10]=E,e[11]=g,e[12]=M):M=e[12];const Ae=M;let X;e[13]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{J(null)},e[13]=X):X=e[13];const Ne=X;let ve,re,G,Y,ne,le,ke,Se,de,be,$,Z,we;if(e[14]!==d||e[15]!==ue||e[16]!==h||e[17]!==o||e[18]!==E||e[19]!==Ae||e[20]!==je||e[21]!==p||e[22]!==S||e[23]!==_||e[24]!==R||e[25]!==C||e[26]!==b||e[27]!==v||e[28]!==oe){const Me=L=>{N.current||v(L)};$="space-y-1 border-b p-2";let xe;e[42]===Symbol.for("react.memo_cache_sentinel")?(xe=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[42]=xe):xe=e[42];let Re;e[43]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[43]=Re):Re=e[43];let me;e[44]!==_?(me=n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:_,children:Re})}),e[44]=_,e[45]=me):me=e[45];let ee;e[46]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(pt,{children:"Add variant"}),e[46]=ee):ee=e[46],e[47]!==me?(Z=n.jsxs("div",{className:"flex items-center justify-between",children:[xe,n.jsxs(mt,{children:[me,ee]})]}),e[47]=me,e[48]=Z):Z=e[48],re=oa,le=oe,ke=ia,Se=je,de=Ae,be=Ne,ve=la,Y=E,ne=ca,we="space-y-0.5",G=o.map(L=>n.jsx(eo,{sortableId:L.id,entry:L,isActive:L.index===d,canDelete:ue,decofile:h,meta:S,matchers:p,onSelect:()=>Me(L.index),onRename:()=>b(L.index),onDuplicate:()=>C(L.index),onDelete:()=>R(L.index)},L.id)),e[14]=d,e[15]=ue,e[16]=h,e[17]=o,e[18]=E,e[19]=Ae,e[20]=je,e[21]=p,e[22]=S,e[23]=_,e[24]=R,e[25]=C,e[26]=b,e[27]=v,e[28]=oe,e[29]=ve,e[30]=re,e[31]=G,e[32]=Y,e[33]=ne,e[34]=le,e[35]=ke,e[36]=Se,e[37]=de,e[38]=be,e[39]=$,e[40]=Z,e[41]=we}else ve=e[29],re=e[30],G=e[31],Y=e[32],ne=e[33],le=e[34],ke=e[35],Se=e[36],de=e[37],be=e[38],$=e[39],Z=e[40],we=e[41];let Ee;e[49]!==G||e[50]!==we?(Ee=n.jsx("div",{className:we,children:G}),e[49]=G,e[50]=we,e[51]=Ee):Ee=e[51];let Ke;e[52]!==ve||e[53]!==Y||e[54]!==ne||e[55]!==Ee?(Ke=n.jsx(ve,{items:Y,strategy:ne,children:Ee}),e[52]=ve,e[53]=Y,e[54]=ne,e[55]=Ee,e[56]=Ke):Ke=e[56];let Le;e[57]!==l||e[58]!==h||e[59]!==p||e[60]!==S?(Le=l?n.jsx(no,{variant:l.variant,decofile:h,meta:S,matchers:p}):null,e[57]=l,e[58]=h,e[59]=p,e[60]=S,e[61]=Le):Le=e[61];let Pe;e[62]!==Le?(Pe=n.jsx(ua,{dropAnimation:null,children:Le}),e[62]=Le,e[63]=Pe):Pe=e[63];let $e;e[64]!==re||e[65]!==le||e[66]!==ke||e[67]!==Se||e[68]!==de||e[69]!==be||e[70]!==Ke||e[71]!==Pe?($e=n.jsxs(re,{sensors:le,collisionDetection:ke,onDragStart:Se,onDragEnd:de,onDragCancel:be,children:[Ke,Pe]}),e[64]=re,e[65]=le,e[66]=ke,e[67]=Se,e[68]=de,e[69]=be,e[70]=Ke,e[71]=Pe,e[72]=$e):$e=e[72];let Fe;return e[73]!==$||e[74]!==Z||e[75]!==$e?(Fe=n.jsxs("div",{className:$,children:[Z,$e]}),e[73]=$,e[74]=Z,e[75]=$e,e[76]=Fe):Fe=e[76],Fe}function so(m){return m.id}function Ln(m){const e=He.c(15),{schema:r,value:c,onChange:d,meta:h,decofile:S,onSaveReferencedBlock:p,sandbox:v}=m;let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[b,C]=w.useState(g);let R;e[1]!==b?(R=b.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>C([]),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:"Back to rule",children:n.jsx(lr,{className:"size-3.5"})}),b.map((o,D)=>{const l=D===b.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[D>0&&n.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>C(b.slice(0,D+1)),title:o,className:Be("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:o})]},`${o}-${D}`)})]}),e[1]=b,e[2]=R):R=e[2];let _;e[3]!==b||e[4]!==S||e[5]!==h||e[6]!==d||e[7]!==p||e[8]!==v||e[9]!==r||e[10]!==c?(_=n.jsx(Un,{schema:r,value:c,onChange:d,basePath:"",breadcrumbPath:b,onBreadcrumbChange:C,meta:h,decofile:S,onSaveReferencedBlock:p,sandbox:v}),e[3]=b,e[4]=S,e[5]=h,e[6]=d,e[7]=p,e[8]=v,e[9]=r,e[10]=c,e[11]=_):_=e[11];let k;return e[12]!==R||e[13]!==_?(k=n.jsxs("div",{className:"space-y-2",children:[R,_]}),e[12]=R,e[13]=_,e[14]=k):k=e[14],k}function Fn(m){const e=He.c(21),{activeSchema:r,formValue:c,formResetKey:d,onFormChange:h,onBreadcrumbChange:S,breadcrumbPath:p,emptyMessage:v,beforeForm:g,seoResolveType:b,siteDefaultSeo:C,meta:R,decofile:_,onSaveReferencedBlock:k,sandbox:o}=m;let D;e[0]!==p?(D=p===void 0?[]:p,e[0]=p,e[1]=D):D=e[1];const l=D;let J;e[2]!==r||e[3]!==l||e[4]!==_||e[5]!==d||e[6]!==c||e[7]!==R||e[8]!==S||e[9]!==h||e[10]!==k||e[11]!==o||e[12]!==b||e[13]!==C?(J=r&&c?b?n.jsx(Ar,{schema:r,resolveType:b,value:c,formResetKey:d,onChange:h,onBreadcrumbChange:S,siteDefaultSeo:C}):n.jsx(Un,{schema:r,value:c,onChange:h,basePath:"",breadcrumbPath:l,onBreadcrumbChange:S,meta:R,decofile:_,onSaveReferencedBlock:k,sandbox:o},d):null,e[2]=r,e[3]=l,e[4]=_,e[5]=d,e[6]=c,e[7]=R,e[8]=S,e[9]=h,e[10]=k,e[11]=o,e[12]=b,e[13]=C,e[14]=J):J=e[14];const H=J;let K;e[15]!==v||e[16]!==H?(K=H??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=H,e[17]=K):K=e[17];let u;return e[18]!==g||e[19]!==K?(u=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[g,K]})}),e[18]=g,e[19]=K,e[20]=u):u=e[20],u}const ro="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 oo(m,e){return Is(m,e,et)}function io(m){const e=He.c(13),{pageKey:r,initialName:c,initialPath:d,onFieldChange:h}=m,[S,p]=w.useState(c),[v,g]=w.useState(d),[b,C]=w.useState(r);b!==r&&(C(r),p(c),g(d));let R;e[0]!==h?(R=l=>{p(l.target.value),h("name",l.target.value)},e[0]=h,e[1]=R):R=e[1];let _;e[2]!==S||e[3]!==R?(_=n.jsx("input",{type:"text",value:S,onChange:R,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=S,e[3]=R,e[4]=_):_=e[4];let k;e[5]!==h?(k=l=>{g(l.target.value),h("path",l.target.value)},e[5]=h,e[6]=k):k=e[6];let o;e[7]!==v||e[8]!==k?(o=n.jsx("input",{type:"text",value:v,onChange:k,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:"/path"}),e[7]=v,e[8]=k,e[9]=o):o=e[9];let D;return e[10]!==_||e[11]!==o?(D=n.jsxs("div",{className:"space-y-1",children:[_,o]}),e[10]=_,e[11]=o,e[12]=D):D=e[12],D}function In(m){const e=He.c(6),{onClick:r}=m;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Yn,{size:14}),e[0]=c):c=e[0];let d;e[1]!==r?(d=n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:c})}),e[1]=r,e[2]=d):d=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[3]=h):h=e[3];let S;return e[4]!==d?(S=n.jsxs(mt,{children:[d,h]}),e[4]=d,e[5]=S):S=e[5],S}function Wl({orgSlug:m,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:d,currentPath:h,activePageBlockKey:S=null,activeGlobalBlockKey:p=null,externalSelectedIndex:v,onSaved:g,initialEditSeo:b=!1,onExitSeo:C,onViewJsonFile:R,onVariantPreviewOverride:_}){const k=c?{orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d}:null,{data:o,isLoading:D}=Ds(k),{data:l,isLoading:J}=Ns(k),H=Vs(),K=H?.entity?.id===e?H.entity.metadata?.siteSlug??null:null,[u,P]=w.useState(null),[se,T]=w.useState(null),[pe,N]=w.useState(null),[ce,B]=w.useState(0),[te,oe]=w.useState(void 0),[Ce,E]=w.useState(null),[ue,ie]=w.useState(null),[je,M]=w.useState([]),[Ae,X]=w.useState(0),[Ne,ve]=w.useState(null),[re,G]=w.useState(null),[Y,ne]=w.useState(null),[le,ke]=w.useState(!0),[Se,de]=w.useState(!1),[be,$]=w.useState(!1),[Z,we]=w.useState(b),[Ee,Ke]=w.useState(b);b&&!Ee&&(Ke(!0),we(!0),P(null),T(null),N(null),M([])),!b&&Ee&&Ke(!1);const[Le,Pe]=w.useState(null),[$e,Fe]=w.useState(void 0),[Me,xe]=w.useState([]),[Re,me]=w.useState(0),[ee,L]=w.useState(0),[ae,Q]=w.useState(null),[Ie,he]=w.useState(null),[Qe,un]=w.useState(null),va=vs(),Sa=`${m}/${e}/${r}`,zt=Cs({orgSlug:m,virtualMcpId:e,branch:r}),[xa,ya]=w.useState(h),[ba,_a]=w.useState(S),[ja,ka]=w.useState(p);(xa!==h||ba!==S||ja!==p)&&(queueMicrotask(()=>zt.flush()),ya(h),_a(S),ka(p),P(null),T(null),N(null),B(0),E(null),ie(null),L(0),Q(null),he(null),M([]),X(t=>t+1),we(!1),Pe(null),Fe(void 0),xe([]),me(t=>t+1));const ye=Ps({orgSlug:m,virtualMcpId:e,branch:r}),Nt=Qs((t,a)=>{ye.mutate({blockKey:t,data:a},{onSuccess:()=>g?.(),onError:s=>W.error(`Save failed: ${s.message}`)})}),Ht=Ts({orgSlug:m,virtualMcpId:e,branch:r}),[bt,Vt]=w.useState(!1),Ut=w.useRef(null),ht=w.useRef(null),gt=w.useRef(null),Wt=w.useRef({}),Ye=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||D||J)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(zn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!l)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const wa=As(o),_e=!!p,ze=_e?null:Ms(wa,h,S),j=_e?p:ze?.key??null,Gt=_e&&p?o[p]:void 0,dn=_e&&p&&Gt?Es(p,Gt):_e&&p?p:"",Ct=!_e&&j&&o[j]?o[j]:null,Yt=Z&&o&&l&&j&&ze?Kn(o,{kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},l):null,Ra=Z?Ct?.seo:void 0,qt=$e!==void 0?$e:Ra,Da=Z?Rr(qt):void 0,Na=Yt?.seoTypeOptions??[],Va=Z&&l?Dr(l):"",mn=Le??Da??{},Jt=Z&&Yt?Nr(mn,Yt):null,Ca=Z&&Jt&&Vr(qt)?$t(Jt,l):null,Pa=Z?Cr(o,l)?.seoData:void 0,Oe=_e?[{label:"Default",sections:[{__resolveType:p}]}]:oo(Ct?.sections,o??{}),Pt=Oe.length>1,Ve=Math.min(ce,Oe.length-1),tt=Oe[Ve],I=tt?.sections??[],Te=Ot(I,o),fn=!_e&&Ks(Ct?.sections);if(_e&&p&&Qe!==p){un(p);const t=I[0],a=Te[0];if(t&&a){P(0),L(0),M([]);const s=ut(t,a,o);s&&(T(s.data),N(s.resolveType),he(null),Q(null))}}!_e&&Qe!==null&&un(null),Ye.current={rawSections:I,parsedSections:Te,decofile:o??{},activePageKey:j,pageVariants:Oe,variantIndex:Ve,sectionVariantIndex:ee,selectedSectionIndex:u};const Ta=()=>({multivariate:fn,index:Ve,variants:Oe.map(t=>({rule:t.rule}))}),pn=(t,a)=>{if(!_)return;if(!j||!fn||t.length<=1){_(null);return}const s=Mn(j,{multivariate:!0,index:a,variants:t},o,l);_(s.length>0?s:null)},vt=(t,a,s)=>{if(!_)return;if(!j){_(null);return}const i=Ta(),f=Mn(j,i,o,l);if(!t||a<0){_(f.length>0?f:null);return}const y=nr({pageKey:j,page:i,sectionIndex:a,sectionLazy:Te[a]?.isLazy??!1,mvObj:t,selectedVariantIndex:s,decofile:o,meta:l}),x=[...f,...y];_(x.length>0?x:null)},nt=(t,a,s,i=u??-1,f=!1)=>{const y=Je(t,a);if(!y){T(null),N(null),he(null),Q(null),f&&vt(null,i,s);return}const V=Vn(y,et)[s];if(!V){T(null),N(null),he(null),Q(null),f&&vt(null,i,s);return}const q=zs(V.value,o);T(q?.data??null),N(q?.resolveType??null);const{resolveType:A,formValue:O}=jt(V.rule,o,l??void 0);he(A),Q(O),f&&vt(y,i,s)};if(v!==void 0&&v!==te&&(oe(v??null),typeof v=="number")){const t=I[v],a=Te[v];if(t&&a)if(P(v),L(0),M([]),X(s=>s+1),a.isMultivariate)nt(t,a,0,v);else{const s=ut(t,a,o);s?(T(s.data),N(s.resolveType)):(T(null),N(null)),he(null),Q(null)}}const Tt={orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d??void 0,siteSlug:K},Qt=pe&&l?$t(pe,l):null,Ue=(t,a)=>{if(!j)return;const s=wt(o,j,t,Ve,Oe);ye.mutate({blockKey:j,data:s},{onSuccess:()=>a?.onSuccess?.()??g?.(),onError:i=>W.error(`Save failed: ${i.message}`)})},St=()=>{P(null),T(null),N(null),L(0),Q(null),he(null),M([]),X(t=>t+1)},Aa=(t,a)=>{Ut.current&&clearTimeout(Ut.current);const s=Ye.current.sectionVariantIndex;Ut.current=setTimeout(()=>{const{rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current,A=i[a];if(!A)return;const O=f[a];if(!O)return;if(O.isSavedBlock){const z=O.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;ye.mutate({blockKey:z,data:t},{onSuccess:()=>g?.(),onError:U=>W.error(`Save failed: ${U.message}`)});return}if(!x)return;const F={...y[x]},ge=[...i];if(O.isMultivariate){const z=Je(A,O);if(!z||!x)return;const U=sr(z,s,t);ge[a]=dt(A,O,U)}else if(O.isHidden){const z=Hn(A.__resolveType),U=z?{...A.section}:{...A},De=Array.isArray(U.variants)?[...U.variants]:[];De[0]&&(De[0]={...De[0],value:t}),U.variants=De,z?ge[a]={...A,section:U}:ge[a]=U}else O.isLazy?ge[a]={...A,section:t}:ge[a]=t;if(V.length>1){const z=F.sections,U=[...z?.variants??[]];U[q]&&(U[q]={...U[q],value:ge}),F.sections={...z,variants:U}}else F.sections=ge;ye.mutate({blockKey:x,data:F},{onSuccess:()=>g?.(),onError:z=>W.error(`Save failed: ${z.message}`)})},rn)},Ma=t=>{P(t),L(0),M([]),X(f=>f+1);const a=I[t],s=Te[t];if(!a||!s)return;if(s.isMultivariate){nt(a,s,0,t);return}const i=ut(a,s,o);if(!i){T(null),N(null),he(null),Q(null),vt(null,t,0);return}T(i.data),N(i.resolveType),he(null),Q(null),vt(null,t,0)},hn=t=>{const a=t;T(a),u!==null&&Aa(a,u)},Xt=t=>{if(!j||!o||!l||!ze)return;const a={kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},s=Kn(o,a,l);s&&zt.save(j,()=>{const i=va.getQueryData(Ss.decofile(Sa))?.[j];if(!i||typeof i!="object"||i===null||Array.isArray(i))return null;const f={...i,...Wt.current};return Wt.current={},t?.raw!==void 0?{...f,seo:t.raw}:t?.inner!==void 0?Tr(a,s,f,t.inner):f})},Ea=(t,a)=>{j&&(Wt.current[t]=a,Xt())},Ka=(t,a)=>{if(!j)return;const s=Dt([...I],t,a);u!==null&&(u===t?P(a):t<u&&a>=u?P(u-1):t>u&&a<=u&&P(u+1)),Ue(s)},$a=t=>{if(!j)return;const a=I.filter((s,i)=>i!==t);u===t?St():u!==null&&u>t&&P(u-1),Ue(a)},Oa=t=>{if(!j)return;const a=I[t];if(!a)return;const s=[...I];s.splice(t+1,0,tr(a)),u!==null&&u>t&&P(u+1),Ue(s)},Ba=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s||s.isMultivariate)return;const i=s.isHidden?Zs(a):er(a);if(!i)return;const f=[...I];f[t]=i,u===t&&St(),Ue(f)},La=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s||s.isMultivariate)return;const i=Xs(a);if(!i)return;const f=[...I];f[t]=i,u===t&&St(),Ue(f)},Fa=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s?.isSavedBlock)return;const i=ut(a,s,o);if(!i?.data)return;const{name:f,...y}=i.data,x=[...I];s.isLazy?x[t]={...a,section:y}:x[t]=y,u===t&&St(),Ue(x)},Ia=t=>{if(!j)return;const a=[...I,{__resolveType:t.resolveType}],s=a.length-1;Ue(a,{onSuccess:()=>{de(!1),P(s),L(0),M([]),X(x=>x+1);const i=a[s],f=Ot(a,o)[s];if(!i||!f)return;if(f.isMultivariate){nt(i,f,0);return}const y=ut(i,f,o);if(!y){T(null),N(null),he(null),Q(null);return}T(y.data),N(y.resolveType),he(null),Q(null)}})},za=t=>{if(u===null)return;const a=I[u],s=Te[u];!a||!s?.isMultivariate||(L(t),M([]),X(i=>i+1),nt(a,s,t,u,!0))},Ha=t=>{if(u===null||!j)return;const a=I[u],s=Te[u];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const f=qs(i,t);if(!f){W.error("Cannot delete the only variant.");return}const y=[...I];y[u]=dt(a,s,f);const x=f.variants;let V=ee;t===ee?V=Math.min(t,x.length-1):t<ee&&(V=ee-1),L(V),M([]),X(q=>q+1),nt(y[u],s,V),Ue(y)},Ua=t=>{if(u===null||!j)return;const a=I[u],s=Te[u];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const f=Js(i,t),y=[...I];y[u]=dt(a,s,f);const x=t+1;L(x),M([]),X(V=>V+1),nt(y[u],s,x),Ue(y)},Wa=(t,a)=>{if(u===null||!j||t===a)return;const s=I[u],i=Te[u];if(!s||!i?.isMultivariate)return;const f=Je(s,i);if(!f)return;const y=Gs(f,t,a),x=[...I];x[u]=dt(s,i,y);let V=ee;ee===t?V=a:t<ee&&a>=ee?V=ee-1:t>ee&&a<=ee&&(V=ee+1),L(V),nt(x[u],i,V),Ue(x)},Zt=t=>{const a=t??u;if(a===null||!j)return;const s=I[a],i=Te[a];if(!s||!i)return;const f=Hs(s,i);if(!f){W.error("This section cannot have variants.");return}const y=[...I];y[a]=f.section;const x=Ot(y,o)[a];if(!x?.isMultivariate){W.error("Could not add variant.");return}P(a),L(f.newVariantIndex),M([]),X(V=>V+1),nt(f.section,x,f.newVariantIndex,a),Ue(y)},Ga=()=>{if(u===null||!j)return;const t=I[u],a=Te[u];if(!t||!a?.isMultivariate)return;const s=Je(t,a);if(!s)return;const i=Ys(t,a,s);if(!i){W.error("Could not remove variants.");return}const f=[...I];f[u]=i;const y=Ot(f,o)[u];if(!y)return;L(0),he(null),Q(null),M([]),X(V=>V+1);const x=ut(i,y,o);x?(T(x.data),N(x.resolveType)):(T(null),N(null)),vt(null,u,0),Ue(f)},Ya=async t=>{if(Ne===null||!j)return;const a=sn(t,o);if(a){W.error(a);return}const s=I[Ne],i=Te[Ne];if(!s||!i)return;const f=ut(s,i,o);if(!f){W.error("This section cannot be saved as global.");return}const y={...f.data,name:t};try{await ye.mutateAsync({blockKey:t,data:y});const x=[...I];x[Ne]={__resolveType:t},await ye.mutateAsync({blockKey:j,data:wt(o,j,x,Ve,Oe)}),u===Ne&&St(),ve(null),W.success(`Saved global block "${t}"`),g?.()}catch(x){W.error(x instanceof Error?x.message:"Failed to save global block")}},gn=tt?.rule;if(Pt&&u===null&&ue===null&&gn){const{resolveType:t,formValue:a}=jt(gn,o??{},l??void 0);ie(t),E(a)}const At=l?$s(l):[],vn=l&&o?Os(l,o):[],qa=!_e&&!!(d&&l&&o),Sn=ue&&l?$t(ue,l):null,Mt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},_t=async(t,a)=>{if(!(ar(a,t,l)>0))try{await Ht.mutateAsync({blockKey:t})}catch(s){W.error(s instanceof Error?s.message:"Could not delete matcher block")}},xn=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:a,decofile:s,variantIndex:i}=Ye.current;if(!a)return;const f={...s[a]},y={...f.sections},x=[...y.variants??[]],V=x[i],q=V?.rule;if(xt(q,s,l)){const A=q?.__resolveType??"",O=s[A],F=typeof O?.name=="string"?O.name:A,{__resolveType:ge,...z}=t;ye.mutate({blockKey:A,data:yt(ge??"",z,F)},{onSuccess:()=>g?.(),onError:U=>W.error(`Save failed: ${U.message}`)});return}V&&(x[i]={...V,rule:t}),f.sections={...y,variants:x},ye.mutate({blockKey:a,data:f},{onSuccess:()=>g?.(),onError:A=>W.error(`Save failed: ${A.message}`)})},rn)},Ja=t=>{ie(t);const a=t?{__resolveType:t}:{__resolveType:En};E({}),xn(a)},Qa=t=>{const a=t;E(a);const s=ue?{__resolveType:ue,...a}:{...a};xn(s)},Xa=async t=>{Mt();const{activePageKey:a,decofile:s,variantIndex:i}=Ye.current;if(!a)return;const f=s[a],y=f?.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const x=y;if(!Array.isArray(x.variants))return;const V=[...x.variants],q=V[i];if(!q)return;const A=kt(q.rule,s,l),O=Lt(t);V[i]={...q,rule:O};const F={...s,[a]:{...f,sections:{...x,variants:V}}},{resolveType:ge,formValue:z}=jt(O,F,l??void 0);ie(ge),E(z);try{await ye.mutateAsync({blockKey:a,data:F[a]}),A&&A!==t&&await _t(A,F),g?.()}catch(U){W.error(U instanceof Error?U.message:"Could not apply saved rule")}},yn=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:a,sectionVariantIndex:s}=Ye.current;a!==null&&(gt.current=setTimeout(()=>{const{rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current;if(!x)return;const A=i[a],O=f[a];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const z=(F.variants??[])[s]?.rule;if(xt(z,y,l)){const fe=z?.__resolveType??"",We=y[fe],Xe=typeof We?.name=="string"?We.name:fe,{__resolveType:rt,...Ze}=t;ye.mutate({blockKey:fe,data:yt(rt??"",Ze,Xe)},{onSuccess:()=>g?.(),onError:ot=>W.error(`Save failed: ${ot.message}`)});return}const U=Pn(F,s,t),De=[...i];De[a]=dt(A,O,U);const qe=wt(y,x,De,q,V);ye.mutate({blockKey:x,data:qe},{onSuccess:()=>g?.(),onError:fe=>W.error(`Save failed: ${fe.message}`)})},rn))},Za=t=>{he(t),Q({}),yn(t?{__resolveType:t}:{__resolveType:En})},es=t=>{const a=t;Q(a);const s=Ie?{__resolveType:Ie,...a}:{...a};yn(s)},ts=async t=>{Mt();const{selectedSectionIndex:a,sectionVariantIndex:s,rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current;if(a===null||!x)return;const A=i[a],O=f[a];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const ge=F.variants??[],z=kt(ge[s]?.rule,y,l),U=Lt(t),De=Pn(F,s,U),qe=[...i];qe[a]=dt(A,O,De);const fe=wt(y,x,qe,q,V),We={...y,[x]:fe},{resolveType:Xe,formValue:rt}=jt(U,We,l??void 0);he(Xe),Q(rt);try{await ye.mutateAsync({blockKey:x,data:fe}),z&&z!==t&&await _t(z,We),g?.()}catch(Ze){W.error(Ze instanceof Error?Ze.message:"Could not apply saved rule")}};if(!_e&&!ze)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",h]});if(_e&&!Gt)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const at=u!==null?Te[u]??null:null,bn=u!==null?I[u]:null,_n=bn&&at?.isMultivariate?Je(bn,at):null,lt=_n?Vn(_n,et):[],en=Math.min(ee,Math.max(lt.length-1,0)),Et=lt[en]??null,ct=at?.isMultivariate===!0,jn=u!==null&&at!==null,Kt=jn&&(ct||!!(Qt&&se)),ns=Kt&&!_e&&at?.isSavedBlock===!0,st=_e||ns,as=_e?dn:at?.label??"",kn=Ie&&l?$t(Ie,l):null,tn=Kt&&(!_e||je.length>0)?_e?[dn,...je]:[ze.name,at.label,...ct&&Et?[Et.label]:[],...je]:[],ss=Z&&ze?[ze.name,"SEO",...Me]:[],wn=Z?ss:st?tn.length>0?tn:[as]:tn,Rn=()=>{if(!j)return;const t=o[j],a=Us(t.sections,I);if(!a)return;const s=Ws(a);ye.mutate({blockKey:j,data:{...t,sections:a}},{onSuccess:()=>{B(s),P(null),T(null),N(null),M([]),E(null),ie(null)},onError:i=>W.error(`Save failed: ${i.message}`)})},nn=(t,a,s)=>{if(!j)return;const i=o[j],f=i.sections;if(!f||typeof f!="object"||Array.isArray(f))return;const y=f;if(!Array.isArray(y.variants))return;const x=t([...y.variants]);if(!x)return;const V=rr(y,x),q={...o,[j]:{...i,sections:V}};ye.mutate({blockKey:j,data:q[j]},{onSuccess:()=>{a?.(),s&&_t(s,q)},onError:A=>W.error(`Save failed: ${A.message}`)})},rs=t=>{G(null),B(t),P(null),T(null),N(null),M([]);const a=Oe[t]?.rule,{resolveType:s,formValue:i}=jt(a,o??{},l??void 0);ie(s),E(i),pn(Oe.map(f=>({rule:f.rule})),t)},os=(t,a)=>{if(t===a)return;let s=Ve;Ve===t?s=a:t<Ve&&a>=Ve?s=Ve-1:t>Ve&&a<=Ve&&(s=Ve+1),B(s);const i=Dt(Oe.map(f=>({rule:f.rule})),t,a);pn(i,s),nn(f=>Dt(f,t,a))},is=t=>{const a=Oe[t]?.rule,s=kt(a,o??{},l??void 0);nn(i=>i.length<=1?null:(i.splice(t,1),i),()=>{Oe.length-1===1?B(0):t<Ve?B(Ve-1):t===Ve&&B(Math.max(0,t-1)),P(null),T(null),N(null),M([]),E(null),ie(null)},s)},ls=t=>{nn(a=>or(a,t),()=>{B(t+1),P(null),T(null),N(null),M([]),E(null),ie(null)})},cs=async(t,a)=>{Mt();const s=Ye.current.activePageKey,i=Ye.current.decofile;if(!s)return;const f=i[s],y=f.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const x=y;if(!Array.isArray(x.variants))return;const V=[...x.variants],q=V[t];if(!q?.rule||typeof q.rule!="object"){W.error("This variant has no matcher rule to rename.");return}const A=q.rule,O=a.trim();Vt(!0);try{if(!O){if(!xt(A,i,l)){G(null);return}const qe=A.__resolveType??"";V[t]={...q,rule:Tn(A,i,l)};const fe={...i,[s]:{...f,sections:{...x,variants:V}}};await ye.mutateAsync({blockKey:s,data:fe[s]}),await _t(qe,fe),G(null),g?.();return}const F=An(A,i,l);if(!F){W.error("Could not read this variant's matcher rule.");return}if(F.blockKey){await ye.mutateAsync({blockKey:F.blockKey,data:yt(F.resolveType,F.data,O)}),G(null),g?.();return}const ge=an(O),z=sn(ge,i);if(z){W.error(z);return}const U=yt(F.resolveType,F.data,O);let De=null;try{await ye.mutateAsync({blockKey:ge,data:U}),De=ge,V[t]={...q,rule:Lt(ge)},await ye.mutateAsync({blockKey:s,data:{...f,sections:{...x,variants:V}}}),De=null}catch(qe){throw De&&await Ht.mutateAsync({blockKey:De}).catch(()=>{}),qe}G(null),W.success(`Saved matcher as global block "${O}"`),g?.()}catch(F){W.error(F instanceof Error?F.message:"Failed to rename variant")}finally{Vt(!1)}},us=async(t,a)=>{Mt();const{selectedSectionIndex:s,rawSections:i,parsedSections:f,decofile:y,activePageKey:x,pageVariants:V,variantIndex:q}=Ye.current;if(s===null||!x)return;const A=i[s],O=f[s];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const ge=F.variants??[],z=ge[t];if(!z?.rule||typeof z.rule!="object"){W.error("This variant has no matcher rule to rename.");return}const U=z.rule,De=a.trim();Vt(!0);const qe=async fe=>{const We={...F,variants:fe},Xe=[...i];Xe[s]=dt(A,O,We);const rt=wt(y,x,Xe,q,V);return await ye.mutateAsync({blockKey:x,data:rt}),{...y,[x]:rt}};try{if(!De){if(!xt(U,y,l)){ne(null);return}const ot=U.__resolveType??"",Nn=[...ge];Nn[t]={...z,rule:Tn(U,y,l)};const gs=await qe(Nn);await _t(ot,gs),ne(null),g?.();return}const fe=An(U,y,l);if(!fe){W.error("Could not read this variant's matcher rule.");return}if(fe.blockKey){await ye.mutateAsync({blockKey:fe.blockKey,data:yt(fe.resolveType,fe.data,De)}),ne(null),g?.();return}const We=an(De),Xe=sn(We,y);if(Xe){W.error(Xe);return}const rt=yt(fe.resolveType,fe.data,De);let Ze=null;try{await ye.mutateAsync({blockKey:We,data:rt}),Ze=We;const ot=[...ge];ot[t]={...z,rule:Lt(We)},await qe(ot),Ze=null}catch(ot){throw Ze&&await Ht.mutateAsync({blockKey:Ze}).catch(()=>{}),ot}ne(null),W.success(`Saved matcher as global block "${De}"`),g?.()}catch(fe){W.error(fe instanceof Error?fe.message:"Failed to rename variant")}finally{Vt(!1)}},Dn=()=>{St()},ds=t=>{Pe(t),Xt({inner:t})},ms=t=>{Fe(t),Xt({raw:t})},fs=()=>{Pe(null),xe([])},ps=()=>me(t=>t+1),hs=t=>{if(Z){if(t===0){zt.flush(),we(!1),Pe(null),Fe(void 0),xe([]),me(s=>s+1),C?.();return}if(t===1){xe([]),me(s=>s+1);return}xe(Me.slice(0,t-1)),me(s=>s+1);return}if(_e){M(je.slice(0,t)),X(s=>s+1);return}if(t===0){Dn();return}if(t===1){M([]),X(s=>s+1);return}if(ct&&t===2){M([]),X(s=>s+1);return}const a=ct?2:1;M(je.slice(0,t-a))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:st||Kt||Z?n.jsxs("div",{className:Be("border-b px-3 py-2.5",st&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!_e&&Pt&&tt&&n.jsxs("button",{type:"button",onClick:Dn,title:`Editing in variant: ${tt.label}`,className:Be("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",ro),children:[n.jsx(ha,{rule:Rt(tt.rule,o??{},l??void 0),matchers:At}),n.jsx("span",{className:"max-w-[160px] truncate",children:tt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:wn.map((t,a)=>{const s=a===wn.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&n.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>hs(a),title:t,className:Be("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",s?st?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":st?"text-foreground/80":"text-muted-foreground",st?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${a}`)})}),st&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(fr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(pt,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),jn&&!ct&&!at?.isHidden&&j&&n.jsx(In,{onClick:()=>Zt()})]}),st&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(io,{pageKey:j,initialName:ze.name,initialPath:ze.path,onFieldChange:Ea})}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>we(!0),children:n.jsx(dr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>R&&j?R(j):$(!0),children:n.jsx(mr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"View JSON"})]}),n.jsx(In,{onClick:Rn})]})}),Z?n.jsx(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ct&&j?n.jsx(Pr,{rawSeo:qt,innerSeo:mn,defaultResolveType:Va,seoSchema:Ca,activeResolveType:Jt,seoTypeOptions:Na,formResetKey:Re,siteDefaultSeo:Pa,onBreadcrumbChange:xe,onPersistRaw:ms,onInnerChange:ds,onClearForm:fs,onBumpFormKey:ps}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):Kt?n.jsxs(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ct&&lt.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Bs,{listKey:`${j??""}:${u??""}`,variants:lt.map((t,a)=>({index:a,label:t.label})),selectedIndex:en,onSelect:za,onRename:ne,onDuplicate:Ua,onDelete:Ha,onRemoveAll:Ga,onReorder:Wa,onAdd:()=>Zt()}),ct&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(Cn,{currentRt:Ie??"",currentLabel:Bt(Et?.rule,o??{},et,l??void 0),currentGlobalKey:kt(Et?.rule,o??{},l??void 0)??void 0,matchers:At,globals:vn,onSelect:Za,onSelectGlobal:ts}),kn&&ae&&n.jsx("div",{className:"pt-1",children:n.jsx(Ln,{schema:kn,value:ae,onChange:es,meta:l??void 0,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt},`${u??"none"}:${en}:${Ie??""}`)})]})]}),n.jsx(Fn,{activeSchema:Qt,formValue:se,formResetKey:Ae,onFormChange:hn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this variant.",meta:l,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt})]}):_e?n.jsx(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Fn,{activeSchema:Qt,formValue:se,formResetKey:Ae,onFormChange:hn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this global block.",meta:l,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt})}):n.jsxs(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Pt&&j&&n.jsx(ao,{listKey:j,variants:Oe,activeIndex:Ve,decofile:o??{},meta:l,matchers:At,onSelect:rs,onReorder:os,onRename:G,onDuplicate:ls,onDelete:is,onAdd:Rn}),Pt&&ue!==null&&n.jsxs("div",{className:Be("px-3 border-b",le?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":le,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),le?n.jsx(cr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ir,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),le&&n.jsxs("div",{className:Be("space-y-3",bt&&"pointer-events-none opacity-50"),children:[n.jsx(Cn,{currentRt:ue,currentLabel:Bt(tt?.rule,o??{},et,l??void 0),currentGlobalKey:kt(tt?.rule,o??{},l??void 0)??void 0,matchers:At,globals:vn,onSelect:Ja,onSelectGlobal:Xa}),Sn&&Ce&&n.jsx("div",{className:"space-y-3",children:n.jsx(Ln,{schema:Sn,value:Ce,onChange:Qa,meta:l??void 0,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt},`${Ve}:${ue??""}`)})]})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(Yr,{listKey:`${j??""}-${Ve}`,rawSections:I,sections:Te,meta:l,selectedIndex:u,onSelect:Ma,onReorder:Ka,onDelete:$a,onDuplicate:Oa,onMakeReusable:ve,onToggleHidden:Ba,onToggleLazy:La,onAddVariant:Zt,onDetach:Fa,onAddSection:()=>de(!0),canAddSection:qa})})]}),n.jsx(Ls,{open:Ne!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:Ne!==null?an(Te[Ne]?.label??""):"",isPending:ye.isPending,onSubmit:Ya}),d&&n.jsx(Er,{open:Se,onOpenChange:de,meta:l,decofile:o,previewBaseUrl:d,onSelect:Ia}),be&&j&&o&&n.jsx(Fs,{open:be,onOpenChange:$,pageKey:j,decofile:o}),re!==null&&n.jsx(On,{open:!0,initialName:xt(Oe[re]?.rule,o??{},l??void 0)?Bt(Oe[re]?.rule,o??{},et,l??void 0):"",autoLabel:et(Rt(Oe[re]?.rule,o??{},l??void 0)),isPending:bt,onSubmit:async t=>{await cs(re,t)},onOpenChange:t=>{!t&&!bt&&G(null)}}),Y!==null&&n.jsx(On,{open:!0,initialName:xt(lt[Y]?.rule,o??{},l??void 0)?Bt(lt[Y]?.rule,o??{},et,l??void 0):"",autoLabel:et(Rt(lt[Y]?.rule,o??{},l??void 0)),isPending:bt,onSubmit:async t=>{await us(Y,t)},onOpenChange:t=>{!t&&!bt&&ne(null)}})]})}export{Wl as SectionsEditor};
@@ -1 +1 @@
1
- import{r as c,aj as nt,a3 as Pe,j as d,a4 as rt,ak as be,_ as k,U as st,V as j,W as _,bP as $,a2 as lt,aQ as Ne,X as Ee,ai as at,bK as it,bR as ct,dz as dt,dC as ut,dA as pt,dD as ft,$ as mt,Y as ht,dB as vt,a0 as gt,a1 as xt,c as ee,l as oe}from"./index-DmjWDqcd.js";import{V as St}from"./tooltip-Cr9AJTu1.js";import{i as wt,n as Ct}from"./ChevronUp-DLoyITzq.js";import{t as Re}from"./ChevronDown-BHp2n33E.js";function _e(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],Q="Select",[de,ue,bt]=at(Q),[ne]=ht(Q,[bt,Ee]),pe=Ee(),[Tt,G]=ne(Q),[Pt,_t]=ne(Q),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[U,M]=c.useState(!1),re=nt(u),[N,O]=Pe({prop:o,defaultProp:n??!1,onChange:i,caller:Q}),[F,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:Q}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.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:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:N,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Je,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=Q;var Me="SelectTrigger",Ae=c.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.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,...i,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:_(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:_(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:_(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=c.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:i,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==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}):i})});De.displayName=Oe;var Nt="SelectIcon",ke=c.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=Nt;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var J="SelectContent",Be=c.forwardRef((r,e)=>{const t=G(J,r.__scopeSelect),[o,n]=c.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const i=o;return i?Ne.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),i):null}return d.jsx(He,{...r,ref:e})});Be.displayName=J;var A=10,[Ve,Y]=ne(J),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=c.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:i,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(J,t),[x,U]=c.useState(null),[M,re]=c.useState(null),N=k(e,f=>U(f)),[O,F]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=c.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.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]),c.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=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===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:_(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:_(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,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,i=G(J,t),s=Y(J,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,N=>h(N)),b=ue(t),w=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const N=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const I=q.left-O.left,P=F.left-I,X=N.left-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-F.right-I,X=window.innerWidth-N.right-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[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=N.top+N.height/2-A,ie=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 P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ie,se+(I?he:0)+P+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,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[U,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(N=>{N&&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:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...i}=r,s=pe(t);return d.jsx(gt,{...s,...i,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...i.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(J,{}),we="SelectViewport",Ue=c.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.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:_(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),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=c.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=Fe;var We="SelectLabel",Bt=c.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 ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:i,...s}=r,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[b,w]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=c.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:c.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:_(s.onFocus,()=>w(!0)),onBlur:_(s.onBlur,()=>w(!1)),onClick:_(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:_(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:_(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:_(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:_(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...i}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=_t(le,t),[h,g]=c.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=c.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,...i,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ne.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.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=c.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...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=c.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,i]=c.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;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Qe=c.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.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:_(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:_(n.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:_(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.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",Ut=c.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Je=c.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=c.useRef(null),i=k(o,n),s=it(e);return c.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:i,defaultValue:e})});Je.displayName=Ft;function et(r){return r===""||r===void 0}function tt(r){const e=ct(r),t=c.useRef(""),o=c.useRef(0),n=c.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]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,i]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?r.indexOf(t):-1;let s=Wt(r,Math.max(i,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=Ue,Qt=$e,Jt=Ge,eo=qe,to=Xe,oo=Ze;function co(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 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(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(13);let t,o,n,i;e[0]!==r?({className:o,size:i,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=i):(t=e[1],o=e[2],n=e[3],i=e[4]);const s=i===void 0?"default":i;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 fo(r){const e=ee.c(25);let t,o,n,i,s;e[0]!==r?({className:o,children:t,position:i,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=i,e[5]=s):(t=e[1],o=e[2],n=e[3],i=e[4],s=e[5]);const l=i===void 0?"popper":i,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("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",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 mo(r){const e=ee.c(16);let t,o,n,i;e[0]!==r?({className:o,children:t,hideCheck:i,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=i):(t=e[1],o=e[2],n=e[3],i=e[4]);const s=i===void 0?!1:i;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(Jt,{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(Qt,{"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 i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Ct,{className:"size-4"}),e[5]=i):i=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:i}),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 i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=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:i}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{fo as S,mo as a,po as b,uo as c,co as d,_e as e};
1
+ import{r as c,aj as nt,a3 as Pe,j as d,a4 as rt,ak as be,_ as k,U as st,V as j,W as _,bQ as $,a2 as lt,an as Ne,X as Ee,ai as at,bL as it,bS as ct,dA as dt,dD as ut,dB as pt,dE as ft,$ as mt,Y as ht,dC as vt,a0 as gt,a1 as xt,c as ee,l as oe}from"./index-CFiyU0D9.js";import{V as St}from"./tooltip-DrpiSbRG.js";import{i as wt,n as Ct}from"./ChevronUp-DBpw6M-L.js";import{t as Re}from"./ChevronDown-DyHvxYlc.js";function _e(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],Q="Select",[de,ue,bt]=at(Q),[ne]=ht(Q,[bt,Ee]),pe=Ee(),[Tt,G]=ne(Q),[Pt,_t]=ne(Q),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[U,M]=c.useState(!1),re=nt(u),[N,O]=Pe({prop:o,defaultProp:n??!1,onChange:i,caller:Q}),[F,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:Q}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.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:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:N,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Je,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=Q;var Me="SelectTrigger",Ae=c.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.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,...i,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:_(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:_(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:_(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=c.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:i,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==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}):i})});De.displayName=Oe;var Nt="SelectIcon",ke=c.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=Nt;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var J="SelectContent",Be=c.forwardRef((r,e)=>{const t=G(J,r.__scopeSelect),[o,n]=c.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const i=o;return i?Ne.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),i):null}return d.jsx(He,{...r,ref:e})});Be.displayName=J;var A=10,[Ve,Y]=ne(J),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=c.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:i,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(J,t),[x,U]=c.useState(null),[M,re]=c.useState(null),N=k(e,f=>U(f)),[O,F]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=c.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.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]),c.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=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===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:_(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:_(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,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,i=G(J,t),s=Y(J,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,N=>h(N)),b=ue(t),w=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const N=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const I=q.left-O.left,P=F.left-I,X=N.left-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-F.right-I,X=window.innerWidth-N.right-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[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=N.top+N.height/2-A,ie=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 P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ie,se+(I?he:0)+P+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,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[U,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(N=>{N&&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:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...i}=r,s=pe(t);return d.jsx(gt,{...s,...i,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...i.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(J,{}),we="SelectViewport",Ue=c.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.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:_(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),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=c.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=Fe;var We="SelectLabel",Bt=c.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 ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:i,...s}=r,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[b,w]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=c.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:c.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:_(s.onFocus,()=>w(!0)),onBlur:_(s.onBlur,()=>w(!1)),onClick:_(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:_(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:_(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:_(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:_(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...i}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=_t(le,t),[h,g]=c.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=c.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,...i,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ne.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.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=c.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...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=c.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,i]=c.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;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Qe=c.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.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:_(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:_(n.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:_(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.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",Ut=c.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Je=c.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=c.useRef(null),i=k(o,n),s=it(e);return c.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:i,defaultValue:e})});Je.displayName=Ft;function et(r){return r===""||r===void 0}function tt(r){const e=ct(r),t=c.useRef(""),o=c.useRef(0),n=c.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]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,i]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?r.indexOf(t):-1;let s=Wt(r,Math.max(i,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=Ue,Qt=$e,Jt=Ge,eo=qe,to=Xe,oo=Ze;function co(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 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(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(13);let t,o,n,i;e[0]!==r?({className:o,size:i,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=i):(t=e[1],o=e[2],n=e[3],i=e[4]);const s=i===void 0?"default":i;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 fo(r){const e=ee.c(25);let t,o,n,i,s;e[0]!==r?({className:o,children:t,position:i,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=i,e[5]=s):(t=e[1],o=e[2],n=e[3],i=e[4],s=e[5]);const l=i===void 0?"popper":i,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("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",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 mo(r){const e=ee.c(16);let t,o,n,i;e[0]!==r?({className:o,children:t,hideCheck:i,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=i):(t=e[1],o=e[2],n=e[3],i=e[4]);const s=i===void 0?!1:i;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(Jt,{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(Qt,{"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 i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Ct,{className:"size-4"}),e[5]=i):i=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:i}),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 i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=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:i}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{fo as S,mo as a,po as b,uo as c,co as d,_e as e};
@@ -1 +1 @@
1
- import{c as D,j as o,l as R,r as $,B as H}from"./index-DmjWDqcd.js";import{i as Q,a as W,d as J,e as K}from"./dialog-onqVrhoh.js";import{g as V,b as Y,a as Z,D as ee}from"./drawer-D6-83PZ_.js";import{u as oe}from"./use-mobile-C1ok2Oda.js";import{b as A}from"./chat-context-Ba1J4Wbr.js";import{D as te,b as le,S as U,M as se}from"./decopilot-Y0nnLngo.js";import{a as G,b as z}from"./connect-desktop-dialog-DPJKYCn-.js";const ie=[{tier:"fast",description:"Quicker responses"},{tier:"smart",description:"Balanced quality"},{tier:"thinking",description:"Deeper reasoning"}];function X(r){const e=D.c(10),{modelSet:t,selectedModelId:s,onSelect:i}=r;let l,c;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==i||e[4]!==s){const a=Object.fromEntries(t.models.map(ne));l="flex flex-col p-2 w-[320px]",c=ie.map(d=>{const{tier:p,description:m}=d,u=t.tiers[p];if(!u.modelId)return null;const x=a[u.modelId];if(!x)return null;const f=s===u.modelId;return o.jsxs("button",{type:"button",onClick:()=>i(x),className:R("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",f&&"bg-accent/50"),children:[o.jsx("img",{src:t.logo,alt:u.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:u.label}),o.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:m})]})]},p)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=i,e[4]=s,e[5]=l,e[6]=c}else l=e[5],c=e[6];let n;return e[7]!==l||e[8]!==c?(n=o.jsx("div",{className:l,children:c}),e[7]=l,e[8]=c,e[9]=n):n=e[9],n}function ne(r){return[r.modelId,r]}const de=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 4.8 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],L="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",ce=[{providerId:"codex",modelId:"codex:gpt-5.5",title:"GPT-5.5",description:"Frontier model for complex coding, research, and real-world work",capabilities:["text","reasoning"],logo:L,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.4",title:"GPT-5.4",description:"Strong model for everyday coding",capabilities:["text","reasoning"],logo:L,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.4-mini",title:"GPT-5.4 Mini",description:"Small, fast, and cost-efficient model for simpler coding tasks",capabilities:["text","reasoning"],logo:L,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:L,limits:null,costs:null}],re="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",ae="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg",me={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5",description:"Quicker responses",iconNode:o.jsx(G,{size:16})},smart:{modelId:"claude-code:sonnet",label:"Sonnet 5",description:"Balanced quality",iconNode:o.jsx(G,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M",description:"Deeper reasoning",iconNode:o.jsx(G,{size:16})}},pe={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Quicker responses",iconNode:o.jsx(z,{size:16})},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4",description:"Balanced quality",iconNode:o.jsx(z,{size:16})},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5",description:"Deeper reasoning",iconNode:o.jsx(z,{size:16})}};function q(r){return r==="claude-code"?{logo:re,tiers:me,models:de}:r==="codex"?{logo:ae,tiers:pe,models:ce}:null}function ue(r){const e=D.c(11),{onClose:t,agent:s}=r,i=A(),l=s??i.pendingHarnessId??"decopilot";let c;e[0]!==l?(c=q(l),e[0]=l,e[1]=c):c=e[1];const n=c;if(!n){let m;return e[2]!==t?(m=o.jsx(le,{onClose:t}),e[2]=t,e[3]=m):m=e[3],m}const a=i.selectedModel?.modelId??n.tiers[i.simpleModeTier].modelId;let d;e[4]!==t||e[5]!==i?(d=m=>{i.setModel({...m,keyId:void 0}),t()},e[4]=t,e[5]=i,e[6]=d):d=e[6];let p;return e[7]!==n||e[8]!==a||e[9]!==d?(p=o.jsx(X,{modelSet:n,selectedModelId:a,onSelect:d}),e[7]=n,e[8]=a,e[9]=d,e[10]=p):p=e[10],p}function fe(r){const e=D.c(13);let t,s;e[0]!==r?({agent:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=t?q(t):null,e[3]=t,e[4]=i):i=e[4];const l=i;if(!l){let d;return e[5]!==s?(d=o.jsx(te,{...s}),e[5]=s,e[6]=d):d=e[6],d}const c=s.selectedModel?.modelId??l.tiers.smart.modelId;let n;e[7]!==s?(n=d=>{s.onModelChange(d),s.onClose()},e[7]=s,e[8]=n):n=e[8];let a;return e[9]!==l||e[10]!==c||e[11]!==n?(a=o.jsx(X,{modelSet:l,selectedModelId:c,onSelect:n}),e[9]=l,e[10]=c,e[11]=n,e[12]=a):a=e[12],a}function ve(r){const e=D.c(39),{variant:t,className:s,placeholder:i,model:l,isLoading:c,credentialId:n,onCredentialChange:a,onModelChange:d,filterModels:p,agent:m}=r,u=t===void 0?"borderless":t,x=i===void 0?"Select model":i,[f,k]=$.useState(!1),g=d!==void 0,F=oe(),B=u==="borderless"?"ghost":"outline",P=u==="borderless"&&"md:border-none";let h;e[0]!==s||e[1]!==P?(h=R("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",P,s),e[0]=s,e[1]=P,e[2]=h):h=e[2];let b;e[3]!==c||e[4]!==l||e[5]!==x||e[6]!==g?(b=g?o.jsx(U,{model:l??null,placeholder:x,isLoading:c}):o.jsx(ge,{placeholder:x}),e[3]=c,e[4]=l,e[5]=x,e[6]=g,e[7]=b):b=e[7];let O;e[8]!==B||e[9]!==h||e[10]!==b?(O=o.jsx(H,{variant:B,size:"sm",className:h,children:b}),e[8]=B,e[9]=h,e[10]=b,e[11]=O):O=e[11];const C=O;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(se,{}),e[12]=w):w=e[12];let y;e[13]!==m||e[14]!==n||e[15]!==p||e[16]!==l||e[17]!==a||e[18]!==d||e[19]!==g?(y=o.jsx($.Suspense,{fallback:w,children:g?o.jsx(fe,{onClose:()=>k(!1),agent:m,credentialId:n??null,onCredentialChange:a??xe,selectedModel:l??null,onModelChange:d,filterModels:p}):o.jsx(ue,{onClose:()=>k(!1),agent:m})}),e[13]=m,e[14]=n,e[15]=p,e[16]=l,e[17]=a,e[18]=d,e[19]=g,e[20]=y):y=e[20];const I=y;if(F){let M;e[21]!==C?(M=o.jsx(V,{asChild:!0,children:C}),e[21]=C,e[22]=M):M=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Y,{className:"sr-only",children:"Select model"}),e[23]=_):_=e[23];let v;e[24]!==I?(v=o.jsxs(Z,{className:"p-0 flex flex-col max-h-[95vh]",children:[_,o.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:I})]}),e[24]=I,e[25]=v):v=e[25];let T;return e[26]!==f||e[27]!==M||e[28]!==v?(T=o.jsxs(ee,{open:f,onOpenChange:k,children:[M,v]}),e[26]=f,e[27]=M,e[28]=v,e[29]=T):T=e[29],T}let S;e[30]!==C?(S=o.jsx(Q,{asChild:!0,children:C}),e[30]=C,e[31]=S):S=e[31];let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(W,{className:"sr-only",children:"Select model"}),e[32]=N):N=e[32];let j;e[33]!==I?(j=o.jsxs(J,{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:[N,I]}),e[33]=I,e[34]=j):j=e[34];let E;return e[35]!==f||e[36]!==S||e[37]!==j?(E=o.jsxs(K,{open:f,onOpenChange:k,children:[S,j]}),e[35]=f,e[36]=S,e[37]=j,e[38]=E):E=e[38],E}function xe(){}function ge(r){const e=D.c(4),{placeholder:t}=r,{selectedModel:s,isModelsLoading:i}=A();let l;return e[0]!==i||e[1]!==s||e[2]!==t?(l=o.jsx(U,{model:s,placeholder:t,isLoading:i}),e[0]=i,e[1]=s,e[2]=t,e[3]=l):l=e[3],l}export{ve as M};
1
+ import{c as D,j as o,l as R,r as $,B as H}from"./index-CFiyU0D9.js";import{i as Q,a as W,d as J,e as K}from"./dialog-BAqFyO8a.js";import{g as V,b as Y,a as Z,D as ee}from"./drawer-CFkqEC3w.js";import{u as oe}from"./use-mobile-NlF-3RoP.js";import{b as A}from"./chat-context-n9syhvq-.js";import{D as te,b as le,S as U,M as se}from"./decopilot-BItqS11w.js";import{a as G,b as z}from"./connect-desktop-dialog-Brra3cMC.js";const ie=[{tier:"fast",description:"Quicker responses"},{tier:"smart",description:"Balanced quality"},{tier:"thinking",description:"Deeper reasoning"}];function X(r){const e=D.c(10),{modelSet:t,selectedModelId:s,onSelect:i}=r;let l,c;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==i||e[4]!==s){const a=Object.fromEntries(t.models.map(ne));l="flex flex-col p-2 w-[320px]",c=ie.map(d=>{const{tier:p,description:m}=d,u=t.tiers[p];if(!u.modelId)return null;const x=a[u.modelId];if(!x)return null;const f=s===u.modelId;return o.jsxs("button",{type:"button",onClick:()=>i(x),className:R("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",f&&"bg-accent/50"),children:[o.jsx("img",{src:t.logo,alt:u.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:u.label}),o.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:m})]})]},p)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=i,e[4]=s,e[5]=l,e[6]=c}else l=e[5],c=e[6];let n;return e[7]!==l||e[8]!==c?(n=o.jsx("div",{className:l,children:c}),e[7]=l,e[8]=c,e[9]=n):n=e[9],n}function ne(r){return[r.modelId,r]}const de=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 4.8 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],L="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",ce=[{providerId:"codex",modelId:"codex:gpt-5.5",title:"GPT-5.5",description:"Frontier model for complex coding, research, and real-world work",capabilities:["text","reasoning"],logo:L,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.4",title:"GPT-5.4",description:"Strong model for everyday coding",capabilities:["text","reasoning"],logo:L,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.4-mini",title:"GPT-5.4 Mini",description:"Small, fast, and cost-efficient model for simpler coding tasks",capabilities:["text","reasoning"],logo:L,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:L,limits:null,costs:null}],re="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",ae="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg",me={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5",description:"Quicker responses",iconNode:o.jsx(G,{size:16})},smart:{modelId:"claude-code:sonnet",label:"Sonnet 5",description:"Balanced quality",iconNode:o.jsx(G,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M",description:"Deeper reasoning",iconNode:o.jsx(G,{size:16})}},pe={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Quicker responses",iconNode:o.jsx(z,{size:16})},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4",description:"Balanced quality",iconNode:o.jsx(z,{size:16})},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5",description:"Deeper reasoning",iconNode:o.jsx(z,{size:16})}};function q(r){return r==="claude-code"?{logo:re,tiers:me,models:de}:r==="codex"?{logo:ae,tiers:pe,models:ce}:null}function ue(r){const e=D.c(11),{onClose:t,agent:s}=r,i=A(),l=s??i.pendingHarnessId??"decopilot";let c;e[0]!==l?(c=q(l),e[0]=l,e[1]=c):c=e[1];const n=c;if(!n){let m;return e[2]!==t?(m=o.jsx(le,{onClose:t}),e[2]=t,e[3]=m):m=e[3],m}const a=i.selectedModel?.modelId??n.tiers[i.simpleModeTier].modelId;let d;e[4]!==t||e[5]!==i?(d=m=>{i.setModel({...m,keyId:void 0}),t()},e[4]=t,e[5]=i,e[6]=d):d=e[6];let p;return e[7]!==n||e[8]!==a||e[9]!==d?(p=o.jsx(X,{modelSet:n,selectedModelId:a,onSelect:d}),e[7]=n,e[8]=a,e[9]=d,e[10]=p):p=e[10],p}function fe(r){const e=D.c(13);let t,s;e[0]!==r?({agent:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=t?q(t):null,e[3]=t,e[4]=i):i=e[4];const l=i;if(!l){let d;return e[5]!==s?(d=o.jsx(te,{...s}),e[5]=s,e[6]=d):d=e[6],d}const c=s.selectedModel?.modelId??l.tiers.smart.modelId;let n;e[7]!==s?(n=d=>{s.onModelChange(d),s.onClose()},e[7]=s,e[8]=n):n=e[8];let a;return e[9]!==l||e[10]!==c||e[11]!==n?(a=o.jsx(X,{modelSet:l,selectedModelId:c,onSelect:n}),e[9]=l,e[10]=c,e[11]=n,e[12]=a):a=e[12],a}function ve(r){const e=D.c(39),{variant:t,className:s,placeholder:i,model:l,isLoading:c,credentialId:n,onCredentialChange:a,onModelChange:d,filterModels:p,agent:m}=r,u=t===void 0?"borderless":t,x=i===void 0?"Select model":i,[f,k]=$.useState(!1),g=d!==void 0,F=oe(),B=u==="borderless"?"ghost":"outline",P=u==="borderless"&&"md:border-none";let h;e[0]!==s||e[1]!==P?(h=R("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",P,s),e[0]=s,e[1]=P,e[2]=h):h=e[2];let b;e[3]!==c||e[4]!==l||e[5]!==x||e[6]!==g?(b=g?o.jsx(U,{model:l??null,placeholder:x,isLoading:c}):o.jsx(ge,{placeholder:x}),e[3]=c,e[4]=l,e[5]=x,e[6]=g,e[7]=b):b=e[7];let O;e[8]!==B||e[9]!==h||e[10]!==b?(O=o.jsx(H,{variant:B,size:"sm",className:h,children:b}),e[8]=B,e[9]=h,e[10]=b,e[11]=O):O=e[11];const C=O;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(se,{}),e[12]=w):w=e[12];let y;e[13]!==m||e[14]!==n||e[15]!==p||e[16]!==l||e[17]!==a||e[18]!==d||e[19]!==g?(y=o.jsx($.Suspense,{fallback:w,children:g?o.jsx(fe,{onClose:()=>k(!1),agent:m,credentialId:n??null,onCredentialChange:a??xe,selectedModel:l??null,onModelChange:d,filterModels:p}):o.jsx(ue,{onClose:()=>k(!1),agent:m})}),e[13]=m,e[14]=n,e[15]=p,e[16]=l,e[17]=a,e[18]=d,e[19]=g,e[20]=y):y=e[20];const I=y;if(F){let M;e[21]!==C?(M=o.jsx(V,{asChild:!0,children:C}),e[21]=C,e[22]=M):M=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Y,{className:"sr-only",children:"Select model"}),e[23]=_):_=e[23];let v;e[24]!==I?(v=o.jsxs(Z,{className:"p-0 flex flex-col max-h-[95vh]",children:[_,o.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:I})]}),e[24]=I,e[25]=v):v=e[25];let T;return e[26]!==f||e[27]!==M||e[28]!==v?(T=o.jsxs(ee,{open:f,onOpenChange:k,children:[M,v]}),e[26]=f,e[27]=M,e[28]=v,e[29]=T):T=e[29],T}let S;e[30]!==C?(S=o.jsx(Q,{asChild:!0,children:C}),e[30]=C,e[31]=S):S=e[31];let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(W,{className:"sr-only",children:"Select model"}),e[32]=N):N=e[32];let j;e[33]!==I?(j=o.jsxs(J,{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:[N,I]}),e[33]=I,e[34]=j):j=e[34];let E;return e[35]!==f||e[36]!==S||e[37]!==j?(E=o.jsxs(K,{open:f,onOpenChange:k,children:[S,j]}),e[35]=f,e[36]=S,e[37]=j,e[38]=E):E=e[38],E}function xe(){}function ge(r){const e=D.c(4),{placeholder:t}=r,{selectedModel:s,isModelsLoading:i}=A();let l;return e[0]!==i||e[1]!==s||e[2]!==t?(l=o.jsx(U,{model:s,placeholder:t,isLoading:i}),e[0]=i,e[1]=s,e[2]=t,e[3]=l):l=e[3],l}export{ve as M};