decocms 4.211.13 → 4.212.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.
- package/dist/client/assets/{AlertCircle-BMPkNMGJ.js → AlertCircle-CWOm5Uve.js} +1 -1
- package/dist/client/assets/{AreaChart-488R_nQ_.js → AreaChart-UxGJ9jAc.js} +1 -1
- package/dist/client/assets/{ArrowLeft-Bo0FpGQs.js → ArrowLeft-DSLmAXMn.js} +1 -1
- package/dist/client/assets/{ArrowUp-Cmxc5KIG.js → ArrowUp-BcOlM00A.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-OVKS4c5s.js → ArrowUpRight-DMEBYWz_.js} +1 -1
- package/dist/client/assets/{Check-CeB_ZeLq.js → Check-DRUrRM4k.js} +1 -1
- package/dist/client/assets/{CheckCircle-C9SAYY-W.js → CheckCircle-Cj9wXz7h.js} +1 -1
- package/dist/client/assets/{ChevronDown-CGwhMiqT.js → ChevronDown-C84fi4SM.js} +1 -1
- package/dist/client/assets/{ChevronRight-Cux_llMB.js → ChevronRight-1hSG5rxw.js} +1 -1
- package/dist/client/assets/{ChevronUp-3dsPU76D.js → ChevronUp-B_P52q74.js} +1 -1
- package/dist/client/assets/{Copy01-CXcHnxi0.js → Copy01-BIHAMwMS.js} +1 -1
- package/dist/client/assets/{CpuChip01-CGpR8wkh.js → CpuChip01-bhvA1IPq.js} +1 -1
- package/dist/client/assets/{CreditCard01-DSA6UjMO.js → CreditCard01-DjlAzA63.js} +1 -1
- package/dist/client/assets/{DotsVertical-9U5tOb04.js → DotsVertical-DKRrOswH.js} +1 -1
- package/dist/client/assets/{Eye-DXWAJYKq.js → Eye-C2o0TGpU.js} +1 -1
- package/dist/client/assets/{FilterLines-DZrlB4Kh.js → FilterLines-CWNPFfmU.js} +1 -1
- package/dist/client/assets/{Globe01-Cm-V-gHj.js → Globe01-C0Wza-pB.js} +1 -1
- package/dist/client/assets/{Globe04-m1tzMty0.js → Globe04-DlPMnL_W.js} +1 -1
- package/dist/client/assets/{HardDrive-Dvps78YO.js → HardDrive-CuUDIL3d.js} +1 -1
- package/dist/client/assets/{Key01-DY7yaq7L.js → Key01-DGtD9k-H.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C0u89h3U.js → LayoutLeft-CgpazeQW.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CLr9HZg0.js → LinkExternal01-C3r7gRMA.js} +1 -1
- package/dist/client/assets/{LogOut01-BeE1lxGA.js → LogOut01-DrJBO7A2.js} +1 -1
- package/dist/client/assets/{Monitor01-RiuZmvGS.js → Monitor01-sWedXVH7.js} +1 -1
- package/dist/client/assets/{Palette-C8S3zMtK.js → Palette-Cumnt5dU.js} +1 -1
- package/dist/client/assets/{Play-B8V74CpU.js → Play-CEUcklF_.js} +1 -1
- package/dist/client/assets/{Plus-CGrXNe_q.js → Plus-BzXIpygM.js} +1 -1
- package/dist/client/assets/{SearchLg-DrUBeTI6.js → SearchLg-BaWhFDSb.js} +1 -1
- package/dist/client/assets/{SearchMd-DFwCvkV1.js → SearchMd-CYo4IMba.js} +1 -1
- package/dist/client/assets/{Settings02-DBlt8Mfk.js → Settings02-CuJD2QQQ.js} +1 -1
- package/dist/client/assets/{Share07-C1_p27Hs.js → Share07-DpvwgZZl.js} +1 -1
- package/dist/client/assets/{Shield01-CZr-J1Qk.js → Shield01-DRzjQN2b.js} +1 -1
- package/dist/client/assets/{Star01-ClwU4gOx.js → Star01-CIJmX3JD.js} +1 -1
- package/dist/client/assets/{Stars01-jLom0LSv.js → Stars01-B7GvVd6X.js} +1 -1
- package/dist/client/assets/{Stars02-2eb3r8Gu.js → Stars02-B0uiQKM0.js} +1 -1
- package/dist/client/assets/{Sun-m3RjKnDt.js → Sun-CUJtCtMs.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-D0Mi7oaK.js → SwitchHorizontal01-bOur07pT.js} +1 -1
- package/dist/client/assets/{Tool01-DMQJZ6a0.js → Tool01-kS2-_uju.js} +1 -1
- package/dist/client/assets/{Tool02-CZZOjaKh.js → Tool02-C__tuoKZ.js} +1 -1
- package/dist/client/assets/{Trash01-BCoCDH0H.js → Trash01-Dt7JHw9s.js} +1 -1
- package/dist/client/assets/{TrendUp01-CYPiI6vW.js → TrendUp01-Ui3JerXt.js} +1 -1
- package/dist/client/assets/{Upload01-mvF19nky.js → Upload01-Bii7Hq0g.js} +1 -1
- package/dist/client/assets/{User01-UnLfhP79.js → User01-l4IrhDce.js} +1 -1
- package/dist/client/assets/{Users01-BGTUZMIA.js → Users01-C_ExcbfC.js} +1 -1
- package/dist/client/assets/{Users03-C0P658nm.js → Users03-ysfZCx2u.js} +1 -1
- package/dist/client/assets/{X-CId2-nhW.js → X-CSOAIpHP.js} +1 -1
- package/dist/client/assets/{XCircle-DOtlBDfF.js → XCircle-Bj_OSIiW.js} +1 -1
- package/dist/client/assets/{XClose-BoiJoxeV.js → XClose-DhJ7lSIE.js} +1 -1
- package/dist/client/assets/{Zap-C6ApHWIY.js → Zap-7arhZWhP.js} +1 -1
- package/dist/client/assets/{ZapSquare-GHgi4Hl7.js → ZapSquare-gB0cAUuh.js} +1 -1
- package/dist/client/assets/{access-gate-C95F2WkH.js → access-gate-9mLtNHnW.js} +1 -1
- package/dist/client/assets/{agent-icon-D_vHJRnE.js → agent-icon-2qQdCLvH.js} +1 -1
- package/dist/client/assets/{agents-list-DkgLS7SC.js → agents-list-CaEmkaVM.js} +1 -1
- package/dist/client/assets/{ai-providers-Bu525zoa.js → ai-providers-Cpd1oQCV.js} +1 -1
- package/dist/client/assets/{alert-DbDLUaFg.js → alert-DRBiofW0.js} +1 -1
- package/dist/client/assets/{alert-dialog-BgN-Tqd-.js → alert-dialog-C7kop1Uj.js} +1 -1
- package/dist/client/assets/{app-editor-BxnAP5XK.js → app-editor-DFQlXle0.js} +1 -1
- package/dist/client/assets/{auth-BcPAS4K5.js → auth-CC88oAR_.js} +1 -1
- package/dist/client/assets/{auth-catchall-beEoU58X.js → auth-catchall-CcUgjXYK.js} +1 -1
- package/dist/client/assets/{auth-entry-Ba9Dx-Qf.js → auth-entry-vw5JSJvS.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BWtw05-K.js → auth-split-layout-CFdgpz78.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-COCTTCRF.js → authenticate-and-persist-oauth-HCKgl3h4.js} +1 -1
- package/dist/client/assets/{automation-list-row-BYFAi_YA.js → automation-list-row-3iCxhyP9.js} +1 -1
- package/dist/client/assets/{automation-runs-DeLRBvkt.js → automation-runs-P9Mw6j7h.js} +1 -1
- package/dist/client/assets/{automations-BRAq3s1h.js → automations-Bo3dZiV1.js} +1 -1
- package/dist/client/assets/{avatar-CKAwkvrw.js → avatar-B1oqUtwq.js} +1 -1
- package/dist/client/assets/{badge-CxlSzoE1.js → badge-CdU2Ug8F.js} +1 -1
- package/dist/client/assets/{billing-B-o9jNmN.js → billing-BbGgbRke.js} +1 -1
- package/dist/client/assets/{block-document-B55t08Gk.js → block-document-BDzl0VW9.js} +1 -1
- package/dist/client/assets/{brand-context-BFbc6Rr3.js → brand-context-DuChSejv.js} +1 -1
- package/dist/client/assets/{buckets-DPkGfuKn.js → buckets-Brp_nLB9.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DEeeidyr.js → bulk-category-panel-DMORTRmY.js} +1 -1
- package/dist/client/assets/{capability-load-error-BJPRtvi9.js → capability-load-error-DVkPrUPI.js} +1 -1
- package/dist/client/assets/{card-GrGBYBXG.js → card-CqN-NUhK.js} +1 -1
- package/dist/client/assets/{cards-DY2u3Spm.js → cards-DM1ZCHpf.js} +1 -1
- package/dist/client/assets/{category-editor-ZQJJznra.js → category-editor-Cd3-S_ZK.js} +1 -1
- package/dist/client/assets/{chat-context-cK_4I7Xc.js → chat-context-DhgZwGdc.js} +1 -1
- package/dist/client/assets/{checkbox-DjytOswq.js → checkbox-CTxCGW48.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BM-cW7fp.js → cli-auth-success-Blnikggc.js} +1 -1
- package/dist/client/assets/{collection-detail-agcgXjLA.js → collection-detail-CTX1sh79.js} +1 -1
- package/dist/client/assets/{collection-display-button-C1_cSZ46.js → collection-display-button-CNmfKDHN.js} +1 -1
- package/dist/client/assets/{collection-search-Cwveue76.js → collection-search-Bj_EVERX.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-rFP3w6Km.js → collection-table-wrapper-DIX9P-r-.js} +1 -1
- package/dist/client/assets/{collection-tabs-DMyjVQaZ.js → collection-tabs-hyTpqdOU.js} +1 -1
- package/dist/client/assets/{command-DktWLnIE.js → command-BPVTZoz7.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-m9N-S4Gz.js → commerce-onboarding-Dx_jhjTh.js} +1 -1
- package/dist/client/assets/{connect-D2N1y-Ip.js → connect-D5pDHNvd.js} +1 -1
- package/dist/client/assets/{connection-xiSJ6-RD.js → connection-BXLA3Hjm.js} +1 -1
- package/dist/client/assets/{connection-card-BoEQ2uqc.js → connection-card-SAZw6a20.js} +1 -1
- package/dist/client/assets/{connection-detail-CQcpDcrD.js → connection-detail-jMzbUDgm.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DB6bc0s9.js → connection-form-helpers-Dkb7-8HI.js} +1 -1
- package/dist/client/assets/{connections-Dw0iE25b.js → connections-DXzVA7Mn.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-CYVKd86r.js → decopilot-sse-pool-oua6a_5v.js} +1 -1
- package/dist/client/assets/{dialog-7h2q_S_D.js → dialog-BESgF0t5.js} +1 -1
- package/dist/client/assets/{domain-settings-VApHKPI3.js → domain-settings-BoLVEXtk.js} +1 -1
- package/dist/client/assets/{drawer-WhUz4erM.js → drawer-BX8td69Q.js} +1 -1
- package/dist/client/assets/{dropdown-menu-D3TVm231.js → dropdown-menu-wvfbPcYr.js} +1 -1
- package/dist/client/assets/{empty-state-tOcrn7Ci.js → empty-state-BPZfx_fo.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BKY0ec6n.js → extract-connection-data-7BFhmMaZ.js} +1 -1
- package/dist/client/assets/{file-explorer-Dq0lQM5q.js → file-explorer-Dw0HWLvp.js} +1 -1
- package/dist/client/assets/{file-type-icon-CpiTVpKx.js → file-type-icon-DldS77Gr.js} +1 -1
- package/dist/client/assets/{form-FE1JRkSu.js → form-ClQ7Ni5r.js} +1 -1
- package/dist/client/assets/{general-g40hJC_5.js → general-BB6pt6Xu.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BId4yHDh.js → github-repo-picker-C4r_E65q.js} +1 -1
- package/dist/client/assets/{hooks-BTTh4oan.js → hooks-DIjcjCME.js} +1 -1
- package/dist/client/assets/{index-GMtytQiz.js → index-BHNegbCC.js} +1 -1
- package/dist/client/assets/{index-Bqv-pFdx.js → index-BbvS0vYI.js} +1 -1
- package/dist/client/assets/{index-UyBix6gL.js → index-BiVuzbjZ.js} +1 -1
- package/dist/client/assets/{index-BEPKcH_a.js → index-BnuZOi3L.js} +1 -1
- package/dist/client/assets/{index-D5KNWpFX.js → index-Bpi-6hXQ.js} +1 -1
- package/dist/client/assets/index-DLY0hGwC.js +1 -0
- package/dist/client/assets/{index-BYGXPjH8.js → index-DTVp8viB.js} +1 -1
- package/dist/client/assets/{index-BEYzla8F.js → index-Dp2mcxiD.js} +5 -5
- package/dist/client/assets/{index-Bfy-Fe7V.js → index-HPW3S3aV.js} +3 -3
- package/dist/client/assets/{index-redirect-ck6OyrmB.js → index-redirect-DscdT9Zc.js} +1 -1
- package/dist/client/assets/{index-CGRQEzbN.js → index-x3vtdsS8.js} +1 -1
- package/dist/client/assets/{input-BVD_WyXJ.js → input-C0I5JNx4.js} +1 -1
- package/dist/client/assets/{integration-icon-BbWY9vfD.js → integration-icon-BDOm4BcE.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-CV1AK1O7.js → invite-member-dialog-quaFWBAv.js} +1 -1
- package/dist/client/assets/{label-Dplc1_oE.js → label-TMER_91K.js} +1 -1
- package/dist/client/assets/{layout-D5YUqSjq.js → layout-B48kKPDS.js} +1 -1
- package/dist/client/assets/{login-BhrXfYan.js → login-fTm_I-WY.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Bi0vxp4Q.js → mcp-oauth-DHGnWo7T.js} +1 -1
- package/dist/client/assets/{members-Ji9eO7Ec.js → members-nDg99afK.js} +1 -1
- package/dist/client/assets/{monaco-editor-a45QrHzb.js → monaco-editor-BkWT_ZEx.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-Clyov0L3.js → monitoring-stats-row-BMMm9Jsb.js} +1 -1
- package/dist/client/assets/{multi-select-CjPTNrcr.js → multi-select-DO2_SE9H.js} +1 -1
- package/dist/client/assets/{oauth-callback-DiDAIf8E.js → oauth-callback-CizY8-N4.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-IqzbVWPo.js → oauth-callback-ai-provider-gR5tzBK4.js} +1 -1
- package/dist/client/assets/{onboarding-BJiKjmun.js → onboarding-E2xLL3yE.js} +1 -1
- package/dist/client/assets/{org-layout-PfQPZIP6.js → org-layout-CP-EhX8x.js} +1 -1
- package/dist/client/assets/{organization-choice-gP3A2ZAR.js → organization-choice-DsPAeXs4.js} +1 -1
- package/dist/client/assets/{orgs-Cr1CFs6W.js → orgs-DQMpoY2s.js} +1 -1
- package/dist/client/assets/{page-seo-form-DudbV1zC.js → page-seo-form-DaSZgD3I.js} +1 -1
- package/dist/client/assets/{popover-DigaZ5Sb.js → popover-DPCi05d2.js} +1 -1
- package/dist/client/assets/{post-editor-BWzSgRMR.js → post-editor-DlkL3aZp.js} +1 -1
- package/dist/client/assets/{primitives-J7wgcQJq.js → primitives-_L_NfdKv.js} +1 -1
- package/dist/client/assets/{profile-BDbSzozU.js → profile-BjPNlwI9.js} +1 -1
- package/dist/client/assets/{project-app-view-DAXzq1Ls.js → project-app-view-DCV5bSBl.js} +1 -1
- package/dist/client/assets/record-editor-B6H1gkNA.js +1 -0
- package/dist/client/assets/redirect-editor-BFi6M8p2.js +1 -0
- package/dist/client/assets/registry-9Wy4Tgzd.js +2 -0
- package/dist/client/assets/{registry-layout-CpdnxiQT.js → registry-layout-B1rlOeMT.js} +1 -1
- package/dist/client/assets/{reports-DRHBtKft.js → reports-BMEjQ5BB.js} +1 -1
- package/dist/client/assets/{require-capability-ATUore6a.js → require-capability-BMoN1nC5.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BFPFAQoy.js → required-auth-layout-8ocM8xDK.js} +1 -1
- package/dist/client/assets/{reset-password-Dqj508VS.js → reset-password-ByLWwpWh.js} +1 -1
- package/dist/client/assets/{roles-CxUv-U9E.js → roles-MIUf3-w-.js} +1 -1
- package/dist/client/assets/{search-input--fbtpx3Q.js → search-input-DNC728_E.js} +1 -1
- package/dist/client/assets/{secrets-Bks5AT9o.js → secrets-D-IHpt-P.js} +1 -1
- package/dist/client/assets/{sections-editor-D3-0_ytR.js → sections-editor-pDJxz0yB.js} +1 -1
- package/dist/client/assets/{select-wwJ8EUoY.js → select-DTS7Lm6P.js} +1 -1
- package/dist/client/assets/{select-model-BpUI37HY.js → select-model-y_C2MN3i.js} +1 -1
- package/dist/client/assets/{self-tool-result-Cch-sPi1.js → self-tool-result-DnGIQn1o.js} +1 -1
- package/dist/client/assets/{seo-editor-B-BXD83I.js → seo-editor-8Euk0CLJ.js} +1 -1
- package/dist/client/assets/{settings-layout-ByUBxOIX.js → settings-layout-BGtWu9jG.js} +1 -1
- package/dist/client/assets/{settings-section-CfhHwu3l.js → settings-section-Cx85iU9E.js} +1 -1
- package/dist/client/assets/{shell-controls-CCkUJzaH.js → shell-controls-BJdMLNhD.js} +1 -1
- package/dist/client/assets/{shell-layout-C7FmlawD.js → shell-layout-BHbgVrVC.js} +1 -1
- package/dist/client/assets/{sidebar-CusUIOZL.js → sidebar-f7Yn2HRt.js} +1 -1
- package/dist/client/assets/{skeleton-Dd2jseki.js → skeleton-BahaVLML.js} +1 -1
- package/dist/client/assets/{spinner-Cq2vfE1B.js → spinner-Dbsv0bfZ.js} +1 -1
- package/dist/client/assets/{sso-B3-RbBmC.js → sso-C4-wf225.js} +1 -1
- package/dist/client/assets/{store-pPcfwgDj.js → store-DB22otr5.js} +1 -1
- package/dist/client/assets/store-registry-DP3fQYh_.js +2 -0
- package/dist/client/assets/{studio-tools-BBDHxwPb.js → studio-tools-DnX4fHFe.js} +1 -1
- package/dist/client/assets/{switch-CAjDqeuV.js → switch-BDoYmMK9.js} +1 -1
- package/dist/client/assets/{synced-repos-B2r15ecn.js → synced-repos-VYIhjKiH.js} +1 -1
- package/dist/client/assets/{tab-id-BtKEoC5y.js → tab-id-BB8NVpbv.js} +1 -1
- package/dist/client/assets/{table-DwuSaCi4.js → table-B5qyucGR.js} +1 -1
- package/dist/client/assets/{tabs-CIxl9qVO.js → tabs-BrXfVpvw.js} +1 -1
- package/dist/client/assets/{textarea-BkOjJMTl.js → textarea-GQBocofC.js} +1 -1
- package/dist/client/assets/{toggle-group-znNdMK--.js → toggle-group-Clh5nuH4.js} +1 -1
- package/dist/client/assets/{toolbar-CdII6jdL.js → toolbar-CwcZPI-m.js} +1 -1
- package/dist/client/assets/{tooltip-F9SMeJ-j.js → tooltip-DI3Hz4lP.js} +1 -1
- package/dist/client/assets/{track-CQoHeM9p.js → track-O8SJjyqW.js} +1 -1
- package/dist/client/assets/{use-ai-providers-NYX7QSgc.js → use-ai-providers-MbQtQBY4.js} +1 -1
- package/dist/client/assets/{use-automations-DoX-Tmqm.js → use-automations-HBEx9wKJ.js} +1 -1
- package/dist/client/assets/{use-autosave-BpJYCCvJ.js → use-autosave-DdVAdb4k.js} +1 -1
- package/dist/client/assets/{use-capability-DssZIcHp.js → use-capability-CJU_PUqY.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CFTIWs0c.js → use-clock-tick-BpA4A29S.js} +1 -1
- package/dist/client/assets/{use-connection-niAftPf5.js → use-connection-DMTeFaun.js} +1 -1
- package/dist/client/assets/{use-copy-C8wJsCEn.js → use-copy-CGZ5jXfB.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BeJ2z9vu.js → use-create-virtual-mcp-DUeF7RG_.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CGiNF_NH.js → use-debounced-autosave-D44_xeXB.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BolYSN9R.js → use-debounced-value-DV34ei4H.js} +1 -1
- package/dist/client/assets/{use-deco-credits-De3PrmGo.js → use-deco-credits-CfxA2OJy.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-UAWY9DUq.js → use-decopilot-events-BnO8ZQ7u.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BcCyYYBn.js → use-delete-connection-C8tdcGoo.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-Dkp6hxxc.js → use-deployment-admin-D232sSe6.js} +1 -1
- package/dist/client/assets/{use-file-configs-Cq0JL4Et.js → use-file-configs-DodT1yw8.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BMPCHIFs.js → use-infinite-scroll-Cn4b6uN5.js} +1 -1
- package/dist/client/assets/{use-join-requests-BGkaC20q.js → use-join-requests-CnbgsJes.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CMZDCFwV.js → use-mcp-client-Dd9BhgSs.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DcIN6xvI.js → use-mcp-tools-BTugLIIE.js} +1 -1
- package/dist/client/assets/{use-members-CNN6Y-Zt.js → use-members-DP7ds61c.js} +1 -1
- package/dist/client/assets/{use-mobile-RWxooM53.js → use-mobile-DJGPHp4h.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-ChzmcYSy.js → use-navigate-to-agent-DE3a5vV6.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-XDJk2wdH.js → use-open-billing-url-BU4i4vHj.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-hxCPh-jf.js → use-org-auth-client-CCVSFhLN.js} +1 -1
- package/dist/client/assets/{use-org-sso-FYR_uf1o.js → use-org-sso-rE8Xzp2x.js} +1 -1
- package/dist/client/assets/{use-organization-roles-H8GHPaLQ.js → use-organization-roles-B9ya_lhf.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CmS9ohCu.js → use-organization-settings-Cz3O3Adt.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CvNGLAr0.js → use-registry-connections-kKuNWCoR.js} +1 -1
- package/dist/client/assets/{use-secrets-B-jc_6m7.js → use-secrets-DFgI2DPZ.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-B2DzWzr2.js → use-section-preview-base-ByvuPow7.js} +1 -1
- package/dist/client/assets/{use-status-sounds-UrQRxkaM.js → use-status-sounds-jmdvs_bW.js} +1 -1
- package/dist/client/assets/{use-tags-opYrp-Zi.js → use-tags-BmdDAXPp.js} +1 -1
- package/dist/client/assets/{use-view-mode-Dgp9VTk6.js → use-view-mode-BITDUU_d.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CvLFbjo1.js → use-virtual-mcp-CsgaUGpK.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-tMxJVteW.js +1 -0
- package/dist/client/assets/{useRouterState-rS_ZBcbr.js → useRouterState-CE_XxoM4.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-k4eiew2A.js +1 -0
- package/dist/client/assets/{users-BQPiAp2u.js → users-BPl4KRrw.js} +1 -1
- package/dist/client/assets/{variant-calendar-DboldH8s.js → variant-calendar-5jRij6mZ.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DDofaiqJ.js → view-mode-toggle-B4g50unp.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/index-C6ZFB-pr.js +0 -1
- package/dist/client/assets/record-editor-ppkuJl7e.js +0 -1
- package/dist/client/assets/redirect-editor-pHmu3bPB.js +0 -1
- package/dist/client/assets/registry-Cd5hmvAQ.js +0 -2
- package/dist/client/assets/store-registry-BvvyMLoR.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DuCyL_is.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ByQ627dx.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as Ge,b as ct,r as w,m as $e,j as n,ae as Xn,B as Xe,k as Zn,o as Ca,t as J,K as Ma}from"./index-Bfy-Fe7V.js";import{ap as Ba,aq as Ka,ar as La,a4 as es,a5 as Qt,as as ts,at as ns,a6 as ss,a7 as as,au as os,av as Fa,ae as rs,af as is,aw as Ia,ax as Oa,ay as ls,O as $a,a8 as cs,a9 as Mt,ac as us,ad as ds,aa as ms,ak as fs,az as za,aA as Bt,aB as ps,aC as Ha,S as gs,aD as lt,G as hs,aE as Ua,aF as qa,aG as Ga,aH as Wa,D as Ya,F as Ja,aI as Qa,aJ as Xa,aK as Za,aL as eo,ai as qt,aM as Gt,aN as to,aO as St,aP as Pt,aQ as no,aR as so,aS as tt,aT as Kn,aU as ao,aV as At,aW as Wt,aX as oo,aY as mn,aZ as ro,a_ as kt,a$ as io,b0 as lo,b1 as co,b2 as uo,b3 as mo,b4 as xt,b5 as fo,b6 as po,b7 as go,I as ho,b8 as Ln,b9 as Ct,ba as Fn,bb as In,bc as vo,bd as bo,be as So,bf as xo,bg as fn,bh as On,bi as $n,bj as Tt,bk as Yt,bl as zn,bm as yo,bn as pn,bo as _o,bp as jo,bq as Eo,br as Ro,bs as wo}from"./index-BEYzla8F.js";import{t as ko}from"./ChevronDown-CGwhMiqT.js";import{ad as hn,v as To,T as vs,E as No,u as bs,af as Vo,_ as Do}from"./agent-icon-D_vHJRnE.js";import{i as Ss}from"./ChevronRight-Cux_llMB.js";import{n as Po}from"./ChevronUp-3dsPU76D.js";import{i as Ao}from"./Globe01-Cm-V-gHj.js";import{B as Jt}from"./automation-runs-DeLRBvkt.js";import{c as yt,T as _t,a as jt}from"./tooltip-F9SMeJ-j.js";import{b as Co,h as Mo,a as Bo,c as Ko,d as Lo,e as Fo}from"./dialog-7h2q_S_D.js";import{I as Io}from"./input-BVD_WyXJ.js";import{a as xs}from"./Copy01-CXcHnxi0.js";import{i as Oo}from"./Settings02-DBlt8Mfk.js";import{s as $o}from"./Eye-DXWAJYKq.js";import{s as ys}from"./TrendUp01-CYPiI6vW.js";import{s as vn}from"./Plus-CGrXNe_q.js";import{s as _s}from"./Trash01-BCoCDH0H.js";import{i as zo}from"./Zap-C6ApHWIY.js";import{D as js,a as vt,c as Es,b as Rs,i as Ho}from"./dropdown-menu-D3TVm231.js";import{S as Uo,r as Hn,u as qo,d as Go,a as Wo,i as Yo,f as Jo,P as Qo,b as Xo}from"./page-seo-form-DudbV1zC.js";import{c as Zo}from"./Tool01-DMQJZ6a0.js";import{u as er,A as tr}from"./use-section-preview-base-B2DzWzr2.js";import"./ArrowUp-Cmxc5KIG.js";import"./chat-context-cK_4I7Xc.js";import"./tab-id-BtKEoC5y.js";import"./Check-CeB_ZeLq.js";import"./hooks-BTTh4oan.js";import"./use-mcp-client-CMZDCFwV.js";import"./auth-BcPAS4K5.js";import"./decopilot-sse-pool-CYVKd86r.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-CvLFbjo1.js";import"./use-ai-providers-NYX7QSgc.js";import"./studio-tools-BBDHxwPb.js";import"./use-decopilot-events-UAWY9DUq.js";import"./use-organization-settings-CmS9ohCu.js";import"./spinner-Cq2vfE1B.js";import"./drawer-WhUz4erM.js";import"./collection-search-Cwveue76.js";import"./SearchMd-DFwCvkV1.js";import"./use-mobile-RWxooM53.js";import"./AreaChart-488R_nQ_.js";import"./index-GMtytQiz.js";import"./X-CId2-nhW.js";import"./shell-layout-C7FmlawD.js";import"./avatar-CKAwkvrw.js";import"./User01-UnLfhP79.js";import"./Users03-C0P658nm.js";import"./SearchLg-DrUBeTI6.js";import"./Stars02-2eb3r8Gu.js";import"./XClose-BoiJoxeV.js";import"./CheckCircle-C9SAYY-W.js";import"./CpuChip01-CGpR8wkh.js";import"./FilterLines-DZrlB4Kh.js";import"./Monitor01-RiuZmvGS.js";import"./required-auth-layout-BFPFAQoy.js";import"./use-org-sso-FYR_uf1o.js";import"./deco-site-production-url-BjY4ZYd-.js";import"./ZapSquare-GHgi4Hl7.js";import"./Star01-ClwU4gOx.js";import"./Upload01-mvF19nky.js";import"./AlertCircle-BMPkNMGJ.js";import"./form-FE1JRkSu.js";import"./label-Dplc1_oE.js";import"./select-wwJ8EUoY.js";import"./ArrowLeft-Bo0FpGQs.js";import"./XCircle-DOtlBDfF.js";import"./tabs-CIxl9qVO.js";import"./Tool02-CZZOjaKh.js";import"./toggle-group-znNdMK--.js";import"./use-deco-credits-De3PrmGo.js";import"./sidebar-CusUIOZL.js";import"./LayoutLeft-C0u89h3U.js";import"./popover-DigaZ5Sb.js";import"./self-tool-result-Cch-sPi1.js";import"./alert-dialog-BgN-Tqd-.js";import"./integration-icon-BbWY9vfD.js";import"./extract-connection-data-BKY0ec6n.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-C2HwF4Ce.js";import"./use-debounced-value-BolYSN9R.js";import"./LinkExternal01-CLr9HZg0.js";import"./authenticate-and-persist-oauth-COCTTCRF.js";import"./mcp-oauth-Bi0vxp4Q.js";import"./track-CQoHeM9p.js";import"./toolbar-CdII6jdL.js";import"./skeleton-Dd2jseki.js";import"./github-repo-picker-BId4yHDh.js";import"./use-connection-niAftPf5.js";import"./Share07-C1_p27Hs.js";import"./use-mcp-tools-DcIN6xvI.js";import"./use-navigate-to-agent-ChzmcYSy.js";import"./reusable-new-chat-CouMjkYR.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-BoEQ2uqc.js";import"./use-registry-connections-CvNGLAr0.js";import"./useInfiniteQuery-DuCyL_is.js";import"./use-infinite-scroll-BMPCHIFs.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-GrGBYBXG.js";import"./textarea-BkOjJMTl.js";import"./connection-form-helpers-DB6bc0s9.js";import"./collection-tabs-DMyjVQaZ.js";import"./badge-CxlSzoE1.js";import"./useSuspenseInfiniteQuery-ByQ627dx.js";import"./use-open-billing-url-XDJk2wdH.js";import"./select-model-BpUI37HY.js";import"./checkbox-DjytOswq.js";import"./Key01-DY7yaq7L.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CfhHwu3l.js";import"./ArrowUpRight-OVKS4c5s.js";import"./Stars01-jLom0LSv.js";import"./cards-DY2u3Spm.js";import"./DotsVertical-9U5tOb04.js";import"./Palette-C8S3zMtK.js";import"./file-type-icon-CpiTVpKx.js";import"./question-004-sINsf4GQ.js";import"./use-members-CNN6Y-Zt.js";import"./use-org-auth-client-hxCPh-jf.js";import"./use-status-sounds-UrQRxkaM.js";import"./empty-state-tOcrn7Ci.js";import"./use-capability-DssZIcHp.js";import"./monaco-editor-a45QrHzb.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./switch-CAjDqeuV.js";import"./Play-B8V74CpU.js";import"./use-debounced-autosave-CGiNF_NH.js";import"./index-D5KNWpFX.js";import"./search-input--fbtpx3Q.js";import"./index-BEPKcH_a.js";import"./Users01-BGTUZMIA.js";import"./use-secrets-B-jc_6m7.js";import"./format-time-BnbuEtat.js";import"./use-copy-C8wJsCEn.js";import"./SwitchHorizontal01-D0Mi7oaK.js";import"./use-tags-opYrp-Zi.js";import"./get-initials-D-f_fDFw.js";import"./command-DktWLnIE.js";import"./index-Bqv-pFdx.js";import"./use-file-configs-Cq0JL4Et.js";import"./use-automations-DoX-Tmqm.js";import"./automation-list-row-BYFAi_YA.js";import"./CreditCard01-DSA6UjMO.js";import"./Globe04-m1tzMty0.js";import"./HardDrive-Dvps78YO.js";import"./LogOut01-BeE1lxGA.js";import"./Sun-m3RjKnDt.js";import"./Shield01-CZr-J1Qk.js";import"./table-DwuSaCi4.js";import"./use-clock-tick-CFTIWs0c.js";function nr(g){return g.schema?.definitions??g.schema?.$defs??{}}function sr(g,e){const o=nr(e),u=o[btoa(g)];if(!u)return;let d=typeof u.image=="string"?u.image:void 0;if(!d&&Array.isArray(u.allOf)){const S=u.allOf.find(x=>typeof x.$ref=="string")?.$ref;if(typeof S=="string"){const x=S.replace("#/definitions/",""),m=o[x];d=typeof m?.image=="string"?m.image:void 0}}if(d?.includes("{{{"))return d}function ar(g,e){if(!e)return;const o=Ba(g);if(!o)return;const u=sr(o.resolveType,e);if(!u)return;const d=Ka(u,o.data);if(d)return La(d)}const or="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",rr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Un(g){return Array.from({length:g},(e,o)=>({id:crypto.randomUUID(),index:o}))}function ws(g){return g.map((e,o)=>({...e,index:o}))}function ir(g,e){if(e===g.length)return g;if(e<g.length)return ws(g.slice(0,e));const o=Array.from({length:e-g.length},(u,d)=>({id:crypto.randomUUID(),index:g.length+d}));return[...g,...o]}function ks(g){const e=Ge.c(20),{section:o,raw:u,meta:d}=g,S=o.isSavedBlock===!0,x=o.isMultivariate===!0;let m;e[0]!==d||e[1]!==u?(m=u&&d?ar(u,d):void 0,e[0]=d,e[1]=u,e[2]=m):m=e[2];const v=m;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(To,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=f):f=e[3];let y;e[4]!==v?(y=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]=y):y=e[5];let T;e[6]!==x||e[7]!==S?(T=S?{color:$a}:x?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=x,e[7]=S,e[8]=T):T=e[8];let V;e[9]!==T?(V=n.jsx(hn,{className:"h-4 w-4 shrink-0",style:T}),e[9]=T,e[10]=V):V=e[10];const E=o.isHidden&&"line-through opacity-50";let l;e[11]!==E?(l=$e("min-w-0 flex-1 truncate text-sm font-medium",E),e[11]=E,e[12]=l):l=e[12];let h;e[13]!==o.label||e[14]!==l?(h=n.jsx("span",{className:l,children:o.label}),e[13]=o.label,e[14]=l,e[15]=h):h=e[15];let r;return e[16]!==y||e[17]!==V||e[18]!==h?(r=n.jsxs(n.Fragment,{children:[f,y,V,h]}),e[16]=y,e[17]=V,e[18]=h,e[19]=r):r=e[19],r}const lr="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",cr="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ur="w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function gn(g,e){return $e("h-7 shrink-0 overflow-hidden",e?lr:g?ur:cr)}function Ts(g,e){const o=g.isSavedBlock===!0,u=g.isMultivariate===!0;return $e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":o?or:u?ls:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function dr(g){const e=Ge.c(82),{section:o,raw:u,meta:d,sortableId:S,selected:x,onSelect:m,onDelete:v,onDuplicate:f,onMakeReusable:y,onToggleHidden:T,onToggleLazy:V,onAddVariant:E,onDetach:l}=g,h=ct(),r=u?os(u.__resolveType??""):!1,C=o.isHidden===!0,i=r||C;let R;e[0]!==o?(R=Fa(o),e[0]=o,e[1]=R):R=e[1];const M=R;let I;e[2]!==S?(I={id:S,animateLayoutChanges:hr},e[2]=S,e[3]=I):I=e[3];const{attributes:H,listeners:p,setNodeRef:B,transform:pe,isDragging:K}=rs(I);let le;e[4]!==pe?(le=is.Transform.toString(pe?{...pe,x:0}:null),e[4]=pe,e[5]=le):le=e[5];const D=K?0:void 0;let te;e[6]!==le||e[7]!==D?(te={transform:le,opacity:D},e[6]=le,e[7]=D,e[8]=te):te=e[8];const O=te;let se;e[9]!==o?(se=Ia(o),e[9]=o,e[10]=se):se=e[10];const De=se,xe="button",Q=0;let X;e[11]!==m?(X=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m())},e[11]=m,e[12]=X):X=e[12];const ge=K?"cursor-grabbing":"cursor-pointer";let ae;e[13]!==o||e[14]!==x||e[15]!==ge?(ae=$e("touch-none transition-colors",ge,Ts(o,x)),e[13]=o,e[14]=x,e[15]=ge,e[16]=ae):ae=e[16];let L;e[17]!==d||e[18]!==u||e[19]!==o?(L=n.jsx(ks,{section:o,raw:u,meta:d}),e[17]=d,e[18]=u,e[19]=o,e[20]=L):L=e[20];const ze=!o.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(r?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:$e(gn(i,r)),onClick:N=>{N.stopPropagation(),V()},onPointerDown:gr,children:n.jsx(zo,{className:$e("h-3.5 w-3.5",r&&"text-yellow-500")})})}),n.jsx(jt,{side:"bottom",children:h(r?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),nt=!o.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(C?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:$e(gn(i,C)),onClick:N=>{N.stopPropagation(),T()},onPointerDown:pr,children:C?n.jsx(Oo,{className:"h-3.5 w-3.5"}):n.jsx($o,{className:"h-3.5 w-3.5"})})}),n.jsx(jt,{side:"bottom",children:h(C?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),Le=Es,Me=js,W=!0,Z=Xe,Fe="button",Pe="ghost",ye="icon";let ce;e[21]!==h?(ce=h("sectionsEditor.sectionList.sectionActionsMenu"),e[21]=h,e[22]=ce):ce=e[22];const he=$e(gn(i,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let _e;e[23]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(vs,{className:"h-3.5 w-3.5"}),e[23]=_e):_e=e[23];let we;e[24]!==Z||e[25]!==ce||e[26]!==he?(we=n.jsx(Z,{type:Fe,variant:Pe,size:ye,"aria-label":ce,className:he,onClick:fr,onPointerDown:mr,children:_e}),e[24]=Z,e[25]=ce,e[26]=he,e[27]=we):we=e[27];let ve;e[28]!==Me||e[29]!==we?(ve=n.jsx(Me,{asChild:W,children:we}),e[28]=Me,e[29]=we,e[30]=ve):ve=e[30];let oe;e[31]!==f?(oe=N=>{N.stopPropagation(),f()},e[31]=f,e[32]=oe):oe=e[32];let Ae;e[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(xs,{className:"h-4 w-4"}),e[33]=Ae):Ae=e[33];let je;e[34]!==h?(je=h("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=h,e[35]=je):je=e[35];let me;e[36]!==oe||e[37]!==je?(me=n.jsxs(vt,{onClick:oe,children:[Ae,je]}),e[36]=oe,e[37]=je,e[38]=me):me=e[38];let $;e[39]!==M||e[40]!==E||e[41]!==h?($=M&&n.jsxs(vt,{className:Oa,onClick:N=>{N.stopPropagation(),E()},children:[n.jsx(ys,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=M,e[40]=E,e[41]=h,e[42]=$):$=e[42];let fe;e[43]!==De||e[44]!==y||e[45]!==h?(fe=De&&n.jsxs(vt,{className:rr,onClick:N=>{N.stopPropagation(),y()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=De,e[44]=y,e[45]=h,e[46]=fe):fe=e[46];let Ce;e[47]!==l||e[48]!==o.isMultivariate||e[49]!==o.isSavedBlock||e[50]!==h?(Ce=o.isSavedBlock===!0&&!o.isMultivariate&&n.jsxs(vt,{onClick:N=>{N.stopPropagation(),l()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=l,e[48]=o.isMultivariate,e[49]=o.isSavedBlock,e[50]=h,e[51]=Ce):Ce=e[51];let be;e[52]!==v?(be=N=>{N.stopPropagation(),v()},e[52]=v,e[53]=be):be=e[53];let ke;e[54]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(_s,{className:"h-4 w-4"}),e[54]=ke):ke=e[54];let ne;e[55]!==h?(ne=h("sectionsEditor.sectionList.deleteMenuItem"),e[55]=h,e[56]=ne):ne=e[56];let ie;e[57]!==be||e[58]!==ne?(ie=n.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:be,children:[ke,ne]}),e[57]=be,e[58]=ne,e[59]=ie):ie=e[59];let ue;e[60]!==me||e[61]!==$||e[62]!==fe||e[63]!==Ce||e[64]!==ie?(ue=n.jsxs(Rs,{align:"end",className:"w-44",children:[me,$,fe,Ce,ie]}),e[60]=me,e[61]=$,e[62]=fe,e[63]=Ce,e[64]=ie,e[65]=ue):ue=e[65];let Ee;e[66]!==Le||e[67]!==ve||e[68]!==ue?(Ee=n.jsxs(Le,{children:[ve,ue]}),e[66]=Le,e[67]=ve,e[68]=ue,e[69]=Ee):Ee=e[69];let de;return e[70]!==H||e[71]!==p||e[72]!==m||e[73]!==B||e[74]!==O||e[75]!==ae||e[76]!==L||e[77]!==ze||e[78]!==nt||e[79]!==Ee||e[80]!==X?(de=n.jsxs("div",{ref:B,style:O,...H,...p,role:xe,tabIndex:Q,onClick:m,onKeyDown:X,className:ae,children:[L,ze,nt,Ee]}),e[70]=H,e[71]=p,e[72]=m,e[73]=B,e[74]=O,e[75]=ae,e[76]=L,e[77]=ze,e[78]=nt,e[79]=Ee,e[80]=X,e[81]=de):de=e[81],de}function mr(g){return g.stopPropagation()}function fr(g){return g.stopPropagation()}function pr(g){return g.stopPropagation()}function gr(g){return g.stopPropagation()}function hr(){return!1}function vr(g){const e=Ge.c(104),{listKey:o,rawSections:u,sections:d,meta:S,selectedIndex:x,onSelect:m,onReorder:v,onDelete:f,onDuplicate:y,onMakeReusable:T,onToggleHidden:V,onToggleLazy:E,onAddVariant:l,onDetach:h,onAddSection:r,canAddSection:C}=g,i=C===void 0?!0:C,R=ct();let M;e[0]!==d.length?(M=()=>Un(d.length),e[0]=d.length,e[1]=M):M=e[1];const[I,H]=w.useState(M),[p,B]=w.useState(null),[pe,K]=w.useState(o),[le,D]=w.useState(d.length),te=w.useRef(!1);pe!==o?(K(o),D(d.length),H(Un(d.length))):le!==d.length&&(D(d.length),H(de=>ir(de,d.length)));let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={activationConstraint:{distance:8}},e[2]=O):O=e[2];let se;e[3]===Symbol.for("react.memo_cache_sentinel")?(se={coordinateGetter:cs},e[3]=se):se=e[3];const De=es(Qt(as,O),Qt(ss,se));let xe;e[4]!==I?(xe=I.map(br),e[4]=I,e[5]=xe):xe=e[5];const Q=xe;let X;e[6]===Symbol.for("react.memo_cache_sentinel")?(X=de=>{B(String(de.active.id))},e[6]=X):X=e[6];const ge=X;let ae;e[7]!==Q||e[8]!==v?(ae=de=>{B(null);const{active:N,over:re}=de;if(!re||N.id===re.id)return;const F=Q.indexOf(String(N.id)),Be=Q.indexOf(String(re.id));F===-1||Be===-1||(H(ut=>ws(Mt([...ut],F,Be))),te.current=!0,requestAnimationFrame(()=>{te.current=!1}),v?.(F,Be))},e[7]=Q,e[8]=v,e[9]=ae):ae=e[9];const L=ae;let ze;e[10]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{B(null)},e[10]=ze):ze=e[10];const nt=ze;let Le,Me,W,Z,Fe,Pe,ye,ce,he,_e,we,ve,oe,Ae,je;if(e[11]!==p||e[12]!==i||e[13]!==I||e[14]!==Q||e[15]!==L||e[16]!==S||e[17]!==r||e[18]!==l||e[19]!==f||e[20]!==h||e[21]!==y||e[22]!==T||e[23]!==m||e[24]!==V||e[25]!==E||e[26]!==u||e[27]!==d||e[28]!==x||e[29]!==De||e[30]!==R){Ae=Symbol.for("react.early_return_sentinel");e:{const de=N=>{te.current||m(N)};if(e[46]!==p||e[47]!==i||e[48]!==I||e[49]!==r||e[50]!==u||e[51]!==d||e[52]!==R){const N=p?I.find(re=>re.id===p):null;if(Z=N!=null?d[N.index]:null,W=N!=null?u[N.index]:void 0,I.length===0){let re;e[56]!==R?(re=R("sectionsEditor.sectionList.noSections"),e[56]=R,e[57]=re):re=e[57];let F;e[58]!==re?(F=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:re}),e[58]=re,e[59]=F):F=e[59];const Be=!i;let ut;e[60]===Symbol.for("react.memo_cache_sentinel")?(ut=n.jsx(vn,{size:14}),e[60]=ut):ut=e[60];let Te;e[61]!==R?(Te=R("sectionsEditor.sectionList.addSectionButton"),e[61]=R,e[62]=Te):Te=e[62];let We;e[63]!==r||e[64]!==Be||e[65]!==Te?(We=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Be,onClick:r,children:[ut,Te]}),e[63]=r,e[64]=Be,e[65]=Te,e[66]=We):We=e[66];let Ie;e[67]!==F||e[68]!==We?(Ie=n.jsxs("div",{className:"space-y-2",children:[F,We]}),e[67]=F,e[68]=We,e[69]=Ie):Ie=e[69],Ae=Ie;break e}oe=$e(N&&"cursor-grabbing"),e[46]=p,e[47]=i,e[48]=I,e[49]=r,e[50]=u,e[51]=d,e[52]=R,e[53]=W,e[54]=Z,e[55]=oe}else W=e[53],Z=e[54],oe=e[55];Me=us,ce=De,he=ds,_e=ge,we=L,ve=nt,Le=ms,Pe=Q,ye=fs,je="space-y-1",Fe=I.map(N=>{const re=d[N.index];return re?n.jsx(dr,{sortableId:N.id,section:re,raw:u[N.index],meta:S,selected:x===N.index,onSelect:()=>de(N.index),onDelete:()=>f(N.index),onDuplicate:()=>y(N.index),onMakeReusable:()=>T(N.index),onToggleHidden:()=>V(N.index),onToggleLazy:()=>E(N.index),onAddVariant:()=>l(N.index),onDetach:()=>h(N.index)},N.id):null})}e[11]=p,e[12]=i,e[13]=I,e[14]=Q,e[15]=L,e[16]=S,e[17]=r,e[18]=l,e[19]=f,e[20]=h,e[21]=y,e[22]=T,e[23]=m,e[24]=V,e[25]=E,e[26]=u,e[27]=d,e[28]=x,e[29]=De,e[30]=R,e[31]=Le,e[32]=Me,e[33]=W,e[34]=Z,e[35]=Fe,e[36]=Pe,e[37]=ye,e[38]=ce,e[39]=he,e[40]=_e,e[41]=we,e[42]=ve,e[43]=oe,e[44]=Ae,e[45]=je}else Le=e[31],Me=e[32],W=e[33],Z=e[34],Fe=e[35],Pe=e[36],ye=e[37],ce=e[38],he=e[39],_e=e[40],we=e[41],ve=e[42],oe=e[43],Ae=e[44],je=e[45];if(Ae!==Symbol.for("react.early_return_sentinel"))return Ae;let me;e[70]!==Fe||e[71]!==je?(me=n.jsx("div",{className:je,children:Fe}),e[70]=Fe,e[71]=je,e[72]=me):me=e[72];let $;e[73]!==Le||e[74]!==Pe||e[75]!==ye||e[76]!==me?($=n.jsx(Le,{items:Pe,strategy:ye,children:me}),e[73]=Le,e[74]=Pe,e[75]=ye,e[76]=me,e[77]=$):$=e[77];let fe;e[78]!==W||e[79]!==Z||e[80]!==S?(fe=Z?n.jsx("div",{className:$e("cursor-grabbing shadow-lg ring-1 ring-border/60",Ts(Z,!1)),children:n.jsx(ks,{section:Z,raw:W,meta:S})}):null,e[78]=W,e[79]=Z,e[80]=S,e[81]=fe):fe=e[81];let Ce;e[82]!==fe?(Ce=Xn.createPortal(n.jsx(ts,{dropAnimation:ns,children:fe}),document.body),e[82]=fe,e[83]=Ce):Ce=e[83];let be;e[84]!==Me||e[85]!==ce||e[86]!==he||e[87]!==_e||e[88]!==we||e[89]!==ve||e[90]!==$||e[91]!==Ce?(be=n.jsxs(Me,{sensors:ce,collisionDetection:he,onDragStart:_e,onDragEnd:we,onDragCancel:ve,children:[$,Ce]}),e[84]=Me,e[85]=ce,e[86]=he,e[87]=_e,e[88]=we,e[89]=ve,e[90]=$,e[91]=Ce,e[92]=be):be=e[92];const ke=!i;let ne;e[93]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx(vn,{size:14}),e[93]=ne):ne=e[93];let ie;e[94]!==R?(ie=R("sectionsEditor.sectionList.addSectionButton"),e[94]=R,e[95]=ie):ie=e[95];let ue;e[96]!==r||e[97]!==ke||e[98]!==ie?(ue=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:ke,onClick:r,children:[ne,ie]}),e[96]=r,e[97]=ke,e[98]=ie,e[99]=ue):ue=e[99];let Ee;return e[100]!==oe||e[101]!==be||e[102]!==ue?(Ee=n.jsxs("div",{className:oe,children:[be,ue]}),e[100]=oe,e[101]=be,e[102]=ue,e[103]=Ee):Ee=e[103],Ee}function br(g){return g.id}function qn(g){const e=Ge.c(57),{open:o,initialName:u,autoLabel:d,isPending:S,onSubmit:x,onOpenChange:m}=g,v=S===void 0?!1:S,f=ct(),[y,T]=w.useState(u),[V,E]=w.useState(o);o!==V&&(E(o),o&&T(u));let l;e[0]!==v||e[1]!==m?(l=ge=>{!ge&&!v&&m(!1)},e[0]=v,e[1]=m,e[2]=l):l=e[2];const h=l;let r;e[3]!==v||e[4]!==y||e[5]!==x?(r=async ge=>{ge.preventDefault(),!v&&await x(y.trim())},e[3]=v,e[4]=y,e[5]=x,e[6]=r):r=e[6];const C=r;let i;e[7]!==f?(i=f("sectionsEditor.variantRenameDialog.title"),e[7]=f,e[8]=i):i=e[8];let R;e[9]!==i?(R=n.jsx(Co,{children:i}),e[9]=i,e[10]=R):R=e[10];let M;e[11]!==d||e[12]!==f?(M=f("sectionsEditor.variantRenameDialog.description",{fallback:d||f("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=d,e[12]=f,e[13]=M):M=e[13];let I;e[14]!==M?(I=n.jsx(Mo,{children:M}),e[14]=M,e[15]=I):I=e[15];let H;e[16]!==R||e[17]!==I?(H=n.jsxs(Bo,{children:[R,I]}),e[16]=R,e[17]=I,e[18]=H):H=e[18];let p;e[19]!==f?(p=f("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=f,e[20]=p):p=e[20];let B;e[21]!==p?(B=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:p}),e[21]=p,e[22]=B):B=e[22];let pe;e[23]===Symbol.for("react.memo_cache_sentinel")?(pe=ge=>T(ge.target.value),e[23]=pe):pe=e[23];let K;e[24]!==d||e[25]!==v||e[26]!==y?(K=n.jsx(Io,{id:"variant-rename-name",value:y,onChange:pe,placeholder:d,autoFocus:!0,disabled:v}),e[24]=d,e[25]=v,e[26]=y,e[27]=K):K=e[27];let le;e[28]!==B||e[29]!==K?(le=n.jsxs("div",{className:"space-y-1.5 py-4",children:[B,K]}),e[28]=B,e[29]=K,e[30]=le):le=e[30];let D;e[31]!==m?(D=()=>m(!1),e[31]=m,e[32]=D):D=e[32];let te;e[33]!==f?(te=f("sectionsEditor.variantRenameDialog.cancel"),e[33]=f,e[34]=te):te=e[34];let O;e[35]!==v||e[36]!==D||e[37]!==te?(O=n.jsx(Xe,{type:"button",variant:"outline",onClick:D,disabled:v,children:te}),e[35]=v,e[36]=D,e[37]=te,e[38]=O):O=e[38];let se;e[39]!==v||e[40]!==f?(se=v?n.jsxs(n.Fragment,{children:[n.jsx(Zn,{size:14,className:"animate-spin"}),f("sectionsEditor.variantRenameDialog.saving")]}):f("sectionsEditor.variantRenameDialog.save"),e[39]=v,e[40]=f,e[41]=se):se=e[41];let De;e[42]!==v||e[43]!==se?(De=n.jsx(Xe,{type:"submit",disabled:v,children:se}),e[42]=v,e[43]=se,e[44]=De):De=e[44];let xe;e[45]!==O||e[46]!==De?(xe=n.jsxs(Ko,{children:[O,De]}),e[45]=O,e[46]=De,e[47]=xe):xe=e[47];let Q;e[48]!==C||e[49]!==le||e[50]!==xe||e[51]!==H?(Q=n.jsx(Lo,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:C,children:[H,le,xe]})}),e[48]=C,e[49]=le,e[50]=xe,e[51]=H,e[52]=Q):Q=e[52];let X;return e[53]!==h||e[54]!==o||e[55]!==Q?(X=n.jsx(Fo,{open:o,onOpenChange:h,children:Q}),e[53]=h,e[54]=o,e[55]=Q,e[56]=X):X=e[56],X}function Ns(g){const e=Ge.c(5),{rule:o,matchers:u}=g,d=o?.__resolveType??"";let S;if(e[0]!==u||e[1]!==d){const f=u.find(y=>y.resolveType===d)?.iconName??za(d);S=No(f),e[0]=u,e[1]=d,e[2]=S}else S=e[2];const x=S;if(!x)return null;let m;return e[3]!==x?(m=n.jsx(x,{size:14,className:"shrink-0"}),e[3]=x,e[4]=m):m=e[4],m}function Gn(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
1
|
+
import{c as Ge,b as ct,r as w,m as $e,j as n,ae as Xn,B as Xe,k as Zn,o as Ca,t as J,K as Ma}from"./index-HPW3S3aV.js";import{ap as Ba,aq as Ka,ar as La,a4 as es,a5 as Qt,as as ts,at as ns,a6 as ss,a7 as as,au as os,av as Fa,ae as rs,af as is,aw as Ia,ax as Oa,ay as ls,O as $a,a8 as cs,a9 as Mt,ac as us,ad as ds,aa as ms,ak as fs,az as za,aA as Bt,aB as ps,aC as Ha,S as gs,aD as lt,G as hs,aE as Ua,aF as qa,aG as Ga,aH as Wa,D as Ya,F as Ja,aI as Qa,aJ as Xa,aK as Za,aL as eo,ai as qt,aM as Gt,aN as to,aO as St,aP as Pt,aQ as no,aR as so,aS as tt,aT as Kn,aU as ao,aV as At,aW as Wt,aX as oo,aY as mn,aZ as ro,a_ as kt,a$ as io,b0 as lo,b1 as co,b2 as uo,b3 as mo,b4 as xt,b5 as fo,b6 as po,b7 as go,I as ho,b8 as Ln,b9 as Ct,ba as Fn,bb as In,bc as vo,bd as bo,be as So,bf as xo,bg as fn,bh as On,bi as $n,bj as Tt,bk as Yt,bl as zn,bm as yo,bn as pn,bo as _o,bp as jo,bq as Eo,br as Ro,bs as wo}from"./index-Dp2mcxiD.js";import{t as ko}from"./ChevronDown-C84fi4SM.js";import{ad as hn,v as To,T as vs,E as No,u as bs,af as Vo,_ as Do}from"./agent-icon-2qQdCLvH.js";import{i as Ss}from"./ChevronRight-1hSG5rxw.js";import{n as Po}from"./ChevronUp-B_P52q74.js";import{i as Ao}from"./Globe01-C0Wza-pB.js";import{B as Jt}from"./automation-runs-P9Mw6j7h.js";import{c as yt,T as _t,a as jt}from"./tooltip-DI3Hz4lP.js";import{b as Co,h as Mo,a as Bo,c as Ko,d as Lo,e as Fo}from"./dialog-BESgF0t5.js";import{I as Io}from"./input-C0I5JNx4.js";import{a as xs}from"./Copy01-BIHAMwMS.js";import{i as Oo}from"./Settings02-CuJD2QQQ.js";import{s as $o}from"./Eye-C2o0TGpU.js";import{s as ys}from"./TrendUp01-Ui3JerXt.js";import{s as vn}from"./Plus-BzXIpygM.js";import{s as _s}from"./Trash01-Dt7JHw9s.js";import{i as zo}from"./Zap-7arhZWhP.js";import{D as js,a as vt,c as Es,b as Rs,i as Ho}from"./dropdown-menu-wvfbPcYr.js";import{S as Uo,r as Hn,u as qo,d as Go,a as Wo,i as Yo,f as Jo,P as Qo,b as Xo}from"./page-seo-form-DaSZgD3I.js";import{c as Zo}from"./Tool01-kS2-_uju.js";import{u as er,A as tr}from"./use-section-preview-base-ByvuPow7.js";import"./ArrowUp-BcOlM00A.js";import"./chat-context-DhgZwGdc.js";import"./tab-id-BB8NVpbv.js";import"./Check-DRUrRM4k.js";import"./hooks-DIjcjCME.js";import"./use-mcp-client-Dd9BhgSs.js";import"./auth-CC88oAR_.js";import"./decopilot-sse-pool-oua6a_5v.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-CsgaUGpK.js";import"./use-ai-providers-MbQtQBY4.js";import"./studio-tools-DnX4fHFe.js";import"./use-decopilot-events-BnO8ZQ7u.js";import"./use-organization-settings-Cz3O3Adt.js";import"./spinner-Dbsv0bfZ.js";import"./drawer-BX8td69Q.js";import"./collection-search-Bj_EVERX.js";import"./SearchMd-CYo4IMba.js";import"./use-mobile-DJGPHp4h.js";import"./AreaChart-UxGJ9jAc.js";import"./index-BHNegbCC.js";import"./X-CSOAIpHP.js";import"./shell-layout-BHbgVrVC.js";import"./avatar-B1oqUtwq.js";import"./User01-l4IrhDce.js";import"./Users03-ysfZCx2u.js";import"./SearchLg-BaWhFDSb.js";import"./Stars02-B0uiQKM0.js";import"./XClose-DhJ7lSIE.js";import"./CheckCircle-Cj9wXz7h.js";import"./CpuChip01-bhvA1IPq.js";import"./FilterLines-CWNPFfmU.js";import"./Monitor01-sWedXVH7.js";import"./required-auth-layout-8ocM8xDK.js";import"./use-org-sso-rE8Xzp2x.js";import"./deco-site-production-url-BjY4ZYd-.js";import"./ZapSquare-gB0cAUuh.js";import"./Star01-CIJmX3JD.js";import"./Upload01-Bii7Hq0g.js";import"./AlertCircle-CWOm5Uve.js";import"./form-ClQ7Ni5r.js";import"./label-TMER_91K.js";import"./select-DTS7Lm6P.js";import"./ArrowLeft-DSLmAXMn.js";import"./XCircle-Bj_OSIiW.js";import"./tabs-BrXfVpvw.js";import"./Tool02-C__tuoKZ.js";import"./toggle-group-Clh5nuH4.js";import"./use-deco-credits-CfxA2OJy.js";import"./sidebar-f7Yn2HRt.js";import"./LayoutLeft-CgpazeQW.js";import"./popover-DPCi05d2.js";import"./self-tool-result-DnGIQn1o.js";import"./alert-dialog-C7kop1Uj.js";import"./integration-icon-BDOm4BcE.js";import"./extract-connection-data-7BFhmMaZ.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-C2HwF4Ce.js";import"./use-debounced-value-DV34ei4H.js";import"./LinkExternal01-C3r7gRMA.js";import"./authenticate-and-persist-oauth-HCKgl3h4.js";import"./mcp-oauth-DHGnWo7T.js";import"./track-O8SJjyqW.js";import"./toolbar-CwcZPI-m.js";import"./skeleton-BahaVLML.js";import"./github-repo-picker-C4r_E65q.js";import"./use-connection-DMTeFaun.js";import"./Share07-DpvwgZZl.js";import"./use-mcp-tools-BTugLIIE.js";import"./use-navigate-to-agent-DE3a5vV6.js";import"./reusable-new-chat-CouMjkYR.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-SAZw6a20.js";import"./use-registry-connections-kKuNWCoR.js";import"./useInfiniteQuery-tMxJVteW.js";import"./use-infinite-scroll-Cn4b6uN5.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-CqN-NUhK.js";import"./textarea-GQBocofC.js";import"./connection-form-helpers-Dkb7-8HI.js";import"./collection-tabs-hyTpqdOU.js";import"./badge-CdU2Ug8F.js";import"./useSuspenseInfiniteQuery-k4eiew2A.js";import"./use-open-billing-url-BU4i4vHj.js";import"./select-model-y_C2MN3i.js";import"./checkbox-CTxCGW48.js";import"./Key01-DGtD9k-H.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cx85iU9E.js";import"./ArrowUpRight-DMEBYWz_.js";import"./Stars01-B7GvVd6X.js";import"./cards-DM1ZCHpf.js";import"./DotsVertical-DKRrOswH.js";import"./Palette-Cumnt5dU.js";import"./file-type-icon-DldS77Gr.js";import"./question-004-sINsf4GQ.js";import"./use-members-DP7ds61c.js";import"./use-org-auth-client-CCVSFhLN.js";import"./use-status-sounds-jmdvs_bW.js";import"./empty-state-BPZfx_fo.js";import"./use-capability-CJU_PUqY.js";import"./monaco-editor-BkWT_ZEx.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./switch-BDoYmMK9.js";import"./Play-CEUcklF_.js";import"./use-debounced-autosave-D44_xeXB.js";import"./index-Bpi-6hXQ.js";import"./search-input-DNC728_E.js";import"./index-BnuZOi3L.js";import"./Users01-C_ExcbfC.js";import"./use-secrets-DFgI2DPZ.js";import"./format-time-BnbuEtat.js";import"./use-copy-CGZ5jXfB.js";import"./SwitchHorizontal01-bOur07pT.js";import"./use-tags-BmdDAXPp.js";import"./get-initials-D-f_fDFw.js";import"./command-BPVTZoz7.js";import"./index-BbvS0vYI.js";import"./use-file-configs-DodT1yw8.js";import"./use-automations-HBEx9wKJ.js";import"./automation-list-row-3iCxhyP9.js";import"./CreditCard01-DjlAzA63.js";import"./Globe04-DlPMnL_W.js";import"./HardDrive-CuUDIL3d.js";import"./LogOut01-DrJBO7A2.js";import"./Sun-CUJtCtMs.js";import"./Shield01-DRzjQN2b.js";import"./table-B5qyucGR.js";import"./use-clock-tick-BpA4A29S.js";function nr(g){return g.schema?.definitions??g.schema?.$defs??{}}function sr(g,e){const o=nr(e),u=o[btoa(g)];if(!u)return;let d=typeof u.image=="string"?u.image:void 0;if(!d&&Array.isArray(u.allOf)){const S=u.allOf.find(x=>typeof x.$ref=="string")?.$ref;if(typeof S=="string"){const x=S.replace("#/definitions/",""),m=o[x];d=typeof m?.image=="string"?m.image:void 0}}if(d?.includes("{{{"))return d}function ar(g,e){if(!e)return;const o=Ba(g);if(!o)return;const u=sr(o.resolveType,e);if(!u)return;const d=Ka(u,o.data);if(d)return La(d)}const or="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",rr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Un(g){return Array.from({length:g},(e,o)=>({id:crypto.randomUUID(),index:o}))}function ws(g){return g.map((e,o)=>({...e,index:o}))}function ir(g,e){if(e===g.length)return g;if(e<g.length)return ws(g.slice(0,e));const o=Array.from({length:e-g.length},(u,d)=>({id:crypto.randomUUID(),index:g.length+d}));return[...g,...o]}function ks(g){const e=Ge.c(20),{section:o,raw:u,meta:d}=g,S=o.isSavedBlock===!0,x=o.isMultivariate===!0;let m;e[0]!==d||e[1]!==u?(m=u&&d?ar(u,d):void 0,e[0]=d,e[1]=u,e[2]=m):m=e[2];const v=m;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(To,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=f):f=e[3];let y;e[4]!==v?(y=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]=y):y=e[5];let T;e[6]!==x||e[7]!==S?(T=S?{color:$a}:x?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=x,e[7]=S,e[8]=T):T=e[8];let V;e[9]!==T?(V=n.jsx(hn,{className:"h-4 w-4 shrink-0",style:T}),e[9]=T,e[10]=V):V=e[10];const E=o.isHidden&&"line-through opacity-50";let l;e[11]!==E?(l=$e("min-w-0 flex-1 truncate text-sm font-medium",E),e[11]=E,e[12]=l):l=e[12];let h;e[13]!==o.label||e[14]!==l?(h=n.jsx("span",{className:l,children:o.label}),e[13]=o.label,e[14]=l,e[15]=h):h=e[15];let r;return e[16]!==y||e[17]!==V||e[18]!==h?(r=n.jsxs(n.Fragment,{children:[f,y,V,h]}),e[16]=y,e[17]=V,e[18]=h,e[19]=r):r=e[19],r}const lr="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",cr="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ur="w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function gn(g,e){return $e("h-7 shrink-0 overflow-hidden",e?lr:g?ur:cr)}function Ts(g,e){const o=g.isSavedBlock===!0,u=g.isMultivariate===!0;return $e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":o?or:u?ls:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function dr(g){const e=Ge.c(82),{section:o,raw:u,meta:d,sortableId:S,selected:x,onSelect:m,onDelete:v,onDuplicate:f,onMakeReusable:y,onToggleHidden:T,onToggleLazy:V,onAddVariant:E,onDetach:l}=g,h=ct(),r=u?os(u.__resolveType??""):!1,C=o.isHidden===!0,i=r||C;let R;e[0]!==o?(R=Fa(o),e[0]=o,e[1]=R):R=e[1];const M=R;let I;e[2]!==S?(I={id:S,animateLayoutChanges:hr},e[2]=S,e[3]=I):I=e[3];const{attributes:H,listeners:p,setNodeRef:B,transform:pe,isDragging:K}=rs(I);let le;e[4]!==pe?(le=is.Transform.toString(pe?{...pe,x:0}:null),e[4]=pe,e[5]=le):le=e[5];const D=K?0:void 0;let te;e[6]!==le||e[7]!==D?(te={transform:le,opacity:D},e[6]=le,e[7]=D,e[8]=te):te=e[8];const O=te;let se;e[9]!==o?(se=Ia(o),e[9]=o,e[10]=se):se=e[10];const De=se,xe="button",Q=0;let X;e[11]!==m?(X=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m())},e[11]=m,e[12]=X):X=e[12];const ge=K?"cursor-grabbing":"cursor-pointer";let ae;e[13]!==o||e[14]!==x||e[15]!==ge?(ae=$e("touch-none transition-colors",ge,Ts(o,x)),e[13]=o,e[14]=x,e[15]=ge,e[16]=ae):ae=e[16];let L;e[17]!==d||e[18]!==u||e[19]!==o?(L=n.jsx(ks,{section:o,raw:u,meta:d}),e[17]=d,e[18]=u,e[19]=o,e[20]=L):L=e[20];const ze=!o.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(r?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:$e(gn(i,r)),onClick:N=>{N.stopPropagation(),V()},onPointerDown:gr,children:n.jsx(zo,{className:$e("h-3.5 w-3.5",r&&"text-yellow-500")})})}),n.jsx(jt,{side:"bottom",children:h(r?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),nt=!o.isMultivariate&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":h(C?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:$e(gn(i,C)),onClick:N=>{N.stopPropagation(),T()},onPointerDown:pr,children:C?n.jsx(Oo,{className:"h-3.5 w-3.5"}):n.jsx($o,{className:"h-3.5 w-3.5"})})}),n.jsx(jt,{side:"bottom",children:h(C?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),Le=Es,Me=js,W=!0,Z=Xe,Fe="button",Pe="ghost",ye="icon";let ce;e[21]!==h?(ce=h("sectionsEditor.sectionList.sectionActionsMenu"),e[21]=h,e[22]=ce):ce=e[22];const he=$e(gn(i,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let _e;e[23]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(vs,{className:"h-3.5 w-3.5"}),e[23]=_e):_e=e[23];let we;e[24]!==Z||e[25]!==ce||e[26]!==he?(we=n.jsx(Z,{type:Fe,variant:Pe,size:ye,"aria-label":ce,className:he,onClick:fr,onPointerDown:mr,children:_e}),e[24]=Z,e[25]=ce,e[26]=he,e[27]=we):we=e[27];let ve;e[28]!==Me||e[29]!==we?(ve=n.jsx(Me,{asChild:W,children:we}),e[28]=Me,e[29]=we,e[30]=ve):ve=e[30];let oe;e[31]!==f?(oe=N=>{N.stopPropagation(),f()},e[31]=f,e[32]=oe):oe=e[32];let Ae;e[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(xs,{className:"h-4 w-4"}),e[33]=Ae):Ae=e[33];let je;e[34]!==h?(je=h("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=h,e[35]=je):je=e[35];let me;e[36]!==oe||e[37]!==je?(me=n.jsxs(vt,{onClick:oe,children:[Ae,je]}),e[36]=oe,e[37]=je,e[38]=me):me=e[38];let $;e[39]!==M||e[40]!==E||e[41]!==h?($=M&&n.jsxs(vt,{className:Oa,onClick:N=>{N.stopPropagation(),E()},children:[n.jsx(ys,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=M,e[40]=E,e[41]=h,e[42]=$):$=e[42];let fe;e[43]!==De||e[44]!==y||e[45]!==h?(fe=De&&n.jsxs(vt,{className:rr,onClick:N=>{N.stopPropagation(),y()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=De,e[44]=y,e[45]=h,e[46]=fe):fe=e[46];let Ce;e[47]!==l||e[48]!==o.isMultivariate||e[49]!==o.isSavedBlock||e[50]!==h?(Ce=o.isSavedBlock===!0&&!o.isMultivariate&&n.jsxs(vt,{onClick:N=>{N.stopPropagation(),l()},children:[n.jsx(hn,{className:"h-4 w-4"}),h("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=l,e[48]=o.isMultivariate,e[49]=o.isSavedBlock,e[50]=h,e[51]=Ce):Ce=e[51];let be;e[52]!==v?(be=N=>{N.stopPropagation(),v()},e[52]=v,e[53]=be):be=e[53];let ke;e[54]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(_s,{className:"h-4 w-4"}),e[54]=ke):ke=e[54];let ne;e[55]!==h?(ne=h("sectionsEditor.sectionList.deleteMenuItem"),e[55]=h,e[56]=ne):ne=e[56];let ie;e[57]!==be||e[58]!==ne?(ie=n.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:be,children:[ke,ne]}),e[57]=be,e[58]=ne,e[59]=ie):ie=e[59];let ue;e[60]!==me||e[61]!==$||e[62]!==fe||e[63]!==Ce||e[64]!==ie?(ue=n.jsxs(Rs,{align:"end",className:"w-44",children:[me,$,fe,Ce,ie]}),e[60]=me,e[61]=$,e[62]=fe,e[63]=Ce,e[64]=ie,e[65]=ue):ue=e[65];let Ee;e[66]!==Le||e[67]!==ve||e[68]!==ue?(Ee=n.jsxs(Le,{children:[ve,ue]}),e[66]=Le,e[67]=ve,e[68]=ue,e[69]=Ee):Ee=e[69];let de;return e[70]!==H||e[71]!==p||e[72]!==m||e[73]!==B||e[74]!==O||e[75]!==ae||e[76]!==L||e[77]!==ze||e[78]!==nt||e[79]!==Ee||e[80]!==X?(de=n.jsxs("div",{ref:B,style:O,...H,...p,role:xe,tabIndex:Q,onClick:m,onKeyDown:X,className:ae,children:[L,ze,nt,Ee]}),e[70]=H,e[71]=p,e[72]=m,e[73]=B,e[74]=O,e[75]=ae,e[76]=L,e[77]=ze,e[78]=nt,e[79]=Ee,e[80]=X,e[81]=de):de=e[81],de}function mr(g){return g.stopPropagation()}function fr(g){return g.stopPropagation()}function pr(g){return g.stopPropagation()}function gr(g){return g.stopPropagation()}function hr(){return!1}function vr(g){const e=Ge.c(104),{listKey:o,rawSections:u,sections:d,meta:S,selectedIndex:x,onSelect:m,onReorder:v,onDelete:f,onDuplicate:y,onMakeReusable:T,onToggleHidden:V,onToggleLazy:E,onAddVariant:l,onDetach:h,onAddSection:r,canAddSection:C}=g,i=C===void 0?!0:C,R=ct();let M;e[0]!==d.length?(M=()=>Un(d.length),e[0]=d.length,e[1]=M):M=e[1];const[I,H]=w.useState(M),[p,B]=w.useState(null),[pe,K]=w.useState(o),[le,D]=w.useState(d.length),te=w.useRef(!1);pe!==o?(K(o),D(d.length),H(Un(d.length))):le!==d.length&&(D(d.length),H(de=>ir(de,d.length)));let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={activationConstraint:{distance:8}},e[2]=O):O=e[2];let se;e[3]===Symbol.for("react.memo_cache_sentinel")?(se={coordinateGetter:cs},e[3]=se):se=e[3];const De=es(Qt(as,O),Qt(ss,se));let xe;e[4]!==I?(xe=I.map(br),e[4]=I,e[5]=xe):xe=e[5];const Q=xe;let X;e[6]===Symbol.for("react.memo_cache_sentinel")?(X=de=>{B(String(de.active.id))},e[6]=X):X=e[6];const ge=X;let ae;e[7]!==Q||e[8]!==v?(ae=de=>{B(null);const{active:N,over:re}=de;if(!re||N.id===re.id)return;const F=Q.indexOf(String(N.id)),Be=Q.indexOf(String(re.id));F===-1||Be===-1||(H(ut=>ws(Mt([...ut],F,Be))),te.current=!0,requestAnimationFrame(()=>{te.current=!1}),v?.(F,Be))},e[7]=Q,e[8]=v,e[9]=ae):ae=e[9];const L=ae;let ze;e[10]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{B(null)},e[10]=ze):ze=e[10];const nt=ze;let Le,Me,W,Z,Fe,Pe,ye,ce,he,_e,we,ve,oe,Ae,je;if(e[11]!==p||e[12]!==i||e[13]!==I||e[14]!==Q||e[15]!==L||e[16]!==S||e[17]!==r||e[18]!==l||e[19]!==f||e[20]!==h||e[21]!==y||e[22]!==T||e[23]!==m||e[24]!==V||e[25]!==E||e[26]!==u||e[27]!==d||e[28]!==x||e[29]!==De||e[30]!==R){Ae=Symbol.for("react.early_return_sentinel");e:{const de=N=>{te.current||m(N)};if(e[46]!==p||e[47]!==i||e[48]!==I||e[49]!==r||e[50]!==u||e[51]!==d||e[52]!==R){const N=p?I.find(re=>re.id===p):null;if(Z=N!=null?d[N.index]:null,W=N!=null?u[N.index]:void 0,I.length===0){let re;e[56]!==R?(re=R("sectionsEditor.sectionList.noSections"),e[56]=R,e[57]=re):re=e[57];let F;e[58]!==re?(F=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:re}),e[58]=re,e[59]=F):F=e[59];const Be=!i;let ut;e[60]===Symbol.for("react.memo_cache_sentinel")?(ut=n.jsx(vn,{size:14}),e[60]=ut):ut=e[60];let Te;e[61]!==R?(Te=R("sectionsEditor.sectionList.addSectionButton"),e[61]=R,e[62]=Te):Te=e[62];let We;e[63]!==r||e[64]!==Be||e[65]!==Te?(We=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Be,onClick:r,children:[ut,Te]}),e[63]=r,e[64]=Be,e[65]=Te,e[66]=We):We=e[66];let Ie;e[67]!==F||e[68]!==We?(Ie=n.jsxs("div",{className:"space-y-2",children:[F,We]}),e[67]=F,e[68]=We,e[69]=Ie):Ie=e[69],Ae=Ie;break e}oe=$e(N&&"cursor-grabbing"),e[46]=p,e[47]=i,e[48]=I,e[49]=r,e[50]=u,e[51]=d,e[52]=R,e[53]=W,e[54]=Z,e[55]=oe}else W=e[53],Z=e[54],oe=e[55];Me=us,ce=De,he=ds,_e=ge,we=L,ve=nt,Le=ms,Pe=Q,ye=fs,je="space-y-1",Fe=I.map(N=>{const re=d[N.index];return re?n.jsx(dr,{sortableId:N.id,section:re,raw:u[N.index],meta:S,selected:x===N.index,onSelect:()=>de(N.index),onDelete:()=>f(N.index),onDuplicate:()=>y(N.index),onMakeReusable:()=>T(N.index),onToggleHidden:()=>V(N.index),onToggleLazy:()=>E(N.index),onAddVariant:()=>l(N.index),onDetach:()=>h(N.index)},N.id):null})}e[11]=p,e[12]=i,e[13]=I,e[14]=Q,e[15]=L,e[16]=S,e[17]=r,e[18]=l,e[19]=f,e[20]=h,e[21]=y,e[22]=T,e[23]=m,e[24]=V,e[25]=E,e[26]=u,e[27]=d,e[28]=x,e[29]=De,e[30]=R,e[31]=Le,e[32]=Me,e[33]=W,e[34]=Z,e[35]=Fe,e[36]=Pe,e[37]=ye,e[38]=ce,e[39]=he,e[40]=_e,e[41]=we,e[42]=ve,e[43]=oe,e[44]=Ae,e[45]=je}else Le=e[31],Me=e[32],W=e[33],Z=e[34],Fe=e[35],Pe=e[36],ye=e[37],ce=e[38],he=e[39],_e=e[40],we=e[41],ve=e[42],oe=e[43],Ae=e[44],je=e[45];if(Ae!==Symbol.for("react.early_return_sentinel"))return Ae;let me;e[70]!==Fe||e[71]!==je?(me=n.jsx("div",{className:je,children:Fe}),e[70]=Fe,e[71]=je,e[72]=me):me=e[72];let $;e[73]!==Le||e[74]!==Pe||e[75]!==ye||e[76]!==me?($=n.jsx(Le,{items:Pe,strategy:ye,children:me}),e[73]=Le,e[74]=Pe,e[75]=ye,e[76]=me,e[77]=$):$=e[77];let fe;e[78]!==W||e[79]!==Z||e[80]!==S?(fe=Z?n.jsx("div",{className:$e("cursor-grabbing shadow-lg ring-1 ring-border/60",Ts(Z,!1)),children:n.jsx(ks,{section:Z,raw:W,meta:S})}):null,e[78]=W,e[79]=Z,e[80]=S,e[81]=fe):fe=e[81];let Ce;e[82]!==fe?(Ce=Xn.createPortal(n.jsx(ts,{dropAnimation:ns,children:fe}),document.body),e[82]=fe,e[83]=Ce):Ce=e[83];let be;e[84]!==Me||e[85]!==ce||e[86]!==he||e[87]!==_e||e[88]!==we||e[89]!==ve||e[90]!==$||e[91]!==Ce?(be=n.jsxs(Me,{sensors:ce,collisionDetection:he,onDragStart:_e,onDragEnd:we,onDragCancel:ve,children:[$,Ce]}),e[84]=Me,e[85]=ce,e[86]=he,e[87]=_e,e[88]=we,e[89]=ve,e[90]=$,e[91]=Ce,e[92]=be):be=e[92];const ke=!i;let ne;e[93]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx(vn,{size:14}),e[93]=ne):ne=e[93];let ie;e[94]!==R?(ie=R("sectionsEditor.sectionList.addSectionButton"),e[94]=R,e[95]=ie):ie=e[95];let ue;e[96]!==r||e[97]!==ke||e[98]!==ie?(ue=n.jsxs(Xe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:ke,onClick:r,children:[ne,ie]}),e[96]=r,e[97]=ke,e[98]=ie,e[99]=ue):ue=e[99];let Ee;return e[100]!==oe||e[101]!==be||e[102]!==ue?(Ee=n.jsxs("div",{className:oe,children:[be,ue]}),e[100]=oe,e[101]=be,e[102]=ue,e[103]=Ee):Ee=e[103],Ee}function br(g){return g.id}function qn(g){const e=Ge.c(57),{open:o,initialName:u,autoLabel:d,isPending:S,onSubmit:x,onOpenChange:m}=g,v=S===void 0?!1:S,f=ct(),[y,T]=w.useState(u),[V,E]=w.useState(o);o!==V&&(E(o),o&&T(u));let l;e[0]!==v||e[1]!==m?(l=ge=>{!ge&&!v&&m(!1)},e[0]=v,e[1]=m,e[2]=l):l=e[2];const h=l;let r;e[3]!==v||e[4]!==y||e[5]!==x?(r=async ge=>{ge.preventDefault(),!v&&await x(y.trim())},e[3]=v,e[4]=y,e[5]=x,e[6]=r):r=e[6];const C=r;let i;e[7]!==f?(i=f("sectionsEditor.variantRenameDialog.title"),e[7]=f,e[8]=i):i=e[8];let R;e[9]!==i?(R=n.jsx(Co,{children:i}),e[9]=i,e[10]=R):R=e[10];let M;e[11]!==d||e[12]!==f?(M=f("sectionsEditor.variantRenameDialog.description",{fallback:d||f("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=d,e[12]=f,e[13]=M):M=e[13];let I;e[14]!==M?(I=n.jsx(Mo,{children:M}),e[14]=M,e[15]=I):I=e[15];let H;e[16]!==R||e[17]!==I?(H=n.jsxs(Bo,{children:[R,I]}),e[16]=R,e[17]=I,e[18]=H):H=e[18];let p;e[19]!==f?(p=f("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=f,e[20]=p):p=e[20];let B;e[21]!==p?(B=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:p}),e[21]=p,e[22]=B):B=e[22];let pe;e[23]===Symbol.for("react.memo_cache_sentinel")?(pe=ge=>T(ge.target.value),e[23]=pe):pe=e[23];let K;e[24]!==d||e[25]!==v||e[26]!==y?(K=n.jsx(Io,{id:"variant-rename-name",value:y,onChange:pe,placeholder:d,autoFocus:!0,disabled:v}),e[24]=d,e[25]=v,e[26]=y,e[27]=K):K=e[27];let le;e[28]!==B||e[29]!==K?(le=n.jsxs("div",{className:"space-y-1.5 py-4",children:[B,K]}),e[28]=B,e[29]=K,e[30]=le):le=e[30];let D;e[31]!==m?(D=()=>m(!1),e[31]=m,e[32]=D):D=e[32];let te;e[33]!==f?(te=f("sectionsEditor.variantRenameDialog.cancel"),e[33]=f,e[34]=te):te=e[34];let O;e[35]!==v||e[36]!==D||e[37]!==te?(O=n.jsx(Xe,{type:"button",variant:"outline",onClick:D,disabled:v,children:te}),e[35]=v,e[36]=D,e[37]=te,e[38]=O):O=e[38];let se;e[39]!==v||e[40]!==f?(se=v?n.jsxs(n.Fragment,{children:[n.jsx(Zn,{size:14,className:"animate-spin"}),f("sectionsEditor.variantRenameDialog.saving")]}):f("sectionsEditor.variantRenameDialog.save"),e[39]=v,e[40]=f,e[41]=se):se=e[41];let De;e[42]!==v||e[43]!==se?(De=n.jsx(Xe,{type:"submit",disabled:v,children:se}),e[42]=v,e[43]=se,e[44]=De):De=e[44];let xe;e[45]!==O||e[46]!==De?(xe=n.jsxs(Ko,{children:[O,De]}),e[45]=O,e[46]=De,e[47]=xe):xe=e[47];let Q;e[48]!==C||e[49]!==le||e[50]!==xe||e[51]!==H?(Q=n.jsx(Lo,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:C,children:[H,le,xe]})}),e[48]=C,e[49]=le,e[50]=xe,e[51]=H,e[52]=Q):Q=e[52];let X;return e[53]!==h||e[54]!==o||e[55]!==Q?(X=n.jsx(Fo,{open:o,onOpenChange:h,children:Q}),e[53]=h,e[54]=o,e[55]=Q,e[56]=X):X=e[56],X}function Ns(g){const e=Ge.c(5),{rule:o,matchers:u}=g,d=o?.__resolveType??"";let S;if(e[0]!==u||e[1]!==d){const f=u.find(y=>y.resolveType===d)?.iconName??za(d);S=No(f),e[0]=u,e[1]=d,e[2]=S}else S=e[2];const x=S;if(!x)return null;let m;return e[3]!==x?(m=n.jsx(x,{size:14,className:"shrink-0"}),e[3]=x,e[4]=m):m=e[4],m}function Gn(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
2
|
`)}function Wn(g){return g.map((e,o)=>({id:crypto.randomUUID(),index:o,variant:e}))}function Sr(g,e){const o=new Map;for(const u of g){const d=o.get(u.variant.label);d?d.push(u):o.set(u.variant.label,[u])}return e.map((u,d)=>({id:o.get(u.label)?.shift()?.id??crypto.randomUUID(),index:d,variant:u}))}function xr(g){return g.map((e,o)=>({...e,index:o}))}function Vs(g){const e=Ge.c(17),{label:o,effectiveRule:u,matchers:d,canDelete:S,dragging:x,onRename:m,onDuplicate:v,onDelete:f}=g,y=ct();let T;e[0]!==u||e[1]!==d?(T=n.jsx(Ns,{rule:u,matchers:d}),e[0]=u,e[1]=d,e[2]=T):T=e[2];let V;e[3]!==o?(V=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o}),e[3]=o,e[4]=V):V=e[4];let E;e[5]!==S||e[6]!==x||e[7]!==o||e[8]!==f||e[9]!==v||e[10]!==m||e[11]!==y?(E=!x&&n.jsxs(Es,{children:[n.jsx(js,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":y("sectionsEditor.pageVariantTabs.actionsAriaLabel",{label:o}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:_r,onPointerDown:yr,children:n.jsx(vs,{size:14})})}),n.jsxs(Rs,{align:"end",className:"w-36",children:[n.jsxs(vt,{onClick:h=>{h.stopPropagation(),m?.()},children:[n.jsx(Zo,{size:14}),y("sectionsEditor.pageVariantTabs.renameAction")]}),n.jsxs(vt,{onClick:h=>{h.stopPropagation(),v?.()},children:[n.jsx(xs,{size:14}),y("sectionsEditor.pageVariantTabs.duplicateAction")]}),n.jsx(Ho,{}),n.jsxs(vt,{variant:"destructive",disabled:!S,onClick:h=>{h.stopPropagation(),f?.()},children:[n.jsx(_s,{size:14}),y("sectionsEditor.pageVariantTabs.deleteAction")]})]})]}),e[5]=S,e[6]=x,e[7]=o,e[8]=f,e[9]=v,e[10]=m,e[11]=y,e[12]=E):E=e[12];let l;return e[13]!==T||e[14]!==V||e[15]!==E?(l=n.jsxs(n.Fragment,{children:[T,V,E]}),e[13]=T,e[14]=V,e[15]=E,e[16]=l):l=e[16],l}function yr(g){return g.stopPropagation()}function _r(g){return g.stopPropagation()}function jr(g){const e=Ge.c(33),{entry:o,isActive:u,canDelete:d,decofile:S,meta:x,matchers:m,onSelect:v,onRename:f,onDuplicate:y,onDelete:T}=g;let V;e[0]!==o.id?(V={id:o.id,animateLayoutChanges:Er},e[0]=o.id,e[1]=V):V=e[1];const{attributes:E,listeners:l,setNodeRef:h,transform:r,isDragging:C}=rs(V);let i;e[2]!==r?(i=is.Transform.toString(r?{...r,x:0}:null),e[2]=r,e[3]=i):i=e[3];const R=C?0:void 0;let M;e[4]!==i||e[5]!==R?(M={transform:i,opacity:R},e[4]=i,e[5]=R,e[6]=M):M=e[6];const I=M,H=x??void 0;let p;e[7]!==S||e[8]!==o.variant.rule||e[9]!==H?(p=Bt(o.variant.rule,S,H),e[7]=S,e[8]=o.variant.rule,e[9]=H,e[10]=p):p=e[10];const B=p;let pe;e[11]!==v?(pe=se=>{se.target===se.currentTarget&&(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),v())},e[11]=v,e[12]=pe):pe=e[12];const K=C?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",le=u?ps:ls;let D;e[13]!==K||e[14]!==le?(D=$e("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",K,le),e[13]=K,e[14]=le,e[15]=D):D=e[15];let te;e[16]!==d||e[17]!==B||e[18]!==o.variant.label||e[19]!==m||e[20]!==T||e[21]!==y||e[22]!==f?(te=n.jsx(Vs,{label:o.variant.label,effectiveRule:B,matchers:m,canDelete:d,onRename:f,onDuplicate:y,onDelete:T}),e[16]=d,e[17]=B,e[18]=o.variant.label,e[19]=m,e[20]=T,e[21]=y,e[22]=f,e[23]=te):te=e[23];let O;return e[24]!==E||e[25]!==l||e[26]!==v||e[27]!==h||e[28]!==I||e[29]!==D||e[30]!==te||e[31]!==pe?(O=n.jsx("div",{ref:h,style:I,...E,...l,onClick:v,onKeyDown:pe,className:D,children:te}),e[24]=E,e[25]=l,e[26]=v,e[27]=h,e[28]=I,e[29]=D,e[30]=te,e[31]=pe,e[32]=O):O=e[32],O}function Er(){return!1}function Rr(g){const e=Ge.c(9),{variant:o,decofile:u,meta:d,matchers:S}=g,x=d??void 0;let m;e[0]!==u||e[1]!==x||e[2]!==o.rule?(m=Bt(o.rule,u,x),e[0]=u,e[1]=x,e[2]=o.rule,e[3]=m):m=e[3];const v=m;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=$e("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ps),e[4]=f):f=e[4];let y;return e[5]!==v||e[6]!==S||e[7]!==o.label?(y=n.jsx("div",{className:f,children:n.jsx(Vs,{label:o.label,effectiveRule:v,matchers:S,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=S,e[7]=o.label,e[8]=y):y=e[8],y}function wr(g){const e=Ge.c(91),{listKey:o,variants:u,activeIndex:d,decofile:S,meta:x,matchers:m,onSelect:v,onReorder:f,onRename:y,onDuplicate:T,onDelete:V,onAdd:E}=g,l=ct();let h;e[0]!==u?(h=()=>Wn(u),e[0]=u,e[1]=h):h=e[1];const[r,C]=w.useState(h),[i,R]=w.useState(null),[M,I]=w.useState(o),[H,p]=w.useState(u.length);let B;e[2]!==u?(B=()=>Gn(u),e[2]=u,e[3]=B):B=e[3];const[pe,K]=w.useState(B),le=w.useRef(!1),D=Gn(u);M!==o?(I(o),p(u.length),K(D),C(Wn(u))):(H!==u.length||pe!==D)&&(p(u.length),K(D),C(be=>Sr(be,u)));let te;e[4]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[4]=te):te=e[4];let O;e[5]===Symbol.for("react.memo_cache_sentinel")?(O={coordinateGetter:cs},e[5]=O):O=e[5];const se=es(Qt(as,te),Qt(ss,O));let De;e[6]!==r?(De=r.map(kr),e[6]=r,e[7]=De):De=e[7];const xe=De,Q=u.length>1;let X;e[8]!==r?(X=be=>{const ke=String(be.active.id);R(r.find(ne=>ne.id===ke)??null)},e[8]=r,e[9]=X):X=e[9];const ge=X;let ae;e[10]!==xe||e[11]!==f?(ae=be=>{R(null);const{active:ke,over:ne}=be;if(!ne||ke.id===ne.id)return;const ie=xe.indexOf(String(ke.id)),ue=xe.indexOf(String(ne.id));ie===-1||ue===-1||(C(Ee=>xr(Mt([...Ee],ie,ue))),le.current=!0,requestAnimationFrame(()=>{le.current=!1}),f(ie,ue))},e[10]=xe,e[11]=f,e[12]=ae):ae=e[12];const L=ae;let ze;e[13]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{R(null)},e[13]=ze):ze=e[13];const nt=ze;let Le,Me,W,Z,Fe,Pe,ye,ce,he,_e,we,ve,oe;if(e[14]!==d||e[15]!==Q||e[16]!==S||e[17]!==r||e[18]!==xe||e[19]!==L||e[20]!==ge||e[21]!==m||e[22]!==x||e[23]!==E||e[24]!==V||e[25]!==T||e[26]!==y||e[27]!==v||e[28]!==se||e[29]!==l){const be=F=>{le.current||v(F)};we="space-y-1 border-b p-2";let ke;e[43]!==l?(ke=l("sectionsEditor.pageVariantTabs.variantsLabel"),e[43]=l,e[44]=ke):ke=e[44];let ne;e[45]!==ke?(ne=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ke}),e[45]=ke,e[46]=ne):ne=e[46];let ie;e[47]!==l?(ie=l("sectionsEditor.pageVariantTabs.addVariantAriaLabel"),e[47]=l,e[48]=ie):ie=e[48];let ue;e[49]===Symbol.for("react.memo_cache_sentinel")?(ue=n.jsx(vn,{size:14}),e[49]=ue):ue=e[49];let Ee;e[50]!==E||e[51]!==ie?(Ee=n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":ie,className:"size-6",onClick:E,children:ue})}),e[50]=E,e[51]=ie,e[52]=Ee):Ee=e[52];let de;e[53]!==l?(de=l("sectionsEditor.pageVariantTabs.addVariantTooltip"),e[53]=l,e[54]=de):de=e[54];let N;e[55]!==de?(N=n.jsx(jt,{children:de}),e[55]=de,e[56]=N):N=e[56];let re;e[57]!==Ee||e[58]!==N?(re=n.jsxs(yt,{children:[Ee,N]}),e[57]=Ee,e[58]=N,e[59]=re):re=e[59],e[60]!==ne||e[61]!==re?(ve=n.jsxs("div",{className:"flex items-center justify-between",children:[ne,re]}),e[60]=ne,e[61]=re,e[62]=ve):ve=e[62],Me=us,Pe=se,ye=ds,ce=ge,he=L,_e=nt,Le=ms,Z=xe,Fe=fs,oe="space-y-0.5",W=r.map(F=>n.jsx(jr,{entry:F,isActive:F.index===d,canDelete:Q,decofile:S,meta:x,matchers:m,onSelect:()=>be(F.index),onRename:()=>y(F.index),onDuplicate:()=>T(F.index),onDelete:()=>V(F.index)},F.id)),e[14]=d,e[15]=Q,e[16]=S,e[17]=r,e[18]=xe,e[19]=L,e[20]=ge,e[21]=m,e[22]=x,e[23]=E,e[24]=V,e[25]=T,e[26]=y,e[27]=v,e[28]=se,e[29]=l,e[30]=Le,e[31]=Me,e[32]=W,e[33]=Z,e[34]=Fe,e[35]=Pe,e[36]=ye,e[37]=ce,e[38]=he,e[39]=_e,e[40]=we,e[41]=ve,e[42]=oe}else Le=e[30],Me=e[31],W=e[32],Z=e[33],Fe=e[34],Pe=e[35],ye=e[36],ce=e[37],he=e[38],_e=e[39],we=e[40],ve=e[41],oe=e[42];let Ae;e[63]!==W||e[64]!==oe?(Ae=n.jsx("div",{className:oe,children:W}),e[63]=W,e[64]=oe,e[65]=Ae):Ae=e[65];let je;e[66]!==Le||e[67]!==Z||e[68]!==Fe||e[69]!==Ae?(je=n.jsx(Le,{items:Z,strategy:Fe,children:Ae}),e[66]=Le,e[67]=Z,e[68]=Fe,e[69]=Ae,e[70]=je):je=e[70];let me;e[71]!==i||e[72]!==S||e[73]!==m||e[74]!==x?(me=i?n.jsx(Rr,{variant:i.variant,decofile:S,meta:x,matchers:m}):null,e[71]=i,e[72]=S,e[73]=m,e[74]=x,e[75]=me):me=e[75];let $;e[76]!==me?($=Xn.createPortal(n.jsx(ts,{dropAnimation:ns,children:me}),document.body),e[76]=me,e[77]=$):$=e[77];let fe;e[78]!==Me||e[79]!==Pe||e[80]!==ye||e[81]!==ce||e[82]!==he||e[83]!==_e||e[84]!==je||e[85]!==$?(fe=n.jsxs(Me,{sensors:Pe,collisionDetection:ye,onDragStart:ce,onDragEnd:he,onDragCancel:_e,children:[je,$]}),e[78]=Me,e[79]=Pe,e[80]=ye,e[81]=ce,e[82]=he,e[83]=_e,e[84]=je,e[85]=$,e[86]=fe):fe=e[86];let Ce;return e[87]!==we||e[88]!==ve||e[89]!==fe?(Ce=n.jsxs("div",{className:we,children:[ve,fe]}),e[87]=we,e[88]=ve,e[89]=fe,e[90]=Ce):Ce=e[90],Ce}function kr(g){return g.id}function Tr(g){const e=Ge.c(16),{schema:o,value:u,onChange:d,meta:S,decofile:x,onSaveReferencedBlock:m,sandbox:v}=g,f=ct();let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0];const[T,V]=w.useState(y);let E;e[1]!==T||e[2]!==f?(E=T.length>0&&n.jsxs("nav",{"aria-label":f("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>V([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:f("sectionsEditor.sectionsEditorPanels.backToRule"),children:n.jsx(bs,{className:"size-3.5"})}),T.map((r,C)=>{const i=C===T.length-1,R=hs(r);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[C>0&&n.jsx(Ss,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>V(T.slice(0,C+1)),title:R,className:$e("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",i?"font-medium text-foreground":"text-muted-foreground"),children:R})]},`${R}-${C}`)})]}),e[1]=T,e[2]=f,e[3]=E):E=e[3];let l;e[4]!==T||e[5]!==x||e[6]!==S||e[7]!==d||e[8]!==m||e[9]!==v||e[10]!==o||e[11]!==u?(l=n.jsx(gs,{schema:o,value:u,onChange:d,basePath:"",breadcrumbPath:T,onBreadcrumbChange:V,meta:S,decofile:x,onSaveReferencedBlock:m,sandbox:v}),e[4]=T,e[5]=x,e[6]=S,e[7]=d,e[8]=m,e[9]=v,e[10]=o,e[11]=u,e[12]=l):l=e[12];let h;return e[13]!==E||e[14]!==l?(h=n.jsxs("div",{className:"space-y-2",children:[E,l]}),e[13]=E,e[14]=l,e[15]=h):h=e[15],h}function Yn(g){const e=Ge.c(23),{activeSchema:o,formValue:u,formResetKey:d,onFormChange:S,onBreadcrumbChange:x,breadcrumbPath:m,emptyMessage:v,beforeForm:f,seoResolveType:y,siteDefaultSeo:T,meta:V,decofile:E,onSaveReferencedBlock:l,sandbox:h,previewBaseUrl:r,onRequestAddSection:C}=g;let i;e[0]!==m?(i=m===void 0?[]:m,e[0]=m,e[1]=i):i=e[1];const R=i;let M;e[2]!==o||e[3]!==R||e[4]!==E||e[5]!==d||e[6]!==u||e[7]!==V||e[8]!==x||e[9]!==S||e[10]!==C||e[11]!==l||e[12]!==r||e[13]!==h||e[14]!==y||e[15]!==T?(M=o&&u?y?n.jsx(Uo,{schema:o,resolveType:y,value:u,formResetKey:d,onChange:S,onBreadcrumbChange:x,siteDefaultSeo:T}):n.jsx(gs,{schema:o,value:u,onChange:S,basePath:"",breadcrumbPath:R,onBreadcrumbChange:x,meta:V,decofile:E,onSaveReferencedBlock:l,sandbox:h,previewBaseUrl:r,onRequestAddSection:C},d):null,e[2]=o,e[3]=R,e[4]=E,e[5]=d,e[6]=u,e[7]=V,e[8]=x,e[9]=S,e[10]=C,e[11]=l,e[12]=r,e[13]=h,e[14]=y,e[15]=T,e[16]=M):M=e[16];const I=M;let H;e[17]!==v||e[18]!==I?(H=I??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[17]=v,e[18]=I,e[19]=H):H=e[19];let p;return e[20]!==f||e[21]!==H?(p=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:[f,H]})}),e[20]=f,e[21]=H,e[22]=p):p=e[22],p}const Nr="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 Vr(g,e){return Ha(g,e,lt)}function Dr(g){const e=Ge.c(19),{pageKey:o,initialName:u,initialPath:d,onFieldChange:S}=g,x=ct(),[m,v]=w.useState(u),[f,y]=w.useState(d),[T,V]=w.useState(o);T!==o&&(V(o),v(u),y(d));let E;e[0]!==S?(E=M=>{v(M.target.value),S("name",M.target.value)},e[0]=S,e[1]=E):E=e[1];let l;e[2]!==x?(l=x("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[2]=x,e[3]=l):l=e[3];let h;e[4]!==m||e[5]!==E||e[6]!==l?(h=n.jsx("input",{type:"text",value:m,onChange:E,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:l}),e[4]=m,e[5]=E,e[6]=l,e[7]=h):h=e[7];let r;e[8]!==S?(r=M=>{y(M.target.value),S("path",M.target.value)},e[8]=S,e[9]=r):r=e[9];let C;e[10]!==x?(C=x("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[10]=x,e[11]=C):C=e[11];let i;e[12]!==f||e[13]!==r||e[14]!==C?(i=n.jsx("input",{type:"text",value:f,onChange:r,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:C}),e[12]=f,e[13]=r,e[14]=C,e[15]=i):i=e[15];let R;return e[16]!==h||e[17]!==i?(R=n.jsxs("div",{className:"space-y-1",children:[h,i]}),e[16]=h,e[17]=i,e[18]=R):R=e[18],R}function Jn(g){const e=Ge.c(13),{onClick:o}=g,u=ct();let d;e[0]!==u?(d=u("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=u,e[1]=d):d=e[1];let S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ys,{size:14}),e[2]=S):S=e[2];let x;e[3]!==o||e[4]!==d?(x=n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":d,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:o,children:S})}),e[3]=o,e[4]=d,e[5]=x):x=e[5];let m;e[6]!==u?(m=u("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=u,e[7]=m):m=e[7];let v;e[8]!==m?(v=n.jsx(jt,{side:"bottom",children:m}),e[8]=m,e[9]=v):v=e[9];let f;return e[10]!==x||e[11]!==v?(f=n.jsxs(yt,{children:[x,v]}),e[10]=x,e[11]=v,e[12]=f):f=e[12],f}function Qn(g){const e=Ge.c(21),{currentRt:o,currentLabel:u,currentGlobalKey:d,matchers:S,globals:x,onSelect:m,onSelectGlobal:v,schema:f,formValue:y,onChange:T,formKey:V,formWrapperClassName:E,meta:l,decofile:h,onSaveReferencedBlock:r,sandbox:C}=g;let i;e[0]!==d||e[1]!==u||e[2]!==o||e[3]!==x||e[4]!==S||e[5]!==m||e[6]!==v?(i=n.jsx(Ua,{currentRt:o,currentLabel:u,currentGlobalKey:d,matchers:S,globals:x,onSelect:m,onSelectGlobal:v}),e[0]=d,e[1]=u,e[2]=o,e[3]=x,e[4]=S,e[5]=m,e[6]=v,e[7]=i):i=e[7];let R;e[8]!==h||e[9]!==V||e[10]!==y||e[11]!==E||e[12]!==l||e[13]!==T||e[14]!==r||e[15]!==C||e[16]!==f?(R=f&&y&&n.jsx("div",{className:E,children:n.jsx(Tr,{schema:f,value:y,onChange:T,meta:l,decofile:h,onSaveReferencedBlock:r,sandbox:C},V)}),e[8]=h,e[9]=V,e[10]=y,e[11]=E,e[12]=l,e[13]=T,e[14]=r,e[15]=C,e[16]=f,e[17]=R):R=e[17];let M;return e[18]!==i||e[19]!==R?(M=n.jsxs(n.Fragment,{children:[i,R]}),e[18]=i,e[19]=R,e[20]=M):M=e[20],M}function Rc({orgSlug:g,virtualMcpId:e,branch:o,previewReady:u=!0,previewUrl:d,currentPath:S,activePageBlockKey:x=null,activeGlobalBlockKey:m=null,externalSelection:v,onSaved:f,initialEditSeo:y=!1,onExitSeo:T,onViewJsonFile:V,onVariantPreviewOverride:E}){const l=ct(),h=u?{orgSlug:g,virtualMcpId:e,branch:o,previewUrl:d}:null,{data:r,isLoading:C}=qa(h),{data:i,isLoading:R}=Ga(h),M=Wa(),I=M?.entity?.id===e?M.entity.metadata?.siteSlug??null:null,H=er({virtualMcpId:e,sandboxUrl:d}),[p,B]=w.useState(null),[pe,K]=w.useState(null),[le,D]=w.useState(null),[te,O]=w.useState(0),[se,De]=w.useState(void 0),[xe,Q]=w.useState(null),[X,ge]=w.useState(null),[ae,L]=w.useState([]),ze=w.useRef(null),[nt,Le]=w.useState(ae.length);nt!==ae.length&&(Le(ae.length),requestAnimationFrame(()=>{ze.current&&(ze.current.scrollTop=0)}));const[Me,W]=w.useState(0),[Z,Fe]=w.useState(null),[Pe,ye]=w.useState(null),[ce,he]=w.useState(null),[_e,we]=w.useState(!0),[ve,oe]=w.useState(!1),[Ae,je]=w.useState(!1),me=w.useRef(null),[$,fe]=w.useState(y),[Ce,be]=w.useState(y);y&&!Ce&&(be(!0),fe(!0),B(null),K(null),D(null),L([])),!y&&Ce&&be(!1);const[ke,ne]=w.useState(null),[ie,ue]=w.useState(void 0),[Ee,de]=w.useState([]),[N,re]=w.useState(0),[F,Be]=w.useState(0),[ut,Te]=w.useState(null),[We,Ie]=w.useState(null),[bn,Sn]=w.useState(null),Ds=Ca(),Ps=`${g}/${e}/${o}`,Xt=Ya({orgSlug:g,virtualMcpId:e,branch:o}),[As,Cs]=w.useState(S),[Ms,Bs]=w.useState(x),[Ks,Ls]=w.useState(m);(As!==S||Ms!==x||Ks!==m)&&(queueMicrotask(()=>Xt.flush()),Cs(S),Bs(x),Ls(m),B(null),K(null),D(null),O(0),Q(null),ge(null),Be(0),Te(null),Ie(null),L([]),W(t=>t+1),fe(!1),ne(null),ue(void 0),de([]),re(t=>t+1));const Ne=Ja({orgSlug:g,virtualMcpId:e,branch:o}),Kt=ho((t,s)=>{Ne.mutate({blockKey:t,data:s},{onSuccess:()=>f?.(),onError:a=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),Zt=Qa({orgSlug:g,virtualMcpId:e,branch:o}),[Nt,Lt]=w.useState(!1),He=w.useRef(null),st=w.useRef(null),at=w.useRef(null),en=w.useRef({}),Ze=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!u||C||R)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Zn,{size:20,className:"animate-spin text-muted-foreground"})});if(!r||!i)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Fs=Xa(r),Ve=!!m,Ye=Ve?null:Za(Fs,S,x),k=Ve?m:Ye?.key??null,tn=Ve&&m?r[m]:void 0,xn=Ve&&m&&tn?eo(m,tn):Ve&&m?m:"",Ft=!Ve&&k&&r[k]?r[k]:null,nn=$&&r&&i&&k&&Ye?Hn(r,{kind:"page",pageKey:k,pageName:String(Ye.name??""),path:String(Ye.path??"")},i):null,Is=$?Ft?.seo:void 0,sn=ie!==void 0?ie:Is,Os=$?qo(sn):void 0,$s=nn?.seoTypeOptions??[],zs=$&&i?Go(i):"",yn=ke??Os??{},an=$&&nn?Wo(yn,nn):null,Hs=$&&an&&Yo(sn)?qt(an,i):null,Us=$?Jo(r,i)?.seoData:void 0,qe=Ve?[{label:"Default",sections:[{__resolveType:m}]}]:Vr(Ft?.sections,r??{}),It=qe.length>1,Oe=Math.min(te,qe.length-1),dt=qe[Oe],q=dt?.sections??[],Ue=Gt(q,r),_n=!Ve&&to(Ft?.sections);if(Ve&&m&&bn!==m){Sn(m);const t=q[0],s=Ue[0];if(t&&s){B(0),Be(0),L([]);const a=St(t,s,r);a&&(K(a.data),D(a.resolveType),Ie(null),Te(null))}}!Ve&&bn!==null&&Sn(null),Ze.current={rawSections:q,parsedSections:Ue,decofile:r??{},activePageKey:k,pageVariants:qe,variantIndex:Oe,sectionVariantIndex:F,selectedSectionIndex:p};const qs=()=>({multivariate:_n,index:Oe,variants:qe.map(t=>({rule:t.rule}))}),jn=(t,s)=>{if(!E)return;if(!k||!_n||t.length<=1){E(null);return}const a=zn(k,{multivariate:!0,index:s,variants:t},r,i);E(a.length>0?a:null)},Et=(t,s,a)=>{if(!E)return;if(!k){E(null);return}const c=qs(),b=zn(k,c,r,i);if(!t||s<0){E(b.length>0?b:null);return}const j=yo({pageKey:k,page:c,sectionIndex:s,sectionLazy:Ue[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:r,meta:i}),_=[...b,...j];E(_.length>0?_:null)},mt=(t,s,a,c=p??-1,b=!1)=>{const j=tt(t,s);if(!j){K(null),D(null),Ie(null),Te(null),b&&Et(null,c,a);return}const P=Kn(j,lt)[a];if(!P){K(null),D(null),Ie(null),Te(null),b&&Et(null,c,a);return}const ee=io(P.value,r);K(ee?.data??null),D(ee?.resolveType??null);const{resolveType:A,formValue:z}=Pt(P.rule,r,i??void 0);Ie(A),Te(z),b&&Et(j,c,a)},Vt=v?.index;if(v!==void 0&&(v?.seq??null)!==se&&(De(v?.seq??null),typeof Vt=="number")){const t=q[Vt],s=Ue[Vt];if(t&&s)if(B(Vt),Be(0),L([]),W(a=>a+1),s.isMultivariate)mt(t,s,0,Vt);else{const a=St(t,s,r);a?(K(a.data),D(a.resolveType)):(K(null),D(null)),Ie(null),Te(null)}}const Ot={orgSlug:g,virtualMcpId:e,branch:o,previewUrl:d??void 0,siteSlug:I},on=le&&i?qt(le,i):null,Je=(t,s)=>{if(!k)return;He.current&&(clearTimeout(He.current),He.current=null),at.current&&(clearTimeout(at.current),at.current=null),st.current&&(clearTimeout(st.current),st.current=null);const a=Ct(r,k,t,Oe,qe);Ne.mutate({blockKey:k,data:a},{onSuccess:()=>s?.onSuccess?.()??f?.(),onError:c=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},Rt=()=>{B(null),K(null),D(null),Be(0),Te(null),Ie(null),L([]),W(t=>t+1)},Gs=(t,s)=>{He.current&&clearTimeout(He.current);const a=Ze.current.sectionVariantIndex;He.current=setTimeout(()=>{const{rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:ee}=Ze.current,A=c[s];if(!A)return;const z=b[s];if(!z)return;if(z.isSavedBlock){const G=z.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;Ne.mutate({blockKey:G,data:t},{onSuccess:()=>f?.(),onError:Y=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:Y.message}))});return}if(!_)return;const U={...j[_]},Re=[...c];if(z.isMultivariate){const G=tt(A,z);if(!G||!_)return;const Y=jo(G,a,t);Re[s]=xt(A,z,Y)}else if(z.isHidden){const G=os(A.__resolveType),Y=G?{...A.section}:{...A},Ke=Array.isArray(Y.variants)?[...Y.variants]:[];Ke[0]&&(Ke[0]={...Ke[0],value:t}),Y.variants=Ke,G?Re[s]={...A,section:Y}:Re[s]=Y}else z.isLazy?Re[s]={...A,section:t}:Re[s]=t;if(P.length>1){const G=U.sections,Y=[...G?.variants??[]];Y[ee]&&(Y[ee]={...Y[ee],value:Re}),U.sections={...G,variants:Y}}else U.sections=Re;Ne.mutate({blockKey:_,data:U},{onSuccess:()=>f?.(),onError:G=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:G.message}))})},pn)},Ws=t=>{B(t),Be(0),L([]),W(b=>b+1);const s=q[t],a=Ue[t];if(!s||!a)return;if(a.isMultivariate){mt(s,a,0,t);return}const c=St(s,a,r);if(!c){K(null),D(null),Ie(null),Te(null),Et(null,t,0);return}K(c.data),D(c.resolveType),Ie(null),Te(null),Et(null,t,0)},En=t=>{const s=t;K(s),p!==null&&Gs(s,p)},rn=t=>{if(!k||!r||!i||!Ye)return;const s={kind:"page",pageKey:k,pageName:String(Ye.name??""),path:String(Ye.path??"")},a=Hn(r,s,i);a&&Xt.save(k,()=>{const c=Ds.getQueryData(Ma.decofile(Ps))?.[k];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const b={...c,...en.current};return en.current={},t?.raw!==void 0?{...b,seo:t.raw}:t?.inner!==void 0?Xo(s,a,b,t.inner):b})},Ys=(t,s)=>{k&&(en.current[t]=s,rn())},Js=(t,s)=>{if(!k)return;const a=Mt([...q],t,s);p!==null&&(p===t?B(s):t<p&&s>=p?B(p-1):t>p&&s<=p&&B(p+1)),Je(a)},Qs=t=>{if(!k)return;const s=q.filter((a,c)=>c!==t);p===t?Rt():p!==null&&p>t&&B(p-1),Je(s)},Xs=t=>{if(!k)return;const s=q[t];if(!s)return;const a=[...q];a.splice(t+1,0,xo(s)),p!==null&&p>t&&B(p+1),Je(a)},Zs=t=>{if(!k)return;const s=q[t],a=Ue[t];if(!s||!a||a.isMultivariate)return;const c=a.isHidden?bo(s):So(s);if(!c)return;const b=[...q];b[t]=c,p===t&&Rt(),Je(b)},ea=t=>{if(!k)return;const s=q[t],a=Ue[t];if(!s||!a||a.isMultivariate)return;const c=vo(s);if(!c)return;const b=[...q];b[t]=c,p===t&&Rt(),Je(b)},ta=t=>{if(!k)return;const s=q[t],a=Ue[t];if(!s||!a?.isSavedBlock)return;const c=St(s,a,r);if(!c?.data)return;const{name:b,...j}=c.data,_=[...q];a.isLazy?_[t]={...s,section:j}:_[t]=j,p===t&&Rt(),Je(_)},na=t=>{if(!k)return;const s=[...q,{__resolveType:t.resolveType}],a=s.length-1;Je(s,{onSuccess:()=>{oe(!1),B(a),Be(0),L([]),W(_=>_+1);const c=s[a],b=Gt(s,r)[a];if(!c||!b)return;if(b.isMultivariate){mt(c,b,0);return}const j=St(c,b,r);if(!j){K(null),D(null),Ie(null),Te(null);return}K(j.data),D(j.resolveType),Ie(null),Te(null)}})},Rn=t=>{me.current=t.append,oe(!0)},sa=t=>{const s=me.current;if(!s){na(t);return}s({__resolveType:t.resolveType}),oe(!1),me.current=null},aa=t=>{if(p===null)return;const s=q[p],a=Ue[p];!s||!a?.isMultivariate||(Be(t),L([]),W(c=>c+1),mt(s,a,t,p,!0))},oa=t=>{if(p===null||!k)return;const s=q[p],a=Ue[p];if(!s||!a?.isMultivariate)return;const c=tt(s,a);if(!c)return;const b=po(c,t);if(!b){J.error(l("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const j=[...q];j[p]=xt(s,a,b);const _=b.variants;let P=F;t===F?P=Math.min(t,_.length-1):t<F&&(P=F-1),Be(P),L([]),W(ee=>ee+1),mt(j[p],a,P),Je(j)},ra=t=>{if(p===null||!k)return;const s=q[p],a=Ue[p];if(!s||!a?.isMultivariate)return;const c=tt(s,a);if(!c)return;const b=go(c,t),j=[...q];j[p]=xt(s,a,b);const _=t+1;Be(_),L([]),W(P=>P+1),mt(j[p],a,_),Je(j)},ia=(t,s)=>{if(p===null||!k||t===s)return;const a=q[p],c=Ue[p];if(!a||!c?.isMultivariate)return;const b=tt(a,c);if(!b)return;const j=mo(b,t,s),_=[...q];_[p]=xt(a,c,j);let P=F;F===t?P=s:t<F&&s>=F?P=F-1:t>F&&s<=F&&(P=F+1),Be(P),mt(_[p],c,P),Je(_)},ln=t=>{const s=t??p;if(s===null||!k)return;const a=q[s],c=Ue[s];if(!a||!c)return;const b=lo(a,c);if(!b){J.error(l("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const j=[...q];j[s]=b.section;const _=Gt(j,r)[s];if(!_?.isMultivariate){J.error(l("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(s),Be(b.newVariantIndex),L([]),W(P=>P+1),mt(b.section,_,b.newVariantIndex,s),Je(j)},la=()=>{if(p===null||!k)return;const t=q[p],s=Ue[p];if(!t||!s?.isMultivariate)return;const a=tt(t,s);if(!a)return;const c=fo(t,s,a);if(!c){J.error(l("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const b=[...q];b[p]=c;const j=Gt(b,r)[p];if(!j)return;Be(0),Ie(null),Te(null),L([]),W(P=>P+1);const _=St(c,j,r);_?(K(_.data),D(_.resolveType)):(K(null),D(null)),Et(null,p,0),Je(b)},ca=async t=>{if(Z===null||!k)return;const s=fn(t,r);if(s){J.error(s);return}const a=q[Z],c=Ue[Z];if(!a||!c)return;const b=St(a,c,r);if(!b){J.error(l("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const j={...b.data,name:t};try{await Ne.mutateAsync({blockKey:t,data:j});const _=[...q];_[Z]={__resolveType:t},await Ne.mutateAsync({blockKey:k,data:Ct(r,k,_,Oe,qe)}),p===Z&&Rt(),Fe(null),J.success(l("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),f?.()}catch(_){J.error(_ instanceof Error?_.message:l("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},wn=dt?.rule;if(It&&p===null&&X===null&&wn){const{resolveType:t,formValue:s}=Pt(wn,r??{},i??void 0);ge(t),Q(s)}const $t=i?no(i):[],kn=i&&r?so(i,r):[],ua=!Ve&&!!(H&&i&&r),da=X&&i?qt(X,i):null,wt=()=>{st.current&&(clearTimeout(st.current),st.current=null),at.current&&(clearTimeout(at.current),at.current=null)},Dt=async(t,s)=>{if(!(_o(s,t,i)>0))try{await Zt.mutateAsync({blockKey:t})}catch(a){J.error(a instanceof Error?a.message:l("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},Tn=t=>{st.current&&clearTimeout(st.current),st.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:c}=Ze.current;if(!s)return;const b={...a[s]},j={...b.sections},_=[...j.variants??[]],P=_[c],ee=P?.rule;if(kt(ee,a,i)){const A=ee?.__resolveType??"",z=a[A],U=typeof z?.name=="string"?z.name:A,{__resolveType:Re,...G}=t;Ne.mutate({blockKey:A,data:Tt(Re??"",G,U)},{onSuccess:()=>f?.(),onError:Y=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:Y.message}))});return}P&&(_[c]={...P,rule:t}),b.sections={...j,variants:_},Ne.mutate({blockKey:s,data:b},{onSuccess:()=>f?.(),onError:A=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:A.message}))})},pn)},ma=t=>{ge(t);const s=t?Fn(t,i):{__resolveType:In};Q(t?s:{}),Tn(s)},fa=t=>{const s=t;Q(s);const a=X?{__resolveType:X,...s}:{...s};Tn(a)},pa=async t=>{wt();const{activePageKey:s,decofile:a,variantIndex:c}=Ze.current;if(!s)return;const b=a[s],j=b?.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const P=[..._.variants],ee=P[c];if(!ee)return;const A=At(ee.rule,a,i),z=Yt(t);P[c]={...ee,rule:z};const U={...a,[s]:{...b,sections:{..._,variants:P}}},{resolveType:Re,formValue:G}=Pt(z,U,i??void 0);ge(Re),Q(G);try{await Ne.mutateAsync({blockKey:s,data:U[s]}),A&&A!==t&&await Dt(A,U),f?.()}catch(Y){J.error(Y instanceof Error?Y.message:l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},Nn=t=>{at.current&&clearTimeout(at.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=Ze.current;s!==null&&(at.current=setTimeout(()=>{const{rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:ee}=Ze.current;if(!_)return;const A=c[s],z=b[s];if(!A||!z?.isMultivariate)return;const U=tt(A,z);if(!U)return;const G=(U.variants??[])[a]?.rule;if(kt(G,j,i)){const Se=G?.__resolveType??"",Qe=j[Se],rt=typeof Qe?.name=="string"?Qe.name:Se,{__resolveType:gt,...it}=t;Ne.mutate({blockKey:Se,data:Tt(gt??"",it,rt)},{onSuccess:()=>f?.(),onError:ht=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:ht.message}))});return}const Y=Ln(U,a,t),Ke=[...c];Ke[s]=xt(A,z,Y);const et=Ct(j,_,Ke,ee,P);Ne.mutate({blockKey:_,data:et},{onSuccess:()=>f?.(),onError:Se=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:Se.message}))})},pn))},ga=t=>{Ie(t);const s=t?Fn(t,i):{__resolveType:In};Te(t?s:{}),Nn(s)},ha=t=>{const s=t;Te(s);const a=We?{__resolveType:We,...s}:{...s};Nn(a)},va=async t=>{wt();const{selectedSectionIndex:s,sectionVariantIndex:a,rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:ee}=Ze.current;if(s===null||!_)return;const A=c[s],z=b[s];if(!A||!z?.isMultivariate)return;const U=tt(A,z);if(!U)return;const Re=U.variants??[],G=At(Re[a]?.rule,j,i),Y=Yt(t),Ke=Ln(U,a,Y),et=[...c];et[s]=xt(A,z,Ke);const Se=Ct(j,_,et,ee,P),Qe={...j,[_]:Se},{resolveType:rt,formValue:gt}=Pt(Y,Qe,i??void 0);Ie(rt),Te(gt);try{await Ne.mutateAsync({blockKey:_,data:Se}),G&&G!==t&&await Dt(G,Qe),f?.()}catch(it){J.error(it instanceof Error?it.message:l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Ve&&!Ye)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.noPageFound",{currentPath:S})});if(Ve&&!tn)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.globalBlockNotFound")});const ft=p!==null?Ue[p]??null:null,Vn=p!==null?q[p]:null,Dn=Vn&&ft?.isMultivariate?tt(Vn,ft):null,bt=Dn?Kn(Dn,lt):[],cn=Math.min(F,Math.max(bt.length-1,0)),zt=bt[cn]??null,pt=ft?.isMultivariate===!0,Pn=p!==null&&ft!==null,Ht=Pn&&(pt||!!(on&&pe)),ba=Ht&&!Ve&&ft?.isSavedBlock===!0,ot=Ve||ba,Sa=Ve?xn:ft?.label??"",xa=We&&i?qt(We,i):null,un=Ht&&(!Ve||ae.length>0)?Ve?[xn,...ae]:[Ye.name,ft.label,...pt&&zt?[zt.label]:[],...ae]:[],ya=$&&Ye?[Ye.name,"SEO",...Ee]:[],Ut=$?ya:ot?un.length>0?un:[Sa]:un,_a=!$&&!Ve&&pt&&ae.length===0,An=()=>{if(!k)return;wt(),He.current&&(clearTimeout(He.current),He.current=null);const t=r[k],s=co(t.sections,q);if(!s)return;const a=uo(s);Ne.mutate({blockKey:k,data:{...t,sections:s}},{onSuccess:()=>{O(a),B(null),K(null),D(null),L([]),Q(null),ge(null)},onError:c=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},dn=(t,s,a)=>{if(!k)return;wt(),He.current&&(clearTimeout(He.current),He.current=null);const c=r[k],b=c.sections;if(!b||typeof b!="object"||Array.isArray(b))return;const j=b;if(!Array.isArray(j.variants))return;const _=t([...j.variants]);if(!_)return;const P=Eo(j,_),ee={...r,[k]:{...c,sections:P}};Ne.mutate({blockKey:k,data:ee[k]},{onSuccess:()=>{s?.(),a&&Dt(a,ee)},onError:A=>J.error(l("sectionsEditor.sectionsEditor.saveFailed",{error:A.message}))})},ja=t=>{ye(null),O(t),B(null),K(null),D(null),L([]);const s=qe[t]?.rule,{resolveType:a,formValue:c}=Pt(s,r??{},i??void 0);ge(a),Q(c),jn(qe.map(b=>({rule:b.rule})),t)},Ea=(t,s)=>{if(t===s)return;let a=Oe;Oe===t?a=s:t<Oe&&s>=Oe?a=Oe-1:t>Oe&&s<=Oe&&(a=Oe+1),O(a);const c=Mt(qe.map(b=>({rule:b.rule})),t,s);jn(c,a),dn(b=>Mt(b,t,s))},Ra=t=>{const s=qe[t]?.rule,a=At(s,r??{},i??void 0);dn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{qe.length-1===1?O(0):t<Oe?O(Oe-1):t===Oe&&O(Math.max(0,t-1)),B(null),K(null),D(null),L([]),Q(null),ge(null)},a)},wa=t=>{dn(s=>Ro(s,t),()=>{O(t+1),B(null),K(null),D(null),L([]),Q(null),ge(null)})},ka=async(t,s)=>{wt(),He.current&&(clearTimeout(He.current),He.current=null);const a=Ze.current.activePageKey,c=Ze.current.decofile;if(!a)return;const b=c[a],j=b.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const P=[..._.variants],ee=P[t];if(!ee?.rule||typeof ee.rule!="object"){J.error(l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const A=ee.rule,z=s.trim();Lt(!0);try{if(!z){if(!kt(A,c,i)){ye(null);return}const et=A.__resolveType??"";P[t]={...ee,rule:On(A,c,i)};const Se={...c,[a]:{...b,sections:{..._,variants:P}}};await Ne.mutateAsync({blockKey:a,data:Se[a]}),await Dt(et,Se),ye(null),f?.();return}const U=$n(A,c,i);if(!U){J.error(l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(U.blockKey){await Ne.mutateAsync({blockKey:U.blockKey,data:Tt(U.resolveType,U.data,z)}),ye(null),f?.();return}const Re=mn(z),G=fn(Re,c);if(G){J.error(G);return}const Y=Tt(U.resolveType,U.data,z);let Ke=null;try{await Ne.mutateAsync({blockKey:Re,data:Y}),Ke=Re,P[t]={...ee,rule:Yt(Re)},await Ne.mutateAsync({blockKey:a,data:{...b,sections:{..._,variants:P}}}),Ke=null}catch(et){throw Ke&&await Zt.mutateAsync({blockKey:Ke}).catch(()=>{}),et}ye(null),J.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:z})),f?.()}catch(U){J.error(U instanceof Error?U.message:l("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Lt(!1)}},Ta=async(t,s)=>{wt(),He.current&&(clearTimeout(He.current),He.current=null);const{selectedSectionIndex:a,rawSections:c,parsedSections:b,decofile:j,activePageKey:_,pageVariants:P,variantIndex:ee}=Ze.current;if(a===null||!_)return;const A=c[a],z=b[a];if(!A||!z?.isMultivariate)return;const U=tt(A,z);if(!U)return;const Re=U.variants??[],G=Re[t];if(!G?.rule||typeof G.rule!="object"){J.error(l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const Y=G.rule,Ke=s.trim();Lt(!0);const et=async Se=>{const Qe={...U,variants:Se},rt=[...c];rt[a]=xt(A,z,Qe);const gt=Ct(j,_,rt,ee,P);return await Ne.mutateAsync({blockKey:_,data:gt}),{...j,[_]:gt}};try{if(!Ke){if(!kt(Y,j,i)){he(null);return}const ht=Y.__resolveType??"",Bn=[...Re];Bn[t]={...G,rule:On(Y,j,i)};const Aa=await et(Bn);await Dt(ht,Aa),he(null),f?.();return}const Se=$n(Y,j,i);if(!Se){J.error(l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(Se.blockKey){await Ne.mutateAsync({blockKey:Se.blockKey,data:Tt(Se.resolveType,Se.data,Ke)}),he(null),f?.();return}const Qe=mn(Ke),rt=fn(Qe,j);if(rt){J.error(rt);return}const gt=Tt(Se.resolveType,Se.data,Ke);let it=null;try{await Ne.mutateAsync({blockKey:Qe,data:gt}),it=Qe;const ht=[...Re];ht[t]={...G,rule:Yt(Qe)},await et(ht),it=null}catch(ht){throw it&&await Zt.mutateAsync({blockKey:it}).catch(()=>{}),ht}he(null),J.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Ke})),f?.()}catch(Se){J.error(Se instanceof Error?Se.message:l("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Lt(!1)}},Cn=()=>{Rt()},Na=t=>{ne(t),rn({inner:t})},Va=t=>{ue(t),rn({raw:t})},Da=()=>{ne(null),de([])},Pa=()=>re(t=>t+1),Mn=t=>{if($){if(t===0){Xt.flush(),fe(!1),ne(null),ue(void 0),de([]),re(a=>a+1),T?.();return}if(t===1){de([]),re(a=>a+1);return}de(Ee.slice(0,t-1)),re(a=>a+1);return}if(Ve){L(ae.slice(0,t)),W(a=>a+1);return}if(t===0){Cn();return}if(t===1){L([]),W(a=>a+1);return}if(pt&&t===2){L([]),W(a=>a+1);return}const s=pt?2:1;L(ae.slice(0,t-s))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:ot||Ht||$?n.jsxs("div",{className:$e("border-b px-3 py-2.5",ot&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[Ut.length>1&&n.jsx("button",{type:"button",onClick:()=>Mn(wo(Ut.length,{isMultivariateSectionTop:_a})),title:l("sectionsEditor.sectionsEditor.back"),"aria-label":l("sectionsEditor.sectionsEditor.back"),className:$e("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",ot?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(bs,{className:"size-4"})}),!Ve&&It&&dt&&n.jsxs("button",{type:"button",onClick:Cn,title:l("sectionsEditor.sectionsEditor.editingInVariant",{variant:dt.label}),className:$e("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",Nr),children:[n.jsx(Ns,{rule:Bt(dt.rule,r??{},i??void 0),matchers:$t}),n.jsx("span",{className:"max-w-[160px] truncate",children:dt.label})]}),n.jsx("nav",{"aria-label":l("sectionsEditor.sectionsEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:Ut.map((t,s)=>{const a=s===Ut.length-1,c=hs(t);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&n.jsx(Ss,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Mn(s),title:c,className:$e("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?ot?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":ot?"text-foreground/80":"text-muted-foreground",ot?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:c})]},`${c}-${s}`)})}),ot&&n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(Ao,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:l("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Pn&&!pt&&!ft?.isHidden&&k&&n.jsx(Jn,{onClick:()=>ln()})]}),ot&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:l("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(Dr,{pageKey:k,initialName:Ye.name,initialPath:Ye.path,onFieldChange:Ys})}),n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":l("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>fe(!0),children:n.jsx(Vo,{size:14})})}),n.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.editSeo")})]}),n.jsxs(yt,{children:[n.jsx(_t,{asChild:!0,children:n.jsx(Xe,{type:"button",variant:"ghost",size:"icon","aria-label":l("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>V&&k?V(k):je(!0),children:n.jsx(Do,{size:14})})}),n.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.viewJson")})]}),n.jsx(Jn,{onClick:An})]})}),$?n.jsx(Jt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ft&&k?n.jsx(Qo,{rawSeo:sn,innerSeo:yn,defaultResolveType:zs,seoSchema:Hs,activeResolveType:an,seoTypeOptions:$s,formResetKey:N,siteDefaultSeo:Us,onBreadcrumbChange:de,onPersistRaw:Va,onInnerChange:Na,onClearForm:Da,onBumpFormKey:Pa}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})}):Ht?n.jsxs(Jt,{viewportRef:ze,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[pt&&bt.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(ao,{listKey:`${k??""}:${p??""}`,variants:bt.map((t,s)=>({index:s,label:t.label})),selectedIndex:cn,onSelect:aa,onRename:he,onDuplicate:ra,onDelete:oa,onRemoveAll:la,onReorder:ia,onAdd:()=>ln()}),pt&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("sectionsEditor.sectionsEditor.variantRule")}),n.jsx(Qn,{currentRt:We??"",currentLabel:Wt(zt?.rule,r??{},lt,i??void 0),currentGlobalKey:At(zt?.rule,r??{},i??void 0)??void 0,matchers:$t,globals:kn,onSelect:ga,onSelectGlobal:va,schema:xa,formValue:ut,onChange:ha,formKey:`${p??"none"}:${cn}:${We??""}`,formWrapperClassName:"pt-1",meta:i??void 0,decofile:r,onSaveReferencedBlock:Kt,sandbox:Ot})]})]}),n.jsx(Yn,{activeSchema:on,formValue:pe,formResetKey:Me,onFormChange:En,onBreadcrumbChange:L,breadcrumbPath:ae,emptyMessage:l("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:i,decofile:r,onSaveReferencedBlock:Kt,sandbox:Ot,previewBaseUrl:H,onRequestAddSection:Rn})]}):Ve?n.jsx(Jt,{viewportRef:ze,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Yn,{activeSchema:on,formValue:pe,formResetKey:Me,onFormChange:En,onBreadcrumbChange:L,breadcrumbPath:ae,emptyMessage:l("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:i,decofile:r,onSaveReferencedBlock:Kt,sandbox:Ot,previewBaseUrl:H,onRequestAddSection:Rn})}):n.jsxs(Jt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[It&&k&&n.jsx(wr,{listKey:k,variants:qe,activeIndex:Oe,decofile:r??{},meta:i,matchers:$t,onSelect:ja,onReorder:Ea,onRename:ye,onDuplicate:wa,onDelete:Ra,onAdd:An}),It&&X!==null&&n.jsxs("div",{className:$e("px-3 border-b",_e?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>we(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":_e,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("sectionsEditor.sectionsEditor.variantRule")}),_e?n.jsx(Po,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ko,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),_e&&n.jsx("div",{className:$e("space-y-3",Nt&&"pointer-events-none opacity-50"),children:n.jsx(Qn,{currentRt:X,currentLabel:Wt(dt?.rule,r??{},lt,i??void 0),currentGlobalKey:At(dt?.rule,r??{},i??void 0)??void 0,matchers:$t,globals:kn,onSelect:ma,onSelectGlobal:pa,schema:da,formValue:xe,onChange:fa,formKey:`${Oe}:${X??""}`,formWrapperClassName:"space-y-3",meta:i??void 0,decofile:r,onSaveReferencedBlock:Kt,sandbox:Ot})})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(vr,{listKey:`${k??""}-${Oe}`,rawSections:q,sections:Ue,meta:i,selectedIndex:p,onSelect:Ws,onReorder:Js,onDelete:Qs,onDuplicate:Xs,onMakeReusable:Fe,onToggleHidden:Zs,onToggleLazy:ea,onAddVariant:ln,onDetach:ta,onAddSection:()=>oe(!0),canAddSection:ua})})]}),n.jsx(oo,{open:Z!==null,onOpenChange:t=>{t||Fe(null)},defaultBlockId:Z!==null?mn(Ue[Z]?.label??""):"",isPending:Ne.isPending,onSubmit:ca}),H&&n.jsx(tr,{open:ve,onOpenChange:t=>{oe(t),t||(me.current=null)},meta:i,decofile:r,previewBaseUrl:H,onSelect:sa}),Ae&&k&&r&&n.jsx(ro,{open:Ae,onOpenChange:je,pageKey:k,decofile:r}),Pe!==null&&n.jsx(qn,{open:!0,initialName:kt(qe[Pe]?.rule,r??{},i??void 0)?Wt(qe[Pe]?.rule,r??{},lt,i??void 0):"",autoLabel:lt(Bt(qe[Pe]?.rule,r??{},i??void 0)),isPending:Nt,onSubmit:async t=>{await ka(Pe,t)},onOpenChange:t=>{!t&&!Nt&&ye(null)}}),ce!==null&&n.jsx(qn,{open:!0,initialName:kt(bt[ce]?.rule,r??{},i??void 0)?Wt(bt[ce]?.rule,r??{},lt,i??void 0):"",autoLabel:lt(Bt(bt[ce]?.rule,r??{},i??void 0)),isPending:Nt,onSubmit:async t=>{await Ta(ce,t)},onOpenChange:t=>{!t&&!Nt&&he(null)}})]})}export{Rc as SectionsEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,aM as nt,aK as Ne,j as d,cZ as rt,aO as be,aL as k,c_ as st,aH as j,aN as P,bR as $,c$ as lt,ae as _e,d0 as Ee,aI as at,bI as ct,bT as it,d6 as dt,d7 as ut,d8 as pt,d9 as ft,d1 as mt,aJ as ht,da as vt,d2 as gt,d4 as xt,c as ee,m as oe}from"./index-Bfy-Fe7V.js";import{V as St}from"./tooltip-F9SMeJ-j.js";import{i as wt}from"./Check-CeB_ZeLq.js";import{t as Re}from"./ChevronDown-CGwhMiqT.js";import{n as Ct}from"./ChevronUp-3dsPU76D.js";function Pe(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[F,M]=i.useState(!1),re=nt(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[U,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:b,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:P(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,F]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>F(f)),[O,U]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(U(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ce,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[F,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ut;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("notranslate bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e};
|
|
1
|
+
import{r as i,aM as nt,aK as Ne,j as d,cZ as rt,aO as be,aL as k,c_ as st,aH as j,aN as P,bR as $,c$ as lt,ae as _e,d0 as Ee,aI as at,bI as ct,bT as it,d6 as dt,d7 as ut,d8 as pt,d9 as ft,d1 as mt,aJ as ht,da as vt,d2 as gt,d4 as xt,c as ee,m as oe}from"./index-HPW3S3aV.js";import{V as St}from"./tooltip-DI3Hz4lP.js";import{i as wt}from"./Check-DRUrRM4k.js";import{t as Re}from"./ChevronDown-C84fi4SM.js";import{n as Ct}from"./ChevronUp-B_P52q74.js";function Pe(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[F,M]=i.useState(!1),re=nt(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[U,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:b,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:P(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,F]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>F(f)),[O,U]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(U(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ce,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[F,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ut;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("notranslate bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as $,ae as mt,c as G,b as ie,j as s,F as ge,o as ke,a2 as We,a1 as Ve,e as Se,Z as He,$ as be,K as ce,t as le,B as oe,p as ne,m as re,n as ft,d as pt,E as xt,z as gt}from"./index-
|
|
1
|
+
import{r as $,ae as mt,c as G,b as ie,j as s,F as ge,o as ke,a2 as We,a1 as Ve,e as Se,Z as He,$ as be,K as ce,t as le,B as oe,p as ne,m as re,n as ft,d as pt,E as xt,z as gt}from"./index-HPW3S3aV.js";import{c as qe,e as Ye,d as Ge,a as vt,b as Xe,h as bt,D as yt}from"./dialog-BESgF0t5.js";import{d as jt,b as St,a as Nt,D as wt}from"./drawer-BX8td69Q.js";import{u as kt}from"./use-mobile-DJGPHp4h.js";import{u as Qe}from"./chat-context-DhgZwGdc.js";import{C as _t}from"./checkbox-CTxCGW48.js";import{I as xe}from"./input-C0I5JNx4.js";import{S as Ct,a as It,b as Mt,c as Et,d as Ot}from"./select-DTS7Lm6P.js";import{S as te}from"./skeleton-BahaVLML.js";import{i as Je}from"./ArrowLeft-DSLmAXMn.js";import{d as At,a as Pt,b as Tt,i as Lt}from"./Tool01-kS2-_uju.js";import{i as zt}from"./Key01-DGtD9k-H.js";import{i as Ze,b as Rt,a as Ft,s as Kt}from"./Settings02-CuJD2QQQ.js";import{i as et}from"./SearchMd-CYo4IMba.js";import{f as _e,u as Dt,b as $t}from"./use-ai-providers-MbQtQBY4.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{i as Ee}from"./Monitor01-sWedXVH7.js";import{i as Ut}from"./AlertCircle-CWOm5Uve.js";import{S as Oe}from"./spinner-Dbsv0bfZ.js";import{u as we}from"./studio-tools-DnX4fHFe.js";import{i as Bt}from"./ChevronRight-1hSG5rxw.js";import{A as Wt}from"./avatar-B1oqUtwq.js";import{S as Ae,a as Pe,b as tt}from"./settings-section-Cx85iU9E.js";import{s as st}from"./Eye-C2o0TGpU.js";import{i as Vt,D as Ht}from"./tab-id-BB8NVpbv.js";import{u as qt}from"./use-is-desktop-app-BNujXJc_.js";import{t as Te}from"./ChevronDown-C84fi4SM.js";import{t as Yt}from"./Stars01-B7GvVd6X.js";function pe(n,e,t){let i=t.initialDeps??[],o,l=!0;function c(){var r,h,d;let a;t.key&&((r=t.debug)!=null&&r.call(t))&&(a=Date.now());const f=n();if(!(f.length!==i.length||f.some((m,b)=>i[b]!==m)))return o;i=f;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...f),t.key&&((d=t.debug)!=null&&d.call(t))){const m=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-u)*100)/100,N=b/16,w=(y,_)=>{for(y=String(y);y.length<_;)y=" "+y;return y};console.info(`%c⏱ ${w(b,5)} /${w(m,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*N,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(l&&t.skipInitialOnChange)&&t.onChange(o),l=!1,o}return c.updateDeps=r=>{i=r},c}function Le(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Gt=(n,e)=>Math.abs(n-e)<1.01,Xt=(n,e,t)=>{let i;return function(...o){n.clearTimeout(i),i=n.setTimeout(()=>e.apply(this,o),t)}},ze=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},Qt=n=>n,Jt=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let o=e;o<=t;o++)i.push(o);return i},Zt=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;const o=c=>{const{width:r,height:h}=c;e({width:Math.round(r),height:Math.round(h)})};if(o(ze(t)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(c=>{const r=()=>{const h=c[0];if(h?.borderBoxSize){const d=h.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(ze(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return l.observe(t,{box:"border-box"}),()=>{l.unobserve(t)}},Re={passive:!0},Fe=typeof window>"u"?!0:"onscrollend"in window,es=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;let o=0;const l=n.options.useScrollendEvent&&Fe?()=>{}:Xt(i,()=>{e(o,!1)},n.options.isScrollingResetDelay),c=a=>()=>{const{horizontal:f,isRtl:p}=n.options;o=f?t.scrollLeft*(p&&-1||1):t.scrollTop,l(),e(o,a)},r=c(!0),h=c(!1);t.addEventListener("scroll",r,Re);const d=n.options.useScrollendEvent&&Fe;return d&&t.addEventListener("scrollend",h,Re),()=>{t.removeEventListener("scroll",r),d&&t.removeEventListener("scrollend",h)}},ts=(n,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},ss=(n,{adjustments:e=0,behavior:t},i)=>{var o,l;const c=n+e;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:c,behavior:t})};class is{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,o;return((o=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const c=()=>{const r=l.target,h=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r);return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(r,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),t=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,o])=>{typeof o>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Qt,rangeExtractor:Jt,onChange:()=>{},measureElement:ts,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,t)},this.maybeNotify=pe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const o=new Map,l=new Map;for(let c=i-1;c>=0;c--){const r=t[c];if(o.has(r.lane))continue;const h=l.get(r.lane);if(h==null||r.end>h.end?l.set(r.lane,r):r.end<h.end&&o.set(r.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((c,r)=>c.end===r.end?c.index-r.index:c.end-r.end)[0]:void 0},this.getMeasurementOptions=pe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,o,l,c,r,h)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:c,lanes:r,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=pe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:c,lanes:r,laneAssignmentMode:h},d)=>{if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const u of this.laneAssignments.keys())u>=t&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,a),p=new Array(r).fill(void 0);for(let u=0;u<a;u++){const m=f[u];m&&(p[m.lane]=u)}for(let u=a;u<t;u++){const m=l(u),b=this.laneAssignments.get(u);let N,w;const y=h==="estimate"||d.has(m);if(b!==void 0&&this.options.lanes>1){N=b;const k=p[N],x=k!==void 0?f[k]:void 0;w=x?x.end+this.options.gap:i+o}else{const k=this.options.lanes===1?f[u-1]:this.getFurthestMeasurement(f,u);w=k?k.end+this.options.gap:i+o,N=k?k.lane:u%this.options.lanes,this.options.lanes>1&&y&&this.laneAssignments.set(u,N)}const _=d.get(m),M=typeof _=="number"?_:this.options.estimateSize(u),P=w+M;f[u]={index:u,start:w,size:M,end:P,key:m,lane:N},p[N]=u}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,o,l)=>this.range=t.length>0&&i>0?ns({measurements:t,outerSize:i,scrollOffset:o,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=pe(()=>{let t=null,i=null;const o=this.calculateRange();return o&&(t=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,o,l,c)=>l===null||c===null?[]:t({startIndex:l,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,o=t.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-l),r=Math.min(this.options.count-1,o+l);return t>=c&&t<=r}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((c,r)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(r))});return}const i=this.indexFromElement(t),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var o;const l=this.measurementsCache[t];if(!l)return;const c=this.itemSizeCache.get(l.key)??l.size,r=i-c;r!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,r,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,i)),this.notify(!1))},this.getVirtualItems=pe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const o=[];for(let l=0,c=t.length;l<c;l++){const r=t[l],h=i[r];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Le(i[it(0,i.length-1,o=>Le(i[o]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=t>=c+l?"end":"start"),i==="center"?t+=(o-l)/2:i==="end"&&(t-=l);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),c=this.measurementsCache[t];if(!c)return;if(i==="auto")if(c.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const r=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,i,c.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(t,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getOffsetForIndex(t,i);if(!l)return;const[c,r]=l,h=this.now();this.scrollState={index:t,align:r,behavior:o,startedAt:h,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+t,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=i[i.length-1])==null?void 0:t.end)??0;else{const l=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&l.some(r=>r===null);){const r=i[c];l[r.lane]===null&&(l[r.lane]=r.end),c--}o=Math.max(...l.filter(r=>r!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&Gt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,c&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const it=(n,e,t,i)=>{for(;n<=e;){const o=(n+e)/2|0,l=t(o);if(l<i)n=o+1;else if(l>i)e=o-1;else return o}return n>0?n-1:0};function ns({measurements:n,outerSize:e,scrollOffset:t,lanes:i}){const o=n.length-1,l=h=>n[h].start;if(n.length<=i)return{startIndex:0,endIndex:o};let c=it(0,o,l,t),r=c;if(i===1)for(;r<o&&n[r].end<t+e;)r++;else if(i>1){const h=Array(i).fill(0);for(;r<o&&h.some(a=>a<t+e);){const a=n[r];h[a.lane]=a.end,r++}const d=Array(i).fill(t+e);for(;c>=0&&d.some(a=>a>=t);){const a=n[c];d[a.lane]=a.start,c--}c=Math.max(0,c-c%i),r=Math.min(o,r+(i-1-r%i))}return{startIndex:c,endIndex:r}}const Ke=typeof document<"u"?$.useLayoutEffect:$.useEffect;function ls({useFlushSync:n=!0,...e}){const t=$.useReducer(()=>({}),{})[1],i={...e,onChange:(l,c)=>{var r;n&&c?mt.flushSync(t):t(),(r=e.onChange)==null||r.call(e,l,c)}},[o]=$.useState(()=>new is(i));return o.setOptions(i),Ke(()=>o._didMount(),[]),Ke(()=>o._willUpdate()),o}function os(n){return ls({observeElementRect:Zt,observeElementOffset:es,scrollToFn:ss,...n})}const nt=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function ye(n){if(n)return nt.find(e=>e.id===n)}const De=4;function ve(n){const e=G.c(8),{logo:t,name:i,description:o,onClick:l}=n;let c;e[0]!==t||e[1]!==i?(c=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Wt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=c):c=e[2];let r;return e[3]!==o||e[4]!==i||e[5]!==l||e[6]!==c?(r=s.jsx(tt,{onClick:l,icon:c,title:i,description:o}),e[3]=o,e[4]=i,e[5]=l,e[6]=c,e[7]=r):r=e[7],r}function lt(n){const e=G.c(38),{providers:t,onSelect:i,onShowAll:o}=n,l=ie();let c;e[0]!==t?(c=t.find(ds),e[0]=t,e[1]=c):c=e[1];const r=c;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=h):h=e[2];const d=h;let a;if(e[3]!==i||e[4]!==t||e[5]!==l){let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=(j,I)=>{const L=d[j.id]??Number.MAX_SAFE_INTEGER,A=d[I.id]??Number.MAX_SAFE_INTEGER;return L-A},e[7]=M):M=e[7];const P=t.filter(cs).sort(M);let k;e[8]!==t?(k=t.find(as),e[8]=t,e[9]=k):k=e[9];const x=k;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=ye("openai"),e[10]=S):S=e[10];const C=S;let E;e[11]!==i?(E=j=>s.jsx(ve,{logo:j.logo,name:j.name,description:j.description,onClick:()=>i({kind:"provider",provider:j})},j.id),e[11]=i,e[12]=E):E=e[12];let v;e[13]!==i||e[14]!==x?(v=x&&C?[s.jsx(ve,{logo:C.logo,name:C.name,description:C.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:C})},C.id)]:[],e[13]=i,e[14]=x,e[15]=v):v=e[15];let g;e[16]!==i||e[17]!==x||e[18]!==l?(g=x?[...nt.filter(rs).map(j=>s.jsx(ve,{logo:j.logo,name:j.name,description:j.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:j})},j.id)),s.jsx(ve,{logo:x.logo,name:l("settings.aiProviders.customOpenAiCompatible"),description:l("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=l,e[19]=g):g=e[19],a=[...P.map(E),...v,...g],e[3]=i,e[4]=t,e[5]=l,e[6]=a}else a=e[6];const f=a,p=f.length-De,u=!!o&&p>0;let m;e[20]!==f||e[21]!==u?(m=u?f.slice(0,De):f,e[20]=f,e[21]=u,e[22]=m):m=e[22];const b=m;let N;e[23]!==r||e[24]!==i||e[25]!==l?(N=r&&s.jsx(Ae,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:l("settings.aiProviders.recommended")}),s.jsx(Pe,{className:"relative",children:s.jsx(ve,{logo:r.logo,name:r.name,description:r.description,onClick:()=>i({kind:"provider",provider:r})})})]})}),e[23]=r,e[24]=i,e[25]=l,e[26]=N):N=e[26];let w;e[27]!==p||e[28]!==o||e[29]!==u||e[30]!==l?(w=u&&s.jsx(tt,{onClick:o,title:l(p===1?"settings.aiProviders.moreProvidersSingular":"settings.aiProviders.moreProvidersPlural",{count:p}),action:s.jsx(Bt,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=u,e[30]=l,e[31]=w):w=e[31];let y;e[32]!==w||e[33]!==b?(y=s.jsx(Ae,{children:s.jsxs(Pe,{children:[b,w]})}),e[32]=w,e[33]=b,e[34]=y):y=e[34];let _;return e[35]!==N||e[36]!==y?(_=s.jsxs("div",{className:"flex flex-col gap-6",children:[N,y]}),e[35]=N,e[36]=y,e[37]=_):_=e[37],_}function rs(n){return n.id!=="openai"}function as(n){return n.id==="openai-compatible"}function cs(n){return n.id!=="deco"&&n.id!=="openai-compatible"}function ds(n){return n.id==="deco"}function hs(n){return He({label:be().optional(),apiKey:be().min(1,n)})}function us(n){const e=G.c(91),{providerId:t,onCancel:i,onSuccess:o}=n,{org:l}=ge(),c=we(),r=ke(),[h,d]=$.useState(!1),a=ie();let f;e[0]!==a?(f=We(hs(a("settings.connectForms.apiKeyRequired"))),e[0]=a,e[1]=f):f=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={label:"",apiKey:""},e[2]=p):p=e[2];let u;e[3]!==f?(u={resolver:f,defaultValues:p},e[3]=f,e[4]=u):u=e[4];const{register:m,handleSubmit:b,formState:N}=Ve(u),{errors:w}=N;let y;e[5]!==t||e[6]!==c||e[7]!==a?(y=async se=>{await c.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:se.label||a("settings.connectForms.defaultKeyLabel"),apiKey:se.apiKey})},e[5]=t,e[6]=c,e[7]=a,e[8]=y):y=e[8];let _;e[9]!==o||e[10]!==l||e[11]!==r||e[12]!==a?(_=()=>{r.invalidateQueries({queryKey:ce.aiProviderKeys(l.id)}),r.invalidateQueries({queryKey:ce.aiProviders(l.id)}),le.success(a("settings.connectForms.keySavedSuccess")),o()},e[9]=o,e[10]=l,e[11]=r,e[12]=a,e[13]=_):_=e[13];let M;e[14]!==a?(M=se=>{le.error(a("settings.connectForms.failedSaveKey",{error:se.message}))},e[14]=a,e[15]=M):M=e[15];let P;e[16]!==y||e[17]!==_||e[18]!==M?(P={mutationFn:y,onSuccess:_,onError:M},e[16]=y,e[17]=_,e[18]=M,e[19]=P):P=e[19];const{mutate:k,isPending:x,error:S}=Se(P);let C;e[20]!==k?(C=se=>k(se),e[20]=k,e[21]=C):C=e[21];let E;e[22]!==b||e[23]!==C?(E=b(C),e[22]=b,e[23]=C,e[24]=E):E=e[24];let v;e[25]!==a?(v=a("settings.connectForms.labelField"),e[25]=a,e[26]=v):v=e[26];let g;e[27]!==v?(g=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:v}),e[27]=v,e[28]=g):g=e[28];let j;e[29]!==a?(j=a("settings.connectForms.labelPlaceholder"),e[29]=a,e[30]=j):j=e[30];let I;e[31]!==m?(I=m("label"),e[31]=m,e[32]=I):I=e[32];let L;e[33]!==j||e[34]!==I?(L=s.jsx(xe,{placeholder:j,...I,className:"h-8 text-sm"}),e[33]=j,e[34]=I,e[35]=L):L=e[35];let A;e[36]!==g||e[37]!==L?(A=s.jsxs("div",{className:"space-y-1",children:[g,L]}),e[36]=g,e[37]=L,e[38]=A):A=e[38];let O;e[39]!==a?(O=a("settings.connectForms.apiKeyField"),e[39]=a,e[40]=O):O=e[40];let T;e[41]!==O?(T=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:O}),e[41]=O,e[42]=T):T=e[42];const F=h?"text":"password";let R;e[43]!==m?(R=m("apiKey"),e[43]=m,e[44]=R):R=e[44];let K;e[45]!==F||e[46]!==R?(K=s.jsx(xe,{type:F,placeholder:"sk-...",...R,className:"ph-no-capture h-8 text-sm pr-8"}),e[45]=F,e[46]=R,e[47]=K):K=e[47];let X;e[48]!==h?(X=()=>d(!h),e[48]=h,e[49]=X):X=e[49];let q;e[50]!==h||e[51]!==a?(q=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[50]=h,e[51]=a,e[52]=q):q=e[52];let Q;e[53]!==h?(Q=h?s.jsx(Ze,{size:14}):s.jsx(st,{size:14}),e[53]=h,e[54]=Q):Q=e[54];let V;e[55]!==X||e[56]!==q||e[57]!==Q?(V=s.jsx("button",{type:"button",onClick:X,"aria-label":q,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Q}),e[55]=X,e[56]=q,e[57]=Q,e[58]=V):V=e[58];let Z;e[59]!==K||e[60]!==V?(Z=s.jsxs("div",{className:"relative",children:[K,V]}),e[59]=K,e[60]=V,e[61]=Z):Z=e[61];let U;e[62]!==w.apiKey?(U=w.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:w.apiKey.message}),e[62]=w.apiKey,e[63]=U):U=e[63];let B;e[64]!==T||e[65]!==Z||e[66]!==U?(B=s.jsxs("div",{className:"space-y-1",children:[T,Z,U]}),e[64]=T,e[65]=Z,e[66]=U,e[67]=B):B=e[67];let H;e[68]!==S?(H=S&&s.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[68]=S,e[69]=H):H=e[69];let J;e[70]!==a?(J=a("settings.connectForms.cancel"),e[70]=a,e[71]=J):J=e[71];let z;e[72]!==x||e[73]!==i||e[74]!==J?(z=s.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:J}),e[72]=x,e[73]=i,e[74]=J,e[75]=z):z=e[75];let D;e[76]!==x||e[77]!==a?(D=a(x?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[76]=x,e[77]=a,e[78]=D):D=e[78];let W;e[79]!==x||e[80]!==D?(W=s.jsx(oe,{type:"submit",size:"sm",disabled:x,children:D}),e[79]=x,e[80]=D,e[81]=W):W=e[81];let Y;e[82]!==z||e[83]!==W?(Y=s.jsxs(qe,{children:[z,W]}),e[82]=z,e[83]=W,e[84]=Y):Y=e[84];let ee;return e[85]!==E||e[86]!==A||e[87]!==B||e[88]!==H||e[89]!==Y?(ee=s.jsxs("form",{onSubmit:E,className:"space-y-3",children:[A,B,H,Y]}),e[85]=E,e[86]=A,e[87]=B,e[88]=H,e[89]=Y,e[90]=ee):ee=e[90],ee}function ms(n){return He({label:be().optional(),baseUrl:be().min(1,n),apiKey:be().optional()})}function fs(n){const e=G.c(109),{preset:t,onCancel:i,onSuccess:o}=n,{org:l}=ge(),c=we(),r=ke(),[h,d]=$.useState(!1),a=ie();let f;e[0]!==a?(f=We(ms(a("settings.connectForms.baseUrlRequired"))),e[0]=a,e[1]=f):f=e[1];const p=t?.defaultBaseUrl??"";let u;e[2]!==p?(u={label:"",baseUrl:p,apiKey:""},e[2]=p,e[3]=u):u=e[3];let m;e[4]!==f||e[5]!==u?(m={resolver:f,defaultValues:u},e[4]=f,e[5]=u,e[6]=m):m=e[6];const{register:b,handleSubmit:N,formState:w}=Ve(m),{errors:y}=w;let _;e[7]!==t||e[8]!==c?(_=async ae=>{const ut=JSON.stringify({baseUrl:ae.baseUrl,apiKey:ae.apiKey||""});await c.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:ae.label||t?.name||ae.baseUrl,apiKey:ut,...t?{presetId:t.id}:{}})},e[7]=t,e[8]=c,e[9]=_):_=e[9];let M;e[10]!==o||e[11]!==l||e[12]!==r||e[13]!==a?(M=()=>{r.invalidateQueries({queryKey:ce.aiProviderKeys(l.id)}),r.invalidateQueries({queryKey:ce.aiProviders(l.id)}),le.success(a("settings.connectForms.connectionSavedSuccess")),o()},e[10]=o,e[11]=l,e[12]=r,e[13]=a,e[14]=M):M=e[14];let P;e[15]!==a?(P=ae=>{le.error(a("settings.connectForms.failedSaveConnection",{error:ae.message}))},e[15]=a,e[16]=P):P=e[16];let k;e[17]!==_||e[18]!==M||e[19]!==P?(k={mutationFn:_,onSuccess:M,onError:P},e[17]=_,e[18]=M,e[19]=P,e[20]=k):k=e[20];const{mutate:x,isPending:S,error:C}=Se(k);let E;e[21]!==t||e[22]!==a?(E=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[21]=t,e[22]=a,e[23]=E):E=e[23];const v=E;let g;e[24]!==t?.baseUrlPlaceholder||e[25]!==a?(g=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[24]=t?.baseUrlPlaceholder,e[25]=a,e[26]=g):g=e[26];const j=g;let I;e[27]!==x?(I=ae=>x(ae),e[27]=x,e[28]=I):I=e[28];let L;e[29]!==N||e[30]!==I?(L=N(I),e[29]=N,e[30]=I,e[31]=L):L=e[31];let A;e[32]!==a?(A=a("settings.connectForms.labelField"),e[32]=a,e[33]=A):A=e[33];let O;e[34]!==A?(O=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:A}),e[34]=A,e[35]=O):O=e[35];let T;e[36]!==b?(T=b("label"),e[36]=b,e[37]=T):T=e[37];let F;e[38]!==v||e[39]!==T?(F=s.jsx(xe,{placeholder:v,...T,className:"h-8 text-sm"}),e[38]=v,e[39]=T,e[40]=F):F=e[40];let R;e[41]!==O||e[42]!==F?(R=s.jsxs("div",{className:"space-y-1",children:[O,F]}),e[41]=O,e[42]=F,e[43]=R):R=e[43];let K;e[44]!==j||e[45]!==y||e[46]!==t?.defaultBaseUrl||e[47]!==b||e[48]!==a?(K=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...b("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),s.jsx(xe,{type:"url",placeholder:j,...b("baseUrl"),className:"h-8 text-sm"}),y.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[44]=j,e[45]=y,e[46]=t?.defaultBaseUrl,e[47]=b,e[48]=a,e[49]=K):K=e[49];let X;e[50]!==a?(X=a("settings.connectForms.apiKeyField"),e[50]=a,e[51]=X):X=e[51];let q;e[52]!==t?.apiKeyRecommended||e[53]!==a?(q=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[52]=t?.apiKeyRecommended,e[53]=a,e[54]=q):q=e[54];let Q;e[55]!==q?(Q=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",q,")"]}),e[55]=q,e[56]=Q):Q=e[56];let V;e[57]!==X||e[58]!==Q?(V=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[X," ",Q]}),e[57]=X,e[58]=Q,e[59]=V):V=e[59];const Z=h?"text":"password";let U;e[60]!==b?(U=b("apiKey"),e[60]=b,e[61]=U):U=e[61];let B;e[62]!==Z||e[63]!==U?(B=s.jsx(xe,{type:Z,placeholder:"sk-...",...U,className:"ph-no-capture h-8 text-sm pr-8"}),e[62]=Z,e[63]=U,e[64]=B):B=e[64];let H;e[65]!==h?(H=()=>d(!h),e[65]=h,e[66]=H):H=e[66];let J;e[67]!==h||e[68]!==a?(J=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[67]=h,e[68]=a,e[69]=J):J=e[69];let z;e[70]!==h?(z=h?s.jsx(Ze,{size:14}):s.jsx(st,{size:14}),e[70]=h,e[71]=z):z=e[71];let D;e[72]!==H||e[73]!==J||e[74]!==z?(D=s.jsx("button",{type:"button",onClick:H,"aria-label":J,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:z}),e[72]=H,e[73]=J,e[74]=z,e[75]=D):D=e[75];let W;e[76]!==B||e[77]!==D?(W=s.jsxs("div",{className:"relative",children:[B,D]}),e[76]=B,e[77]=D,e[78]=W):W=e[78];let Y;e[79]!==V||e[80]!==W?(Y=s.jsxs("div",{className:"space-y-1",children:[V,W]}),e[79]=V,e[80]=W,e[81]=Y):Y=e[81];let ee;e[82]!==t?(ee=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[82]=t,e[83]=ee):ee=e[83];let se;e[84]!==C?(se=C&&s.jsx("p",{className:"text-xs text-destructive",children:C.message}),e[84]=C,e[85]=se):se=e[85];let de;e[86]!==a?(de=a("settings.connectForms.cancel"),e[86]=a,e[87]=de):de=e[87];let he;e[88]!==S||e[89]!==i||e[90]!==de?(he=s.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:S,children:de}),e[88]=S,e[89]=i,e[90]=de,e[91]=he):he=e[91];let ue;e[92]!==S||e[93]!==a?(ue=a(S?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[92]=S,e[93]=a,e[94]=ue):ue=e[94];let me;e[95]!==S||e[96]!==ue?(me=s.jsx(oe,{type:"submit",size:"sm",disabled:S,children:ue}),e[95]=S,e[96]=ue,e[97]=me):me=e[97];let fe;e[98]!==he||e[99]!==me?(fe=s.jsxs(qe,{children:[he,me]}),e[98]=he,e[99]=me,e[100]=fe):fe=e[100];let je;return e[101]!==L||e[102]!==R||e[103]!==K||e[104]!==Y||e[105]!==ee||e[106]!==se||e[107]!==fe?(je=s.jsxs("form",{onSubmit:L,className:"space-y-3",children:[R,K,Y,ee,se,fe]}),e[101]=L,e[102]=R,e[103]=K,e[104]=Y,e[105]=ee,e[106]=se,e[107]=fe,e[108]=je):je=e[108],je}const ps={kind:"closed"};function xs(n,e){switch(e.type){case"open":return n.kind==="closed"?{kind:"grid"}:n;case"close":return{kind:"closed"};case"back":switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return n}case"select-form":return n.kind!=="grid"?n:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return n.kind!=="grid"?n:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return n.kind==="oauth-pending"?{kind:"grid"}:n;case"select-provision":return n.kind!=="grid"?n:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return n.kind!=="provision-pending"?n:{kind:"provision-error",providerId:n.providerId,error:e.error};case"retry-provision":return n.kind!=="provision-error"?n:{kind:"provision-pending",providerId:n.providerId}}}function gs(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function vs({open:n,onOpenChange:e,initialProvider:t}){const i=ie(),l=_e()?.providers??[],{org:c}=ge(),r=we(),h=ke(),[d,a]=$.useReducer(xs,ps),f=$.useRef(!1);$.useEffect(()=>{n&&d.kind==="closed"?a({type:"open"}):!n&&d.kind!=="closed"&&a({type:"close"})},[n,d.kind]);const p=()=>{f.current=!1,a({type:"close"}),e(!1)},u=()=>{h.invalidateQueries({queryKey:ce.aiProviderKeys(c.id)}),h.invalidateQueries({queryKey:ce.aiProviders(c.id)})},{mutate:m}=Se({mutationFn:async({providerId:v,code:g,stateToken:j,label:I})=>(await r.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:v,code:g,stateToken:j,label:I}),v),onSuccess:v=>{ne("ai_provider_oauth_succeeded",{provider_id:v}),u();const g=l.find(j=>j.id===v);le.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ne("ai_provider_oauth_failed",{provider_id:g.providerId,error:v.message}),le.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:v.message})),a({type:"oauth-failed"})}}),{mutate:b}=Se({mutationFn:async v=>(await r.call("AI_PROVIDER_PROVISION_KEY",{providerId:v}),v),onSuccess:v=>{ne("ai_provider_provision_succeeded",{provider_id:v}),u();const g=l.find(j=>j.id===v);le.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ne("ai_provider_provision_failed",{provider_id:g,error:v.message}),a({type:"provision-error",error:v.message})}}),N=async v=>{const{provider:g}=v,j=v.kind==="openai-compatible"?v.preset?.id??null:null,I=g.supportedMethods.includes("oauth-pkce"),L=g.supportedMethods.includes("api-key");if(g.supportsProvision===!0){ne("ai_provider_connect_clicked",{provider_id:g.id,method:"provision"}),a({type:"select-provision",providerId:g.id}),b(g.id);return}if(I){ne("ai_provider_connect_clicked",{provider_id:g.id,method:"oauth-pkce"});try{const O=await r.call("AI_PROVIDER_OAUTH_URL",{providerId:g.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:g.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}L&&(ne("ai_provider_connect_clicked",{provider_id:g.id,...j!==null?{preset_id:j}:{},method:"api-key"}),a({type:"select-form",providerId:g.id,presetId:j}))},w=$.useRef(N);w.current=N;const y=$.useRef(t);y.current=t,$.useEffect(()=>{!y.current||d.kind!=="grid"||f.current||(f.current=!0,w.current(y.current))},[d.kind]);const _=d.kind==="oauth-pending"?d.stateToken:null,M=d.kind==="oauth-pending"?d.providerId:null;$.useEffect(()=>{if(d.kind!=="oauth-pending")return;let v=!1;const g=d.stateToken,j=d.providerId,I=A=>{if(A.origin!==window.location.origin||A.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:T}=A.data;if(T!==g){le.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}v=!0;const F=l.find(R=>R.id===j);m({providerId:j,code:O,stateToken:g,label:F?.name??j})};window.addEventListener("message",I);const L=setTimeout(()=>{v||(ne("ai_provider_oauth_timeout",{provider_id:j}),a({type:"oauth-failed"}),le.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",I),clearTimeout(L)}},[d.kind,_,M,m]);const P=gs(d),k=P?l.find(v=>v.id===P):null,S=(d.kind==="form"&&d.presetId?ye(d.presetId):null)?.name??k?.name??i("settings.connectProviderDialog.defaultTitle"),C=d.kind!=="grid"&&d.kind!=="closed",E=()=>{t?p():a({type:"back"})};return s.jsx(Ye,{open:d.kind!=="closed",onOpenChange:v=>!v&&p(),children:s.jsxs(Ge,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(vt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[C&&s.jsx(oe,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:E,children:s.jsx(Je,{size:16})}),s.jsx(Xe,{children:S})]}),d.kind==="grid"&&!t&&s.jsx(bt,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(lt,{providers:l,onSelect:N}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(fs,{preset:d.presetId?ye(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}}):s.jsx(us,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Oe,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Oe,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(Ut,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(oe,{size:"sm",onClick:()=>{a({type:"retry-provision"}),b(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function bs(){const n=G.c(7),{org:e}=ge(),t=we();let i;n[0]!==e.id?(i=ce.defaultBrand(e.id),n[0]=e.id,n[1]=i):i=n[1];let o;n[2]!==t?(o=async()=>{const{items:r}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(r)?r:[]).find(ys)??null},n[2]=t,n[3]=o):o=n[3];let l;n[4]!==i||n[5]!==o?(l={queryKey:i,queryFn:o},n[4]=i,n[5]=o,n[6]=l):l=n[6];const{data:c}=ft(l);return c??null}function ys(n){return n.isDefault&&!n.archivedAt}function js(n){const e=n.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(o=>typeof o=="object"&&o!==null&&"label"in o&&/primary|brand|main/i.test(o.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function Ss(n){const e=G.c(49);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:i,description:o}=t,l=ie(),{org:c}=ge(),r=bs(),[h,d]=$.useState(null),[a,f]=$.useState(!1),[p,u]=$.useState(!1),m=qt();let b;e[2]!==m?(b=Vt()&&!m,e[2]=m,e[3]=b):b=e[3];const N=b,w=_e();let y;e[4]!==w?.providers?(y=w?.providers??[],e[4]=w?.providers,e[5]=y):y=e[5];const _=y,M=c.name;let P;e[6]!==r?(P=r?js(r):null,e[6]=r,e[7]=P):P=e[7];const k=P,x=r?.favicon??r?.logo??null;let S;e[8]!==M||e[9]!==l||e[10]!==i?(S=i??(M?l("chat.noAiProviderEmptyState.headingWithOrg",{org:M}):l("chat.noAiProviderEmptyState.headingDefault")),e[8]=M,e[9]=l,e[10]=i,e[11]=S):S=e[11];const C=S;let E;e[12]!==o||e[13]!==l?(E=o??l("chat.noAiProviderEmptyState.subtitleDefault"),e[12]=o,e[13]=l,e[14]=E):E=e[14];const v=E,g=!!(x||k);let j;e[15]!==k?(j=k?{backgroundColor:`${k}18`,borderColor:`${k}30`}:void 0,e[15]=k,e[16]=j):j=e[16];const I=j,L=g?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";let A;e[17]!==L||e[18]!==I||e[19]!==x||e[20]!==N||e[21]!==k||e[22]!==l?(A=x?s.jsx("div",{className:L,style:I,children:s.jsx("img",{src:x,alt:"",className:"size-7 rounded object-contain"})}):N?s.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":l("downloadApp.openLabel"),className:re(L,"cursor-pointer transition-colors hover:bg-accent"),style:I,children:s.jsx(Ee,{size:24,style:k?{color:k}:void 0,className:re(!k&&"text-muted-foreground")})}):s.jsx("div",{className:L,style:I,children:s.jsx(Ee,{size:24,style:k?{color:k}:void 0,className:re(!k&&"text-muted-foreground")})}),e[17]=L,e[18]=I,e[19]=x,e[20]=N,e[21]=k,e[22]=l,e[23]=A):A=e[23];let O;e[24]!==C?(O=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:C}),e[24]=C,e[25]=O):O=e[25];let T;e[26]!==v?(T=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:v}),e[26]=v,e[27]=T):T=e[27];let F;e[28]!==T||e[29]!==O?(F=s.jsxs("div",{className:"space-y-2",children:[O,T]}),e[28]=T,e[29]=O,e[30]=F):F=e[30];let R;e[31]!==F||e[32]!==A?(R=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[A,F]}),e[31]=F,e[32]=A,e[33]=R):R=e[33];let K,X;e[34]===Symbol.for("react.memo_cache_sentinel")?(K=J=>d(J),X=()=>f(!0),e[34]=K,e[35]=X):(K=e[34],X=e[35]);let q;e[36]!==_?(q=s.jsx("div",{className:"w-full",children:s.jsx(lt,{providers:_,onSelect:K,onShowAll:X})}),e[36]=_,e[37]=q):q=e[37];const Q=h!==null||a;let V;e[38]===Symbol.for("react.memo_cache_sentinel")?(V=J=>{J||(d(null),f(!1))},e[38]=V):V=e[38];const Z=h??void 0;let U;e[39]!==Q||e[40]!==Z?(U=s.jsx(vs,{open:Q,onOpenChange:V,initialProvider:Z}),e[39]=Q,e[40]=Z,e[41]=U):U=e[41];let B;e[42]!==p?(B=s.jsx(Ht,{open:p,onOpenChange:u}),e[42]=p,e[43]=B):B=e[43];let H;return e[44]!==R||e[45]!==q||e[46]!==U||e[47]!==B?(H=s.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[R,q,U,B]}),e[44]=R,e[45]=q,e[46]=U,e[47]=B,e[48]=H):H=e[48],H}function Ie(n){const e=n.title.includes(": ");return{provider:e?n.title.split(": ")[0]??"":n.modelId.split("/")[0]??"",displayName:e?n.title.split(": ").slice(1).join(": "):n.title}}function Ns(n){return n<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:n<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:n<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const ws=["bg-destructive","bg-warning","bg-success","bg-success"],ks=["text-success","text-warning","text-warning","text-destructive"];function _s(n,e){const t=Math.round(n*.75/1e3),i=t>=1?`${t}K`:`${Math.round(n*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function Cs(n){return n<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:n<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:n<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const Is={text:{icon:s.jsx(Tt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Pt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Rt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx(At,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(Yt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(et,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function Ms(n){const e=G.c(10),{capability:t}=n,i=ie(),o=Is[t];if(o){const h=o.icon;let d;e[0]!==o.labelKey||e[1]!==i?(d=i(o.labelKey),e[0]=o.labelKey,e[1]=i,e[2]=d):d=e[2];let a;return e[3]!==o.icon||e[4]!==d?(a=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[h,d]}),e[3]=o.icon,e[4]=d,e[5]=a):a=e[5],a}let l;e[6]!==t?(l=t.charAt(0).toUpperCase(),e[6]=t,e[7]=l):l=e[7];const c=l+t.slice(1);let r;return e[8]!==c?(r=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:c}),e[8]=c,e[9]=r):r=e[9],r}function Es(n){const e=G.c(59),{model:t,compact:i}=n,o=i===void 0?!1:i,l=ie();if(!t){let x;e[0]!==l?(x=l("chat.shared.hoverToPreview"),e[0]=l,e[1]=x):x=e[1];let S;return e[2]!==x?(S=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=S):S=e[3],S}const c=t.costs?.input!=null?t.costs.input*1e6:null,r=t.costs?.output!=null?t.costs.output*1e6:null;let h;e[4]!==t?(h=Ie(t),e[4]=t,e[5]=h):h=e[5];const{provider:d,displayName:a}=h;if(o){let x;e[6]!==t.limits||e[7]!==l?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=l,e[8]=x):x=e[8];let S;e[9]!==c||e[10]!==l?(S=c!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[9]=c,e[10]=l,e[11]=S):S=e[11];let C;e[12]!==r||e[13]!==l?(C=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[12]=r,e[13]=l,e[14]=C):C=e[14];let E;e[15]!==t.limits||e[16]!==l?(E=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=l,e[17]=E):E=e[17];let v;return e[18]!==x||e[19]!==S||e[20]!==C||e[21]!==E?(v=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,S,C,E]}),e[18]=x,e[19]=S,e[20]=C,e[21]=E,e[22]=v):v=e[22],v}let f;e[23]!==d?(f=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=f):f=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let u;e[28]!==a?(u=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=u):u=e[29];let m;e[30]!==p||e[31]!==u?(m=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,u]}),e[30]=p,e[31]=u,e[32]=m):m=e[32];let b;e[33]!==t.modelId?(b=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=b):b=e[34];let N;e[35]!==f||e[36]!==m||e[37]!==b?(N=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[f,m,b]}),e[35]=f,e[36]=m,e[37]=b,e[38]=N):N=e[38];let w;e[39]!==t.capabilities?(w=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(Os)}),e[39]=t.capabilities,e[40]=w):w=e[40];let y;e[41]!==t.limits||e[42]!==l?(y=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:S,descriptionKey:C}=Ns(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.contextWindow")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(E=>s.jsx("div",{className:re("w-2 h-2 rounded-full",E<=x?ws[x-1]:"bg-muted")},E))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:l(S)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",l(C)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=l,e[43]=y):y=e[43];let _;e[44]!==t.limits||e[45]!==l?(_=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:_s(t.limits.maxOutputTokens,l)})]})]}),e[44]=t.limits,e[45]=l,e[46]=_):_=e[46];let M;e[47]!==c||e[48]!==r||e[49]!==l?(M=(c!=null||r!=null)&&(()=>{const{level:x,labelKey:S}=c!=null?Cs(c):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.pricing")}),c!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>s.jsx("span",{className:re("text-sm font-bold leading-none",C<=x?ks[x-1]:"text-muted-foreground/20"),children:"$"},C))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:S?l(S):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[c!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]}),r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]})]})]})})(),e[47]=c,e[48]=r,e[49]=l,e[50]=M):M=e[50];let P;e[51]!==y||e[52]!==_||e[53]!==M?(P=s.jsxs("div",{className:"flex flex-col gap-6",children:[y,_,M]}),e[51]=y,e[52]=_,e[53]=M,e[54]=P):P=e[54];let k;return e[55]!==P||e[56]!==N||e[57]!==w?(k=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[N,w,P]}),e[55]=P,e[56]=N,e[57]=w,e[58]=k):k=e[58],k}function Os(n){return s.jsx(Ms,{capability:n},n)}function ot(n){const e=G.c(22),{model:t,placeholder:i,isLoading:o}=n,l=o===void 0?!1:o,c=ie();let r;e[0]!==i||e[1]!==c?(r=i??c("chat.shared.selectModel"),e[0]=i,e[1]=c,e[2]=r):r=e[2];const h=r;if(l){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(te,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(te,{className:"w-16 h-3 hidden md:block"})]}),e[3]=w):w=e[3],w}if(!t){let w;e[4]!==h?(w=s.jsx("span",{className:"text-sm text-muted-foreground",children:h}),e[4]=h,e[5]=w):w=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Te,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=y):y=e[6];let _;return e[7]!==w?(_=s.jsxs("div",{className:"flex items-center gap-1.5",children:[w,y]}),e[7]=w,e[8]=_):_=e[8],_}let d;e[9]!==t?(d=Ie(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let f;e[11]!==t?(f=Ce(t),e[11]=t,e[12]=f):f=e[12];const p=f;let u;e[13]!==t.title||e[14]!==p?(u=s.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=u):u=e[15];let m;e[16]!==a?(m=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=m):m=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Te,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=b):b=e[18];let N;return e[19]!==u||e[20]!==m?(N=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,m,b]}),e[19]=u,e[20]=m,e[21]=N):N=e[21],N}const As=["vision","image","file","audio","video"],rt=["image/png","image/jpeg","image/gif","image/webp"],at=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Me(n){const e=n?.capabilities;return e?As.some(t=>e.includes(t)):!1}function Ri(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),o=t.includes("file"),l=t.includes("audio"),c=t.includes("video");return!!(i&&rt.includes(n)||o&&n==="application/pdf"||l&&n.startsWith("audio/")||c&&n.startsWith("video/")||Me(e)&&at.includes(n))}function Fi(n){const e=n?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...rt),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Me(n)&&t.push(...at),t.join(",")}function Ki(n){const e=n?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Me(n)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const ct=["smarter","faster","cheaper"],Ps={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},Ts=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ls=Ts.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),zs="google/gemini-2.5-pro",$e=new Map;function Rs(n){const e=$e.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:o}of Ls)if(n.startsWith(o)){if(o===zs&&n.length>o.length&&n[o.length]==="-"){const c=n[o.length+1];if(!c||!/\d/.test(c))continue}t=i;break}return $e.set(n,t),t}function Ue(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const i=Rs(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,o)=>i.title.localeCompare(o.title));return e}const dt="studio:model-shortlist:",Fs=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Ks(n){try{const e=localStorage.getItem(dt+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function Ds(n,e){localStorage.setItem(dt+n,JSON.stringify([...e]))}function $s(n){const e=G.c(21),{model:t,onHover:i}=n;let o;e[0]!==t?(o=Ie(t),e[0]=t,e[1]=o):o=e[1];const{displayName:l,provider:c}=o;let r;e[2]!==t?(r=Ce(t),e[2]=t,e[3]=r):r=e[3];const h=r;let d;e[4]!==t||e[5]!==i?(d=()=>i(t),e[4]=t,e[5]=i,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==h?(a=s.jsx("img",{src:h,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=h,e[9]=a):a=e[9];let f;e[10]!==l?(f=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:l}),e[10]=l,e[11]=f):f=e[11];let p;e[12]!==c?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:c}),e[12]=c,e[13]=p):p=e[13];let u;e[14]!==f||e[15]!==p?(u=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[f,p]}),e[14]=f,e[15]=p,e[16]=u):u=e[16];let m;return e[17]!==d||e[18]!==a||e[19]!==u?(m=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,u]}),e[17]=d,e[18]=a,e[19]=u,e[20]=m):m=e[20],m}function Us(n){const e=G.c(16),{error:t,onRetry:i}=n,o=ie();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(gt,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];const c=o("chat.decopilot.failedToLoadModels");let r;e[1]!==c?(r=s.jsx("p",{className:"text-sm font-medium text-foreground",children:c}),e[1]=c,e[2]=r):r=e[2];const h=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==h||e[4]!==d?(a=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[h,d]}),e[3]=h,e[4]=d,e[5]=a):a=e[5];let f;e[6]!==r||e[7]!==a?(f=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,a]}),e[6]=r,e[7]=a,e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Kt,{className:"size-3.5"}),e[9]=p):p=e[9];const u=o("chat.decopilot.retry");let m;e[10]!==i||e[11]!==u?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(oe,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[p,u]})}),e[10]=i,e[11]=u,e[12]=m):m=e[12];let b;return e[13]!==m||e[14]!==f?(b=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,f,m]}),e[13]=m,e[14]=f,e[15]=b):b=e[15],b}function Bs(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Ws)}),n[0]=e):e=n[0],e}function Ws(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(te,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(te,{className:"flex-1 h-4"}),s.jsx(te,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Be(n){const e=G.c(12),{label:t,models:i,onSelect:o,onHover:l}=n;if(i.length===0)return null;let c;e[0]!==t?(c=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=c):c=e[1];let r;if(e[2]!==i||e[3]!==l||e[4]!==o){let d;e[6]!==l||e[7]!==o?(d=a=>s.jsx("button",{type:"button",onClick:()=>o(a),onFocus:()=>l(a),className:"w-full text-left cursor-pointer",children:s.jsx($s,{model:a,onHover:l})},a.modelId),e[6]=l,e[7]=o,e[8]=d):d=e[8],r=i.map(d),e[2]=i,e[3]=l,e[4]=o,e[5]=r}else r=e[5];let h;return e[9]!==c||e[10]!==r?(h=s.jsxs("div",{children:[c,r]}),e[9]=c,e[10]=r,e[11]=h):h=e[11],h}function Ne(n,e){return e(n==="other"?"chat.decopilot.tierOther":Ps[n])}function Vs(n){const e=G.c(21),{model:t,isChecked:i,onToggle:o,onHover:l}=n,[c,r]=$.useState(i);c!==i&&r(i);let h;e[0]!==t?(h=Ce(t),e[0]=t,e[1]=h):h=e[1];const d=h;let a;e[2]!==t||e[3]!==l?(a=()=>l(t),e[2]=t,e[3]=l,e[4]=a):a=e[4];let f;e[5]!==t.modelId||e[6]!==o?(f=()=>{r(Hs),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=f):f=e[7];let p;e[8]!==c||e[9]!==f?(p=s.jsx(_t,{checked:c,onCheckedChange:f}),e[8]=c,e[9]=f,e[10]=p):p=e[10];let u;e[11]!==d||e[12]!==t.title?(u=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=u):u=e[13];let m;e[14]!==t.title?(m=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=m):m=e[15];let b;return e[16]!==a||e[17]!==p||e[18]!==u||e[19]!==m?(b=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[p,u,m]}),e[16]=a,e[17]=p,e[18]=u,e[19]=m,e[20]=b):b=e[20],b}function Hs(n){return!n}function qs(n,e){const t=[];for(const i of ct)if(n[i].length>0){t.push({type:"header",label:Ne(i,e)});for(const o of n[i])t.push({type:"model",model:o})}if(n.other.length>0){t.push({type:"header",label:Ne("other",e)});for(const i of n.other)t.push({type:"model",model:i})}return t}function Ys({items:n,shortlistSet:e,onToggle:t,onHover:i}){const o=$.useRef(null),l=os({count:n.length,getScrollElement:()=>o.current,estimateSize:c=>n[c]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:l.getTotalSize()},children:l.getVirtualItems().map(c=>{const r=n[c.index];return r?s.jsx("div",{"data-index":c.index,ref:l.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${c.start}px)`},children:r.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:r.label}):s.jsx(Vs,{model:r.model,isChecked:e.has(r.model.modelId),onToggle:t,onHover:i})},c.key):null})})})}function Gs(n){const e=G.c(30),{keyId:t,searchTerm:i,onHover:o,onModelSelect:l,managing:c,onToggleManage:r,filterModels:h}=n,d=ie(),{models:a}=$t(t),f=h?a.filter(h):a.filter(Xs);let p;e[0]!==t?(p=()=>(t?Ks(t):null)??Fs,e[0]=t,e[1]=p):p=e[1];const[u,m]=$.useState(p),[,b]=$.useTransition();let N;e[2]!==t||e[3]!==b?(N=g=>{t&&b(()=>{m(j=>{const I=new Set(j);return I.has(g)?I.delete(g):I.add(g),Ds(t,I),I})})},e[2]=t,e[3]=b,e[4]=N):N=e[4];const w=N,y=i.toLowerCase().trim(),_=g=>y?g.filter(j=>j.title.toLowerCase().includes(y)||j.modelId.toLowerCase().includes(y)):g;if(c){const g=Ue(_(f)),j=qs(g,d);let I;e[5]!==u?(I=F=>u.has(F.modelId),e[5]=u,e[6]=I):I=e[6];const L=f.filter(I).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Je,{size:14}),e[7]=A):A=e[7];let O;e[8]!==d?(O=d("chat.decopilot.back"),e[8]=d,e[9]=O):O=e[9];let T;return e[10]!==r||e[11]!==O?(T=s.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[A,O]}),e[10]=r,e[11]=O,e[12]=T):T=e[12],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[T,s.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:L})})]}),s.jsx(Ys,{items:j,shortlistSet:u,onToggle:w,onHover:o})]})}let M;e[13]!==u?(M=g=>u.has(g.modelId),e[13]=u,e[14]=M):M=e[14];const P=f.filter(M),k=P.length>0?P:f,x=Ue(_(k));let S;e[15]!==x||e[16]!==o||e[17]!==l||e[18]!==d?(S=ct.map(g=>s.jsx(Be,{label:Ne(g,d),models:x[g],onSelect:l,onHover:o},g)),e[15]=x,e[16]=o,e[17]=l,e[18]=d,e[19]=S):S=e[19];let C;e[20]!==d?(C=Ne("other",d),e[20]=d,e[21]=C):C=e[21];let E;e[22]!==x.other||e[23]!==o||e[24]!==l||e[25]!==C?(E=s.jsx(Be,{label:C,models:x.other,onSelect:l,onHover:o}),e[22]=x.other,e[23]=o,e[24]=l,e[25]=C,e[26]=E):E=e[26];let v;return e[27]!==S||e[28]!==E?(v=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[S,E]}),e[27]=S,e[28]=E,e[29]=v):v=e[29],v}function Xs(n){return n.asyncResearch!==!0}function Qs(){const n=G.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(te,{className:"size-4 shrink-0"}),s.jsx(te,{className:"flex-1 h-6"}),s.jsx(te,{className:"w-[140px] h-8 shrink-0"})]})}),n[0]=e):e=n[0];let t;n[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(Js)})]}),n[1]=t):t=n[1];let i;n[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(te,{className:"size-6 shrink-0"}),s.jsx(te,{className:"h-6 w-32"})]}),n[2]=i):i=n[2];let o;n[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{className:"h-6 w-20 rounded-md"}),s.jsx(te,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=o):o=n[3];let l;n[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(te,{className:"h-4 w-24"}),s.jsx(te,{className:"h-4 w-32"})]}),n[4]=l):l=n[4];let c;return n[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[o,s.jsxs("div",{className:"flex flex-col gap-4",children:[l,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(te,{className:"h-4 w-16"}),s.jsx(te,{className:"h-4 w-40"})]})]})]})})]}),n[5]=c):c=n[5],c}function Js(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(te,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(te,{className:"flex-1 h-4"}),s.jsx(te,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ht(n){const e=G.c(66),{onClose:t,credentialId:i,onCredentialChange:o,selectedModel:l,onModelChange:c,filterModels:r,compact:h}=n,d=ie(),[a,f]=$.useState(null),[p,u]=$.useState(""),[m,b]=$.useState(!1),N=$.useRef(null),w=_e(),y=Dt();let _;e[0]!==w?.providers?(_=Object.fromEntries((w?.providers??[]).map(ti)),e[0]=w?.providers,e[1]=_):_=e[1];const M=_,P=pt(),{org:k}=ge();let x;e[2]!==o?(x=z=>{o(z),f(null)},e[2]=o,e[3]=x):x=e[3];const S=x;let C;e[4]!==i||e[5]!==t||e[6]!==c?(C=z=>{i&&(c(z),u(""),t())},e[4]=i,e[5]=t,e[6]=c,e[7]=C):C=e[7];const E=C;if(y.length===0){const z=!h&&"sm:w-[740px]";let D;e[8]!==z?(D=re("flex items-center justify-center p-8 w-full",z),e[8]=z,e[9]=D):D=e[9];let W;e[10]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Ss,{}),e[10]=W):W=e[10];let Y;return e[11]!==D?(Y=s.jsx("div",{className:D,children:W}),e[11]=D,e[12]=Y):Y=e[12],Y}const v=h?"sm:h-[420px]":"sm:h-[460px]";let g;e[13]!==v?(g=re("flex flex-col md:flex-row h-full min-h-0",v),e[13]=v,e[14]=g):g=e[14];const j=h?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let I;e[15]!==j?(I=re("flex-1 flex flex-col min-h-0 overflow-hidden",j),e[15]=j,e[16]=I):I=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=L):L=e[17];let A;e[18]!==m||e[19]!==d?(A=d(m?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=m,e[19]=d,e[20]=A):A=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=z=>u(z.target.value),e[21]=O):O=e[21];let T;e[22]!==p||e[23]!==A?(T=s.jsx(xe,{ref:N,type:"text",placeholder:A,value:p,onChange:O,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=A,e[24]=T):T=e[24];let F;e[25]!==i||e[26]!==S||e[27]!==y||e[28]!==M||e[29]!==d?(F=y.length>0&&s.jsxs(Ct,{value:i??"",onValueChange:S,children:[s.jsxs(It,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:ei,children:[s.jsx(Mt,{placeholder:d("chat.decopilot.key"),children:(()=>{const z=y.find(se=>se.id===i),D=z?M[z.providerId]:void 0,W=ye(z?.presetId),Y=W?.logo??D?.logo,ee=W?.name??D?.name??z?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[Y?s.jsx("img",{src:Y,alt:ee,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:ee.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:ee})]})})()}),s.jsx(Lt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(Et,{children:y.map(z=>{const D=M[z.providerId],W=ye(z.presetId),Y=W?.logo??D?.logo,ee=W?.name??D?.name??z.providerId;return s.jsx(Ot,{value:z.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[Y?s.jsx("img",{src:Y,alt:ee,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:ee.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[ee," — ",z.label]})]})},z.id)})})]}),e[25]=i,e[26]=S,e[27]=y,e[28]=M,e[29]=d,e[30]=F):F=e[30];let R;e[31]!==T||e[32]!==F?(R=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[L,T,F]})}),e[31]=T,e[32]=F,e[33]=R):R=e[33];let K;e[34]!==i?(K=z=>{const{error:D,resetError:W}=z;return s.jsx(Us,{error:D,onRetry:W,credentialId:i??void 0})},e[34]=i,e[35]=K):K=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Bs,{}),e[36]=X):X=e[36];const q=i??void 0;let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>b(Zs),e[37]=Q):Q=e[37];let V;e[38]!==r||e[39]!==E||e[40]!==m||e[41]!==p||e[42]!==q?(V=s.jsx($.Suspense,{fallback:X,children:s.jsx(Gs,{keyId:q,searchTerm:p,onHover:f,onModelSelect:E,managing:m,onToggleManage:Q,filterModels:r})}),e[38]=r,e[39]=E,e[40]=m,e[41]=p,e[42]=q,e[43]=V):V=e[43];let Z;e[44]!==i||e[45]!==K||e[46]!==V?(Z=s.jsx(xt,{fallback:K,children:V},i),e[44]=i,e[45]=K,e[46]=V,e[47]=Z):Z=e[47];let U;e[48]!==m||e[49]!==P||e[50]!==k||e[51]!==d?(U=!m&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>$.startTransition(()=>b(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Ft,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>P({to:"/$org/settings/ai-providers",params:{org:k.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(zt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=m,e[49]=P,e[50]=k,e[51]=d,e[52]=U):U=e[52];let B;e[53]!==R||e[54]!==Z||e[55]!==U||e[56]!==I?(B=s.jsxs("div",{className:I,children:[R,Z,U]}),e[53]=R,e[54]=Z,e[55]=U,e[56]=I,e[57]=B):B=e[57];let H;e[58]!==h||e[59]!==a||e[60]!==l?(H=!h&&s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Es,{model:a??l??null})}),e[58]=h,e[59]=a,e[60]=l,e[61]=H):H=e[61];let J;return e[62]!==B||e[63]!==H||e[64]!==g?(J=s.jsxs("div",{className:g,children:[B,H]}),e[62]=B,e[63]=H,e[64]=g,e[65]=J):J=e[65],J}function Zs(n){return!n}function ei(n){return n.stopPropagation()}function ti(n){return[n.id,n]}function si(n){const e=G.c(12),{onClose:t}=n,{credentialId:i,setCredentialId:o,selectedModel:l,setModel:c}=Qe();let r;e[0]!==o?(r=a=>{ne("chat_credential_changed",{credential_id:a}),o(a)},e[0]=o,e[1]=r):r=e[1];let h;e[2]!==i||e[3]!==l?.modelId||e[4]!==c?(h=a=>{i&&(ne("chat_model_changed",{from_model_id:l?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:i}),c({...a,keyId:i}))},e[2]=i,e[3]=l?.modelId,e[4]=c,e[5]=h):h=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==l||e[9]!==r||e[10]!==h?(d=s.jsx(ht,{onClose:t,credentialId:i,onCredentialChange:r,selectedModel:l,onModelChange:h}),e[6]=i,e[7]=t,e[8]=l,e[9]=r,e[10]=h,e[11]=d):d=e[11],d}function ii(n){const e=G.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(si,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ni(n){const e=G.c(2);let t;return e[0]!==n?(t=s.jsx(ht,{...n}),e[0]=n,e[1]=t):t=e[1],t}function li(n){const e=G.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(ii,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function oi(n){const e=G.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let i;return e[2]!==t?(i=s.jsx(ni,{...t}),e[2]=t,e[3]=i):i=e[3],i}function Di(n){const e=G.c(48),{variant:t,className:i,placeholder:o,model:l,isLoading:c,credentialId:r,onCredentialChange:h,onModelChange:d,filterModels:a}=n,f=t===void 0?"borderless":t,p=o===void 0?"Select model":o,u=ie(),[m,b]=$.useState(!1),N=d!==void 0,w=kt(),y=f==="borderless"?"ghost":"outline",_=f==="borderless"&&"md:border-none";let M;e[0]!==i||e[1]!==_?(M=re("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",_,i),e[0]=i,e[1]=_,e[2]=M):M=e[2];let P;e[3]!==c||e[4]!==l||e[5]!==p||e[6]!==N?(P=N?s.jsx(ot,{model:l??null,placeholder:p,isLoading:c}):s.jsx(ai,{placeholder:p}),e[3]=c,e[4]=l,e[5]=p,e[6]=N,e[7]=P):P=e[7];let k;e[8]!==y||e[9]!==M||e[10]!==P?(k=s.jsx(oe,{variant:y,size:"sm",className:M,children:P}),e[8]=y,e[9]=M,e[10]=P,e[11]=k):k=e[11];const x=k;let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Qs,{}),e[12]=S):S=e[12];let C;e[13]!==r||e[14]!==a||e[15]!==l||e[16]!==h||e[17]!==d||e[18]!==N?(C=s.jsx($.Suspense,{fallback:S,children:N?s.jsx(oi,{onClose:()=>b(!1),credentialId:r??null,onCredentialChange:h??ri,selectedModel:l??null,onModelChange:d,filterModels:a}):s.jsx(li,{onClose:()=>b(!1)})}),e[13]=r,e[14]=a,e[15]=l,e[16]=h,e[17]=d,e[18]=N,e[19]=C):C=e[19];const E=C;if(w){let A;e[20]!==x?(A=s.jsx(jt,{asChild:!0,children:x}),e[20]=x,e[21]=A):A=e[21];let O;e[22]!==u?(O=u("chat.selectModel.selectModel"),e[22]=u,e[23]=O):O=e[23];let T;e[24]!==O?(T=s.jsx(St,{className:"sr-only",children:O}),e[24]=O,e[25]=T):T=e[25];let F;e[26]!==E?(F=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:E}),e[26]=E,e[27]=F):F=e[27];let R;e[28]!==T||e[29]!==F?(R=s.jsxs(Nt,{className:"p-0 flex flex-col max-h-[95vh]",children:[T,F]}),e[28]=T,e[29]=F,e[30]=R):R=e[30];let K;return e[31]!==m||e[32]!==A||e[33]!==R?(K=s.jsxs(wt,{open:m,onOpenChange:b,children:[A,R]}),e[31]=m,e[32]=A,e[33]=R,e[34]=K):K=e[34],K}let v;e[35]!==x?(v=s.jsx(yt,{asChild:!0,children:x}),e[35]=x,e[36]=v):v=e[36];let g;e[37]!==u?(g=u("chat.selectModel.selectModel"),e[37]=u,e[38]=g):g=e[38];let j;e[39]!==g?(j=s.jsx(Xe,{className:"sr-only",children:g}),e[39]=g,e[40]=j):j=e[40];let I;e[41]!==E||e[42]!==j?(I=s.jsxs(Ge,{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:[j,E]}),e[41]=E,e[42]=j,e[43]=I):I=e[43];let L;return e[44]!==m||e[45]!==v||e[46]!==I?(L=s.jsxs(Ye,{open:m,onOpenChange:b,children:[v,I]}),e[44]=m,e[45]=v,e[46]=I,e[47]=L):L=e[47],L}function ri(){}function ai(n){const e=G.c(4),{placeholder:t}=n,{selectedModel:i,isModelsLoading:o}=Qe();let l;return e[0]!==o||e[1]!==i||e[2]!==t?(l=s.jsx(ot,{model:i,placeholder:t,isLoading:o}),e[0]=o,e[1]=i,e[2]=t,e[3]=l):l=e[3],l}export{vs as C,oi as M,Ss as N,lt as P,Qs as a,Fi as b,Di as c,ye as d,Ki as g,Ri as i,Me as m};
|