decocms 4.329.5 → 4.329.6
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-mN_-o_mQ.js → AlertCircle-DA1cEHVG.js} +1 -1
- package/dist/client/assets/{AreaChart-Bvt1hsm0.js → AreaChart-CXRdv0xx.js} +1 -1
- package/dist/client/assets/{ArrowLeft-TOd2y5eQ.js → ArrowLeft-Br9KqDZP.js} +1 -1
- package/dist/client/assets/{ArrowUp-D9BmQW3y.js → ArrowUp-TsmTWJjN.js} +1 -1
- package/dist/client/assets/{Check-DHPj8hLS.js → Check-grvRnT6d.js} +1 -1
- package/dist/client/assets/{CheckCircle-Bape6EQJ.js → CheckCircle-W70-Hp-u.js} +1 -1
- package/dist/client/assets/{ChevronRight-CNf6Y7s8.js → ChevronRight-gw9dm0MJ.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-BGG06THN.js → ChevronSelectorVertical-CZ_XnnrO.js} +1 -1
- package/dist/client/assets/{ChevronUp-DhEp0EVP.js → ChevronUp-DbYyUJ2c.js} +1 -1
- package/dist/client/assets/{Copy01-BM0WPlp9.js → Copy01-DC15dYeZ.js} +1 -1
- package/dist/client/assets/{CreditCard01-BcxIFS9C.js → CreditCard01-BQ448v1L.js} +1 -1
- package/dist/client/assets/{DotsVertical-Bbr6RMTH.js → DotsVertical-DuImY45F.js} +1 -1
- package/dist/client/assets/{Download01-BP8_5nMI.js → Download01-C92aqGYG.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-D1mkTlU7.js → ErrorBarContext-VF7KGcUm.js} +1 -1
- package/dist/client/assets/{Eye-B0Pd_ezn.js → Eye-BHvUcvRj.js} +1 -1
- package/dist/client/assets/{GitBranch01-ITA5wAsb.js → GitBranch01-5KhVbuOf.js} +1 -1
- package/dist/client/assets/{Globe01-CxD9oJyC.js → Globe01-B1lfl4nW.js} +1 -1
- package/dist/client/assets/{HardDrive-Bx3SgLl5.js → HardDrive-Bl2sm0P3.js} +1 -1
- package/dist/client/assets/{Image01-DkeWoTxv.js → Image01-BmysQdds.js} +1 -1
- package/dist/client/assets/{Key01-3XmA_FLZ.js → Key01-BHRixQVB.js} +1 -1
- package/dist/client/assets/{Link01-DBqTW3qG.js → Link01-pXyMJR2J.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CDbttyHT.js → LinkExternal01-CqwZLC94.js} +1 -1
- package/dist/client/assets/{Monitor01-DxoPQwl_.js → Monitor01-VQD1wr6O.js} +1 -1
- package/dist/client/assets/{Package-BmmKpgLP.js → Package-D8xZrFk4.js} +1 -1
- package/dist/client/assets/{Palette-PDnTmDZk.js → Palette-Bo_A8ldC.js} +1 -1
- package/dist/client/assets/{Play-67XUCyKd.js → Play-CyYcbqou.js} +1 -1
- package/dist/client/assets/{Plus-BiE4uFsT.js → Plus-BIAtk7db.js} +1 -1
- package/dist/client/assets/{SearchMd-D9B5PGY2.js → SearchMd-D6yqdaba.js} +1 -1
- package/dist/client/assets/{Sector-Bx8Rm7Bx.js → Sector-CsxyX7hI.js} +1 -1
- package/dist/client/assets/{Settings02-D20k8vab.js → Settings02-Dmn9Uagb.js} +1 -1
- package/dist/client/assets/{Share07-mTYGTjnX.js → Share07-BUu5_15N.js} +1 -1
- package/dist/client/assets/{Shield01-Dh1KVvty.js → Shield01-B9JGpaTp.js} +1 -1
- package/dist/client/assets/{Stars01-PXW__m1z.js → Stars01-CWhfbfaB.js} +1 -1
- package/dist/client/assets/{Sun-CPXNGo67.js → Sun-DWLAV3m1.js} +1 -1
- package/dist/client/assets/{Tool01-DO3tFwrT.js → Tool01-Cy0ZGCil.js} +1 -1
- package/dist/client/assets/{Tool02-BsbxtGm_.js → Tool02-CSZTEjDX.js} +1 -1
- package/dist/client/assets/{Trash01-Dp51yqnn.js → Trash01-D1GpJcjK.js} +1 -1
- package/dist/client/assets/{TrendUp01-B5AMHutg.js → TrendUp01-CYPVBoFc.js} +1 -1
- package/dist/client/assets/{Upload01-BNUtlGr4.js → Upload01-BCzsausn.js} +1 -1
- package/dist/client/assets/{User01-Ct3vu-8e.js → User01-DpOHQvBN.js} +1 -1
- package/dist/client/assets/{UserSquare-BMU7ptkw.js → UserSquare-BncQsikh.js} +1 -1
- package/dist/client/assets/{Users01-BiGPt9OV.js → Users01-Di41qDP0.js} +1 -1
- package/dist/client/assets/{Users03-CtT9PMQy.js → Users03-DTortZ69.js} +1 -1
- package/dist/client/assets/{XCircle-CPujy2uw.js → XCircle-waBvJxuW.js} +1 -1
- package/dist/client/assets/{XClose-ydonzdQx.js → XClose-D87Tx9wT.js} +1 -1
- package/dist/client/assets/{Zap-Cff3TLsZ.js → Zap-Bz0lnET7.js} +1 -1
- package/dist/client/assets/{ZoomOut-Cyr7GMp8.js → ZoomOut-NYNe_Z4v.js} +1 -1
- package/dist/client/assets/{access-gate-CxbXElgc.js → access-gate-CrQA8sIX.js} +1 -1
- package/dist/client/assets/{agent-icon-D0nFNhxK.js → agent-icon-CUm4oB7y.js} +1 -1
- package/dist/client/assets/{agents-list-CWgCuNdA.js → agents-list-dztbB-Cw.js} +1 -1
- package/dist/client/assets/{ai-providers-B_1c2MUZ.js → ai-providers-B_bOEKQb.js} +1 -1
- package/dist/client/assets/{alert-DXRS4LlD.js → alert-6mjnov6H.js} +1 -1
- package/dist/client/assets/{alert-dialog-P0CuRl4b.js → alert-dialog-C51iVTPN.js} +1 -1
- package/dist/client/assets/{analytics-tab-C8Ml9hnf.js → analytics-tab-BncFpj4z.js} +1 -1
- package/dist/client/assets/{api-keys-BlbK2ztb.js → api-keys-BAAWPoda.js} +1 -1
- package/dist/client/assets/api-keys-HdPFDyhU.js +1 -0
- package/dist/client/assets/{app-editor-DNnqs-BT.js → app-editor-DR0tLRro.js} +1 -1
- package/dist/client/assets/{auth-BVp2xy53.js → auth-Bbv_i1Jo.js} +1 -1
- package/dist/client/assets/{auth-catchall-DNlKODhS.js → auth-catchall-C4qKgNYY.js} +1 -1
- package/dist/client/assets/{auth-entry-DBaEHAB5.js → auth-entry-DRIlfsP_.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BhgIfBec.js → auth-split-layout-CC36faDL.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BAd7rGHc.js → authenticate-and-persist-oauth-sBYdDIRi.js} +1 -1
- package/dist/client/assets/{automation-list-row-DlvHKPyj.js → automation-list-row-Hqe9OUun.js} +1 -1
- package/dist/client/assets/{automation-runs-CCVcrtR2.js → automation-runs-DLjirUtq.js} +1 -1
- package/dist/client/assets/automations-BDc7sMoE.js +1 -0
- package/dist/client/assets/{avatar-b8hndRPx.js → avatar-Cqr4rNtI.js} +1 -1
- package/dist/client/assets/{badge-BStsm_lg.js → badge-CdD_S6_J.js} +1 -1
- package/dist/client/assets/{block-document-CgPj5a7q.js → block-document-CwU9JWtH.js} +1 -1
- package/dist/client/assets/{breadcrumb-Bcg6Ab2L.js → breadcrumb-CGLwazRA.js} +1 -1
- package/dist/client/assets/{buckets-C0rDB5Al.js → buckets-CJn89MHy.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DN63hkby.js → bulk-category-panel-3QzafbMh.js} +1 -1
- package/dist/client/assets/{capability-load-error-DJ7cUT9Z.js → capability-load-error-DXzCDpxj.js} +1 -1
- package/dist/client/assets/{cards-DaQEzixK.js → cards-De2Tofte.js} +1 -1
- package/dist/client/assets/{category-editor-vpz2dWAT.js → category-editor-COqxAE1f.js} +1 -1
- package/dist/client/assets/{cdn-tab-BbmlviYg.js → cdn-tab-D_pbGC7l.js} +1 -1
- package/dist/client/assets/{chart-DHv_Afvm.js → chart-7R5tmwSB.js} +1 -1
- package/dist/client/assets/{chat-context-CsVVImtr.js → chat-context-CTC6stWi.js} +1 -1
- package/dist/client/assets/{checkbox-BSJHTjoV.js → checkbox-DtN6Dr54.js} +1 -1
- package/dist/client/assets/{choose-editor-CJmqYzFT.js → choose-editor-Blhw32Ri.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BsTXHwdh.js → cli-auth-success-CeAzdEYA.js} +1 -1
- package/dist/client/assets/{client-icons-Dbh16KTh.js → client-icons-C1w3IsHJ.js} +1 -1
- package/dist/client/assets/{collection-detail-YcEc9PSs.js → collection-detail-BFl9ZukZ.js} +1 -1
- package/dist/client/assets/{collection-display-button-Dlv2uRSO.js → collection-display-button-Bzjk0jzF.js} +1 -1
- package/dist/client/assets/{collection-search-Nx8I1VWD.js → collection-search-CO09NGkg.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DEUvwrm7.js → collection-table-wrapper-eg9oZGZn.js} +1 -1
- package/dist/client/assets/{collection-tabs-DkuVrlwj.js → collection-tabs-cr1701fJ.js} +1 -1
- package/dist/client/assets/{command-BQZNWnLl.js → command-A0s0uPHt.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-D2RPtK_d.js → commerce-onboarding-DtsFghjm.js} +1 -1
- package/dist/client/assets/{connect-CqMi0Kj6.js → connect-DrXaw1w8.js} +1 -1
- package/dist/client/assets/{connect-layout-LGbISPTt.js → connect-layout-CrHWsBPn.js} +1 -1
- package/dist/client/assets/{connection-BKjGbuRp.js → connection-DFFOswZj.js} +1 -1
- package/dist/client/assets/{connection-card-CUDq88xM.js → connection-card-TaYo6pYl.js} +1 -1
- package/dist/client/assets/{connection-detail-PQGXGzTQ.js → connection-detail-BFvYx2p3.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-j54kv39E.js → connection-form-helpers-CoIQo1Gb.js} +1 -1
- package/dist/client/assets/{connections-BIa_J0_x.js → connections-DW0Ud7Ns.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-C0dAeHRr.js → create-organization-dialog-CY527eHC.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BJt1WWih.js → decopilot-sse-pool-DU0j98RE.js} +1 -1
- package/dist/client/assets/{dialog-CwR2ZkB1.js → dialog-1xIvEVWS.js} +1 -1
- package/dist/client/assets/{domain-settings-Ck9aohMU.js → domain-settings-CiOIlCwE.js} +1 -1
- package/dist/client/assets/{download-app-dialog-BSTfXNDN.js → download-app-dialog-CsPmnO0q.js} +1 -1
- package/dist/client/assets/{drawer-C4eE6wVo.js → drawer-C-pTdfTV.js} +1 -1
- package/dist/client/assets/{dropdown-menu-D1Dyu0Ie.js → dropdown-menu-Dm9zz_PI.js} +1 -1
- package/dist/client/assets/{e2e-tab-BKa3vgG1.js → e2e-tab-DAWapk18.js} +1 -1
- package/dist/client/assets/{editor-X_GwLxUe.js → editor-DuZZHVnS.js} +1 -1
- package/dist/client/assets/{empty-state-DweMZJTW.js → empty-state-CaQCn5yY.js} +1 -1
- package/dist/client/assets/{empty-state-BObNah86.js → empty-state-Z33ir3je.js} +1 -1
- package/dist/client/assets/{extract-connection-data-TVNJHOmc.js → extract-connection-data-C44EqyQK.js} +1 -1
- package/dist/client/assets/{file-explorer-BVlXTJHP.js → file-explorer-DQ8njhcM.js} +1 -1
- package/dist/client/assets/{file-type-icon-DFeVbUcK.js → file-type-icon-Dl9zrC0W.js} +1 -1
- package/dist/client/assets/{folder-icon-fliliFSE.js → folder-icon-DXofXja-.js} +1 -1
- package/dist/client/assets/{form-R-ND42yQ.js → form-DLHM0IAy.js} +1 -1
- package/dist/client/assets/{general-CbsMwCUF.js → general-D6rHAjlN.js} +1 -1
- package/dist/client/assets/{github-repo-picker-VVXQm56m.js → github-repo-picker-BIbCpUFZ.js} +1 -1
- package/dist/client/assets/{hooks-Chtya12g.js → hooks-Cv_l36vR.js} +1 -1
- package/dist/client/assets/{hosting-tab-yCo5MFnA.js → hosting-tab-DtuFDGvE.js} +1 -1
- package/dist/client/assets/{index-F3C6ps0B.js → index-BVvpVlYL.js} +1 -1
- package/dist/client/assets/{index-BPoFiAxf.js → index-BkljfHxy.js} +2 -2
- package/dist/client/assets/{index-T5aBTzrV.js → index-CRSJpMzc.js} +1 -1
- package/dist/client/assets/{index-EMRlgytw.js → index-CUyq5xp-.js} +1 -1
- package/dist/client/assets/{index-C9r1r2iD.js → index-Dh_lhfEM.js} +1 -1
- package/dist/client/assets/{index-C-iRRri3.js → index-Dm5mbx-j.js} +1 -1
- package/dist/client/assets/{index-B4S5w1-x.js → index-Dmu_jFDN.js} +1 -1
- package/dist/client/assets/{index-DFO8Hy2x.js → index-TRl02mXS.js} +6 -6
- package/dist/client/assets/{index-CZG_2YcM.js → index-fcQmErZ3.js} +1 -1
- package/dist/client/assets/{index-94aQRAaT.js → index-ldx_aeXw.js} +1 -1
- package/dist/client/assets/{index-redirect-wsAas5g2.js → index-redirect-B4WcqrST.js} +1 -1
- package/dist/client/assets/{infra-billing-DmphYAUU.js → infra-billing-CT4isBll.js} +1 -1
- package/dist/client/assets/{input-LsHd3z5Z.js → input-CYJ7J22n.js} +1 -1
- package/dist/client/assets/{integration-icon-BukX17Ja.js → integration-icon-kfJeGcu4.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-CnDi6qyS.js → invite-member-dialog-CcDGSu2c.js} +1 -1
- package/dist/client/assets/{label-fGGyQxp5.js → label-BSeVlzkX.js} +1 -1
- package/dist/client/assets/{layout-CHbCwmYb.js → layout--aonA48-.js} +1 -1
- package/dist/client/assets/{login-C8TvcwaD.js → login-DbVueJaI.js} +1 -1
- package/dist/client/assets/{markdown-BKbOmMip.js → markdown-D7QuNT69.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DTP_bedh.js → mcp-oauth-dGHhlLy0.js} +1 -1
- package/dist/client/assets/{members-m278wo7-.js → members-Bf8lcWZe.js} +1 -1
- package/dist/client/assets/{monaco-editor-BpbvUJwi.js → monaco-editor-CC-Sqg8F.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BIfVwwYm.js → monitoring-stats-row-vacc3BYl.js} +1 -1
- package/dist/client/assets/{multi-select-BGEhYv6Q.js → multi-select-nRNpGGJY.js} +1 -1
- package/dist/client/assets/{oauth-callback-DNm5e3t4.js → oauth-callback-Ce0X_vqm.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C6wR7YHk.js → oauth-callback-ai-provider-BdyUwN3J.js} +1 -1
- package/dist/client/assets/{onboarding-D7MAN9sh.js → onboarding-SmWY9lBA.js} +1 -1
- package/dist/client/assets/org-layout-D0H1iAiF.js +1 -0
- package/dist/client/assets/{organization-choice-yFaS2KYn.js → organization-choice-C49clKoP.js} +1 -1
- package/dist/client/assets/{orgs-GzeWzw6o.js → orgs-CAjirR3W.js} +1 -1
- package/dist/client/assets/{page-seo-form-BlVNkW7I.js → page-seo-form-BGqqc2Gj.js} +1 -1
- package/dist/client/assets/{popover-Q1deFKgp.js → popover-mZ_x_ILZ.js} +1 -1
- package/dist/client/assets/{post-calendar-B09pnMW9.js → post-calendar-DM4--jD1.js} +1 -1
- package/dist/client/assets/{post-editor-DH3cc2rR.js → post-editor-GHkZtflO.js} +1 -1
- package/dist/client/assets/{primitives-0K9NGeUu.js → primitives-Bp0pnH9F.js} +1 -1
- package/dist/client/assets/{profile-BpvIbEub.js → profile-Dvj2Ky_G.js} +1 -1
- package/dist/client/assets/{project-app-view-BW8nEgoK.js → project-app-view-C5a0S8VK.js} +1 -1
- package/dist/client/assets/{project-icon-CW7lG0f-.js → project-icon-BBqdk5OE.js} +1 -1
- package/dist/client/assets/{prompts-BJn-p95i.js → prompts-Dr4JAnH0.js} +1 -1
- package/dist/client/assets/record-editor-2DwNqvUy.js +1 -0
- package/dist/client/assets/{redirect-editor-BI-Kllix.js → redirect-editor-Bat0o4y3.js} +1 -1
- package/dist/client/assets/registry--J_j_Iy0.js +2 -0
- package/dist/client/assets/{registry-layout-BP7gmPI-.js → registry-layout-DIey2mbB.js} +1 -1
- package/dist/client/assets/{reports-CAV2Cslk.js → reports-Bev3cmDf.js} +1 -1
- package/dist/client/assets/{require-capability-C5rDfjFm.js → require-capability-DOJ4tTFn.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Geu1OAEe.js → required-auth-layout-B2tIP5k3.js} +1 -1
- package/dist/client/assets/{reset-password-DUIDurfe.js → reset-password-C4gYW7se.js} +1 -1
- package/dist/client/assets/{review-settings-CsiIDmFA.js → review-settings-BOZEVIl7.js} +1 -1
- package/dist/client/assets/{roles-BAD7kH_t.js → roles-cRWL1Za5.js} +1 -1
- package/dist/client/assets/{schema-D2aEo9_j.js → schema-BgSBbsw7.js} +1 -1
- package/dist/client/assets/{scroll-area-D_zmdKz7.js → scroll-area-0nfzfnAs.js} +1 -1
- package/dist/client/assets/{search-input-BizsLhvX.js → search-input-CIki-uxf.js} +1 -1
- package/dist/client/assets/{secrets-G0v2X3oa.js → secrets-D2e6phy9.js} +1 -1
- package/dist/client/assets/{sections-editor-CWq03Vnp.js → sections-editor-D-QRzAnK.js} +1 -1
- package/dist/client/assets/{select-BPlqzUpB.js → select-DqJyZyIQ.js} +1 -1
- package/dist/client/assets/{select-model-D5-IXAsH.js → select-model-BsGv2vyu.js} +1 -1
- package/dist/client/assets/{self-tool-result-CTIc9xGS.js → self-tool-result-BoZ6MFRP.js} +1 -1
- package/dist/client/assets/{seo-editor-O_gPOD8y.js → seo-editor-g6APT0uI.js} +1 -1
- package/dist/client/assets/settings-layout-CkbSimBL.js +1 -0
- package/dist/client/assets/{settings-sidebar-B8AwNjia.js → settings-sidebar-jSd5MSjq.js} +1 -1
- package/dist/client/assets/{shell-controls-DnZgBbdN.js → shell-controls-C4MO7deC.js} +1 -1
- package/dist/client/assets/{shell-layout-OBmJcmOt.js → shell-layout-tPdz54xh.js} +1 -1
- package/dist/client/assets/{skill-preview-mwAW0EFc.js → skill-preview-C-lpKGFK.js} +1 -1
- package/dist/client/assets/{skills-B4jG1i-v.js → skills-C_OSw6ZN.js} +1 -1
- package/dist/client/assets/{sso-DEIlxpGO.js → sso-BsFPpeYe.js} +1 -1
- package/dist/client/assets/{store-dJDoMR5j.js → store-qwASLyWC.js} +1 -1
- package/dist/client/assets/store-registry-cT643_3i.js +2 -0
- package/dist/client/assets/{switch-DbWQok_U.js → switch-CZqeYbje.js} +1 -1
- package/dist/client/assets/{synced-repos-BN345C03.js → synced-repos-ByBUacaY.js} +1 -1
- package/dist/client/assets/{table-DOif7xTO.js → table-DbdXafHS.js} +1 -1
- package/dist/client/assets/{tabs-B_MhFzq8.js → tabs-C9EAqZz9.js} +1 -1
- package/dist/client/assets/{task-board-CcPCmS8T.js → task-board-7HRng9a2.js} +1 -1
- package/dist/client/assets/{task-route-C4sr5u2Y.js → task-route-_ESOOTZi.js} +1 -1
- package/dist/client/assets/{tasks-DUn9MzS1.js → tasks-CxA4gPZJ.js} +1 -1
- package/dist/client/assets/{textarea-Cg093qVK.js → textarea-90AQXVh4.js} +1 -1
- package/dist/client/assets/{toggle-group-DR2FN9bK.js → toggle-group-Diuss92s.js} +1 -1
- package/dist/client/assets/{toolbar-BMJtXOZ8.js → toolbar-BWOWuYdi.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-j89gz31d.js → toolbar-icon-button-DnenepzG.js} +1 -1
- package/dist/client/assets/{track-CEYIUg92.js → track-Qcawd54k.js} +1 -1
- package/dist/client/assets/{types-CvaupNP5.js → types-B-HpXlbf.js} +1 -1
- package/dist/client/assets/{use-ai-providers-qSmDdlV5.js → use-ai-providers-CWtvyrT-.js} +1 -1
- package/dist/client/assets/{use-automations-BHUwCHCu.js → use-automations-D9Y9jZ0Z.js} +1 -1
- package/dist/client/assets/{use-autosave-B6xJm16y.js → use-autosave-DIT9IDbg.js} +1 -1
- package/dist/client/assets/{use-connection-DssDxszT.js → use-connection-Uyph_H8d.js} +1 -1
- package/dist/client/assets/{use-copy-DElZsO5o.js → use-copy-Cuzq782M.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-fX5KRaaa.js → use-create-virtual-mcp-D24xpy0o.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-MHpLopBx.js → use-debounced-autosave-DS1yKwxh.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CfUze3fk.js → use-debounced-value-DJ0hN8gB.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-BCTeDl9d.js → use-decopilot-events-Cm5dzSwF.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CjblC6Ap.js → use-delete-connection-BKcL-J29.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-i2vFl9gf.js → use-deployment-admin-BE2hLNuR.js} +1 -1
- package/dist/client/assets/{use-destination-route-BnzyxZK-.js → use-destination-route-DLsn9uXe.js} +1 -1
- package/dist/client/assets/{use-file-configs-DbhqGRsz.js → use-file-configs-CHDaFO85.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll--JAy1jrF.js → use-infinite-scroll-Bj-_fMYw.js} +1 -1
- package/dist/client/assets/{use-join-requests-BmM24zP-.js → use-join-requests-Cu_2S_W2.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-BWBUcCX_.js → use-mcp-auth-status-HMnG1EUf.js} +1 -1
- package/dist/client/assets/{use-mcp-client-r4Xv9xDe.js → use-mcp-client-Deaem8WO.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BDT2dqpH.js → use-mcp-prompts-C5IrmXgS.js} +1 -1
- package/dist/client/assets/{use-members-BB0dVjBb.js → use-members-Cv__v2oz.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BAFEWvwz.js → use-navigate-to-agent-B-P_VAZF.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BhrDbDSV.js → use-org-auth-client-DWweu3ja.js} +1 -1
- package/dist/client/assets/{use-org-sso-CxgCZrTk.js → use-org-sso-CMfMnqpv.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CDQDzA2S.js → use-organization-roles-BQmWc6DN.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BZpxVSP5.js → use-organization-settings-CwdP6bUS.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-Bqzu-m4-.js → use-panel-navigate-BRmpjsHj.js} +1 -1
- package/dist/client/assets/{use-registry-connections-BZ-aHAcc.js → use-registry-connections-CU4AWQn4.js} +1 -1
- package/dist/client/assets/{use-secrets-Bh_QiR6h.js → use-secrets--00GbFn8.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-D_r7iT64.js → use-section-preview-base-CTx7wzR-.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CNPhXYst.js → use-status-sounds-CkzzANKj.js} +1 -1
- package/dist/client/assets/{use-tags-CQrzK6kW.js → use-tags-k_sYBsNz.js} +1 -1
- package/dist/client/assets/{use-view-mode-PLD7Z8Gt.js → use-view-mode-3y5HyEBP.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-zpAtwz7v.js → use-virtual-mcp-12aBqy7V.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DiQVH8QR.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-BMUPA2Dd.js +1 -0
- package/dist/client/assets/{users-BZQPvMd3.js → users-DjB8KCBh.js} +1 -1
- package/dist/client/assets/{variant-calendar-BGv44m4Q.js → variant-calendar-DaQkdUZ_.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CC6x-V9J.js → view-mode-toggle-WcHFJdKB.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/api-keys-CwBd9UBU.js +0 -1
- package/dist/client/assets/automations-D0z1_feX.js +0 -1
- package/dist/client/assets/org-layout-D5JilW3M.js +0 -1
- package/dist/client/assets/record-editor-DNyePUjb.js +0 -1
- package/dist/client/assets/registry-Ft8pANng.js +0 -2
- package/dist/client/assets/settings-layout-CB8wJ9KB.js +0 -1
- package/dist/client/assets/store-registry-oLwveuwU.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BkZl1y7Z.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-w4-apbuy.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-
|
|
2
|
-
import{n as Ms,r as A,ac as PC,ad as EC,ae as Dt,af as ns,ag as Re,ah as ar,ai,aj as Th,ak as gu,al as RC,am as wi,an as DC,ao as Vy,c as U,W as Fe,l as ae,j as o,E as rn,b as ce,t as xe,a3 as Fo,I as Hl,h as st,a1 as He,a2 as Ke,a4 as We,ap as Ws,J as Vf,z as Gc,B as fe,aq as a2,ar as Ty,v as fr,as as vs,at as xl,au as _x,d as ln,a7 as ys,e as Rs,o as qe,av as MC,C as Qo,aw as IC,ax as Ay,ay as OC,az as Ji,aA as Z9,aB as qn,aC as $C,aD as e1,aE as BC,aF as zC,aG as FC,aH as UC,aI as c2,aJ as d2,aK as Py,aL as u2,x as Tf,K as it,aM as HC,aN as KC,aO as WC,aP as Ey,aQ as Qd,m as Qt,a as Pn,Y as ki,aR as xu,k as qC,u as Zo,f as el,H as h2,aS as GC,aT as Lx,aU as fm,aa as Ry,a9 as Sx,aV as Dy,aW as My,aX as Iy,aY as YC,aZ as JC,L as Ao,a_ as Oy,a$ as XC,b0 as QC,b1 as ZC,b2 as Ah,b3 as bl,b4 as nn,b5 as $y,b6 as By,b7 as $n,P as On,ab as zy,b8 as eN,b9 as Et,ba as Fy,bb as Uy,bc as Hy,bd as Ky,be as Wy,bf as qy,bg as tN,bh as sN,bi as nN,bj as iN,bk as Gy,bl as Ys,N as si,bm as Yy,bn as rN,bo as oN,bp as Jy,bq as lN,br as aN,bs as cN,bt as dN,bu as mm,bv as Sl,bw as Xy,bx as uN,by as hN,bz as fN,bA as mN,bB as pN,bC as gN,bD as xN,bE as bN,bF as vN,bG as yN}from"./index-BPoFiAxf.js";import{i as Af,n as _N}from"./ArrowUp-D9BmQW3y.js";import{u as Kl,a as ci,b as _s,r as Qy,d as f2,c as m2,p as LN,e as an,f as Zy,s as SN,g as wN,h as kN,i as jN,j as CN,k as NN,l as VN,m as p2,n as e6,T as TN,A as AN,o as PN,q as EN,t as RN,v as DN,w as MN,x as IN,y as ON,z as $N}from"./chat-context-CsVVImtr.js";import{c as g2,s as $u,g as $r,P as Ph,d as x2,t as Eh,a as BN,M as zN,i as FN,b as ji,e as Yc,f as UN,D as HN,h as KN,j as WN,k as Rc,l as qN,m as GN,u as Pf,E as YN,n as Bu,o as JN,F as XN,p as Ef,q as Rf,r as t6,S as QN,v as ZN,w as eV,x as tV,y as wx,z as sV,A as s6,O as nV,B as kx,C as Qi,G as iV,T as Mr,H as rV,I as rr,J as Po,K as pm,L as gm,N as n6,Q as oV,R as i6,U as lV,V as di,W as aV,X as cV,Y as r6,Z as Nr,_ as dV,$ as uV,a0 as o6,a1 as fl,a2 as jx,a3 as hV,a4 as fV,a5 as Cx,a6 as mV,a7 as bu,a8 as Wl,a9 as cr,aa as Rh,ab as b2,ac as v2,ad as pV,ae as gV,af as xV,ag as bV,ah as vV,ai as yV,aj as _V,ak as Df,al as l6,am as a6,an as c6,ao as LV,ap as d6,aq as SV,ar as wV,as as kV,at as jV,au as zu,av as CV,aw as NV,ax as VV,ay as TV}from"./automation-runs-CCVcrtR2.js";import{c as ms,d as Gt,b as Ft,D as Ut,h as Tn,e as Yn,i as AV}from"./dialog-CwR2ZkB1.js";import{c as PV,b as y2,a as _2,D as L2,d as EV}from"./drawer-C4eE6wVo.js";import{C as RV}from"./collection-search-Nx8I1VWD.js";import{u as $s,a as DV}from"./use-mcp-client-r4Xv9xDe.js";import{a as ql,i as xm,S as Jc,b as MV,g as Dh,c as u6,R as IV,d as OV,W as $d,C as $V}from"./constants-DNuUCxmW.js";import{u as h6,g as Mf,l as bm}from"./use-mcp-prompts-BDT2dqpH.js";import{t as Ls,n as f6}from"./ChevronUp-DhEp0EVP.js";import{t as BV,z as zV,a as Fu,w as FV,A as UV,b as S2,c as HV,d as w2,e as If,f as Of,u as m6,r as KV,g as WV}from"./hooks-Chtya12g.js";import{K as qV,a as p6,i as k2,r as GV,s as g6,u as Gl,o as YV,b as x6,f as JV}from"./shell-layout-OBmJcmOt.js";import{u as Vs,a as Xc,b as b6,c as XV,d as QV}from"./use-virtual-mcp-zpAtwz7v.js";import{a as v6,b as j2,d as Yl,c as $f,e as y6,f as _6,g as C2,u as L6,h as ZV,i as eT,j as N2,k as tT,l as sT,n as nT,s as S6,o as iT,p as rT,m as V2,q as oT,r as Dc,t as T2,v as t1,w as Nx,x as w6,y as s1,z as lT,A as aT}from"./use-navigate-to-agent-BAFEWvwz.js";import{i as mr,a as cT}from"./XCircle-CPujy2uw.js";import{t as Bf,l as k6,m as A2,j as tl,o as j6,p as C6,q as N6,A as Ur,r as V6,u as Mc,s as Hr,v as T6,w as Qc,x as dT,y as uT,c as A6,z as Mh,B as zf,g as vm,k as P6,C as hT,D as fT,h as E6,E as Ff,F as Jl,G as mT,H as P2,I as R6,J as D6,K as ym,L as n1,M as Vx,N as Uf,O as pT,P as gT,Q as xT,R as bT,S as vT,f as E2,T as R2,U as M6,V as I6,W as O6,X as $6,Y as yT,Z as D2,_ as _T,$ as Ci,a0 as Tx,a1 as LT,a2 as ST,d as B6,a3 as M2,a4 as Zc,a5 as Br,a6 as I2,a7 as Uu,a8 as wT,i as Hf,a9 as kT,aa as O2,ab as jT,ac as CT,ad as NT,ae as VT,af as TT,ag as AT,ah as Mo,ai as Ax,aj as z6,ak as PT,al as ET,am as Vl,an as Px,ao as RT,ap as DT,aq as MT,ar as F6,as as IT,at as U6,au as OT,av as $T,aw as BT,ax as zT,ay as Zd,az as FT,aA as UT,aB as H6,aC as $2,aD as HT,aE as KT,n as WT,aF as qT,aG as GT}from"./agent-icon-D0nFNhxK.js";import{i as zt}from"./Check-DHPj8hLS.js";import{a as li}from"./Image01-DkeWoTxv.js";import{i as Jn}from"./Upload01-BNUtlGr4.js";import{i as yn}from"./AlertCircle-mN_-o_mQ.js";import{a as vn}from"./Copy01-BM0WPlp9.js";import{F as _m,a as B2,b as z2,c as F2,d as K6}from"./form-R-ND42yQ.js";import{d as Ot,S as ks,a as js,b as Ds,c as Cs}from"./select-BPlqzUpB.js";import{i as Kf}from"./ArrowLeft-TOd2y5eQ.js";import{T as wl,a as Xl,b as ni,c as ed}from"./tabs-B_MhFzq8.js";import{t as Lm,i as U2}from"./Tool02-BsbxtGm_.js";import{T as Wf,a as Ic}from"./toggle-group-DR2FN9bK.js";import{I as kt}from"./input-LsHd3z5Z.js";import{u as H2,A as W6,l as YT,b as q6,m as JT,n as XT,o as QT,q as G6,a as ZT,e as Sm,r as wm,p as eA,v as tA,s as sA,w as nA,x as iA,y as rA,z as oA,B as Ex,C as lA,D as aA,E as Rx,F as cA,S as or,G as dA,H as uA,I as hA,h as fA,c as K2,J as Uo,K as fn,T as Gn,t as W2,L as q2,f as km,M as Y6,N as Hu,O as G2,Q as Ku,R as mA,U as J6,V as jm,W as X6,X as pA,Y as gA,Z as xA,_ as bA,$ as vA,a0 as yA,a1 as _A,a2 as LA,a3 as SA,a4 as wA,a5 as Q6,a6 as kA,i as jA,g as CA,a7 as NA,a8 as VA,a9 as TA,aa as Cm,ab as Dx,ac as AA,ad as PA,ae as EA,af as RA,ag as DA,ah as qf,ai as MA,aj as IA}from"./task-route-C4sr5u2Y.js";import{s as Ni,i as Y2,c as Z6}from"./XClose-ydonzdQx.js";import{M as OA,a as $A,m as Gf,i as BA,g as e8,b as zA,N as FA,c as UA}from"./select-model-D5-IXAsH.js";import{a as ds,b as hs,P as fs,c as HA}from"./popover-Q1deFKgp.js";import{t as zr}from"./Stars01-PXW__m1z.js";import{b as KA,a as t8,u as Yf,c as s8,d as WA}from"./use-organization-settings-BZpxVSP5.js";import{u as Jf,a as qA}from"./use-ai-providers-qSmDdlV5.js";import{g as n8,c as i8,u as td,b as bn,L as Xf,P as r8,s as o8,a as GA,f as YA,d as JA}from"./project-icon-CW7lG0f-.js";import{f as XA,a as QA,u as vu,b as Wu,c as l8,d as ZA,e as J2,g as a8,h as X2,i as eP,j as Q2,k as yu,l as c8,m as tP,n as d8,o as sP}from"./folder-icon-fliliFSE.js";import{c as Ht,D as Kt,b as Wt,a as Ze,d as Zi,e as er,f as tr,g as Ih,h as Io,i as jc,j as yd}from"./dropdown-menu-D1Dyu0Ie.js";import{i as Z2}from"./Link01-DBqTW3qG.js";import{s as Yt}from"./Plus-BiE4uFsT.js";import{p as nP,q as iP}from"./question-004-sINsf4GQ.js";import{A as Ks}from"./avatar-b8hndRPx.js";import{u as Qf,a as eg}from"./use-members-BB0dVjBb.js";import{i as qs}from"./ChevronRight-CNf6Y7s8.js";import{u as sd}from"./use-is-desktop-app-BNujXJc_.js";import{a as pr,u as qu}from"./use-panel-navigate-Bqzu-m4-.js";import{i as gr}from"./CheckCircle-Bape6EQJ.js";import{I as so}from"./integration-icon-BukX17Ja.js";import{e as Gu}from"./backoff-CrEUbyZT.js";import{u as rP}from"./use-status-sounds-CNPhXYst.js";import{E as Vi}from"./empty-state-BObNah86.js";import{g as sl,r as u8}from"./github-repo-COLY3wWI.js";import{T as oP}from"./toolbar-BMJtXOZ8.js";import{i as Ho,n as lP,a as aP}from"./Share07-mTYGTjnX.js";import{i as An}from"./Globe01-CxD9oJyC.js";import{i as h8}from"./Monitor01-DxoPQwl_.js";import{u as Ti,a as tg,b as sg}from"./use-connection-DssDxszT.js";import{g as f8}from"./types-CvaupNP5.js";import{F as Ko}from"./file-type-icon-DFeVbUcK.js";import{f as m8,d as Yu,s as ng,c as cP,b as dP}from"./TrendUp01-B5AMHutg.js";import{i as Ai}from"./ZoomOut-Cyr7GMp8.js";import{i as sr}from"./GitBranch01-ITA5wAsb.js";import{a as ig}from"./Package-BmmKpgLP.js";import{n as _u}from"./Download01-BP8_5nMI.js";import{n as mn}from"./LinkExternal01-CDbttyHT.js";import{D as vl}from"./use-destination-route-BnzyxZK-.js";import{g as uP,s as hP,d as p8,a as fP,F as g8,b as x8,f as b8,S as v8,c as mP}from"./skill-preview-mwAW0EFc.js";import{i as Zf}from"./Key01-3XmA_FLZ.js";import{p as rg,b as un,s as Oc,H as Lu,h as Su,a as ac,c as y8,d as _8}from"./location-oTTXFrSF.js";import{m as pP,a as gP,M as nd,b as xP,O as bP}from"./markdown-BKbOmMip.js";import{p as vP,f as yP}from"./pt-BR-CLy76QW2.js";import{g as _P,e as LP}from"./extract-connection-data-TVNJHOmc.js";import{a as SP,i as Mx}from"./mcp-oauth-DTP_bedh.js";import{A as Kr,a as Wr,b as qr,c as Gr,d as Yr,e as Jr,f as Xr,g as Qr}from"./alert-dialog-P0CuRl4b.js";import{T as Wo}from"./textarea-Cg093qVK.js";import{i as Tl}from"./Play-67XUCyKd.js";import{s as on}from"./Trash01-Dp51yqnn.js";import{u as Oh}from"./use-debounced-autosave-MHpLopBx.js";import{S as Ql}from"./scroll-area-D_zmdKz7.js";import{i as wu}from"./SearchMd-D9B5PGY2.js";import{C as id}from"./checkbox-BSJHTjoV.js";import{S as e9}from"./search-input-BizsLhvX.js";import{C as L8}from"./collection-tabs-DkuVrlwj.js";import{T as S8,u as w8}from"./use-mcp-auth-status-BWBUcCX_.js";import{g as wP}from"./connection-slug-CITJ0kGN.js";import{a as kP,i as jP}from"./Settings02-D20k8vab.js";import{L as Mt}from"./label-fGGyQxp5.js";import{S as ii}from"./switch-DbWQok_U.js";import{s as k8}from"./slugify-CEUa2lfQ.js";import{d as rd}from"./delay-CnY5UFtP.js";import{G as _n,a as Ju,u as CP}from"./github-repo-picker-VVXQm56m.js";import{s as j8}from"./User01-Ct3vu-8e.js";import{t as t9}from"./Users01-BiGPt9OV.js";import{u as C8,a as N8}from"./use-secrets-Bh_QiR6h.js";import{C as NP,a as VP,b as TP}from"./client-icons-Dbh16KTh.js";import{g as Vn}from"./get-initials-D-f_fDFw.js";import{S as as,D as V8,C as T8,R as AP,a as PP,i as A8,n as EP,b as RP}from"./task-board-CcPCmS8T.js";import{a as od}from"./format-time-BnbuEtat.js";import{u as P8,d as DP,c as MP,C as og,a as IP}from"./connect-layout-LGbISPTt.js";import{l as E8,g as OP}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{u as lg,a as $P,b as BP}from"./use-tags-CQrzK6kW.js";import{B as zP,a as FP,b as Ix,c as UP,d as HP,e as KP}from"./breadcrumb-Bcg6Ab2L.js";import{u as i1}from"./use-copy-DElZsO5o.js";import{i as ag,a as WP,c as qP,b as GP}from"./UserSquare-BMU7ptkw.js";import{C as Di,a as ui,b as hi,c as Bn,d as us,e as Es,f as YP,g as Ox}from"./command-BQZNWnLl.js";import{u as JP}from"./use-org-auth-client-BhrDbDSV.js";import{i as s9}from"./ChevronSelectorVertical-BGG06THN.js";import{a as XP}from"./authenticate-and-persist-oauth-BAd7rGHc.js";import{w as $x}from"./editor-X_GwLxUe.js";import{T as Eo,p as R8,I as D8}from"./toolbar-icon-button-j89gz31d.js";import{u as Nm,C as QP,b as ZP,p as M8,a as eE,s as Vm,n as tE}from"./self-tool-result-CTIc9xGS.js";import{M as ld}from"./monaco-editor-BpbvUJwi.js";import{i as sE,a as n9,b as cg}from"./Tool01-DO3tFwrT.js";import{a as Tm}from"./Palette-PDnTmDZk.js";import{s as nE}from"./safe-image-url-D5z803Ot.js";import{s as Xu}from"./Eye-B0Pd_ezn.js";import{i as i9}from"./DotsVertical-Bbr6RMTH.js";import{u as r9}from"./use-debounced-value-CfUze3fk.js";import{u as I8,a as dg}from"./use-file-configs-DbhqGRsz.js";import{u as O8}from"./useInfiniteQuery-BkZl1y7Z.js";import{i as dr}from"./Zap-Cff3TLsZ.js";import{r as $8}from"./site-slug-uya6Wp4-.js";import{B as iE}from"./badge-BStsm_lg.js";import{u as Qu,a as rE,b as oE,c as lE,d as aE}from"./use-automations-BHUwCHCu.js";import{A as cE}from"./automation-list-row-DlvHKPyj.js";import{t as dE}from"./site-error--i37Vnuw.js";import{f as uE,p as hE,g as fE,u as mE,e as pE,a as gE,F as Zu,t as B8,S as xE,B as bE,b as z8,R as vE,c as yE}from"./cards-DaQEzixK.js";function F8(t,e){const s=Ms(e);return _E({filters:{...t,status:"pending"}},s).length}function Bx(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function _E(t={},e){const s=Ms(e).getMutationCache(),n=A.useRef(t),i=A.useRef(null);return i.current===null&&(i.current=Bx(s,t)),A.useEffect(()=>{n.current=t}),A.useSyncExternalStore(A.useCallback(r=>s.subscribe(()=>{const l=PC(i.current,Bx(s,n.current));i.current!==l&&(i.current=l,EC.schedule(r))}),[s]),()=>i.current,()=>i.current)}const U8=Dt({connection_id:Re().describe("Connection ID"),selected_tools:ns(Re()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Re()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Re()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),r1=500,H8=200,ug=200,LE=200,SE=20,wE=50,kE=100,jE=20,CE=100,NE=50,VE=100,TE=50,AE=8192,K8=U8.extend({selected_tools:ns(Re()).max(r1).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Re()).max(r1).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Re()).max(r1).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),PE=Dt({connectionId:Re(),toolName:Re(),label:Re(),icon:Re().nullable().optional()}),EE=Dt({id:Re().describe("Stable id; used as React key and ?tab= value"),title:Re().describe("Tab label"),icon:Re().optional().describe("Optional lucide icon name"),view:Dt({type:Th("ext-app"),appId:Re(),args:gu(Re(),Vy()).optional()})}),W8=ai(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations"]),RE=ai(["on","off"]),DE=new Map([["manual","on"],["auto","on"]]),ME=ai(["on","off","manual","auto"]);function IE(t){if(!t)return null;const e=DE.get(t);return e||(t==="on"||t==="off"?t:null)}const OE=Dt({defaultMainView:Dt({type:Re(),id:Re().optional(),toolName:Re().optional()}).nullable().optional(),chatDefaultOpen:ar().nullable().optional(),cmsDefaultOpen:ar().nullable().optional(),cms:ME.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:ns(W8).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:ns(EE).max(jE).optional()});function e0(t){return IE(t?.cms)??"on"}function $E(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const zx=Dt({tileId:Re().optional(),connectionId:Re().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Re().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Re().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:gu(Re(),Vy()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:wi().int().positive().optional(),maxHeight:wi().int().positive().optional()}),BE=Dt({banner:Re().nullable().optional(),bannerColor:Re().nullable().optional(),icon:Re().nullable().optional(),themeColor:Re().nullable().optional(),pinnedViews:ns(PE).max(kE).nullable().optional(),layout:OE.nullable().optional(),homeTile:zx.nullable().optional(),homeTiles:ns(zx).max(SE).nullable().optional(),homePrompts:ns(Re()).max(wE).nullable().optional()}),t0=/^[A-Za-z_][A-Za-z0-9_]*$/,Fx=Re().min(1).regex(t0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),zE=DC("kind",[Dt({key:Fx,kind:Th("literal"),value:Re().max(AE)}),Dt({key:Fx,kind:Th("secret"),secretId:Re().min(1)})]),hg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,FE=Dt({host:Re().min(1).regex(hg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Re().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),UE=Dt({selected:Re().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Re().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Re().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:ns(zE).max(VE).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:ns(FE).max(TE).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),HE=Dt({url:Re().describe("GitHub repository URL"),owner:Re().describe("Repository owner"),name:Re().describe("Repository name"),installationId:wi().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Re().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),KE=ai(["agent-sandbox","local-api"]),WE={sandboxHandle:Re().describe("Provider-specific handle"),previewUrl:Re().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Re().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:wi().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Dt({packageManager:Re().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Re().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Re().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},q8=Dt(WE);function qE(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=q8.parse(i)}catch{}return s}const GE=gu(Re().describe("userId"),gu(Re().describe("branch"),RC(KE,q8))),YE=Dt({id:Re().describe("Stable identifier for this knowledge file"),name:Re().describe("File name shown in the UI"),kind:ai(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Re().describe("Org filesystem (Library) volume the file lives in"),path:Re().describe("Path within the volume"),url:Re().describe("Same-origin URL to read the file (display/download)"),contentType:Re().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:wi().nullable().optional().describe("File size in bytes"),addedAt:Re().describe("ISO timestamp when the file was attached")}),JE=ns(YE).max(CE).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),XE=ai(["smart","code-review","open"]),QE=XE.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),ZE=ar().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),eR=ar().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),tR=Re().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),sR=Dt({branch:Re().describe("Git branch backing this release"),name:Re().describe('User-facing name, e.g. "Black Friday 2026"'),color:Re().describe("Dot color token shown in the version switcher"),createdBy:Re().optional().describe("User ID who created the release"),createdAt:Re().optional().describe("ISO 8601 creation timestamp")}),nR=ns(sR).max(NE).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),iR=ar().nullable().optional().describe("Draft & Releases mode: gates the drafts UX (releases switcher, read-only production, publish-to-production). Off (default) keeps the classic branch/PR picker and post-publish behavior."),fg={instructions:Re().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:ns(Re()).max(ug).nullable().optional().describe("List of enabled plugin IDs"),subAgents:ns(Re()).max(LE).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:BE.nullable().optional().describe("UI customization settings"),sidebarViews:ns(W8).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:Th(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:HE.nullable().optional().describe("Linked GitHub repository"),runtime:UE.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:JE,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:QE,previewServerUrl:tR,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ar().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:ZE,releases:nR,draftsMode:iR,fastPreviewInPlace:eR},rR=Dt({id:Re().describe("Unique identifier"),title:Re().describe("Human-readable name"),description:Re().nullable().describe("Description"),icon:Re().nullable().describe("Icon URL"),created_at:Re().describe("Creation timestamp"),updated_at:Re().describe("Last update timestamp"),created_by:Re().describe("User ID who created this item"),updated_by:Re().optional().describe("User ID who last updated this item"),organization_id:Re().describe("Organization ID this item belongs to"),status:ai(["active","inactive"]).describe("Current status"),pinned:ar().describe("Whether this space is pinned to the sidebar"),metadata:Dt(fg).extend({instructions:Re().nullable().describe("Instructions also used as system prompt"),sandboxMap:GE.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:ns(U8).describe("Connections with their selected tools, resources, and prompts")}),G8=Dt({title:Re().min(1).max(120).describe("Short label shown on the chip"),description:Re().max(280).optional().describe("One-line subtitle shown under the title"),text:Re().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Dt({title:Re().min(1).max(255).describe("Name for the virtual MCP"),description:Re().max(500).nullable().optional().describe("Optional description"),icon:Re().nullish().describe("Optional icon URL"),status:ai(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ar().optional().default(!1).describe("Pin to sidebar"),metadata:Dt(fg).extend({enabled_plugins:ns(Re()).max(ug).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(K8).max(H8).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:ns(G8).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Dt({title:Re().min(1).max(255).optional().describe("New name"),description:Re().max(500).nullable().optional().describe("New description (null to clear)"),icon:Re().nullish().describe("New icon URL"),status:ai(["active","inactive"]).optional().describe("New status"),pinned:ar().optional().describe("Pin/unpin from sidebar"),metadata:Dt(fg).extend({enabled_plugins:ns(Re()).max(ug).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(K8).max(H8).optional().describe("New connections (replaces existing)"),prompts:ns(G8).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function Ux(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const oR=["dev","start"],Hx=3,Y8="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",lR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function J8(t){const e=U.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const w=$r(c._meta);d=c.title??x2(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const u=d,h=c.description||null;if(a==="card"){let w;e[4]!==n||e[5]!==c?(w=()=>n(c),e[4]=n,e[5]=c,e[6]=w):w=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let V;e[7]!==j||e[8]!==C?(V=ae(lR,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=V):V=e[9];let N;e[10]!==u?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=N):N=e[11];let T;e[12]!==i?(T=i&&o.jsx(st,{size:"xs"}),e[12]=i,e[13]=T):T=e[13];let P;e[14]!==N||e[15]!==T?(P=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,T]}),e[14]=N,e[15]=T,e[16]=P):P=e[16];let E;e[17]!==h?(E=h&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=E):E=e[18];let R;return e[19]!==P||e[20]!==E||e[21]!==w||e[22]!==k||e[23]!==V?(R=o.jsxs("button",{type:"button",onClick:w,disabled:k,className:V,children:[P,E]}),e[19]=P,e[20]=E,e[21]=w,e[22]=k,e[23]=V,e[24]=R):R=e[24],R}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=r||i,p=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ae(Y8,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=o.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let y;e[33]!==i?(y=i&&o.jsx(st,{size:"xs"}),e[33]=i,e[34]=y):y=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==y?(_=o.jsx(He,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,y]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=y,e[40]=_):_=e[40];const L=h??u;let v;e[41]!==L?(v=o.jsx(Ke,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=v):v=e[42];let S;return e[43]!==_||e[44]!==v?(S=o.jsxs(We,{delayDuration:400,children:[_,v]}),e[43]=_,e[44]=v,e[45]=S):S=e[45],S}function aR(t){const e=U.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=ce(),[c,d]=A.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(N=>{const T=c.toLowerCase();return N.prompt.name.toLowerCase().includes(T)||(N.prompt.title??"").toLowerCase().includes(T)||(N.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Hl();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==r){let N;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==r?(N=T=>o.jsx(J8,{item:T,variant:"card",onSelect:P=>{i(!1),r(P)},isLoading:l?.name===T.prompt.name,isDisabled:u&&l?.name!==T.prompt.name},T.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=f.map(N),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let y;e[21]!==a?(y=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=N=>{N.key==="Escape"&&d("")},e[23]=_):_=e[23];let L;e[24]!==c||e[25]!==y?(L=o.jsx(RV,{value:c,onChange:d,placeholder:y,onKeyDown:_}),e[24]=c,e[25]=y,e[26]=L):L=e[26];const v=L;if(m){let N;e[27]!==a?(N=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=N):N=e[28];let T;e[29]!==N?(T=o.jsx(PV,{className:"sr-only",children:o.jsx(y2,{children:N})}),e[29]=N,e[30]=T):T=e[30];let P;e[31]!==a?(P=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=P):P=e[32];let E;e[33]!==P?(E=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:P})}),e[33]=P,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==v||e[37]!==E||e[38]!==T?(R=o.jsxs(_2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,E,v,b]}),e[35]=b,e[36]=v,e[37]=E,e[38]=T,e[39]=R):R=e[39];let M;return e[40]!==i||e[41]!==n||e[42]!==R?(M=o.jsx(Fo,{delayDuration:400,children:o.jsx(L2,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=M):M=e[43],M}let S;e[44]!==a?(S=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=S):S=e[45];let w;e[46]!==S?(w=o.jsx(ms,{className:"sr-only",children:o.jsx(Gt,{children:S})}),e[46]=S,e[47]=w):w=e[47];let k;e[48]!==a?(k=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==v||e[54]!==j||e[55]!==w?(C=o.jsxs(Ft,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,j,v,b]}),e[52]=b,e[53]=v,e[54]=j,e[55]=w,e[56]=C):C=e[56];let V;return e[57]!==i||e[58]!==n||e[59]!==C?(V=o.jsx(Fo,{delayDuration:400,children:o.jsx(Ut,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=V):V=e[60],V}function cR(t){const e=U.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=ce(),[a,c]=A.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,Hx),y=s.slice(Hx),_=!!i;let L;e[10]!==_||e[11]!==i?.name||e[12]!==n?(L=S=>o.jsx(J8,{item:S,onSelect:n,isLoading:i?.name===S.prompt.name,isDisabled:_&&i?.name!==S.prompt.name},S.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=L):L=e[13];const v=b.map(L);d=Fo,m=400,e[14]!==r?(u=ae("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=u):u=e[15],h=v,f=y.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:ae(Y8,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:y.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=o.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(aR,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function dR(){return null}function uR(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function hR(t){const e=U.c(31),{connectionId:s}=t,n=ce(),{sendMessage:i}=ci(),{org:r}=Fe();let l;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=$s(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=h6(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(fR),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=A.useReducer(uR,p),[b,y]=A.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(P,E)=>{if(!a){xe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await Mf(a,P.name,E);x({type:"RESET"});const M={type:"doc",content:[{type:"paragraph",content:[g2({id:P.name,name:$u(P.name,$r(P._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(M)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),xe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=_):_=e[14];const L=_;let v;e[15]!==L?(v=async P=>{if(P.arguments&&P.arguments.length>0){x({type:"SELECT_PROMPT",prompt:P}),y(P);return}x({type:"START_LOADING",prompt:P}),await L(P)},e[15]=L,e[16]=v):v=e[16];const S=v;let w;e[17]!==b||e[18]!==L?(w=async P=>{b&&(x({type:"START_LOADING",prompt:b,arguments:P}),y(null),await L(b,P))},e[17]=b,e[18]=L,e[19]=w):w=e[19];const k=w;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==S||e[21]!==m||e[22]!==j?(C=o.jsx(cR,{items:m,onSelect:S,loadingPrompt:j}),e[20]=S,e[21]=m,e[22]=j,e[23]=C):C=e[23];let V;e[24]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{y(null),x({type:"RESET"})},e[24]=V):V=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(Ph,{prompt:b,setPrompt:V,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let T;return e[28]!==C||e[29]!==N?(T=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=T):T=e[30],T}function fR(t){return{prompt:t}}function mR(t){const e=U.c(13),{className:s}=t,{selectedVirtualMcp:n}=Kl(),{org:i}=Fe();let r;e[0]!==i.id?(r=ql(i.id),e[0]=i.id,e[1]=r):r=e[1];const l=r.id,a=n?.id??l;let c;e[2]!==s?(c=ae("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(dR,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=o.jsx(hR,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=o.jsx(rn,{fallback:null,children:o.jsx(A.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const o1="cubic-bezier(0.645, 0.045, 0.355, 1)",pR=44,gR={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},xR={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},bR={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function qo(t){const e=U.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=ce(),[p,g]=A.useState(d),[x,b]=A.useState(!1);let y;e[0]!==h?(y=()=>{b(!0),h?.()},e[0]=h,e[1]=y):y=e[1];const _=y;if(x)return null;const L=xR[f],v=gR[f];let S;e[2]!==L||e[3]!==v?(S=ae("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,v),e[2]=L,e[3]=v,e[4]=S):S=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(vR),e[5]=w):w=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=ae("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const V=bR[f];let N;e[9]!==V?(N=ae("shrink-0",V),e[9]=V,e[10]=N):N=e[10];let T;e[11]!==s||e[12]!==N?(T=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=T):T=e[13];let P;e[14]!==n?(P=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=P):P=e[15];let E;e[16]!==i?(E=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const R=p?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==R?(M=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(Ls,{size:16,style:{transform:R,transition:`transform 180ms ${o1}`}})}),e[18]=R,e[19]=M):M=e[19];let I;e[20]!==m?(I=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=D):D=e[23];let $,O;e[24]!==_?($=re=>{re.stopPropagation(),_()},O=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),re.stopPropagation(),_())},e[24]=_,e[25]=$,e[26]=O):($=e[25],O=e[26]);let B;e[27]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(Ws,{size:16}),e[27]=B):B=e[27];let F;e[28]!==I||e[29]!==D||e[30]!==$||e[31]!==O?(F=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":I,title:D,onClick:$,onKeyDown:O,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:B}),e[28]=I,e[29]=D,e[30]=$,e[31]=O,e[32]=F):F=e[32];let z;e[33]!==p||e[34]!==T||e[35]!==P||e[36]!==E||e[37]!==M||e[38]!==F||e[39]!==C?(z=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:w,className:C,children:[T,P,E,M,F]}),e[33]=p,e[34]=T,e[35]=P,e[36]=E,e[37]=M,e[38]=F,e[39]=C,e[40]=z):z=e[40];const W=p?"1fr":"0fr";let K;e[41]!==W?(K={display:"grid",gridTemplateRows:W,transition:`grid-template-rows 180ms ${o1}`},e[41]=W,e[42]=K):K=e[42];let H;e[43]===Symbol.for("react.memo_cache_sentinel")?(H={overflow:"hidden",minHeight:0},e[43]=H):H=e[43];const q=p?1:0;let G;e[44]!==q?(G={opacity:q,transition:`opacity 120ms ${o1}`,maxHeight:"60vh"},e[44]=q,e[45]=G):G=e[45];let Q;e[46]!==r?(Q=r?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:r})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=r,e[47]=Q):Q=e[47];let se;e[48]!==c||e[49]!==r?(se=c?o.jsx("div",{className:ae("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=se):se=e[50];let Z;e[51]!==Q||e[52]!==se?(Z=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[Q,se]}),e[51]=Q,e[52]=se,e[53]=Z):Z=e[53];let te;e[54]!==l||e[55]!==a?(te=l||a?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:l}),o.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=te):te=e[56];let X;e[57]!==G||e[58]!==Z||e[59]!==te?(X=o.jsx("div",{style:H,children:o.jsxs("div",{className:"flex flex-col",style:G,children:[Z,te]})}),e[57]=G,e[58]=Z,e[59]=te,e[60]=X):X=e[60];let Y;e[61]!==K||e[62]!==X?(Y=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:X}),e[61]=K,e[62]=X,e[63]=Y):Y=e[63];let de;return e[64]!==z||e[65]!==Y||e[66]!==S||e[67]!==f?(de=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:S,children:[z,Y]}),e[64]=z,e[65]=Y,e[66]=S,e[67]=f,e[68]=de):de=e[68],de}function vR(t){return!t}const yR=Dt({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:ai(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),X8=Dt({todos:ns(yR)}),_R="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";BV({description:_R,inputSchema:zV(X8),execute:async({todos:t})=>({ok:!0,count:t.length})});const LR="tool-todo_write",SR=new Set(["input-available","output-available"]);function wR(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const r=n[i];if(r.type!==LR||typeof r.state!="string"||!SR.has(r.state))continue;const l=X8.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function Q8(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Eh(BN(n)),input:s.input})}return e}function Z8(t){return t.at(-1)}function e7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function kR(t){return t?t.message.startsWith("[CREDITS]"):!1}const jR="[SUBSCRIPTION_REQUIRED]";function t7(t){return t?.message.startsWith(jR)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const CR={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function NR(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&kR(s))return{...CR,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,h=e7(a),f=Q8(c),m=wR(e),p=i?null:t7(s),g=!i&&!!s&&!p,x=f.length>0||i&&r,b=h.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function s7(){const t=U.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ci(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==l||t[4]!==a?(c=NR({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function VR(){const t=s7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function n7(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const TR="__home__";function mg(t,e){return Vf.chatDraft(t,e)}function AR(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function i7(t,e,s,n,i){const r=mg(e,s);if(n7(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(ER(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Kx(t,e,s){const n=mg(e,s),i=t.getItem(n),r=AR(i);return i!==null&&r===null&&t.removeItem(n),r}function PR(t,e,s){t.removeItem(mg(e,s))}function ER(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Sn(t){const e=U.c(14),s=Vs(t),n=_s(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=LN(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,u=r?.metadata;let h;e[2]!==i||e[3]!==u?(h=Qy(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=f2(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=m2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function RR({virtualMcpId:t,variant:e="composer"}){const s=ce(),n=v6(t),[i,r]=A.useState(!1),l=async()=>{if(!i){r(!0);try{await n()}catch(a){xe.error(a instanceof Error?a.message:String(a))}finally{r(!1)}}};return o.jsxs("button",{type:"button",disabled:i,"aria-busy":i,onClick:()=>{l()},className:ae("group flex items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60",e==="composer"?"w-full":"mx-auto my-10 w-full max-w-md"),children:[o.jsx(Gc,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.input.productionReadOnly")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.input.startDraftToEdit")})]}),o.jsx(mr,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}function DR(t){const e=U.c(30),{current:s,total:n,onPrev:i,onNext:r}=t,l=ce();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ae("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==l?(u=l("chat.pagination.previousLabel"),e[2]=l,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Kf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=o.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":u,children:h}),e[5]=i,e[6]=a,e[7]=d,e[8]=u,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=o.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let y;e[16]!==b?(y=ae("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=y):y=e[17];let _;e[18]!==l?(_=l("chat.pagination.nextLabel"),e[18]=l,e[19]=_):_=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(mr,{size:14}),e[20]=L):L=e[20];let v;e[21]!==r||e[22]!==x||e[23]!==y||e[24]!==_?(v=o.jsx("button",{type:"button",onClick:r,disabled:x,className:y,"aria-label":_,children:L}),e[21]=r,e[22]=x,e[23]=y,e[24]=_,e[25]=v):v=e[25];let S;return e[26]!==v||e[27]!==f||e[28]!==g?(S=o.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,v]}),e[26]=v,e[27]=f,e[28]=g,e[29]=S):S=e[29],S}function r7(t){const e=U.c(8),{currentIndex:s,total:n,onPrev:i,onNext:r,extraLeft:l}=t;let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n?(a=o.jsx(DR,{current:s,total:n,onPrev:i,onNext:r}),e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=o.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function MR(t){const e=U.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:r,submitLabel:l,nextLabel:a}=t,u=n?l===void 0?"Submit":l:a===void 0?"Next":a,h=n?s:!i,f=h?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==h||e[1]!==r?(m=()=>{h||r()},e[0]=h,e[1]=r,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ae("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==g?(x=o.jsx(fe,{type:"button",size:"sm","aria-disabled":h,onClick:m,className:g,children:u}),e[5]=h,e[6]=u,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let y;e[10]!==b?(y=o.jsx(He,{asChild:!0,children:b}),e[10]=b,e[11]=y):y=e[11];let _;e[12]!==f?(_=o.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;return e[14]!==y||e[15]!==_?(L=o.jsxs(We,{children:[y,_]}),e[14]=y,e[15]=_,e[16]=L):L=e[16],L}function o7(t,e,s){return t.findIndex(n=>e(n)===s)}function Wx(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function qx(t,e,s,n,i){if(t.length===0)return null;const r=o7(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(r+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function IR(t){return!t.isStreaming&&t.allAnswered}function l7(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:r,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=A.useState(c),[h,f]=A.useState(!1),m=a2({resolver:Ty(n),defaultValues:i}),p=m.watch(),g=o7(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),y=Wx(e,s,p,l),_=IR({isStreaming:r,allAnswered:y}),L=()=>{if(g>0){const V=e[g-1];V&&u(s(V))}},v=()=>{if(g>=0&&g<e.length-1){const V=e[g+1];V&&u(s(V))}},S=()=>{const V=m.getValues(),N=qx(e,s,V,l,d);N&&u(N)},w=()=>{m.handleSubmit(V=>{const N=V;for(const T of e)a(T,N[s(T)])})()},k=A.useRef(w);k.current=w;const j=()=>{_&&(f(!1),k.current())},C=()=>{const V=m.getValues();if(Wx(e,s,V,l)){if(r){f(!0);return}f(!1),k.current()}else{const N=qx(e,s,V,l,d);N&&u(N)}};return A.useEffect(()=>{if(h&&!r){if(!y){f(!1);return}f(!1),k.current()}},[h,r,y]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:y,canSubmit:_,goPrev:L,goNext:v,advanceToNextUnanswered:S,submit:j,submitOrAdvance:C}}const a7="chat.approval.defaultDenyReason";function c7(t){const e=U.c(36),{onYolo:s}=t,n=ce(),[i,r]=fr();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n){const L=xl.find(w=>w.value===i.toolApprovalLevel)??xl[0];let v;e[13]!==s||e[14]!==i||e[15]!==r?(v=w=>{const k=w,j=i.toolApprovalLevel??"readonly";r({...i,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=r,e[16]=v):v=e[16];const S=v;c=ks,m=i.toolApprovalLevel,p=S,a=js,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=OR,l=Ds,d=n(L.shortKey),e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],u=e[8],h=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=o.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==g?(x=o.jsx(a,{size:u,className:h,onClick:f,children:g}),e[20]=a,e[21]=u,e[22]=h,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=xl.map(L=>o.jsx(Ot,{value:L.value,children:n(L.labelKey)},L.value)),e[26]=n,e[27]=b):b=e[27];let y;e[28]!==b?(y=o.jsx(Cs,{children:b}),e[28]=b,e[29]=y):y=e[29];let _;return e[30]!==c||e[31]!==y||e[32]!==m||e[33]!==p||e[34]!==x?(_=o.jsxs(c,{value:m,onValueChange:p,children:[x,y]}),e[30]=c,e[31]=y,e[32]=m,e[33]=p,e[34]=x,e[35]=_):_=e[35],_}function OR(t){return t.stopPropagation()}function d7(t){const e=U.c(8),{input:s}=t,n=ce();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=o.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let r;return e[6]!==i?(r=o.jsx("div",{className:"px-4",children:o.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[6]=i,e[7]=r):r=e[7],r}function $R(t){const e=U.c(38),{approval:s,onRespond:n}=t,i=ce(),[r]=fr(),l=r.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(a7),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const u=d;let h;e[9]!==s.approvalId||e[10]!==n?(h=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=h):h=e[11];const f=h;let m;e[12]!==f?(m=o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(c7,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=o.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let y;e[21]!==u||e[22]!==b?(y=o.jsx(fe,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:b}),e[21]=u,e[22]=b,e[23]=y):y=e[23];let _;e[24]!==x||e[25]!==y?(_=o.jsxs(o.Fragment,{children:[x,y]}),e[24]=x,e[25]=y,e[26]=_):_=e[26];const L=_;let v;e[27]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Bf,{size:14}),e[27]=v):v=e[27];let S;e[28]!==i?(S=i("chat.approval.needsApproval"),e[28]=i,e[29]=S):S=e[29];let w;e[30]!==s.input?(w=o.jsx(d7,{input:s.input}),e[30]=s.input,e[31]=w):w=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==S||e[36]!==w?(k=o.jsx(qo,{icon:v,label:S,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:w}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=S,e[36]=w,e[37]=k):k=e[37],k}const BR=gu(Re(),Dt({approved:ar().optional(),levelOverride:ai(["auto","readonly"]).optional()}));function zR(t){const e=U.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,r=ce(),[l]=fr(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(HR)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==r?(u=(N,T)=>{const P=T;typeof P?.approved=="boolean"&&i(N.approvalId,P.approved,P.approved===!1?r(a7):void 0,P.levelOverride??a)},e[2]=a,e[3]=i,e[4]=r,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:UR,schema:BR,defaultValues:d,isStreaming:n,hasAnswer:FR,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=l7(h);let m;e[11]!==s||e[12]!==f?(m=N=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:N}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=N=>{N.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Bf,{size:14}),e[16]=y):y=e[16];let _;e[17]!==s.length||e[18]!==r?(_=r("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=r,e[19]=_):_=e[19];const L=g?.friendlyName??"";let v;e[20]!==p?(v=o.jsx(c7,{onYolo:p}),e[20]=p,e[21]=v):v=e[21];let S;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==v?(S=o.jsx(r7,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:v}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=v,e[27]=S):S=e[27];let w;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(w=g?o.jsx(KR,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=w):w=e[31];let k;e[32]!==g?(k=g?o.jsx(d7,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==S||e[35]!==w||e[36]!==k||e[37]!==_||e[38]!==L?(j=o.jsx(qo,{icon:y,label:_,title:L,defaultExpanded:!0,footerLeft:S,footerRight:w,children:k}),e[34]=S,e[35]=w,e[36]=k,e[37]=_,e[38]=L,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==b?(C=o.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=C):C=e[42];let V;return e[43]!==f.form||e[44]!==C?(V=o.jsx(_m,{...x,children:C}),e[43]=f.form,e[44]=C,e[45]=V):V=e[45],V}function FR(t){return typeof t?.approved=="boolean"}function UR(t){return t.approvalId}function HR(t){return[t.approvalId,{approved:void 0}]}function KR(t){const e=U.c(7),{approvalId:s,control:n,onChange:i}=t,r=ce(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==r?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return o.jsxs(o.Fragment,{children:[o.jsx(fe,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),i()},"aria-pressed":f,children:r("chat.approval.denyButton")}),o.jsx(fe,{type:"button",variant:h?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),i()},"aria-pressed":h,children:r("chat.approval.acceptButton")})]})},e[0]=i,e[1]=r,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=o.jsx(vs,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function WR(){const t=U.c(5),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Bf,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function qR(t){const e=U.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(WR,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=o.jsx($R,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let r;return e[4]!==s||e[5]!==n||e[6]!==i?(r=o.jsx(zR,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function GR(t){const e=U.c(28),{plan:s,onApprove:n,onDismiss:i}=t,r=ce();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==r?(c=r("chat.proposePlan.keepIterating"),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=o.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==r?(u=r("chat.proposePlan.letsGo"),e[8]=r,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=o.jsx(fe,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:u}),e[10]=a,e[11]=u,e[12]=h):h=e[12];let f;e[13]!==d||e[14]!==h?(f=o.jsxs(o.Fragment,{children:[d,h]}),e[13]=d,e[14]=h,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(k6,{size:14}),e[16]=p):p=e[16];let g;e[17]!==r?(g=r("chat.proposePlan.planReady"),e[17]=r,e[18]=g):g=e[18];let x;e[19]!==r?(x=r("chat.proposePlan.implementationPlan"),e[19]=r,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=o.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:o.jsx(zN,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let y;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(y=o.jsx(qo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=y):y=e[27],y}function YR(t){const e=U.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let r;e[0]!==s?(r=Z8(s),e[0]=s,e[1]=r):r=e[1];const l=r;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=o.jsx(GR,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function u7(t){return t?"response"in t?t.response:t.option??t.draft:""}const Gx=Dt({response:Re().min(1,"Response is required")}),JR=Dt({option:Re().nullable(),draft:Re()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),XR=Dt({response:ai(["yes","no"])});function QR(t){switch(t.type){case"text":return Gx;case"choice":return JR;case"confirm":return XR;default:return Gx}}function ZR(t){const e={};for(const s of t)e[s.toolCallId]=QR(s.input);return Dt(e)}function eD(t){const e=U.c(7),{control:s,name:n,placeholder:i}=t,r=ce();let l;e[0]!==i||e[1]!==r?(l=c=>{const{field:d}=c,u=d.value??"";return o.jsxs(B2,{children:[o.jsx(z2,{children:o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(A2,{size:16,className:"text-muted-foreground"})}),o.jsx("input",{...d,value:u,type:"text",placeholder:i||r("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":r("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),o.jsx(F2,{})]})},e[0]=i,e[1]=r,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=o.jsx(K6,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function h7(t,e){const s=U.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const r=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),A.useEffect(n,i)}function tD(t){const e=U.c(51),{control:s,name:n,options:i}=t,r=ce(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=_x(a),d=`${n}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:h}=_x(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=R=>{const M=i[R];M!=null&&c.onChange(M)},e[6]=c,e[7]=i,e[8]=p):p=e[8],h7(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==r?(x=r("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=r,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==r){let R;e[16]!==c||e[17]!==f||e[18]!==r?(R=(M,I)=>{const D=f===M;return o.jsxs("button",{type:"button",onClick:()=>c.onChange(M),className:ae("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",D&&"bg-accent/50",!D&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.selectOption",{option:M}),children:[o.jsx("span",{className:ae("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",D?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),o.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${I}-${M}`)},e[16]=c,e[17]=f,e[18]=r,e[19]=R):R=e[19],b=i.map(R),e[11]=c,e[12]=f,e[13]=i,e[14]=r,e[15]=b}else b=e[15];const y=g&&"bg-accent/50",_=!g&&"hover:bg-accent/30";let L;e[20]!==y||e[21]!==_?(L=ae("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",y,_),e[20]=y,e[21]=_,e[22]=L):L=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(A2,{size:16,className:"text-muted-foreground"})}),e[23]=v):v=e[23];const S=g?m:"";let w;e[24]!==h||e[25]!==c||e[26]!==f?(w=R=>{h.onChange(R.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=w):w=e[27];let k;e[28]!==c||e[29]!==f?(k=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=r,e[32]=j):j=e[32];let C;e[33]!==r?(C=r("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=r,e[34]=C):C=e[34];let V;e[35]!==S||e[36]!==w||e[37]!==k||e[38]!==j||e[39]!==C?(V=o.jsx("input",{type:"text",value:S,onChange:w,onFocus:k,placeholder:j,"aria-label":C,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=S,e[36]=w,e[37]=k,e[38]=j,e[39]=C,e[40]=V):V=e[40];let N;e[41]!==L||e[42]!==V?(N=o.jsxs("label",{className:L,children:[v,V]}),e[41]=L,e[42]=V,e[43]=N):N=e[43];let T;e[44]!==N||e[45]!==x||e[46]!==b?(T=o.jsx(z2,{children:o.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,N]})}),e[44]=N,e[45]=x,e[46]=b,e[47]=T):T=e[47];let P;e[48]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(F2,{}),e[48]=P):P=e[48];let E;return e[49]!==T?(E=o.jsxs(B2,{children:[T,P]}),e[49]=T,e[50]=E):E=e[50],E}function sD(t){const e=U.c(8),{control:s,name:n}=t,i=ce();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=["yes","no"],e[0]=r):r=e[0];const l=r,a=A.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{a.current?.onChange(l[h]??"")},e[1]=c):c=e[1],h7(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,o.jsxs(B2,{children:[o.jsx(z2,{children:o.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=f.value===m;return o.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ae("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[o.jsx("span",{className:ae("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),o.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),o.jsx(F2,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=o.jsx(K6,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}function Yx(t){const e=U.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const r=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==r?(l=o.jsx(eD,{control:n,name:r,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=r,e[3]=l):l=e[3],l}case"choice":{let r;e[4]!==s.options?(r=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=r):r=e[5];const l=r;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=o.jsx(tD,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const r=`${i}.response`;let l;return e[10]!==n||e[11]!==r?(l=o.jsx(sD,{control:n,name:r}),e[10]=n,e[11]=r,e[12]=l):l=e[12],l}default:return null}}function nD(t){const e=U.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=ZR(s.map(lD)),e[0]=s,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=Object.fromEntries(s.map(oD)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(O,B)=>{const F=u7(B);F&&i(O,F)},e[4]=i,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(u={parts:s,partKey:rD,schema:l,defaultValues:c,isStreaming:n,hasAnswer:iD,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=u):u=e[11];const h=l7(u),f=h.currentPart,m=ce();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const O=f;if(!O)return;const B=m("chat.userAskQuestion.skipMessage"),F=O.toolCallId;O.input?.type==="choice"?(h.form.setValue(`${F}.option`,null),h.form.setValue(`${F}.draft`,B)):h.form.setValue(`${F}.response`,B),h.advanceToNextUnanswered()},e[12]=f,e[13]=h,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==h.currentIndex||e[17]!==h.goNext||e[18]!==h.goPrev||e[19]!==s.length?(x=o.jsx(r7,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext}),e[16]=h.currentIndex,e[17]=h.goNext,e[18]=h.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let y;e[21]!==m?(y=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=y):y=e[22];let _;e[23]!==g||e[24]!==y?(_=o.jsx(fe,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:y}),e[23]=g,e[24]=y,e[25]=_):_=e[25];let L;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(L=o.jsx(MR,{isStreaming:n,isAllAnswered:h.isAllAnswered,isCurrentAnswered:h.isCurrentAnswered,onAdvanceOrSubmit:h.submitOrAdvance}),e[26]=h.isAllAnswered,e[27]=h.isCurrentAnswered,e[28]=h.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let v;e[31]!==_||e[32]!==L?(v=o.jsxs(o.Fragment,{children:[_,L]}),e[31]=_,e[32]=L,e[33]=v):v=e[33];const S=v;if(s.length===1){const O=s[0];if(!O?.input)return null;const B=h.form;let F;e[34]!==h?(F=Z=>{Z.preventDefault(),h.submit()},e[34]=h,e[35]=F):F=e[35];let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Lm,{size:14}),e[36]=z):z=e[36];let W;e[37]!==m?(W=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=W):W=e[38];let K;e[39]!==O.input?.prompt||e[40]!==m?(K=O.input?.prompt??m("chat.userAskQuestion.question"),e[39]=O.input?.prompt,e[40]=m,e[41]=K):K=e[41];const H=O.input;let q;e[42]!==h.form.control||e[43]!==O.toolCallId||e[44]!==H?(q=o.jsx(Yx,{input:H,control:h.form.control,toolCallId:O.toolCallId}),e[42]=h.form.control,e[43]=O.toolCallId,e[44]=H,e[45]=q):q=e[45];let G;e[46]!==S||e[47]!==W||e[48]!==K||e[49]!==q?(G=o.jsx(qo,{icon:z,label:W,title:K,defaultExpanded:!0,footerRight:S,children:q}),e[46]=S,e[47]=W,e[48]=K,e[49]=q,e[50]=G):G=e[50];let Q;e[51]!==F||e[52]!==G?(Q=o.jsx("form",{onSubmit:F,autoComplete:"off",children:G}),e[51]=F,e[52]=G,e[53]=Q):Q=e[53];let se;return e[54]!==h.form||e[55]!==Q?(se=o.jsx(_m,{...B,children:Q}),e[54]=h.form,e[55]=Q,e[56]=se):se=e[56],se}const w=h.form;let k;e[57]!==h?(k=O=>{O.preventDefault(),h.submit()},e[57]=h,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Lm,{size:14}),e[59]=j):j=e[59];let C;e[60]!==m?(C=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=C):C=e[61];const V=h.currentIndex+1;let N;e[62]!==s.length||e[63]!==m||e[64]!==V?(N=m("chat.userAskQuestion.questionCount",{current:V,total:s.length}),e[62]=s.length,e[63]=m,e[64]=V,e[65]=N):N=e[65];let T;e[66]!==f?.input?.prompt||e[67]!==m?(T=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=T):T=e[68];const P=h.activeKey,E=h.setActiveKey;let R;if(e[69]!==h.form||e[70]!==s){let O;e[72]!==h.form?(O=B=>o.jsx(wl,{value:B.toolCallId,className:"mt-0",children:o.jsx(Yx,{input:B.input,control:h.form.control,toolCallId:B.toolCallId})},B.toolCallId),e[72]=h.form,e[73]=O):O=e[73],R=s.map(O),e[69]=h.form,e[70]=s,e[71]=R}else R=e[71];let M;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==R?(M=o.jsx(Xl,{value:P,onValueChange:E,children:R}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=R,e[77]=M):M=e[77];let I;e[78]!==b||e[79]!==S||e[80]!==C||e[81]!==N||e[82]!==T||e[83]!==M?(I=o.jsx(qo,{icon:j,label:C,count:N,title:T,defaultExpanded:!0,footerLeft:b,footerRight:S,children:M}),e[78]=b,e[79]=S,e[80]=C,e[81]=N,e[82]=T,e[83]=M,e[84]=I):I=e[84];let D;e[85]!==k||e[86]!==I?(D=o.jsx("form",{onSubmit:k,autoComplete:"off",children:I}),e[85]=k,e[86]=I,e[87]=D):D=e[87];let $;return e[88]!==h.form||e[89]!==D?($=o.jsx(_m,{...w,children:D}),e[88]=h.form,e[89]=D,e[90]=$):$=e[90],$}function iD(t){return!!u7(t)}function rD(t){return t.toolCallId}function oD(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function lD(t){return{toolCallId:t.toolCallId,input:t.input}}function aD(){const t=U.c(5),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Lm,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function f7(t){const e=U.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=s.filter(cD),e[0]=s,e[1]=r):r=e[1];const l=r;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(aD,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=o.jsx(nD,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function cD(t){return t.state==="input-available"}function dD(t){const e=t.filter(r=>r.status==="in_progress"),s=t.filter(r=>r.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function uD(t){const e=U.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=dD(s),e[0]=s,e[1]=n):n=e[1];const i=n;let r;e[2]!==i.icon?(r=o.jsx(pD,{status:i.icon}),e[2]=i.icon,e[3]=r):r=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(hD),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=o.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==r||e[11]!==d?(u=o.jsx(qo,{icon:r,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=r,e[11]=d,e[12]=u):u=e[12],u}function hD(t,e){return o.jsx(fD,{todo:t},e)}function fD(t){const e=U.c(14),{todo:s}=t,n=s.status==="completed",r=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=o.jsx(mD,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ae("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",u=n?"width 300ms ease 200ms":"width 150ms ease";let h;e[4]!==d||e[5]!==u?(h=o.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=h):h=e[6];let f;e[7]!==r||e[8]!==c||e[9]!==h?(f=o.jsxs("span",{className:c,children:[r,h]}),e[7]=r,e[8]=c,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=o.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,f]}),e[11]=l,e[12]=f,e[13]=m):m=e[13],m}function mD(t){const e=U.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("svg",{viewBox:"0 0 21 21",children:o.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=r):r=e[0];let l;return e[1]!==n||e[2]!==i?(l=o.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:r}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function pD(t){const e=U.c(13),{status:s}=t,n=ce();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:o.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=o.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=o.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let r;return e[11]!==i?(r=o.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=r):r=e[12],r}const gD={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},xD=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function m7(t){const e=U.c(65),{onDismiss:s}=t,{org:n}=Fe(),i=ln(),{decoKeyId:r}=H2(),l=ys(),a=ce(),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{qe("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),A.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async H=>{const{url:q}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:H,currency:f});return q},e[3]=f,e[4]=l,e[5]=b):b=e[5];let y;e[6]!==s?(y=H=>{H&&window.open(H,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=y):y=e[7];let _;e[8]!==a?(_=H=>{xe.error(a("chat.creditsExhaustedBanner.topupError",{error:H.message}))},e[8]=a,e[9]=_):_=e[9];let L;e[10]!==b||e[11]!==y||e[12]!==_?(L={mutationFn:b,onSuccess:y,onError:_},e[10]=b,e[11]=y,e[12]=_,e[13]=L):L=e[13];const{mutate:v,isPending:S}=Rs(L),w=parseFloat(c),k=!isNaN(w)&&w>=1;let j;e[14]!==s?(j=H=>!H&&s?.(),e[14]=s,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=C):C=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=V):V=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=N):N=e[18];let T;e[19]!==a?(T=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=T):T=e[20];let P;e[21]!==T?(P=o.jsx(Gt,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=P):P=e[22];let E;e[23]!==a?(E=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=E):E=e[24];let R;e[25]!==E?(R=o.jsx(Tn,{className:"mt-1.5 text-sm leading-relaxed",children:E}),e[25]=E,e[26]=R):R=e[26];let M;e[27]!==P||e[28]!==R?(M=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[V,o.jsxs(ms,{className:"relative gap-4",children:[N,o.jsxs("div",{children:[P,R]})]})]}),e[27]=P,e[28]=R,e[29]=M):M=e[29];let I;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==w||e[34]!==r||e[35]!==k||e[36]!==S||e[37]!==u||e[38]!==a||e[39]!==v?(I=r&&o.jsxs("div",{className:"px-8 pt-5 pb-6",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(Wf,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:H=>{H&&m(H)},children:[o.jsx(Ic,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Ic,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsxs("div",{className:"rounded-xl border border-border p-5",children:[o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:gD[f].map(H=>{const{dollars:q,labelKey:G}=H;return o.jsxs("button",{type:"button",disabled:S,onClick:()=>{qe("credits_topup_clicked",{amount_cents:q*100,currency:f,tier_label:G,source:"exhausted_banner"}),v(q*100)},className:ae("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,q]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:a(G)})]},q)})}),u?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(kt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:H=>d(H.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(fe,{className:"h-10",disabled:!k||S,onClick:()=>{qe("credits_topup_clicked",{amount_cents:Math.round(w*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(w*100))},children:a(S?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>h(!0),children:a("chat.creditsExhaustedBanner.enterCustom")})]}),o.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:xD.map(H=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:o.jsx(zt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),o.jsx("span",{className:"text-sm text-foreground/80",children:a(H)})]},H))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=w,e[34]=r,e[35]=k,e[36]=S,e[37]=u,e[38]=a,e[39]=v,e[40]=I):I=e[40];let D;e[41]!==a?(D=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=D):D=e[42];let $;e[43]!==s||e[44]!==D?($=o.jsx(fe,{variant:"ghost",size:"sm",onClick:s,children:D}),e[43]=s,e[44]=D,e[45]=$):$=e[45];let O;e[46]!==i||e[47]!==s||e[48]!==n.slug?(O=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=O):O=e[49];let B;e[50]!==a?(B=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=B):B=e[51];let F;e[52]!==O||e[53]!==B?(F=o.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:O,children:B}),e[52]=O,e[53]=B,e[54]=F):F=e[54];let z;e[55]!==$||e[56]!==F?(z=o.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[$,F]}),e[55]=$,e[56]=F,e[57]=z):z=e[57];let W;e[58]!==M||e[59]!==I||e[60]!==z?(W=o.jsxs(Ft,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:bD,children:[M,I,z]}),e[58]=M,e[59]=I,e[60]=z,e[61]=W):W=e[61];let K;return e[62]!==W||e[63]!==j?(K=o.jsx(Ut,{open:!0,onOpenChange:j,children:W}),e[62]=W,e[63]=j,e[64]=K):K=e[64],K}function bD(t){return t.preventDefault()}const vD={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function yD(t){const e=U.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,r=ce(),{label:l,title:a}=vD[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(tl,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==r?(d=r(l),e[1]=l,e[2]=r,e[3]=d):d=e[3];let u;e[4]!==r||e[5]!==a?(u=r(a),e[4]=r,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==r?(h=s==="trial_exhausted"?o.jsx(fe,{size:"sm",onClick:i,className:"h-7 text-xs",children:r("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=r,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=o.jsx(qo,{icon:c,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:h}),e[11]=n,e[12]=d,e[13]=u,e[14]=h,e[15]=f):f=e[15],f}function p7(t,e){const s=U.c(9),n=ys(),i=ce();let r;s[0]!==n||s[1]!==t?(r=async()=>{const{url:c}=await n.call(t,{});return c},s[0]=n,s[1]=t,s[2]=r):r=s[2];let l;s[3]!==e||s[4]!==i?(l=c=>xe.error(i(e,{message:c.message})),s[3]=e,s[4]=i,s[5]=l):l=s[5];let a;return s[6]!==r||s[7]!==l?(a={mutationFn:r,onSuccess:_D,onError:l},s[6]=r,s[7]=l,s[8]=a):a=s[8],Rs(a)}function _D(t){return window.open(t,"_blank","noopener,noreferrer")}function LD(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),r=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:r?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const SD={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function $h(t){const e=U.c(29),s=ce(),{variant:n,onDismiss:i}=t,r=n==="error";let l;e[0]!==r||e[1]!==s?(l=s(r?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=r,e[1]=s,e[2]=l):l=e[2];const a=l,c=r?yn:Qo;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const y=SD[t.finishReason];return y?s(y):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const u=d;let h;e[8]!==r||e[9]!==u?(h=r?LD(u):{summary:u,rawDetails:null},e[8]=r,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;let p;e[11]!==c?(p=o.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==r||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=r?o.jsx(fe,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):o.jsx(fe,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=r,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?o.jsxs("details",{className:"group mx-4",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[o.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})}),o.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),o.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),o.jsxs("div",{className:"relative mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>xe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>xe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:o.jsx(vn,{className:"size-3.5"})}),o.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=o.jsx(qo,{icon:p,label:a,title:f,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function o9(){const t=U.c(73),e=ce(),{error:s,clearError:n,finishReason:i,clearFinishReason:r,messages:l,isStreaming:a,submit:c,sendMessage:d}=ci(),[u,h]=fr(),{virtualMcpId:f,createTaskWithMessage:m}=an(),{chatMode:p,simpleModeTier:g}=Kl(),{mutate:x}=p7("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const y=b;let _;t[2]!==p||t[3]!==g||t[4]!==f?(_=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=_):_=t[5];const L=_;let v;t[6]!==u.toolApprovalLevel?(v=u.toolApprovalLevel??MC(),t[6]=u.toolApprovalLevel,t[7]=v):v=t[7];const S=v,w=l.at(-1),k=w?.role==="assistant"?w.parts:[],j=k.filter(CD),C=e7(k),V=Q8(k);let N;t[8]!==s||t[9]!==d||t[10]!==e?(N=()=>{if(s){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ne)}},t[8]=s,t[9]=d,t[10]=e,t[11]=N):N=t[11];const T=N;let P;t[12]!==d||t[13]!==e?(P=()=>{const le={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(le)},t[12]=d,t[13]=e,t[14]=P):P=t[14];const E=P;let R;t[15]!==L||t[16]!==S||t[17]!==c?(R=(le,ne)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ne}},L(S))},t[15]=L,t[16]=S,t[17]=c,t[18]=R):R=t[18];const M=R;let I;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(I=le=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=I):I=t[24];const D=I,$=jD;let O;t[25]!==L||t[26]!==c?(O=(le,ne,me,ee)=>{c({kind:"approval",approvalId:le,approved:ne,...me?{reason:me}:{}},L(ee))},t[25]=L,t[26]=c,t[27]=O):O=t[27];const B=O,F=s7();if(F.isCreditExhausted){let le;return t[28]!==n?(le=o.jsx(m7,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:z,showWarning:W,hasApprovals:K}=F,H=j.map(kD).join("|"),q=Z8(C)?.toolCallId??"",G=V.map(wD).join("|");let Q;t[30]!==F.todos?(Q=o.jsx(uD,{todos:F.todos}),t[30]=F.todos,t[31]=Q):Q=t[31];let se;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==y?(se=F.subscriptionErrorKind&&o.jsx(yD,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:y}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=y,t[35]=se):se=t[35];let Z;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==z?(Z=z&&o.jsx($h,{variant:"error",error:s,onDismiss:n,onFixInChat:T}),t[36]=n,t[37]=s,t[38]=T,t[39]=z,t[40]=Z):Z=t[40];let te;t[41]!==r||t[42]!==i||t[43]!==E||t[44]!==W?(te=W&&o.jsx($h,{variant:"warning",finishReason:i,onDismiss:r,onContinue:E}),t[41]=r,t[42]=i,t[43]=E,t[44]=W,t[45]=te):te=t[45];let X;t[46]!==G||t[47]!==B||t[48]!==K||t[49]!==a||t[50]!==V?(X=K&&o.jsx(qR,{approvals:V,isStreaming:a,onRespond:B},G),t[46]=G,t[47]=B,t[48]=K,t[49]=a,t[50]=V,t[51]=X):X=t[51];let Y;t[52]!==F.hasPlans||t[53]!==D||t[54]!==$||t[55]!==a||t[56]!==C||t[57]!==q?(Y=F.hasPlans&&o.jsx(YR,{plans:C,isStreaming:a,onApprove:D,onDismiss:$},q),t[52]=F.hasPlans,t[53]=D,t[54]=$,t[55]=a,t[56]=C,t[57]=q,t[58]=Y):Y=t[58];let de;t[59]!==F.isWaitingForUserInput||t[60]!==M||t[61]!==a||t[62]!==H||t[63]!==j?(de=F.isWaitingForUserInput&&o.jsx(f7,{userAskParts:j,isStreaming:a,onSubmit:M},H),t[59]=F.isWaitingForUserInput,t[60]=M,t[61]=a,t[62]=H,t[63]=j,t[64]=de):de=t[64];let re;return t[65]!==Z||t[66]!==te||t[67]!==X||t[68]!==Y||t[69]!==de||t[70]!==Q||t[71]!==se?(re=o.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[Q,se,Z,te,X,Y,de]}),t[65]=Z,t[66]=te,t[67]=X,t[68]=Y,t[69]=de,t[70]=Q,t[71]=se,t[72]=re):re=t[72],re}function wD(t){return t.approvalId}function kD(t){return t.toolCallId}function jD(){document.querySelector("[data-chat-input]")?.focus()}function CD(t){return t.type==="tool-user_ask"}o9.Error=function(e){return o.jsx($h,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};o9.Warning=function(e){return o.jsx($h,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};o9.UserAskQuestion=f7;function ND(t){const e=U.c(20),{taskId:s}=t,n=ce(),i=Zy(s),r=SN(i),l=wN(),{stop:a,removeLocalMessage:c}=ci();if(r.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>{a()},e[2]=a,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Af,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:h})}),e[5]=d,e[6]=u,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=o.jsx(Ke,{side:"top",children:o.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=o.jsxs(We,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,y)=>o.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:y+1}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(_=>{_&&(kN(s,b.messageId),c(b.messageId))})},children:o.jsx(Ni,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],o.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[o.jsx("span",{children:n(r.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:r.length})}),g]}),r.map(x)]})}function VD(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const TD={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function AD(t){const e=U.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:r,onPick:l,onReset:a,onClose:c}=t,d=ce(),u=Jf(),h=new Set(u.map(PD)),f=jN([i,n,r],h),m=f?.keyId??null,[p,g]=A.useState(m??u[0]?.id??null),x=u.some(I=>I.id===p)?p:m??u[0]?.id??null,b=x?u.find(I=>I.id===x):null,y="flex h-[70vh] max-h-[460px] w-full flex-col",_=TD[s];let L;e[0]!==d||e[1]!==_?(L=d(_),e[0]=d,e[1]=_,e[2]=L):L=e[2];let v;e[3]!==L?(v=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=v):v=e[4];let S;e[5]!==a||e[6]!==d||e[7]!==i?(S=i&&o.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=S):S=e[8];let w;e[9]!==v||e[10]!==S?(w=o.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[v,S]}),e[9]=v,e[10]=S,e[11]=w):w=e[11];const k="flex-1 min-h-0",j=A.Suspense;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx($A,{}),e[12]=C):C=e[12];const V=OA,N=!0,T=VD(m?f:null,b?.providerId??"deco");let P;e[13]!==x||e[14]!==l||e[15]!==g?(P=I=>{const D=I.keyId??x??"";g(D),l({keyId:D,modelId:I.modelId,title:I.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=P):P=e[16];let E;e[17]!==V||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==P?(E=o.jsx(V,{compact:N,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:P}),e[17]=V,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=P,e[23]=E):E=e[23];let R;e[24]!==j||e[25]!==E||e[26]!==C?(R=o.jsx("div",{className:k,children:o.jsx(j,{fallback:C,children:E})}),e[24]=j,e[25]=E,e[26]=C,e[27]=R):R=e[27];let M;return e[28]!==R||e[29]!==w?(M=o.jsxs("div",{className:y,children:[w,R]}),e[28]=R,e[29]=w,e[30]=M):M=e[30],M}function PD(t){return t.id}const ED=["fast","smart","thinking"];function g7(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const RD={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function DD(t){const e=U.c(28),{tier:s,pillIcon:n,groups:i}=t,r=ce();let l;e[0]!==r?(l=g7(r),e[0]=r,e[1]=l):l=e[1];const a=l,[c,d]=A.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=k=>{k.onSelect(),d(!1)},e[2]=u):u=e[2];const h=u,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ae("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ae("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=o.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Ls,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let y;e[8]!==n||e[9]!==f||e[10]!==x?(y=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink",children:o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=y):y=e[11];let _;e[12]!==f?(_=o.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;e[14]!==y||e[15]!==_?(L=o.jsxs(We,{children:[y,_]}),e[14]=y,e[15]=_,e[16]=L):L=e[16];let v;if(e[17]!==i||e[18]!==r){let k;e[20]!==r?(k=j=>o.jsx("div",{className:"flex flex-col",children:j.rows.map(C=>o.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[o.jsxs("button",{type:"button",role:"menuitem","aria-label":C.title,onClick:()=>h(C),className:ae("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",C.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[C.icon&&o.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:C.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm",children:C.title}),C.subtitle&&o.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle})]}),C.active&&o.jsx("span",{title:r("chat.tierTrigger.selected"),children:o.jsx(zt,{size:14,className:"text-foreground mt-0.5"})})]}),C.modelOverride&&o.jsx(ID,{label:C.title,render:C.modelOverride})]},C.key))},j.key),e[20]=r,e[21]=k):k=e[21],v=i.map(k),e[17]=i,e[18]=r,e[19]=v}else v=e[19];let S;e[22]!==v?(S=o.jsx(hs,{align:"end",className:"p-1 w-64",onOpenAutoFocus:MD,children:o.jsx("div",{role:"menu",className:"flex flex-col",children:v})}),e[22]=v,e[23]=S):S=e[23];let w;return e[24]!==c||e[25]!==L||e[26]!==S?(w=o.jsxs(fs,{open:c,onOpenChange:d,children:[L,S]}),e[24]=c,e[25]=L,e[26]=S,e[27]=w):w=e[27],w}function MD(t){return t.preventDefault()}function ID(t){const e=U.c(38),{label:s,render:n}=t,i=ce(),r=Hl(),[l,a]=A.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let u;e[1]!==s||e[2]!==i?(u=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=u):u=e[3];const h=l&&"opacity-100";let f;e[4]!==h?(f=ae("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",h),e[4]=h,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(C6,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=o.jsx("button",{type:"button","aria-label":u,className:f,children:m}),e[7]=u,e[8]=f,e[9]=p):p=e[9];const g=p;if(r){let L;e[10]!==g?(L=o.jsx(EV,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let v;e[12]!==s||e[13]!==i?(v=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=v):v=e[14];let S;e[15]!==v?(S=o.jsx(y2,{className:"sr-only",children:v}),e[15]=v,e[16]=S):S=e[16];let w;e[17]!==l||e[18]!==n?(w=l&&n(d),e[17]=l,e[18]=n,e[19]=w):w=e[19];let k;e[20]!==w||e[21]!==S?(k=o.jsxs(_2,{className:"p-0 flex flex-col max-h-[95vh]",children:[S,w]}),e[20]=w,e[21]=S,e[22]=k):k=e[22];let j;return e[23]!==l||e[24]!==k||e[25]!==L?(j=o.jsxs(L2,{open:l,onOpenChange:a,children:[L,k]}),e[23]=l,e[24]=k,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=o.jsx(ds,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let y;e[32]!==b?(y=o.jsx(hs,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=y):y=e[33];let _;return e[34]!==l||e[35]!==x||e[36]!==y?(_=o.jsxs(fs,{open:l,onOpenChange:a,children:[x,y]}),e[34]=l,e[35]=x,e[36]=y,e[37]=_):_=e[37],_}function Jx(t){return t==="fast"?o.jsx(tl,{size:16}):t==="thinking"?o.jsx(j6,{size:16}):o.jsx(zr,{size:16})}function OD(t){const e=U.c(13),s=VN();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const u=s.tiers[d];return u?u.title??u.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let r;e[3]!==i?(r=i("fast"),e[3]=i,e[4]=r):r=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==r||e[10]!==l||e[11]!==a?(c={fast:r,smart:l,thinking:a},e[9]=r,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function $D(){const t=U.c(22),e=ce(),{simpleModeTier:s,setSimpleModeTier:n}=Kl(),i=KA(),r=Jf(),l=qA(r),a=OD(l),{data:c,error:d}=CN();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=NN();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==h||t[10]!==d){const _=g7(e);m="decopilot",p=ED.map(L=>{const v=a[L],S=h.tiers[L];return{key:`decopilot-${L}`,icon:Jx(L),title:_[L],subtitle:v??e(RD[L]),active:s===L,onSelect:()=>n(L),modelOverride:w=>o.jsxs(o.Fragment,{children:[d&&o.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),o.jsx(AD,{tier:L,orgSlot:i.tiers[L],userSlot:S,autoSlot:l.chat[L],onClose:w,onPick:k=>f.mutate({tier:L,slot:k}),onReset:()=>f.mutate({tier:L,slot:null})},`${L}:${S?.keyId??"org"}:${S?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=f,t[9]=h,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=Jx(s),t[16]=s,t[17]=b):b=t[17];let y;return t[18]!==x||t[19]!==b||t[20]!==s?(y=o.jsx(DD,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=y):y=t[21],y}async function pg(t,e,s,n,i,r){if(!Gf(e)){xe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!BA(l,e)){const c=e8(e).parts.map(u=>r(u)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):xe.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){xe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const u=await d,h={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};FN(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),xe.error(`Failed to load file "${s.name}"`)}}function BD(t){const e=U.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,r=ce(),l=A.useRef(FD);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r?(a=()=>{l.current=async(h,f)=>{await pg(s,n,h,f,i,r)}},c=[s,n,i,r],e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=a,e[5]=c):(a=e[4],c=e[5]),A.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new ji("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new Yc({key:h,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const y=g.dataTransfer?.files;if(!y||y.length===0)return!1;g.preventDefault();const _=p.posAtCoords({left:g.clientX,top:g.clientY});if(!_)return!1;const L=Array.from(y);return(async()=>{let v=_.pos;for(const S of L)await l.current?.(S,v),v=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(zD);return b.length===0?!1:(g.preventDefault(),(async()=>{let y=p.state.selection.from;for(const _ of b){const L=_.getAsFile();L&&(await l.current?.(L,y),y=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(h)}},u=[s],e[6]=s,e[7]=d,e[8]=u):(d=e[7],u=e[8]),A.useEffect(d,u),null}function zD(t){return t.kind==="file"}function FD(){return Promise.resolve()}function UD(t){const e=U.c(43),{info:s,onClose:n}=t,i=ce(),r=s!==null;let l;e[0]!==n?(l=N=>!N&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:o.jsx(Qo,{size:18})}),e[4]=d):d=e[4];let u;e[5]!==i?(u=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(Gt,{className:"text-xl font-semibold tracking-tight",children:u}),e[7]=u,e[8]=h):h=e[8];const f=s?.fileName;let m;e[9]!==f?(m=o.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=o.jsxs(Tn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==h?(x=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,o.jsxs(ms,{className:"relative gap-4",children:[d,o.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,e[18]=x):x=e[18];const b=s?.modelName??"";let y;e[19]!==i||e[20]!==b?(y=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=y):y=e[21];let _;e[22]!==y?(_=o.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:y}),e[22]=y,e[23]=_):_=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(N6,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const v=s?.accepted;let S;e[25]!==v?(S=o.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,o.jsx("span",{className:"capitalize",children:v})]}),e[25]=v,e[26]=S):S=e[26];let w;e[27]!==_||e[28]!==S?(w=o.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:o.jsxs("div",{className:"rounded-xl border border-border p-4",children:[_,S]})}),e[27]=_,e[28]=S,e[29]=w):w=e[29];let k;e[30]!==i?(k=i("chat.uploader.gotIt"),e[30]=i,e[31]=k):k=e[31];let j;e[32]!==n||e[33]!==k?(j=o.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:o.jsx(fe,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let C;e[35]!==x||e[36]!==w||e[37]!==j?(C=o.jsxs(Ft,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:HD,children:[x,w,j]}),e[35]=x,e[36]=w,e[37]=j,e[38]=C):C=e[38];let V;return e[39]!==r||e[40]!==l||e[41]!==C?(V=o.jsx(Ut,{open:r,onOpenChange:l,children:C}),e[39]=r,e[40]=l,e[41]=C,e[42]=V):V=e[42],V}function HD(t){return t.preventDefault()}function KD(){const t=U.c(3),[e,s]=A.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var gg=UN;var WD=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Am=WD.join(","),x7=typeof Element>"u",ku=x7?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Bh=!x7&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},zh=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),r=i===""||i==="true",l=r||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):zh(e.parentNode));return l},qD=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},GD=function(e,s,n){if(zh(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Am));return s&&ku.call(e,Am)&&i.unshift(e),i=i.filter(n),i},Pm=function(e,s,n){for(var i=[],r=Array.from(e);r.length;){var l=r.shift();if(!zh(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=Pm(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=ku.call(l,Am);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!zh(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=Pm(h===!0?l.children:h.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else r.unshift.apply(r,l.children)}}return i},b7=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},v7=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||qD(e))&&!b7(e)?0:e.tabIndex},YD=function(e,s){var n=v7(e);return n<0&&s&&!b7(e)?0:n},JD=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},y7=function(e){return e.tagName==="INPUT"},XD=function(e){return y7(e)&&e.type==="hidden"},QD=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},ZD=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},eM=function(e){if(!e.name)return!0;var s=e.form||Bh(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var r=ZD(i,e.form);return!r||r===e},tM=function(e){return y7(e)&&e.type==="radio"},sM=function(e){return tM(e)&&!eM(e)},nM=function(e){var s,n=e&&Bh(e),i=(s=n)===null||s===void 0?void 0:s.host,r=!1;if(n&&n!==e){var l,a,c;for(r=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!r&&i;){var d,u,h;n=Bh(i),i=(d=n)===null||d===void 0?void 0:d.host,r=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return r},Xx=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},iM=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var r=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!r}if(getComputedStyle(e).visibility==="hidden")return!0;var l=ku.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(ku.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,u=Bh(e);if(d&&!d.shadowRoot&&i(d)===!0)return Xx(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(nM(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Xx(e);return!1},rM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return ku.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},oM=function(e,s){return!(s.disabled||XD(s)||iM(s,e)||QD(s)||rM(s))},Qx=function(e,s){return!(sM(s)||v7(s)<0||!oM(e,s))},lM=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},_7=function(e){var s=[],n=[];return e.forEach(function(i,r){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=YD(a,l),d=l?_7(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:r,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(JD).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(s)},L7=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Pm([e],s.includeContainer,{filter:Qx.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:lM}):n=GD(e,s.includeContainer,Qx.bind(null,s)),_7(n)};function aM(){return/apple/i.test(navigator.vendor)}const Zx="data-floating-ui-focusable";function cM(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function Em(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&IC(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function _d(t){return"composedPath"in t?t.composedPath()[0]:t.target}function l1(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function dM(t){return t.matches("html,body")}function ju(t){return t?.ownerDocument||document}function uM(t){return t?t.hasAttribute(Zx)?t:t.querySelector("["+Zx+"]")||t:null}function ph(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var r;return i.parentId===e&&(!s||((r=i.context)==null?void 0:r.open))}).flatMap(i=>[i,...ph(t,i.id,s)])}function hM(t){return"nativeEvent"in t}var fM=typeof document<"u",mM=function(){},kl=fM?A.useLayoutEffect:mM;const pM={...Ay},gM=pM.useInsertionEffect,xM=gM||(t=>t());function bc(t){const e=A.useRef(()=>{});return xM(()=>{e.current=t}),A.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const S7=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function w7(t,e){const s=L7(t,S7()),n=s.length;if(n===0)return;const i=cM(ju(t)),r=s.indexOf(i),l=r===-1?e===1?0:n-1:r+e;return s[l]}function bM(t){return w7(ju(t).body,1)||t}function vM(t){return w7(ju(t).body,-1)||t}function a1(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Em(s,n)}function yM(t){L7(t,S7()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function e4(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const _M="data-floating-ui-focusable",t4="active",s4="selected",LM={...Ay};let n4=!1,SM=0;const i4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+SM++;function wM(){const[t,e]=A.useState(()=>n4?i4():void 0);return kl(()=>{t==null&&e(i4())},[]),A.useEffect(()=>{n4=!0},[]),t}const kM=LM.useId,xg=kM||wM;function jM(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const CM=A.createContext(null),NM=A.createContext(null),k7=()=>{var t;return((t=A.useContext(CM))==null?void 0:t.id)||null},j7=()=>A.useContext(NM);function bg(t){return"data-floating-ui-"+t}const VM={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},r4=A.forwardRef(function(e,s){const[n,i]=A.useState();kl(()=>{aM()&&i("button")},[]);const r={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[bg("focus-guard")]:"",style:VM};return o.jsx("span",{...e,...r})}),TM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},C7=A.createContext(null),o4=bg("portal");function AM(t){t===void 0&&(t={});const{id:e,root:s}=t,n=xg(),i=EM(),[r,l]=A.useState(null),a=A.useRef(null);return kl(()=>()=>{r?.remove(),queueMicrotask(()=>{a.current=null})},[r]),kl(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(o4,""),c.appendChild(d),a.current=d,l(d)},[e,n]),kl(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!UC(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const u=document.createElement("div");u.id=n,u.setAttribute(o4,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),r}function PM(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,r=AM({id:s,root:n}),[l,a]=A.useState(null),c=A.useRef(null),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||r);return A.useEffect(()=>{if(!r||!i||f)return;function g(x){r&&a1(x)&&(x.type==="focusin"?e4:yM)(r)}return r.addEventListener("focusin",g,!0),r.addEventListener("focusout",g,!0),()=>{r.removeEventListener("focusin",g,!0),r.removeEventListener("focusout",g,!0)}},[r,i,f]),A.useEffect(()=>{r&&(m||e4(r))},[m,r]),o.jsxs(C7.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:r,setFocusManagerState:a}),[i,r]),children:[p&&r&&o.jsx(r4,{"data-type":"outside",ref:c,onFocus:g=>{if(a1(g,r)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,y=vM(b);y?.focus()}}}),p&&r&&o.jsx("span",{"aria-owns":r.id,style:TM}),r&&qn.createPortal(e,r),p&&r&&o.jsx(r4,{"data-type":"outside",ref:d,onFocus:g=>{if(a1(g,r)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,y=bM(b);y?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const EM=()=>A.useContext(C7),RM={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},DM={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},l4=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function MM(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:r}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=j7(),x=bc(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,y=A.useRef(!1),{escapeKey:_,outsidePress:L}=l4(m),{escapeKey:v,outsidePress:S}=l4(p),w=A.useRef(!1),k=bc(P=>{var E;if(!s||!l||!a||P.key!=="Escape"||w.current)return;const R=(E=r.current.floatingContext)==null?void 0:E.nodeId,M=g?ph(g.nodesRef.current,R):[];if(!_&&(P.stopPropagation(),M.length>0)){let I=!0;if(M.forEach(D=>{var $;if(($=D.context)!=null&&$.open&&!D.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}n(!1,hM(P)?P.nativeEvent:P,"escape-key")}),j=bc(P=>{var E;const R=()=>{var M;k(P),(M=_d(P))==null||M.removeEventListener("keydown",R)};(E=_d(P))==null||E.addEventListener("keydown",R)}),C=bc(P=>{var E;const R=r.current.insideReactTree;r.current.insideReactTree=!1;const M=y.current;if(y.current=!1,d==="click"&&M||R||typeof b=="function"&&!b(P))return;const I=_d(P),D="["+bg("inert")+"]",$=ju(i.floating).querySelectorAll(D);let O=Ji(I)?I:null;for(;O&&!e1(O);){const W=BC(O);if(e1(W)||!Ji(W))break;O=W}if($.length&&Ji(I)&&!dM(I)&&!Em(I,i.floating)&&Array.from($).every(W=>!Em(O,W)))return;if(zC(I)&&T){const W=e1(I),K=FC(I),H=/auto|scroll/,q=W||H.test(K.overflowX),G=W||H.test(K.overflowY),Q=q&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,se=G&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,Z=K.direction==="rtl",te=se&&(Z?P.offsetX<=I.offsetWidth-I.clientWidth:P.offsetX>I.clientWidth),X=Q&&P.offsetY>I.clientHeight;if(te||X)return}const B=(E=r.current.floatingContext)==null?void 0:E.nodeId,F=g&&ph(g.nodesRef.current,B).some(W=>{var K;return l1(P,(K=W.context)==null?void 0:K.elements.floating)});if(l1(P,i.floating)||l1(P,i.domReference)||F)return;const z=g?ph(g.nodesRef.current,B):[];if(z.length>0){let W=!0;if(z.forEach(K=>{var H;if((H=K.context)!=null&&H.open&&!K.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}n(!1,P,"outside-press")}),V=bc(P=>{var E;const R=()=>{var M;C(P),(M=_d(P))==null||M.removeEventListener(d,R)};(E=_d(P))==null||E.addEventListener(d,R)});A.useEffect(()=>{if(!s||!l)return;r.current.__escapeKeyBubbles=_,r.current.__outsidePressBubbles=L;let P=-1;function E($){n(!1,$,"ancestor-scroll")}function R(){window.clearTimeout(P),w.current=!0}function M(){P=window.setTimeout(()=>{w.current=!1},$C()?5:0)}const I=ju(i.floating);a&&(I.addEventListener("keydown",v?j:k,v),I.addEventListener("compositionstart",R),I.addEventListener("compositionend",M)),b&&I.addEventListener(d,S?V:C,S);let D=[];return f&&(Ji(i.domReference)&&(D=Z9(i.domReference)),Ji(i.floating)&&(D=D.concat(Z9(i.floating))),!Ji(i.reference)&&i.reference&&i.reference.contextElement&&(D=D.concat(Z9(i.reference.contextElement)))),D=D.filter($=>{var O;return $!==((O=I.defaultView)==null?void 0:O.visualViewport)}),D.forEach($=>{$.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(I.removeEventListener("keydown",v?j:k,v),I.removeEventListener("compositionstart",R),I.removeEventListener("compositionend",M)),b&&I.removeEventListener(d,S?V:C,S),D.forEach($=>{$.removeEventListener("scroll",E)}),window.clearTimeout(P)}},[r,i,a,b,d,s,n,f,l,_,L,k,v,j,C,S,V]),A.useEffect(()=>{r.current.insideReactTree=!1},[r,b,d]);const N=A.useMemo(()=>({onKeyDown:k,...u&&{[RM[h]]:P=>{n(!1,P.nativeEvent,"reference-press")},...h!=="click"&&{onClick(P){n(!1,P.nativeEvent,"reference-press")}}}}),[k,n,u,h]),T=A.useMemo(()=>{function P(E){E.button===0&&(y.current=!0)}return{onKeyDown:k,onMouseDown:P,onMouseUp:P,[DM[d]]:()=>{r.current.insideReactTree=!0}}},[k,d,r]);return A.useMemo(()=>l?{reference:N,floating:T}:{},[l,N,T])}function IM(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=xg(),r=A.useRef({}),[l]=A.useState(()=>jM()),a=k7()!=null,[c,d]=A.useState(n.reference),u=bc((m,p,g)=>{r.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),h=A.useMemo(()=>({setPositionReference:d}),[]),f=A.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return A.useMemo(()=>({dataRef:r,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function OM(t){t===void 0&&(t={});const{nodeId:e}=t,s=IM({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[r,l]=A.useState(null),[a,c]=A.useState(null),u=i?.domReference||r,h=A.useRef(null),f=j7();kl(()=>{u&&(h.current=u)},[u]);const m=OC({...t,elements:{...i,...a&&{reference:a}}}),p=A.useCallback(_=>{const L=Ji(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(L),m.refs.setReference(L)},[m.refs]),g=A.useCallback(_=>{(Ji(_)||_===null)&&(h.current=_,l(_)),(Ji(m.refs.reference.current)||m.refs.reference.current===null||_!==null&&!Ji(_))&&m.refs.setReference(_)},[m.refs]),x=A.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=A.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),y=A.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return kl(()=>{n.dataRef.current.floatingContext=y;const _=f?.nodesRef.current.find(L=>L.id===e);_&&(_.context=y)}),A.useMemo(()=>({...m,context:y,refs:x,elements:b}),[m,x,b,y])}function c1(t,e,s){const n=new Map,i=s==="item";let r=t;if(i&&t){const{[t4]:l,[s4]:a,...c}=t;r=c}return{...s==="floating"&&{tabIndex:-1,[_M]:""},...r,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,u]=c;if(!(i&&[t4,s4].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof u=="function"){var h;(h=n.get(d))==null||h.push(u),l[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=u}),l),{})}}function $M(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=A.useCallback(a=>c1(a,t,"reference"),e),r=A.useCallback(a=>c1(a,t,"floating"),s),l=A.useCallback(a=>c1(a,t,"item"),n);return A.useMemo(()=>({getReferenceProps:i,getFloatingProps:r,getItemProps:l}),[i,r,l])}const BM=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function zM(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:r,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=xg(),u=((s=r.domReference)==null?void 0:s.id)||d,h=A.useMemo(()=>{var y;return((y=uM(r.floating))==null?void 0:y.id)||l},[r.floating,l]),f=(n=BM.get(c))!=null?n:c,p=k7()!=null,g=A.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?h:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?h:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,h,p,i,u,c]),x=A.useMemo(()=>{const y={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?y:{...y,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=A.useCallback(y=>{let{active:_,selected:L}=y;const v={role:"option",..._&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...v,"aria-selected":L}}return{}},[h,c]);return A.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function FM(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:l,$position:a}=t,c=n&&!i,d=WN(s),u=new RegExp(`\\s${d}$`),h=l?"^":"",f=i?"":d,m=c?new RegExp(`${h}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),y=new RegExp(`^[${r?.join("")}\0]?$`).test(b);if(r!==null&&!y)return null;const _=g+x.index;let L=_+x[0].length;return c&&u.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),_<a.pos&&L>=a.pos?{range:{from:_,to:L},query:x[0].slice(s.length),text:x[0]}:null}function UM(t){return t.docChanged?t.steps.some(e=>{const s=e.slice;if(!s?.content)return!1;const n=s.content.textBetween(0,s.content.size,`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-D-QRzAnK.js","assets/index-BkljfHxy.js","assets/index-DN9-7YC2.css","assets/chat-context-CTC6stWi.js","assets/use-panel-navigate-BRmpjsHj.js","assets/use-destination-route-DLsn9uXe.js","assets/hooks-Cv_l36vR.js","assets/constants-DNuUCxmW.js","assets/use-mcp-client-Deaem8WO.js","assets/auth-Bbv_i1Jo.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-DU0j98RE.js","assets/task-board-7HRng9a2.js","assets/schema-BgSBbsw7.js","assets/slugify-CEUa2lfQ.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-12aBqy7V.js","assets/use-ai-providers-CWtvyrT-.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-Cm5dzSwF.js","assets/use-organization-settings-CwdP6bUS.js","assets/ChevronUp-DbYyUJ2c.js","assets/agent-icon-CUm4oB7y.js","assets/AlertCircle-DA1cEHVG.js","assets/Tool01-Cy0ZGCil.js","assets/ArrowUp-TsmTWJjN.js","assets/ArrowLeft-Br9KqDZP.js","assets/Tool02-CSZTEjDX.js","assets/XCircle-waBvJxuW.js","assets/TrendUp01-CYPVBoFc.js","assets/ZoomOut-NYNe_Z4v.js","assets/Users03-DTortZ69.js","assets/CheckCircle-W70-Hp-u.js","assets/Check-grvRnT6d.js","assets/ChevronRight-gw9dm0MJ.js","assets/ChevronSelectorVertical-CZ_XnnrO.js","assets/DotsVertical-DuImY45F.js","assets/UserSquare-BncQsikh.js","assets/Copy01-DC15dYeZ.js","assets/CreditCard01-BQ448v1L.js","assets/Download01-C92aqGYG.js","assets/Settings02-Dmn9Uagb.js","assets/Eye-BHvUcvRj.js","assets/Share07-BUu5_15N.js","assets/GitBranch01-5KhVbuOf.js","assets/Globe01-B1lfl4nW.js","assets/XClose-D87Tx9wT.js","assets/HardDrive-Bl2sm0P3.js","assets/Image01-BmysQdds.js","assets/Key01-BHRixQVB.js","assets/Link01-pXyMJR2J.js","assets/LinkExternal01-CqwZLC94.js","assets/Monitor01-VQD1wr6O.js","assets/Sun-DWLAV3m1.js","assets/Package-D8xZrFk4.js","assets/Palette-Bo_A8ldC.js","assets/Play-CyYcbqou.js","assets/Plus-BIAtk7db.js","assets/SearchMd-D6yqdaba.js","assets/Shield01-B9JGpaTp.js","assets/Stars01-CWhfbfaB.js","assets/Trash01-D1GpJcjK.js","assets/Upload01-BCzsausn.js","assets/User01-DpOHQvBN.js","assets/Users01-Di41qDP0.js","assets/Zap-Bz0lnET7.js","assets/scroll-area-0nfzfnAs.js","assets/select-DqJyZyIQ.js","assets/dialog-1xIvEVWS.js","assets/input-CYJ7J22n.js","assets/popover-mZ_x_ILZ.js","assets/dropdown-menu-Dm9zz_PI.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-BGqqc2Gj.js","assets/label-BSeVlzkX.js","assets/switch-CZqeYbje.js","assets/use-section-preview-base-CTx7wzR-.js","assets/automation-runs-DLjirUtq.js","assets/useInfiniteQuery-DiQVH8QR.js","assets/use-infinite-scroll-Bj-_fMYw.js","assets/use-connection-Uyph_H8d.js","assets/table-DbdXafHS.js","assets/empty-state-Z33ir3je.js","assets/use-members-Cv__v2oz.js","assets/use-org-auth-client-DWweu3ja.js","assets/use-automations-D9Y9jZ0Z.js","assets/useSuspenseInfiniteQuery-BMUPA2Dd.js","assets/avatar-Cqr4rNtI.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-Cuzq782M.js","assets/markdown-D7QuNT69.js","assets/monaco-editor-CC-Sqg8F.js","assets/editor-DuZZHVnS.js","assets/types-B-HpXlbf.js","assets/shell-layout-tPdz54xh.js","assets/download-app-dialog-CsPmnO0q.js","assets/project-icon-BBqdk5OE.js","assets/github-repo-COLY3wWI.js","assets/command-A0s0uPHt.js","assets/index-CUyq5xp-.js","assets/required-auth-layout-B2tIP5k3.js","assets/use-org-sso-CMfMnqpv.js","assets/shell-layout-CuFt8bor.css","assets/integration-icon-kfJeGcu4.js","assets/use-navigate-to-agent-B-P_VAZF.js","assets/use-mcp-prompts-C5IrmXgS.js","assets/form-DLHM0IAy.js","assets/file-type-icon-Dl9zrC0W.js","assets/drawer-C-pTdfTV.js","assets/collection-search-CO09NGkg.js","assets/tabs-C9EAqZz9.js","assets/toggle-group-Diuss92s.js","assets/task-route-_ESOOTZi.js","assets/toolbar-icon-button-DnenepzG.js","assets/github-repo-picker-BIbCpUFZ.js","assets/use-debounced-value-DJ0hN8gB.js","assets/authenticate-and-persist-oauth-sBYdDIRi.js","assets/mcp-oauth-dGHhlLy0.js","assets/extract-connection-data-C44EqyQK.js","assets/metadata-dUsYcpuu.js","assets/connection-DFFOswZj.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/connection-card-TaYo6pYl.js","assets/use-registry-connections-CU4AWQn4.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-90AQXVh4.js","assets/connection-form-helpers-CoIQo1Gb.js","assets/collection-tabs-cr1701fJ.js","assets/badge-CdD_S6_J.js","assets/use-file-configs-CHDaFO85.js","assets/site-slug-uya6Wp4-.js","assets/get-initials-D-f_fDFw.js","assets/select-model-BsGv2vyu.js","assets/checkbox-DtN6Dr54.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-DXofXja-.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-CkzzANKj.js","assets/toolbar-BWOWuYdi.js","assets/skill-preview-C-lpKGFK.js","assets/pt-BR-CLy76QW2.js","assets/alert-dialog-C51iVTPN.js","assets/use-debounced-autosave-DS1yKwxh.js","assets/search-input-CIki-uxf.js","assets/use-mcp-auth-status-HMnG1EUf.js","assets/use-secrets--00GbFn8.js","assets/client-icons-C1w3IsHJ.js","assets/connect-layout-CrHWsBPn.js","assets/self-tool-result-BoZ6MFRP.js","assets/track-Qcawd54k.js","assets/use-tags-k_sYBsNz.js","assets/breadcrumb-CGLwazRA.js","assets/automation-list-row-Hqe9OUun.js","assets/site-error--i37Vnuw.js","assets/cards-De2Tofte.js","assets/file-explorer-DQ8njhcM.js","assets/app-editor-DR0tLRro.js","assets/post-editor-GHkZtflO.js","assets/multi-select-nRNpGGJY.js","assets/block-document-CwU9JWtH.js","assets/primitives-Bp0pnH9F.js","assets/use-autosave-DIT9IDbg.js","assets/record-editor-2DwNqvUy.js","assets/category-editor-COqxAE1f.js","assets/bulk-category-panel-3QzafbMh.js","assets/index-ldx_aeXw.js","assets/seo-editor-g6APT0uI.js","assets/variant-calendar-DaQkdUZ_.js","assets/view-mode-toggle-WcHFJdKB.js","assets/post-calendar-DM4--jD1.js","assets/alert-6mjnov6H.js","assets/redirect-editor-Bat0o4y3.js","assets/project-app-view-C5a0S8VK.js","assets/hosting-tab-DtuFDGvE.js","assets/empty-state-CaQCn5yY.js","assets/e2e-tab-DAWapk18.js","assets/analytics-tab-BncFpj4z.js","assets/chart-7R5tmwSB.js","assets/index-Dmu_jFDN.js","assets/AreaChart-CXRdv0xx.js","assets/cdn-tab-D_pbGC7l.js","assets/ErrorBarContext-VF7KGcUm.js","assets/Sector-CsxyX7hI.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as Ms,r as A,ac as PC,ad as EC,ae as Dt,af as ns,ag as Re,ah as ar,ai,aj as Th,ak as gu,al as RC,am as wi,an as DC,ao as Vy,c as U,W as Fe,l as ae,j as o,E as rn,b as ce,t as xe,a3 as Fo,I as Hl,h as st,a1 as He,a2 as Ke,a4 as We,ap as Ws,J as Vf,z as Gc,B as fe,aq as a2,ar as Ty,v as fr,as as vs,at as xl,au as _x,d as ln,a7 as ys,e as Rs,o as qe,av as MC,C as Qo,aw as IC,ax as Ay,ay as OC,az as Ji,aA as Z9,aB as qn,aC as $C,aD as e1,aE as BC,aF as zC,aG as FC,aH as UC,aI as c2,aJ as d2,aK as Py,aL as u2,x as Tf,K as it,aM as HC,aN as KC,aO as WC,aP as Ey,aQ as Qd,m as Qt,a as Pn,Y as ki,aR as xu,k as qC,u as Zo,f as el,H as h2,aS as GC,aT as Lx,aU as fm,aa as Ry,a9 as Sx,aV as Dy,aW as My,aX as Iy,aY as YC,aZ as JC,L as Ao,a_ as Oy,a$ as XC,b0 as QC,b1 as ZC,b2 as Ah,b3 as bl,b4 as nn,b5 as $y,b6 as By,b7 as $n,P as On,ab as zy,b8 as eN,b9 as Et,ba as Fy,bb as Uy,bc as Hy,bd as Ky,be as Wy,bf as qy,bg as tN,bh as sN,bi as nN,bj as iN,bk as Gy,bl as Ys,N as si,bm as Yy,bn as rN,bo as oN,bp as Jy,bq as lN,br as aN,bs as cN,bt as dN,bu as mm,bv as Sl,bw as Xy,bx as uN,by as hN,bz as fN,bA as mN,bB as pN,bC as gN,bD as xN,bE as bN,bF as vN,bG as yN}from"./index-BkljfHxy.js";import{i as Af,n as _N}from"./ArrowUp-TsmTWJjN.js";import{u as Kl,a as ci,b as _s,r as Qy,d as f2,c as m2,p as LN,e as an,f as Zy,s as SN,g as wN,h as kN,i as jN,j as CN,k as NN,l as VN,m as p2,n as e6,T as TN,A as AN,o as PN,q as EN,t as RN,v as DN,w as MN,x as IN,y as ON,z as $N}from"./chat-context-CTC6stWi.js";import{c as g2,s as $u,g as $r,P as Ph,d as x2,t as Eh,a as BN,M as zN,i as FN,b as ji,e as Yc,f as UN,D as HN,h as KN,j as WN,k as Rc,l as qN,m as GN,u as Pf,E as YN,n as Bu,o as JN,F as XN,p as Ef,q as Rf,r as t6,S as QN,v as ZN,w as eV,x as tV,y as wx,z as sV,A as s6,O as nV,B as kx,C as Qi,G as iV,T as Mr,H as rV,I as rr,J as Po,K as pm,L as gm,N as n6,Q as oV,R as i6,U as lV,V as di,W as aV,X as cV,Y as r6,Z as Nr,_ as dV,$ as uV,a0 as o6,a1 as fl,a2 as jx,a3 as hV,a4 as fV,a5 as Cx,a6 as mV,a7 as bu,a8 as Wl,a9 as cr,aa as Rh,ab as b2,ac as v2,ad as pV,ae as gV,af as xV,ag as bV,ah as vV,ai as yV,aj as _V,ak as Df,al as l6,am as a6,an as c6,ao as LV,ap as d6,aq as SV,ar as wV,as as kV,at as jV,au as zu,av as CV,aw as NV,ax as VV,ay as TV}from"./automation-runs-DLjirUtq.js";import{c as ms,d as Gt,b as Ft,D as Ut,h as Tn,e as Yn,i as AV}from"./dialog-1xIvEVWS.js";import{c as PV,b as y2,a as _2,D as L2,d as EV}from"./drawer-C-pTdfTV.js";import{C as RV}from"./collection-search-CO09NGkg.js";import{u as $s,a as DV}from"./use-mcp-client-Deaem8WO.js";import{a as ql,i as xm,S as Jc,b as MV,g as Dh,c as u6,R as IV,d as OV,W as $d,C as $V}from"./constants-DNuUCxmW.js";import{u as h6,g as Mf,l as bm}from"./use-mcp-prompts-C5IrmXgS.js";import{t as Ls,n as f6}from"./ChevronUp-DbYyUJ2c.js";import{t as BV,z as zV,a as Fu,w as FV,A as UV,b as S2,c as HV,d as w2,e as If,f as Of,u as m6,r as KV,g as WV}from"./hooks-Cv_l36vR.js";import{K as qV,a as p6,i as k2,r as GV,s as g6,u as Gl,o as YV,b as x6,f as JV}from"./shell-layout-tPdz54xh.js";import{u as Vs,a as Xc,b as b6,c as XV,d as QV}from"./use-virtual-mcp-12aBqy7V.js";import{a as v6,b as j2,d as Yl,c as $f,e as y6,f as _6,g as C2,u as L6,h as ZV,i as eT,j as N2,k as tT,l as sT,n as nT,s as S6,o as iT,p as rT,m as V2,q as oT,r as Dc,t as T2,v as t1,w as Nx,x as w6,y as s1,z as lT,A as aT}from"./use-navigate-to-agent-B-P_VAZF.js";import{i as mr,a as cT}from"./XCircle-waBvJxuW.js";import{t as Bf,l as k6,m as A2,j as tl,o as j6,p as C6,q as N6,A as Ur,r as V6,u as Mc,s as Hr,v as T6,w as Qc,x as dT,y as uT,c as A6,z as Mh,B as zf,g as vm,k as P6,C as hT,D as fT,h as E6,E as Ff,F as Jl,G as mT,H as P2,I as R6,J as D6,K as ym,L as n1,M as Vx,N as Uf,O as pT,P as gT,Q as xT,R as bT,S as vT,f as E2,T as R2,U as M6,V as I6,W as O6,X as $6,Y as yT,Z as D2,_ as _T,$ as Ci,a0 as Tx,a1 as LT,a2 as ST,d as B6,a3 as M2,a4 as Zc,a5 as Br,a6 as I2,a7 as Uu,a8 as wT,i as Hf,a9 as kT,aa as O2,ab as jT,ac as CT,ad as NT,ae as VT,af as TT,ag as AT,ah as Mo,ai as Ax,aj as z6,ak as PT,al as ET,am as Vl,an as Px,ao as RT,ap as DT,aq as MT,ar as F6,as as IT,at as U6,au as OT,av as $T,aw as BT,ax as zT,ay as Zd,az as FT,aA as UT,aB as H6,aC as $2,aD as HT,aE as KT,n as WT,aF as qT,aG as GT}from"./agent-icon-CUm4oB7y.js";import{i as zt}from"./Check-grvRnT6d.js";import{a as li}from"./Image01-BmysQdds.js";import{i as Jn}from"./Upload01-BCzsausn.js";import{i as yn}from"./AlertCircle-DA1cEHVG.js";import{a as vn}from"./Copy01-DC15dYeZ.js";import{F as _m,a as B2,b as z2,c as F2,d as K6}from"./form-DLHM0IAy.js";import{d as Ot,S as ks,a as js,b as Ds,c as Cs}from"./select-DqJyZyIQ.js";import{i as Kf}from"./ArrowLeft-Br9KqDZP.js";import{T as wl,a as Xl,b as ni,c as ed}from"./tabs-C9EAqZz9.js";import{t as Lm,i as U2}from"./Tool02-CSZTEjDX.js";import{T as Wf,a as Ic}from"./toggle-group-Diuss92s.js";import{I as kt}from"./input-CYJ7J22n.js";import{u as H2,A as W6,l as YT,b as q6,m as JT,n as XT,o as QT,q as G6,a as ZT,e as Sm,r as wm,p as eA,v as tA,s as sA,w as nA,x as iA,y as rA,z as oA,B as Ex,C as lA,D as aA,E as Rx,F as cA,S as or,G as dA,H as uA,I as hA,h as fA,c as K2,J as Uo,K as fn,T as Gn,t as W2,L as q2,f as km,M as Y6,N as Hu,O as G2,Q as Ku,R as mA,U as J6,V as jm,W as X6,X as pA,Y as gA,Z as xA,_ as bA,$ as vA,a0 as yA,a1 as _A,a2 as LA,a3 as SA,a4 as wA,a5 as Q6,a6 as kA,i as jA,g as CA,a7 as NA,a8 as VA,a9 as TA,aa as Cm,ab as Dx,ac as AA,ad as PA,ae as EA,af as RA,ag as DA,ah as qf,ai as MA,aj as IA}from"./task-route-_ESOOTZi.js";import{s as Ni,i as Y2,c as Z6}from"./XClose-D87Tx9wT.js";import{M as OA,a as $A,m as Gf,i as BA,g as e8,b as zA,N as FA,c as UA}from"./select-model-BsGv2vyu.js";import{a as ds,b as hs,P as fs,c as HA}from"./popover-mZ_x_ILZ.js";import{t as zr}from"./Stars01-CWhfbfaB.js";import{b as KA,a as t8,u as Yf,c as s8,d as WA}from"./use-organization-settings-CwdP6bUS.js";import{u as Jf,a as qA}from"./use-ai-providers-CWtvyrT-.js";import{g as n8,c as i8,u as td,b as bn,L as Xf,P as r8,s as o8,a as GA,f as YA,d as JA}from"./project-icon-BBqdk5OE.js";import{f as XA,a as QA,u as vu,b as Wu,c as l8,d as ZA,e as J2,g as a8,h as X2,i as eP,j as Q2,k as yu,l as c8,m as tP,n as d8,o as sP}from"./folder-icon-DXofXja-.js";import{c as Ht,D as Kt,b as Wt,a as Ze,d as Zi,e as er,f as tr,g as Ih,h as Io,i as jc,j as yd}from"./dropdown-menu-Dm9zz_PI.js";import{i as Z2}from"./Link01-pXyMJR2J.js";import{s as Yt}from"./Plus-BIAtk7db.js";import{p as nP,q as iP}from"./question-004-sINsf4GQ.js";import{A as Ks}from"./avatar-Cqr4rNtI.js";import{u as Qf,a as eg}from"./use-members-Cv__v2oz.js";import{i as qs}from"./ChevronRight-gw9dm0MJ.js";import{u as sd}from"./use-is-desktop-app-BNujXJc_.js";import{a as pr,u as qu}from"./use-panel-navigate-BRmpjsHj.js";import{i as gr}from"./CheckCircle-W70-Hp-u.js";import{I as so}from"./integration-icon-kfJeGcu4.js";import{e as Gu}from"./backoff-CrEUbyZT.js";import{u as rP}from"./use-status-sounds-CkzzANKj.js";import{E as Vi}from"./empty-state-Z33ir3je.js";import{g as sl,r as u8}from"./github-repo-COLY3wWI.js";import{T as oP}from"./toolbar-BWOWuYdi.js";import{i as Ho,n as lP,a as aP}from"./Share07-BUu5_15N.js";import{i as An}from"./Globe01-B1lfl4nW.js";import{i as h8}from"./Monitor01-VQD1wr6O.js";import{u as Ti,a as tg,b as sg}from"./use-connection-Uyph_H8d.js";import{g as f8}from"./types-B-HpXlbf.js";import{F as Ko}from"./file-type-icon-Dl9zrC0W.js";import{f as m8,d as Yu,s as ng,c as cP,b as dP}from"./TrendUp01-CYPVBoFc.js";import{i as Ai}from"./ZoomOut-NYNe_Z4v.js";import{i as sr}from"./GitBranch01-5KhVbuOf.js";import{a as ig}from"./Package-D8xZrFk4.js";import{n as _u}from"./Download01-C92aqGYG.js";import{n as mn}from"./LinkExternal01-CqwZLC94.js";import{D as vl}from"./use-destination-route-DLsn9uXe.js";import{g as uP,s as hP,d as p8,a as fP,F as g8,b as x8,f as b8,S as v8,c as mP}from"./skill-preview-C-lpKGFK.js";import{i as Zf}from"./Key01-BHRixQVB.js";import{p as rg,b as un,s as Oc,H as Lu,h as Su,a as ac,c as y8,d as _8}from"./location-oTTXFrSF.js";import{m as pP,a as gP,M as nd,b as xP,O as bP}from"./markdown-D7QuNT69.js";import{p as vP,f as yP}from"./pt-BR-CLy76QW2.js";import{g as _P,e as LP}from"./extract-connection-data-C44EqyQK.js";import{a as SP,i as Mx}from"./mcp-oauth-dGHhlLy0.js";import{A as Kr,a as Wr,b as qr,c as Gr,d as Yr,e as Jr,f as Xr,g as Qr}from"./alert-dialog-C51iVTPN.js";import{T as Wo}from"./textarea-90AQXVh4.js";import{i as Tl}from"./Play-CyYcbqou.js";import{s as on}from"./Trash01-D1GpJcjK.js";import{u as Oh}from"./use-debounced-autosave-DS1yKwxh.js";import{S as Ql}from"./scroll-area-0nfzfnAs.js";import{i as wu}from"./SearchMd-D6yqdaba.js";import{C as id}from"./checkbox-DtN6Dr54.js";import{S as e9}from"./search-input-CIki-uxf.js";import{C as L8}from"./collection-tabs-cr1701fJ.js";import{T as S8,u as w8}from"./use-mcp-auth-status-HMnG1EUf.js";import{g as wP}from"./connection-slug-CITJ0kGN.js";import{a as kP,i as jP}from"./Settings02-Dmn9Uagb.js";import{L as Mt}from"./label-BSeVlzkX.js";import{S as ii}from"./switch-CZqeYbje.js";import{s as k8}from"./slugify-CEUa2lfQ.js";import{d as rd}from"./delay-CnY5UFtP.js";import{G as _n,a as Ju,u as CP}from"./github-repo-picker-BIbCpUFZ.js";import{s as j8}from"./User01-DpOHQvBN.js";import{t as t9}from"./Users01-Di41qDP0.js";import{u as C8,a as N8}from"./use-secrets--00GbFn8.js";import{C as NP,a as VP,b as TP}from"./client-icons-C1w3IsHJ.js";import{g as Vn}from"./get-initials-D-f_fDFw.js";import{S as as,D as V8,C as T8,R as AP,a as PP,i as A8,n as EP,b as RP}from"./task-board-7HRng9a2.js";import{a as od}from"./format-time-BnbuEtat.js";import{u as P8,d as DP,c as MP,C as og,a as IP}from"./connect-layout-CrHWsBPn.js";import{l as E8,g as OP}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{u as lg,a as $P,b as BP}from"./use-tags-k_sYBsNz.js";import{B as zP,a as FP,b as Ix,c as UP,d as HP,e as KP}from"./breadcrumb-CGLwazRA.js";import{u as i1}from"./use-copy-Cuzq782M.js";import{i as ag,a as WP,c as qP,b as GP}from"./UserSquare-BncQsikh.js";import{C as Di,a as ui,b as hi,c as Bn,d as us,e as Es,f as YP,g as Ox}from"./command-A0s0uPHt.js";import{u as JP}from"./use-org-auth-client-DWweu3ja.js";import{i as s9}from"./ChevronSelectorVertical-CZ_XnnrO.js";import{a as XP}from"./authenticate-and-persist-oauth-sBYdDIRi.js";import{w as $x}from"./editor-DuZZHVnS.js";import{T as Eo,p as R8,I as D8}from"./toolbar-icon-button-DnenepzG.js";import{u as Nm,C as QP,b as ZP,p as M8,a as eE,s as Vm,n as tE}from"./self-tool-result-BoZ6MFRP.js";import{M as ld}from"./monaco-editor-CC-Sqg8F.js";import{i as sE,a as n9,b as cg}from"./Tool01-Cy0ZGCil.js";import{a as Tm}from"./Palette-Bo_A8ldC.js";import{s as nE}from"./safe-image-url-D5z803Ot.js";import{s as Xu}from"./Eye-BHvUcvRj.js";import{i as i9}from"./DotsVertical-DuImY45F.js";import{u as r9}from"./use-debounced-value-DJ0hN8gB.js";import{u as I8,a as dg}from"./use-file-configs-CHDaFO85.js";import{u as O8}from"./useInfiniteQuery-DiQVH8QR.js";import{i as dr}from"./Zap-Bz0lnET7.js";import{r as $8}from"./site-slug-uya6Wp4-.js";import{B as iE}from"./badge-CdD_S6_J.js";import{u as Qu,a as rE,b as oE,c as lE,d as aE}from"./use-automations-D9Y9jZ0Z.js";import{A as cE}from"./automation-list-row-Hqe9OUun.js";import{t as dE}from"./site-error--i37Vnuw.js";import{f as uE,p as hE,g as fE,u as mE,e as pE,a as gE,F as Zu,t as B8,S as xE,B as bE,b as z8,R as vE,c as yE}from"./cards-De2Tofte.js";function F8(t,e){const s=Ms(e);return _E({filters:{...t,status:"pending"}},s).length}function Bx(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function _E(t={},e){const s=Ms(e).getMutationCache(),n=A.useRef(t),i=A.useRef(null);return i.current===null&&(i.current=Bx(s,t)),A.useEffect(()=>{n.current=t}),A.useSyncExternalStore(A.useCallback(r=>s.subscribe(()=>{const l=PC(i.current,Bx(s,n.current));i.current!==l&&(i.current=l,EC.schedule(r))}),[s]),()=>i.current,()=>i.current)}const U8=Dt({connection_id:Re().describe("Connection ID"),selected_tools:ns(Re()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Re()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Re()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),r1=500,H8=200,ug=200,LE=200,SE=20,wE=50,kE=100,jE=20,CE=100,NE=50,VE=100,TE=50,AE=8192,K8=U8.extend({selected_tools:ns(Re()).max(r1).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Re()).max(r1).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Re()).max(r1).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),PE=Dt({connectionId:Re(),toolName:Re(),label:Re(),icon:Re().nullable().optional()}),EE=Dt({id:Re().describe("Stable id; used as React key and ?tab= value"),title:Re().describe("Tab label"),icon:Re().optional().describe("Optional lucide icon name"),view:Dt({type:Th("ext-app"),appId:Re(),args:gu(Re(),Vy()).optional()})}),W8=ai(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations"]),RE=ai(["on","off"]),DE=new Map([["manual","on"],["auto","on"]]),ME=ai(["on","off","manual","auto"]);function IE(t){if(!t)return null;const e=DE.get(t);return e||(t==="on"||t==="off"?t:null)}const OE=Dt({defaultMainView:Dt({type:Re(),id:Re().optional(),toolName:Re().optional()}).nullable().optional(),chatDefaultOpen:ar().nullable().optional(),cmsDefaultOpen:ar().nullable().optional(),cms:ME.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:ns(W8).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:ns(EE).max(jE).optional()});function e0(t){return IE(t?.cms)??"on"}function $E(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const zx=Dt({tileId:Re().optional(),connectionId:Re().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Re().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Re().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:gu(Re(),Vy()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:wi().int().positive().optional(),maxHeight:wi().int().positive().optional()}),BE=Dt({banner:Re().nullable().optional(),bannerColor:Re().nullable().optional(),icon:Re().nullable().optional(),themeColor:Re().nullable().optional(),pinnedViews:ns(PE).max(kE).nullable().optional(),layout:OE.nullable().optional(),homeTile:zx.nullable().optional(),homeTiles:ns(zx).max(SE).nullable().optional(),homePrompts:ns(Re()).max(wE).nullable().optional()}),t0=/^[A-Za-z_][A-Za-z0-9_]*$/,Fx=Re().min(1).regex(t0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),zE=DC("kind",[Dt({key:Fx,kind:Th("literal"),value:Re().max(AE)}),Dt({key:Fx,kind:Th("secret"),secretId:Re().min(1)})]),hg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,FE=Dt({host:Re().min(1).regex(hg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Re().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),UE=Dt({selected:Re().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Re().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Re().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:ns(zE).max(VE).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:ns(FE).max(TE).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),HE=Dt({url:Re().describe("GitHub repository URL"),owner:Re().describe("Repository owner"),name:Re().describe("Repository name"),installationId:wi().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Re().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),KE=ai(["agent-sandbox","local-api"]),WE={sandboxHandle:Re().describe("Provider-specific handle"),previewUrl:Re().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Re().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:wi().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Dt({packageManager:Re().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Re().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Re().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},q8=Dt(WE);function qE(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=q8.parse(i)}catch{}return s}const GE=gu(Re().describe("userId"),gu(Re().describe("branch"),RC(KE,q8))),YE=Dt({id:Re().describe("Stable identifier for this knowledge file"),name:Re().describe("File name shown in the UI"),kind:ai(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Re().describe("Org filesystem (Library) volume the file lives in"),path:Re().describe("Path within the volume"),url:Re().describe("Same-origin URL to read the file (display/download)"),contentType:Re().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:wi().nullable().optional().describe("File size in bytes"),addedAt:Re().describe("ISO timestamp when the file was attached")}),JE=ns(YE).max(CE).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),XE=ai(["smart","code-review","open"]),QE=XE.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),ZE=ar().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),eR=ar().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),tR=Re().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),sR=Dt({branch:Re().describe("Git branch backing this release"),name:Re().describe('User-facing name, e.g. "Black Friday 2026"'),color:Re().describe("Dot color token shown in the version switcher"),createdBy:Re().optional().describe("User ID who created the release"),createdAt:Re().optional().describe("ISO 8601 creation timestamp")}),nR=ns(sR).max(NE).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),iR=ar().nullable().optional().describe("Draft & Releases mode: gates the drafts UX (releases switcher, read-only production, publish-to-production). Off (default) keeps the classic branch/PR picker and post-publish behavior."),fg={instructions:Re().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:ns(Re()).max(ug).nullable().optional().describe("List of enabled plugin IDs"),subAgents:ns(Re()).max(LE).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:BE.nullable().optional().describe("UI customization settings"),sidebarViews:ns(W8).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:Th(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:HE.nullable().optional().describe("Linked GitHub repository"),runtime:UE.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:JE,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:QE,previewServerUrl:tR,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ar().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:ZE,releases:nR,draftsMode:iR,fastPreviewInPlace:eR},rR=Dt({id:Re().describe("Unique identifier"),title:Re().describe("Human-readable name"),description:Re().nullable().describe("Description"),icon:Re().nullable().describe("Icon URL"),created_at:Re().describe("Creation timestamp"),updated_at:Re().describe("Last update timestamp"),created_by:Re().describe("User ID who created this item"),updated_by:Re().optional().describe("User ID who last updated this item"),organization_id:Re().describe("Organization ID this item belongs to"),status:ai(["active","inactive"]).describe("Current status"),pinned:ar().describe("Whether this space is pinned to the sidebar"),metadata:Dt(fg).extend({instructions:Re().nullable().describe("Instructions also used as system prompt"),sandboxMap:GE.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:ns(U8).describe("Connections with their selected tools, resources, and prompts")}),G8=Dt({title:Re().min(1).max(120).describe("Short label shown on the chip"),description:Re().max(280).optional().describe("One-line subtitle shown under the title"),text:Re().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Dt({title:Re().min(1).max(255).describe("Name for the virtual MCP"),description:Re().max(500).nullable().optional().describe("Optional description"),icon:Re().nullish().describe("Optional icon URL"),status:ai(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ar().optional().default(!1).describe("Pin to sidebar"),metadata:Dt(fg).extend({enabled_plugins:ns(Re()).max(ug).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(K8).max(H8).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:ns(G8).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Dt({title:Re().min(1).max(255).optional().describe("New name"),description:Re().max(500).nullable().optional().describe("New description (null to clear)"),icon:Re().nullish().describe("New icon URL"),status:ai(["active","inactive"]).optional().describe("New status"),pinned:ar().optional().describe("Pin/unpin from sidebar"),metadata:Dt(fg).extend({enabled_plugins:ns(Re()).max(ug).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(K8).max(H8).optional().describe("New connections (replaces existing)"),prompts:ns(G8).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function Ux(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const oR=["dev","start"],Hx=3,Y8="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",lR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function J8(t){const e=U.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const w=$r(c._meta);d=c.title??x2(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const u=d,h=c.description||null;if(a==="card"){let w;e[4]!==n||e[5]!==c?(w=()=>n(c),e[4]=n,e[5]=c,e[6]=w):w=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let V;e[7]!==j||e[8]!==C?(V=ae(lR,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=V):V=e[9];let N;e[10]!==u?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=N):N=e[11];let T;e[12]!==i?(T=i&&o.jsx(st,{size:"xs"}),e[12]=i,e[13]=T):T=e[13];let P;e[14]!==N||e[15]!==T?(P=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,T]}),e[14]=N,e[15]=T,e[16]=P):P=e[16];let E;e[17]!==h?(E=h&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=E):E=e[18];let R;return e[19]!==P||e[20]!==E||e[21]!==w||e[22]!==k||e[23]!==V?(R=o.jsxs("button",{type:"button",onClick:w,disabled:k,className:V,children:[P,E]}),e[19]=P,e[20]=E,e[21]=w,e[22]=k,e[23]=V,e[24]=R):R=e[24],R}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=r||i,p=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ae(Y8,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=o.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let y;e[33]!==i?(y=i&&o.jsx(st,{size:"xs"}),e[33]=i,e[34]=y):y=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==y?(_=o.jsx(He,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,y]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=y,e[40]=_):_=e[40];const L=h??u;let v;e[41]!==L?(v=o.jsx(Ke,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=v):v=e[42];let S;return e[43]!==_||e[44]!==v?(S=o.jsxs(We,{delayDuration:400,children:[_,v]}),e[43]=_,e[44]=v,e[45]=S):S=e[45],S}function aR(t){const e=U.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=ce(),[c,d]=A.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(N=>{const T=c.toLowerCase();return N.prompt.name.toLowerCase().includes(T)||(N.prompt.title??"").toLowerCase().includes(T)||(N.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Hl();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==r){let N;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==r?(N=T=>o.jsx(J8,{item:T,variant:"card",onSelect:P=>{i(!1),r(P)},isLoading:l?.name===T.prompt.name,isDisabled:u&&l?.name!==T.prompt.name},T.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=f.map(N),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let y;e[21]!==a?(y=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=N=>{N.key==="Escape"&&d("")},e[23]=_):_=e[23];let L;e[24]!==c||e[25]!==y?(L=o.jsx(RV,{value:c,onChange:d,placeholder:y,onKeyDown:_}),e[24]=c,e[25]=y,e[26]=L):L=e[26];const v=L;if(m){let N;e[27]!==a?(N=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=N):N=e[28];let T;e[29]!==N?(T=o.jsx(PV,{className:"sr-only",children:o.jsx(y2,{children:N})}),e[29]=N,e[30]=T):T=e[30];let P;e[31]!==a?(P=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=P):P=e[32];let E;e[33]!==P?(E=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:P})}),e[33]=P,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==v||e[37]!==E||e[38]!==T?(R=o.jsxs(_2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,E,v,b]}),e[35]=b,e[36]=v,e[37]=E,e[38]=T,e[39]=R):R=e[39];let M;return e[40]!==i||e[41]!==n||e[42]!==R?(M=o.jsx(Fo,{delayDuration:400,children:o.jsx(L2,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=M):M=e[43],M}let S;e[44]!==a?(S=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=S):S=e[45];let w;e[46]!==S?(w=o.jsx(ms,{className:"sr-only",children:o.jsx(Gt,{children:S})}),e[46]=S,e[47]=w):w=e[47];let k;e[48]!==a?(k=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==v||e[54]!==j||e[55]!==w?(C=o.jsxs(Ft,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,j,v,b]}),e[52]=b,e[53]=v,e[54]=j,e[55]=w,e[56]=C):C=e[56];let V;return e[57]!==i||e[58]!==n||e[59]!==C?(V=o.jsx(Fo,{delayDuration:400,children:o.jsx(Ut,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=V):V=e[60],V}function cR(t){const e=U.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=ce(),[a,c]=A.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,Hx),y=s.slice(Hx),_=!!i;let L;e[10]!==_||e[11]!==i?.name||e[12]!==n?(L=S=>o.jsx(J8,{item:S,onSelect:n,isLoading:i?.name===S.prompt.name,isDisabled:_&&i?.name!==S.prompt.name},S.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=L):L=e[13];const v=b.map(L);d=Fo,m=400,e[14]!==r?(u=ae("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=u):u=e[15],h=v,f=y.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:ae(Y8,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:y.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=o.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(aR,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function dR(){return null}function uR(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function hR(t){const e=U.c(31),{connectionId:s}=t,n=ce(),{sendMessage:i}=ci(),{org:r}=Fe();let l;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=$s(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=h6(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(fR),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=A.useReducer(uR,p),[b,y]=A.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(P,E)=>{if(!a){xe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await Mf(a,P.name,E);x({type:"RESET"});const M={type:"doc",content:[{type:"paragraph",content:[g2({id:P.name,name:$u(P.name,$r(P._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(M)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),xe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=_):_=e[14];const L=_;let v;e[15]!==L?(v=async P=>{if(P.arguments&&P.arguments.length>0){x({type:"SELECT_PROMPT",prompt:P}),y(P);return}x({type:"START_LOADING",prompt:P}),await L(P)},e[15]=L,e[16]=v):v=e[16];const S=v;let w;e[17]!==b||e[18]!==L?(w=async P=>{b&&(x({type:"START_LOADING",prompt:b,arguments:P}),y(null),await L(b,P))},e[17]=b,e[18]=L,e[19]=w):w=e[19];const k=w;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==S||e[21]!==m||e[22]!==j?(C=o.jsx(cR,{items:m,onSelect:S,loadingPrompt:j}),e[20]=S,e[21]=m,e[22]=j,e[23]=C):C=e[23];let V;e[24]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{y(null),x({type:"RESET"})},e[24]=V):V=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(Ph,{prompt:b,setPrompt:V,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let T;return e[28]!==C||e[29]!==N?(T=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=T):T=e[30],T}function fR(t){return{prompt:t}}function mR(t){const e=U.c(13),{className:s}=t,{selectedVirtualMcp:n}=Kl(),{org:i}=Fe();let r;e[0]!==i.id?(r=ql(i.id),e[0]=i.id,e[1]=r):r=e[1];const l=r.id,a=n?.id??l;let c;e[2]!==s?(c=ae("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(dR,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=o.jsx(hR,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=o.jsx(rn,{fallback:null,children:o.jsx(A.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const o1="cubic-bezier(0.645, 0.045, 0.355, 1)",pR=44,gR={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},xR={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},bR={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function qo(t){const e=U.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=ce(),[p,g]=A.useState(d),[x,b]=A.useState(!1);let y;e[0]!==h?(y=()=>{b(!0),h?.()},e[0]=h,e[1]=y):y=e[1];const _=y;if(x)return null;const L=xR[f],v=gR[f];let S;e[2]!==L||e[3]!==v?(S=ae("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,v),e[2]=L,e[3]=v,e[4]=S):S=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(vR),e[5]=w):w=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=ae("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const V=bR[f];let N;e[9]!==V?(N=ae("shrink-0",V),e[9]=V,e[10]=N):N=e[10];let T;e[11]!==s||e[12]!==N?(T=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=T):T=e[13];let P;e[14]!==n?(P=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=P):P=e[15];let E;e[16]!==i?(E=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const R=p?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==R?(M=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(Ls,{size:16,style:{transform:R,transition:`transform 180ms ${o1}`}})}),e[18]=R,e[19]=M):M=e[19];let I;e[20]!==m?(I=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=D):D=e[23];let $,O;e[24]!==_?($=re=>{re.stopPropagation(),_()},O=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),re.stopPropagation(),_())},e[24]=_,e[25]=$,e[26]=O):($=e[25],O=e[26]);let B;e[27]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(Ws,{size:16}),e[27]=B):B=e[27];let F;e[28]!==I||e[29]!==D||e[30]!==$||e[31]!==O?(F=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":I,title:D,onClick:$,onKeyDown:O,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:B}),e[28]=I,e[29]=D,e[30]=$,e[31]=O,e[32]=F):F=e[32];let z;e[33]!==p||e[34]!==T||e[35]!==P||e[36]!==E||e[37]!==M||e[38]!==F||e[39]!==C?(z=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:w,className:C,children:[T,P,E,M,F]}),e[33]=p,e[34]=T,e[35]=P,e[36]=E,e[37]=M,e[38]=F,e[39]=C,e[40]=z):z=e[40];const W=p?"1fr":"0fr";let K;e[41]!==W?(K={display:"grid",gridTemplateRows:W,transition:`grid-template-rows 180ms ${o1}`},e[41]=W,e[42]=K):K=e[42];let H;e[43]===Symbol.for("react.memo_cache_sentinel")?(H={overflow:"hidden",minHeight:0},e[43]=H):H=e[43];const q=p?1:0;let G;e[44]!==q?(G={opacity:q,transition:`opacity 120ms ${o1}`,maxHeight:"60vh"},e[44]=q,e[45]=G):G=e[45];let Q;e[46]!==r?(Q=r?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:r})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=r,e[47]=Q):Q=e[47];let se;e[48]!==c||e[49]!==r?(se=c?o.jsx("div",{className:ae("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=se):se=e[50];let Z;e[51]!==Q||e[52]!==se?(Z=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[Q,se]}),e[51]=Q,e[52]=se,e[53]=Z):Z=e[53];let te;e[54]!==l||e[55]!==a?(te=l||a?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:l}),o.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=te):te=e[56];let X;e[57]!==G||e[58]!==Z||e[59]!==te?(X=o.jsx("div",{style:H,children:o.jsxs("div",{className:"flex flex-col",style:G,children:[Z,te]})}),e[57]=G,e[58]=Z,e[59]=te,e[60]=X):X=e[60];let Y;e[61]!==K||e[62]!==X?(Y=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:X}),e[61]=K,e[62]=X,e[63]=Y):Y=e[63];let de;return e[64]!==z||e[65]!==Y||e[66]!==S||e[67]!==f?(de=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:S,children:[z,Y]}),e[64]=z,e[65]=Y,e[66]=S,e[67]=f,e[68]=de):de=e[68],de}function vR(t){return!t}const yR=Dt({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:ai(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),X8=Dt({todos:ns(yR)}),_R="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";BV({description:_R,inputSchema:zV(X8),execute:async({todos:t})=>({ok:!0,count:t.length})});const LR="tool-todo_write",SR=new Set(["input-available","output-available"]);function wR(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const r=n[i];if(r.type!==LR||typeof r.state!="string"||!SR.has(r.state))continue;const l=X8.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function Q8(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Eh(BN(n)),input:s.input})}return e}function Z8(t){return t.at(-1)}function e7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function kR(t){return t?t.message.startsWith("[CREDITS]"):!1}const jR="[SUBSCRIPTION_REQUIRED]";function t7(t){return t?.message.startsWith(jR)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const CR={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function NR(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&kR(s))return{...CR,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,h=e7(a),f=Q8(c),m=wR(e),p=i?null:t7(s),g=!i&&!!s&&!p,x=f.length>0||i&&r,b=h.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function s7(){const t=U.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ci(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==l||t[4]!==a?(c=NR({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function VR(){const t=s7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function n7(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const TR="__home__";function mg(t,e){return Vf.chatDraft(t,e)}function AR(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function i7(t,e,s,n,i){const r=mg(e,s);if(n7(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(ER(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Kx(t,e,s){const n=mg(e,s),i=t.getItem(n),r=AR(i);return i!==null&&r===null&&t.removeItem(n),r}function PR(t,e,s){t.removeItem(mg(e,s))}function ER(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Sn(t){const e=U.c(14),s=Vs(t),n=_s(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=LN(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,u=r?.metadata;let h;e[2]!==i||e[3]!==u?(h=Qy(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=f2(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=m2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function RR({virtualMcpId:t,variant:e="composer"}){const s=ce(),n=v6(t),[i,r]=A.useState(!1),l=async()=>{if(!i){r(!0);try{await n()}catch(a){xe.error(a instanceof Error?a.message:String(a))}finally{r(!1)}}};return o.jsxs("button",{type:"button",disabled:i,"aria-busy":i,onClick:()=>{l()},className:ae("group flex items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60",e==="composer"?"w-full":"mx-auto my-10 w-full max-w-md"),children:[o.jsx(Gc,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.input.productionReadOnly")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.input.startDraftToEdit")})]}),o.jsx(mr,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}function DR(t){const e=U.c(30),{current:s,total:n,onPrev:i,onNext:r}=t,l=ce();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ae("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==l?(u=l("chat.pagination.previousLabel"),e[2]=l,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Kf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=o.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":u,children:h}),e[5]=i,e[6]=a,e[7]=d,e[8]=u,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=o.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let y;e[16]!==b?(y=ae("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=y):y=e[17];let _;e[18]!==l?(_=l("chat.pagination.nextLabel"),e[18]=l,e[19]=_):_=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(mr,{size:14}),e[20]=L):L=e[20];let v;e[21]!==r||e[22]!==x||e[23]!==y||e[24]!==_?(v=o.jsx("button",{type:"button",onClick:r,disabled:x,className:y,"aria-label":_,children:L}),e[21]=r,e[22]=x,e[23]=y,e[24]=_,e[25]=v):v=e[25];let S;return e[26]!==v||e[27]!==f||e[28]!==g?(S=o.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,v]}),e[26]=v,e[27]=f,e[28]=g,e[29]=S):S=e[29],S}function r7(t){const e=U.c(8),{currentIndex:s,total:n,onPrev:i,onNext:r,extraLeft:l}=t;let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n?(a=o.jsx(DR,{current:s,total:n,onPrev:i,onNext:r}),e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=o.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function MR(t){const e=U.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:r,submitLabel:l,nextLabel:a}=t,u=n?l===void 0?"Submit":l:a===void 0?"Next":a,h=n?s:!i,f=h?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==h||e[1]!==r?(m=()=>{h||r()},e[0]=h,e[1]=r,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ae("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==g?(x=o.jsx(fe,{type:"button",size:"sm","aria-disabled":h,onClick:m,className:g,children:u}),e[5]=h,e[6]=u,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let y;e[10]!==b?(y=o.jsx(He,{asChild:!0,children:b}),e[10]=b,e[11]=y):y=e[11];let _;e[12]!==f?(_=o.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;return e[14]!==y||e[15]!==_?(L=o.jsxs(We,{children:[y,_]}),e[14]=y,e[15]=_,e[16]=L):L=e[16],L}function o7(t,e,s){return t.findIndex(n=>e(n)===s)}function Wx(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function qx(t,e,s,n,i){if(t.length===0)return null;const r=o7(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(r+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function IR(t){return!t.isStreaming&&t.allAnswered}function l7(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:r,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=A.useState(c),[h,f]=A.useState(!1),m=a2({resolver:Ty(n),defaultValues:i}),p=m.watch(),g=o7(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),y=Wx(e,s,p,l),_=IR({isStreaming:r,allAnswered:y}),L=()=>{if(g>0){const V=e[g-1];V&&u(s(V))}},v=()=>{if(g>=0&&g<e.length-1){const V=e[g+1];V&&u(s(V))}},S=()=>{const V=m.getValues(),N=qx(e,s,V,l,d);N&&u(N)},w=()=>{m.handleSubmit(V=>{const N=V;for(const T of e)a(T,N[s(T)])})()},k=A.useRef(w);k.current=w;const j=()=>{_&&(f(!1),k.current())},C=()=>{const V=m.getValues();if(Wx(e,s,V,l)){if(r){f(!0);return}f(!1),k.current()}else{const N=qx(e,s,V,l,d);N&&u(N)}};return A.useEffect(()=>{if(h&&!r){if(!y){f(!1);return}f(!1),k.current()}},[h,r,y]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:y,canSubmit:_,goPrev:L,goNext:v,advanceToNextUnanswered:S,submit:j,submitOrAdvance:C}}const a7="chat.approval.defaultDenyReason";function c7(t){const e=U.c(36),{onYolo:s}=t,n=ce(),[i,r]=fr();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n){const L=xl.find(w=>w.value===i.toolApprovalLevel)??xl[0];let v;e[13]!==s||e[14]!==i||e[15]!==r?(v=w=>{const k=w,j=i.toolApprovalLevel??"readonly";r({...i,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=r,e[16]=v):v=e[16];const S=v;c=ks,m=i.toolApprovalLevel,p=S,a=js,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=OR,l=Ds,d=n(L.shortKey),e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],u=e[8],h=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=o.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==g?(x=o.jsx(a,{size:u,className:h,onClick:f,children:g}),e[20]=a,e[21]=u,e[22]=h,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=xl.map(L=>o.jsx(Ot,{value:L.value,children:n(L.labelKey)},L.value)),e[26]=n,e[27]=b):b=e[27];let y;e[28]!==b?(y=o.jsx(Cs,{children:b}),e[28]=b,e[29]=y):y=e[29];let _;return e[30]!==c||e[31]!==y||e[32]!==m||e[33]!==p||e[34]!==x?(_=o.jsxs(c,{value:m,onValueChange:p,children:[x,y]}),e[30]=c,e[31]=y,e[32]=m,e[33]=p,e[34]=x,e[35]=_):_=e[35],_}function OR(t){return t.stopPropagation()}function d7(t){const e=U.c(8),{input:s}=t,n=ce();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=o.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let r;return e[6]!==i?(r=o.jsx("div",{className:"px-4",children:o.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[6]=i,e[7]=r):r=e[7],r}function $R(t){const e=U.c(38),{approval:s,onRespond:n}=t,i=ce(),[r]=fr(),l=r.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(a7),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const u=d;let h;e[9]!==s.approvalId||e[10]!==n?(h=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=h):h=e[11];const f=h;let m;e[12]!==f?(m=o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(c7,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=o.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let y;e[21]!==u||e[22]!==b?(y=o.jsx(fe,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:b}),e[21]=u,e[22]=b,e[23]=y):y=e[23];let _;e[24]!==x||e[25]!==y?(_=o.jsxs(o.Fragment,{children:[x,y]}),e[24]=x,e[25]=y,e[26]=_):_=e[26];const L=_;let v;e[27]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Bf,{size:14}),e[27]=v):v=e[27];let S;e[28]!==i?(S=i("chat.approval.needsApproval"),e[28]=i,e[29]=S):S=e[29];let w;e[30]!==s.input?(w=o.jsx(d7,{input:s.input}),e[30]=s.input,e[31]=w):w=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==S||e[36]!==w?(k=o.jsx(qo,{icon:v,label:S,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:w}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=S,e[36]=w,e[37]=k):k=e[37],k}const BR=gu(Re(),Dt({approved:ar().optional(),levelOverride:ai(["auto","readonly"]).optional()}));function zR(t){const e=U.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,r=ce(),[l]=fr(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(HR)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==r?(u=(N,T)=>{const P=T;typeof P?.approved=="boolean"&&i(N.approvalId,P.approved,P.approved===!1?r(a7):void 0,P.levelOverride??a)},e[2]=a,e[3]=i,e[4]=r,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:UR,schema:BR,defaultValues:d,isStreaming:n,hasAnswer:FR,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=l7(h);let m;e[11]!==s||e[12]!==f?(m=N=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:N}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=N=>{N.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Bf,{size:14}),e[16]=y):y=e[16];let _;e[17]!==s.length||e[18]!==r?(_=r("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=r,e[19]=_):_=e[19];const L=g?.friendlyName??"";let v;e[20]!==p?(v=o.jsx(c7,{onYolo:p}),e[20]=p,e[21]=v):v=e[21];let S;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==v?(S=o.jsx(r7,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:v}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=v,e[27]=S):S=e[27];let w;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(w=g?o.jsx(KR,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=w):w=e[31];let k;e[32]!==g?(k=g?o.jsx(d7,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==S||e[35]!==w||e[36]!==k||e[37]!==_||e[38]!==L?(j=o.jsx(qo,{icon:y,label:_,title:L,defaultExpanded:!0,footerLeft:S,footerRight:w,children:k}),e[34]=S,e[35]=w,e[36]=k,e[37]=_,e[38]=L,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==b?(C=o.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=C):C=e[42];let V;return e[43]!==f.form||e[44]!==C?(V=o.jsx(_m,{...x,children:C}),e[43]=f.form,e[44]=C,e[45]=V):V=e[45],V}function FR(t){return typeof t?.approved=="boolean"}function UR(t){return t.approvalId}function HR(t){return[t.approvalId,{approved:void 0}]}function KR(t){const e=U.c(7),{approvalId:s,control:n,onChange:i}=t,r=ce(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==r?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return o.jsxs(o.Fragment,{children:[o.jsx(fe,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),i()},"aria-pressed":f,children:r("chat.approval.denyButton")}),o.jsx(fe,{type:"button",variant:h?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),i()},"aria-pressed":h,children:r("chat.approval.acceptButton")})]})},e[0]=i,e[1]=r,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=o.jsx(vs,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function WR(){const t=U.c(5),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Bf,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function qR(t){const e=U.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(WR,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=o.jsx($R,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let r;return e[4]!==s||e[5]!==n||e[6]!==i?(r=o.jsx(zR,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function GR(t){const e=U.c(28),{plan:s,onApprove:n,onDismiss:i}=t,r=ce();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==r?(c=r("chat.proposePlan.keepIterating"),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=o.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==r?(u=r("chat.proposePlan.letsGo"),e[8]=r,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=o.jsx(fe,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:u}),e[10]=a,e[11]=u,e[12]=h):h=e[12];let f;e[13]!==d||e[14]!==h?(f=o.jsxs(o.Fragment,{children:[d,h]}),e[13]=d,e[14]=h,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(k6,{size:14}),e[16]=p):p=e[16];let g;e[17]!==r?(g=r("chat.proposePlan.planReady"),e[17]=r,e[18]=g):g=e[18];let x;e[19]!==r?(x=r("chat.proposePlan.implementationPlan"),e[19]=r,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=o.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:o.jsx(zN,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let y;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(y=o.jsx(qo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=y):y=e[27],y}function YR(t){const e=U.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let r;e[0]!==s?(r=Z8(s),e[0]=s,e[1]=r):r=e[1];const l=r;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=o.jsx(GR,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function u7(t){return t?"response"in t?t.response:t.option??t.draft:""}const Gx=Dt({response:Re().min(1,"Response is required")}),JR=Dt({option:Re().nullable(),draft:Re()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),XR=Dt({response:ai(["yes","no"])});function QR(t){switch(t.type){case"text":return Gx;case"choice":return JR;case"confirm":return XR;default:return Gx}}function ZR(t){const e={};for(const s of t)e[s.toolCallId]=QR(s.input);return Dt(e)}function eD(t){const e=U.c(7),{control:s,name:n,placeholder:i}=t,r=ce();let l;e[0]!==i||e[1]!==r?(l=c=>{const{field:d}=c,u=d.value??"";return o.jsxs(B2,{children:[o.jsx(z2,{children:o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(A2,{size:16,className:"text-muted-foreground"})}),o.jsx("input",{...d,value:u,type:"text",placeholder:i||r("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":r("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),o.jsx(F2,{})]})},e[0]=i,e[1]=r,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=o.jsx(K6,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function h7(t,e){const s=U.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const r=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),A.useEffect(n,i)}function tD(t){const e=U.c(51),{control:s,name:n,options:i}=t,r=ce(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=_x(a),d=`${n}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:h}=_x(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=R=>{const M=i[R];M!=null&&c.onChange(M)},e[6]=c,e[7]=i,e[8]=p):p=e[8],h7(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==r?(x=r("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=r,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==r){let R;e[16]!==c||e[17]!==f||e[18]!==r?(R=(M,I)=>{const D=f===M;return o.jsxs("button",{type:"button",onClick:()=>c.onChange(M),className:ae("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",D&&"bg-accent/50",!D&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.selectOption",{option:M}),children:[o.jsx("span",{className:ae("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",D?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),o.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${I}-${M}`)},e[16]=c,e[17]=f,e[18]=r,e[19]=R):R=e[19],b=i.map(R),e[11]=c,e[12]=f,e[13]=i,e[14]=r,e[15]=b}else b=e[15];const y=g&&"bg-accent/50",_=!g&&"hover:bg-accent/30";let L;e[20]!==y||e[21]!==_?(L=ae("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",y,_),e[20]=y,e[21]=_,e[22]=L):L=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(A2,{size:16,className:"text-muted-foreground"})}),e[23]=v):v=e[23];const S=g?m:"";let w;e[24]!==h||e[25]!==c||e[26]!==f?(w=R=>{h.onChange(R.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=w):w=e[27];let k;e[28]!==c||e[29]!==f?(k=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=r,e[32]=j):j=e[32];let C;e[33]!==r?(C=r("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=r,e[34]=C):C=e[34];let V;e[35]!==S||e[36]!==w||e[37]!==k||e[38]!==j||e[39]!==C?(V=o.jsx("input",{type:"text",value:S,onChange:w,onFocus:k,placeholder:j,"aria-label":C,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=S,e[36]=w,e[37]=k,e[38]=j,e[39]=C,e[40]=V):V=e[40];let N;e[41]!==L||e[42]!==V?(N=o.jsxs("label",{className:L,children:[v,V]}),e[41]=L,e[42]=V,e[43]=N):N=e[43];let T;e[44]!==N||e[45]!==x||e[46]!==b?(T=o.jsx(z2,{children:o.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,N]})}),e[44]=N,e[45]=x,e[46]=b,e[47]=T):T=e[47];let P;e[48]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(F2,{}),e[48]=P):P=e[48];let E;return e[49]!==T?(E=o.jsxs(B2,{children:[T,P]}),e[49]=T,e[50]=E):E=e[50],E}function sD(t){const e=U.c(8),{control:s,name:n}=t,i=ce();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=["yes","no"],e[0]=r):r=e[0];const l=r,a=A.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{a.current?.onChange(l[h]??"")},e[1]=c):c=e[1],h7(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,o.jsxs(B2,{children:[o.jsx(z2,{children:o.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=f.value===m;return o.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ae("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[o.jsx("span",{className:ae("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),o.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),o.jsx(F2,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=o.jsx(K6,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}function Yx(t){const e=U.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const r=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==r?(l=o.jsx(eD,{control:n,name:r,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=r,e[3]=l):l=e[3],l}case"choice":{let r;e[4]!==s.options?(r=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=r):r=e[5];const l=r;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=o.jsx(tD,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const r=`${i}.response`;let l;return e[10]!==n||e[11]!==r?(l=o.jsx(sD,{control:n,name:r}),e[10]=n,e[11]=r,e[12]=l):l=e[12],l}default:return null}}function nD(t){const e=U.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=ZR(s.map(lD)),e[0]=s,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=Object.fromEntries(s.map(oD)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(O,B)=>{const F=u7(B);F&&i(O,F)},e[4]=i,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(u={parts:s,partKey:rD,schema:l,defaultValues:c,isStreaming:n,hasAnswer:iD,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=u):u=e[11];const h=l7(u),f=h.currentPart,m=ce();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const O=f;if(!O)return;const B=m("chat.userAskQuestion.skipMessage"),F=O.toolCallId;O.input?.type==="choice"?(h.form.setValue(`${F}.option`,null),h.form.setValue(`${F}.draft`,B)):h.form.setValue(`${F}.response`,B),h.advanceToNextUnanswered()},e[12]=f,e[13]=h,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==h.currentIndex||e[17]!==h.goNext||e[18]!==h.goPrev||e[19]!==s.length?(x=o.jsx(r7,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext}),e[16]=h.currentIndex,e[17]=h.goNext,e[18]=h.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let y;e[21]!==m?(y=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=y):y=e[22];let _;e[23]!==g||e[24]!==y?(_=o.jsx(fe,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:y}),e[23]=g,e[24]=y,e[25]=_):_=e[25];let L;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(L=o.jsx(MR,{isStreaming:n,isAllAnswered:h.isAllAnswered,isCurrentAnswered:h.isCurrentAnswered,onAdvanceOrSubmit:h.submitOrAdvance}),e[26]=h.isAllAnswered,e[27]=h.isCurrentAnswered,e[28]=h.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let v;e[31]!==_||e[32]!==L?(v=o.jsxs(o.Fragment,{children:[_,L]}),e[31]=_,e[32]=L,e[33]=v):v=e[33];const S=v;if(s.length===1){const O=s[0];if(!O?.input)return null;const B=h.form;let F;e[34]!==h?(F=Z=>{Z.preventDefault(),h.submit()},e[34]=h,e[35]=F):F=e[35];let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Lm,{size:14}),e[36]=z):z=e[36];let W;e[37]!==m?(W=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=W):W=e[38];let K;e[39]!==O.input?.prompt||e[40]!==m?(K=O.input?.prompt??m("chat.userAskQuestion.question"),e[39]=O.input?.prompt,e[40]=m,e[41]=K):K=e[41];const H=O.input;let q;e[42]!==h.form.control||e[43]!==O.toolCallId||e[44]!==H?(q=o.jsx(Yx,{input:H,control:h.form.control,toolCallId:O.toolCallId}),e[42]=h.form.control,e[43]=O.toolCallId,e[44]=H,e[45]=q):q=e[45];let G;e[46]!==S||e[47]!==W||e[48]!==K||e[49]!==q?(G=o.jsx(qo,{icon:z,label:W,title:K,defaultExpanded:!0,footerRight:S,children:q}),e[46]=S,e[47]=W,e[48]=K,e[49]=q,e[50]=G):G=e[50];let Q;e[51]!==F||e[52]!==G?(Q=o.jsx("form",{onSubmit:F,autoComplete:"off",children:G}),e[51]=F,e[52]=G,e[53]=Q):Q=e[53];let se;return e[54]!==h.form||e[55]!==Q?(se=o.jsx(_m,{...B,children:Q}),e[54]=h.form,e[55]=Q,e[56]=se):se=e[56],se}const w=h.form;let k;e[57]!==h?(k=O=>{O.preventDefault(),h.submit()},e[57]=h,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Lm,{size:14}),e[59]=j):j=e[59];let C;e[60]!==m?(C=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=C):C=e[61];const V=h.currentIndex+1;let N;e[62]!==s.length||e[63]!==m||e[64]!==V?(N=m("chat.userAskQuestion.questionCount",{current:V,total:s.length}),e[62]=s.length,e[63]=m,e[64]=V,e[65]=N):N=e[65];let T;e[66]!==f?.input?.prompt||e[67]!==m?(T=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=T):T=e[68];const P=h.activeKey,E=h.setActiveKey;let R;if(e[69]!==h.form||e[70]!==s){let O;e[72]!==h.form?(O=B=>o.jsx(wl,{value:B.toolCallId,className:"mt-0",children:o.jsx(Yx,{input:B.input,control:h.form.control,toolCallId:B.toolCallId})},B.toolCallId),e[72]=h.form,e[73]=O):O=e[73],R=s.map(O),e[69]=h.form,e[70]=s,e[71]=R}else R=e[71];let M;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==R?(M=o.jsx(Xl,{value:P,onValueChange:E,children:R}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=R,e[77]=M):M=e[77];let I;e[78]!==b||e[79]!==S||e[80]!==C||e[81]!==N||e[82]!==T||e[83]!==M?(I=o.jsx(qo,{icon:j,label:C,count:N,title:T,defaultExpanded:!0,footerLeft:b,footerRight:S,children:M}),e[78]=b,e[79]=S,e[80]=C,e[81]=N,e[82]=T,e[83]=M,e[84]=I):I=e[84];let D;e[85]!==k||e[86]!==I?(D=o.jsx("form",{onSubmit:k,autoComplete:"off",children:I}),e[85]=k,e[86]=I,e[87]=D):D=e[87];let $;return e[88]!==h.form||e[89]!==D?($=o.jsx(_m,{...w,children:D}),e[88]=h.form,e[89]=D,e[90]=$):$=e[90],$}function iD(t){return!!u7(t)}function rD(t){return t.toolCallId}function oD(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function lD(t){return{toolCallId:t.toolCallId,input:t.input}}function aD(){const t=U.c(5),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Lm,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function f7(t){const e=U.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=s.filter(cD),e[0]=s,e[1]=r):r=e[1];const l=r;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(aD,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=o.jsx(nD,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function cD(t){return t.state==="input-available"}function dD(t){const e=t.filter(r=>r.status==="in_progress"),s=t.filter(r=>r.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function uD(t){const e=U.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=dD(s),e[0]=s,e[1]=n):n=e[1];const i=n;let r;e[2]!==i.icon?(r=o.jsx(pD,{status:i.icon}),e[2]=i.icon,e[3]=r):r=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(hD),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=o.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==r||e[11]!==d?(u=o.jsx(qo,{icon:r,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=r,e[11]=d,e[12]=u):u=e[12],u}function hD(t,e){return o.jsx(fD,{todo:t},e)}function fD(t){const e=U.c(14),{todo:s}=t,n=s.status==="completed",r=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=o.jsx(mD,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ae("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",u=n?"width 300ms ease 200ms":"width 150ms ease";let h;e[4]!==d||e[5]!==u?(h=o.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=h):h=e[6];let f;e[7]!==r||e[8]!==c||e[9]!==h?(f=o.jsxs("span",{className:c,children:[r,h]}),e[7]=r,e[8]=c,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=o.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,f]}),e[11]=l,e[12]=f,e[13]=m):m=e[13],m}function mD(t){const e=U.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("svg",{viewBox:"0 0 21 21",children:o.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=r):r=e[0];let l;return e[1]!==n||e[2]!==i?(l=o.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:r}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function pD(t){const e=U.c(13),{status:s}=t,n=ce();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:o.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=o.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=o.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let r;return e[11]!==i?(r=o.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=r):r=e[12],r}const gD={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},xD=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function m7(t){const e=U.c(65),{onDismiss:s}=t,{org:n}=Fe(),i=ln(),{decoKeyId:r}=H2(),l=ys(),a=ce(),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{qe("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),A.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async H=>{const{url:q}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:H,currency:f});return q},e[3]=f,e[4]=l,e[5]=b):b=e[5];let y;e[6]!==s?(y=H=>{H&&window.open(H,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=y):y=e[7];let _;e[8]!==a?(_=H=>{xe.error(a("chat.creditsExhaustedBanner.topupError",{error:H.message}))},e[8]=a,e[9]=_):_=e[9];let L;e[10]!==b||e[11]!==y||e[12]!==_?(L={mutationFn:b,onSuccess:y,onError:_},e[10]=b,e[11]=y,e[12]=_,e[13]=L):L=e[13];const{mutate:v,isPending:S}=Rs(L),w=parseFloat(c),k=!isNaN(w)&&w>=1;let j;e[14]!==s?(j=H=>!H&&s?.(),e[14]=s,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=C):C=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=V):V=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=N):N=e[18];let T;e[19]!==a?(T=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=T):T=e[20];let P;e[21]!==T?(P=o.jsx(Gt,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=P):P=e[22];let E;e[23]!==a?(E=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=E):E=e[24];let R;e[25]!==E?(R=o.jsx(Tn,{className:"mt-1.5 text-sm leading-relaxed",children:E}),e[25]=E,e[26]=R):R=e[26];let M;e[27]!==P||e[28]!==R?(M=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[V,o.jsxs(ms,{className:"relative gap-4",children:[N,o.jsxs("div",{children:[P,R]})]})]}),e[27]=P,e[28]=R,e[29]=M):M=e[29];let I;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==w||e[34]!==r||e[35]!==k||e[36]!==S||e[37]!==u||e[38]!==a||e[39]!==v?(I=r&&o.jsxs("div",{className:"px-8 pt-5 pb-6",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(Wf,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:H=>{H&&m(H)},children:[o.jsx(Ic,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Ic,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsxs("div",{className:"rounded-xl border border-border p-5",children:[o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:gD[f].map(H=>{const{dollars:q,labelKey:G}=H;return o.jsxs("button",{type:"button",disabled:S,onClick:()=>{qe("credits_topup_clicked",{amount_cents:q*100,currency:f,tier_label:G,source:"exhausted_banner"}),v(q*100)},className:ae("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,q]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:a(G)})]},q)})}),u?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(kt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:H=>d(H.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(fe,{className:"h-10",disabled:!k||S,onClick:()=>{qe("credits_topup_clicked",{amount_cents:Math.round(w*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(w*100))},children:a(S?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>h(!0),children:a("chat.creditsExhaustedBanner.enterCustom")})]}),o.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:xD.map(H=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:o.jsx(zt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),o.jsx("span",{className:"text-sm text-foreground/80",children:a(H)})]},H))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=w,e[34]=r,e[35]=k,e[36]=S,e[37]=u,e[38]=a,e[39]=v,e[40]=I):I=e[40];let D;e[41]!==a?(D=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=D):D=e[42];let $;e[43]!==s||e[44]!==D?($=o.jsx(fe,{variant:"ghost",size:"sm",onClick:s,children:D}),e[43]=s,e[44]=D,e[45]=$):$=e[45];let O;e[46]!==i||e[47]!==s||e[48]!==n.slug?(O=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=O):O=e[49];let B;e[50]!==a?(B=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=B):B=e[51];let F;e[52]!==O||e[53]!==B?(F=o.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:O,children:B}),e[52]=O,e[53]=B,e[54]=F):F=e[54];let z;e[55]!==$||e[56]!==F?(z=o.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[$,F]}),e[55]=$,e[56]=F,e[57]=z):z=e[57];let W;e[58]!==M||e[59]!==I||e[60]!==z?(W=o.jsxs(Ft,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:bD,children:[M,I,z]}),e[58]=M,e[59]=I,e[60]=z,e[61]=W):W=e[61];let K;return e[62]!==W||e[63]!==j?(K=o.jsx(Ut,{open:!0,onOpenChange:j,children:W}),e[62]=W,e[63]=j,e[64]=K):K=e[64],K}function bD(t){return t.preventDefault()}const vD={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function yD(t){const e=U.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,r=ce(),{label:l,title:a}=vD[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(tl,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==r?(d=r(l),e[1]=l,e[2]=r,e[3]=d):d=e[3];let u;e[4]!==r||e[5]!==a?(u=r(a),e[4]=r,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==r?(h=s==="trial_exhausted"?o.jsx(fe,{size:"sm",onClick:i,className:"h-7 text-xs",children:r("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=r,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=o.jsx(qo,{icon:c,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:h}),e[11]=n,e[12]=d,e[13]=u,e[14]=h,e[15]=f):f=e[15],f}function p7(t,e){const s=U.c(9),n=ys(),i=ce();let r;s[0]!==n||s[1]!==t?(r=async()=>{const{url:c}=await n.call(t,{});return c},s[0]=n,s[1]=t,s[2]=r):r=s[2];let l;s[3]!==e||s[4]!==i?(l=c=>xe.error(i(e,{message:c.message})),s[3]=e,s[4]=i,s[5]=l):l=s[5];let a;return s[6]!==r||s[7]!==l?(a={mutationFn:r,onSuccess:_D,onError:l},s[6]=r,s[7]=l,s[8]=a):a=s[8],Rs(a)}function _D(t){return window.open(t,"_blank","noopener,noreferrer")}function LD(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),r=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:r?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const SD={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function $h(t){const e=U.c(29),s=ce(),{variant:n,onDismiss:i}=t,r=n==="error";let l;e[0]!==r||e[1]!==s?(l=s(r?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=r,e[1]=s,e[2]=l):l=e[2];const a=l,c=r?yn:Qo;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const y=SD[t.finishReason];return y?s(y):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const u=d;let h;e[8]!==r||e[9]!==u?(h=r?LD(u):{summary:u,rawDetails:null},e[8]=r,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;let p;e[11]!==c?(p=o.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==r||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=r?o.jsx(fe,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):o.jsx(fe,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=r,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?o.jsxs("details",{className:"group mx-4",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[o.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})}),o.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),o.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),o.jsxs("div",{className:"relative mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>xe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>xe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:o.jsx(vn,{className:"size-3.5"})}),o.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=o.jsx(qo,{icon:p,label:a,title:f,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function o9(){const t=U.c(73),e=ce(),{error:s,clearError:n,finishReason:i,clearFinishReason:r,messages:l,isStreaming:a,submit:c,sendMessage:d}=ci(),[u,h]=fr(),{virtualMcpId:f,createTaskWithMessage:m}=an(),{chatMode:p,simpleModeTier:g}=Kl(),{mutate:x}=p7("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const y=b;let _;t[2]!==p||t[3]!==g||t[4]!==f?(_=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=_):_=t[5];const L=_;let v;t[6]!==u.toolApprovalLevel?(v=u.toolApprovalLevel??MC(),t[6]=u.toolApprovalLevel,t[7]=v):v=t[7];const S=v,w=l.at(-1),k=w?.role==="assistant"?w.parts:[],j=k.filter(CD),C=e7(k),V=Q8(k);let N;t[8]!==s||t[9]!==d||t[10]!==e?(N=()=>{if(s){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ne)}},t[8]=s,t[9]=d,t[10]=e,t[11]=N):N=t[11];const T=N;let P;t[12]!==d||t[13]!==e?(P=()=>{const le={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(le)},t[12]=d,t[13]=e,t[14]=P):P=t[14];const E=P;let R;t[15]!==L||t[16]!==S||t[17]!==c?(R=(le,ne)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ne}},L(S))},t[15]=L,t[16]=S,t[17]=c,t[18]=R):R=t[18];const M=R;let I;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(I=le=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=I):I=t[24];const D=I,$=jD;let O;t[25]!==L||t[26]!==c?(O=(le,ne,me,ee)=>{c({kind:"approval",approvalId:le,approved:ne,...me?{reason:me}:{}},L(ee))},t[25]=L,t[26]=c,t[27]=O):O=t[27];const B=O,F=s7();if(F.isCreditExhausted){let le;return t[28]!==n?(le=o.jsx(m7,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:z,showWarning:W,hasApprovals:K}=F,H=j.map(kD).join("|"),q=Z8(C)?.toolCallId??"",G=V.map(wD).join("|");let Q;t[30]!==F.todos?(Q=o.jsx(uD,{todos:F.todos}),t[30]=F.todos,t[31]=Q):Q=t[31];let se;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==y?(se=F.subscriptionErrorKind&&o.jsx(yD,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:y}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=y,t[35]=se):se=t[35];let Z;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==z?(Z=z&&o.jsx($h,{variant:"error",error:s,onDismiss:n,onFixInChat:T}),t[36]=n,t[37]=s,t[38]=T,t[39]=z,t[40]=Z):Z=t[40];let te;t[41]!==r||t[42]!==i||t[43]!==E||t[44]!==W?(te=W&&o.jsx($h,{variant:"warning",finishReason:i,onDismiss:r,onContinue:E}),t[41]=r,t[42]=i,t[43]=E,t[44]=W,t[45]=te):te=t[45];let X;t[46]!==G||t[47]!==B||t[48]!==K||t[49]!==a||t[50]!==V?(X=K&&o.jsx(qR,{approvals:V,isStreaming:a,onRespond:B},G),t[46]=G,t[47]=B,t[48]=K,t[49]=a,t[50]=V,t[51]=X):X=t[51];let Y;t[52]!==F.hasPlans||t[53]!==D||t[54]!==$||t[55]!==a||t[56]!==C||t[57]!==q?(Y=F.hasPlans&&o.jsx(YR,{plans:C,isStreaming:a,onApprove:D,onDismiss:$},q),t[52]=F.hasPlans,t[53]=D,t[54]=$,t[55]=a,t[56]=C,t[57]=q,t[58]=Y):Y=t[58];let de;t[59]!==F.isWaitingForUserInput||t[60]!==M||t[61]!==a||t[62]!==H||t[63]!==j?(de=F.isWaitingForUserInput&&o.jsx(f7,{userAskParts:j,isStreaming:a,onSubmit:M},H),t[59]=F.isWaitingForUserInput,t[60]=M,t[61]=a,t[62]=H,t[63]=j,t[64]=de):de=t[64];let re;return t[65]!==Z||t[66]!==te||t[67]!==X||t[68]!==Y||t[69]!==de||t[70]!==Q||t[71]!==se?(re=o.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[Q,se,Z,te,X,Y,de]}),t[65]=Z,t[66]=te,t[67]=X,t[68]=Y,t[69]=de,t[70]=Q,t[71]=se,t[72]=re):re=t[72],re}function wD(t){return t.approvalId}function kD(t){return t.toolCallId}function jD(){document.querySelector("[data-chat-input]")?.focus()}function CD(t){return t.type==="tool-user_ask"}o9.Error=function(e){return o.jsx($h,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};o9.Warning=function(e){return o.jsx($h,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};o9.UserAskQuestion=f7;function ND(t){const e=U.c(20),{taskId:s}=t,n=ce(),i=Zy(s),r=SN(i),l=wN(),{stop:a,removeLocalMessage:c}=ci();if(r.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>{a()},e[2]=a,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Af,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:h})}),e[5]=d,e[6]=u,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=o.jsx(Ke,{side:"top",children:o.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=o.jsxs(We,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,y)=>o.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:y+1}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(_=>{_&&(kN(s,b.messageId),c(b.messageId))})},children:o.jsx(Ni,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],o.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[o.jsx("span",{children:n(r.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:r.length})}),g]}),r.map(x)]})}function VD(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const TD={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function AD(t){const e=U.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:r,onPick:l,onReset:a,onClose:c}=t,d=ce(),u=Jf(),h=new Set(u.map(PD)),f=jN([i,n,r],h),m=f?.keyId??null,[p,g]=A.useState(m??u[0]?.id??null),x=u.some(I=>I.id===p)?p:m??u[0]?.id??null,b=x?u.find(I=>I.id===x):null,y="flex h-[70vh] max-h-[460px] w-full flex-col",_=TD[s];let L;e[0]!==d||e[1]!==_?(L=d(_),e[0]=d,e[1]=_,e[2]=L):L=e[2];let v;e[3]!==L?(v=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=v):v=e[4];let S;e[5]!==a||e[6]!==d||e[7]!==i?(S=i&&o.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=S):S=e[8];let w;e[9]!==v||e[10]!==S?(w=o.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[v,S]}),e[9]=v,e[10]=S,e[11]=w):w=e[11];const k="flex-1 min-h-0",j=A.Suspense;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx($A,{}),e[12]=C):C=e[12];const V=OA,N=!0,T=VD(m?f:null,b?.providerId??"deco");let P;e[13]!==x||e[14]!==l||e[15]!==g?(P=I=>{const D=I.keyId??x??"";g(D),l({keyId:D,modelId:I.modelId,title:I.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=P):P=e[16];let E;e[17]!==V||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==P?(E=o.jsx(V,{compact:N,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:P}),e[17]=V,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=P,e[23]=E):E=e[23];let R;e[24]!==j||e[25]!==E||e[26]!==C?(R=o.jsx("div",{className:k,children:o.jsx(j,{fallback:C,children:E})}),e[24]=j,e[25]=E,e[26]=C,e[27]=R):R=e[27];let M;return e[28]!==R||e[29]!==w?(M=o.jsxs("div",{className:y,children:[w,R]}),e[28]=R,e[29]=w,e[30]=M):M=e[30],M}function PD(t){return t.id}const ED=["fast","smart","thinking"];function g7(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const RD={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function DD(t){const e=U.c(28),{tier:s,pillIcon:n,groups:i}=t,r=ce();let l;e[0]!==r?(l=g7(r),e[0]=r,e[1]=l):l=e[1];const a=l,[c,d]=A.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=k=>{k.onSelect(),d(!1)},e[2]=u):u=e[2];const h=u,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ae("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ae("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=o.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Ls,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let y;e[8]!==n||e[9]!==f||e[10]!==x?(y=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink",children:o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=y):y=e[11];let _;e[12]!==f?(_=o.jsx(Ke,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;e[14]!==y||e[15]!==_?(L=o.jsxs(We,{children:[y,_]}),e[14]=y,e[15]=_,e[16]=L):L=e[16];let v;if(e[17]!==i||e[18]!==r){let k;e[20]!==r?(k=j=>o.jsx("div",{className:"flex flex-col",children:j.rows.map(C=>o.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[o.jsxs("button",{type:"button",role:"menuitem","aria-label":C.title,onClick:()=>h(C),className:ae("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",C.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[C.icon&&o.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:C.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm",children:C.title}),C.subtitle&&o.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle})]}),C.active&&o.jsx("span",{title:r("chat.tierTrigger.selected"),children:o.jsx(zt,{size:14,className:"text-foreground mt-0.5"})})]}),C.modelOverride&&o.jsx(ID,{label:C.title,render:C.modelOverride})]},C.key))},j.key),e[20]=r,e[21]=k):k=e[21],v=i.map(k),e[17]=i,e[18]=r,e[19]=v}else v=e[19];let S;e[22]!==v?(S=o.jsx(hs,{align:"end",className:"p-1 w-64",onOpenAutoFocus:MD,children:o.jsx("div",{role:"menu",className:"flex flex-col",children:v})}),e[22]=v,e[23]=S):S=e[23];let w;return e[24]!==c||e[25]!==L||e[26]!==S?(w=o.jsxs(fs,{open:c,onOpenChange:d,children:[L,S]}),e[24]=c,e[25]=L,e[26]=S,e[27]=w):w=e[27],w}function MD(t){return t.preventDefault()}function ID(t){const e=U.c(38),{label:s,render:n}=t,i=ce(),r=Hl(),[l,a]=A.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let u;e[1]!==s||e[2]!==i?(u=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=u):u=e[3];const h=l&&"opacity-100";let f;e[4]!==h?(f=ae("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",h),e[4]=h,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(C6,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=o.jsx("button",{type:"button","aria-label":u,className:f,children:m}),e[7]=u,e[8]=f,e[9]=p):p=e[9];const g=p;if(r){let L;e[10]!==g?(L=o.jsx(EV,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let v;e[12]!==s||e[13]!==i?(v=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=v):v=e[14];let S;e[15]!==v?(S=o.jsx(y2,{className:"sr-only",children:v}),e[15]=v,e[16]=S):S=e[16];let w;e[17]!==l||e[18]!==n?(w=l&&n(d),e[17]=l,e[18]=n,e[19]=w):w=e[19];let k;e[20]!==w||e[21]!==S?(k=o.jsxs(_2,{className:"p-0 flex flex-col max-h-[95vh]",children:[S,w]}),e[20]=w,e[21]=S,e[22]=k):k=e[22];let j;return e[23]!==l||e[24]!==k||e[25]!==L?(j=o.jsxs(L2,{open:l,onOpenChange:a,children:[L,k]}),e[23]=l,e[24]=k,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=o.jsx(ds,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let y;e[32]!==b?(y=o.jsx(hs,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=y):y=e[33];let _;return e[34]!==l||e[35]!==x||e[36]!==y?(_=o.jsxs(fs,{open:l,onOpenChange:a,children:[x,y]}),e[34]=l,e[35]=x,e[36]=y,e[37]=_):_=e[37],_}function Jx(t){return t==="fast"?o.jsx(tl,{size:16}):t==="thinking"?o.jsx(j6,{size:16}):o.jsx(zr,{size:16})}function OD(t){const e=U.c(13),s=VN();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const u=s.tiers[d];return u?u.title??u.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let r;e[3]!==i?(r=i("fast"),e[3]=i,e[4]=r):r=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==r||e[10]!==l||e[11]!==a?(c={fast:r,smart:l,thinking:a},e[9]=r,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function $D(){const t=U.c(22),e=ce(),{simpleModeTier:s,setSimpleModeTier:n}=Kl(),i=KA(),r=Jf(),l=qA(r),a=OD(l),{data:c,error:d}=CN();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=NN();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==h||t[10]!==d){const _=g7(e);m="decopilot",p=ED.map(L=>{const v=a[L],S=h.tiers[L];return{key:`decopilot-${L}`,icon:Jx(L),title:_[L],subtitle:v??e(RD[L]),active:s===L,onSelect:()=>n(L),modelOverride:w=>o.jsxs(o.Fragment,{children:[d&&o.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),o.jsx(AD,{tier:L,orgSlot:i.tiers[L],userSlot:S,autoSlot:l.chat[L],onClose:w,onPick:k=>f.mutate({tier:L,slot:k}),onReset:()=>f.mutate({tier:L,slot:null})},`${L}:${S?.keyId??"org"}:${S?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=f,t[9]=h,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=Jx(s),t[16]=s,t[17]=b):b=t[17];let y;return t[18]!==x||t[19]!==b||t[20]!==s?(y=o.jsx(DD,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=y):y=t[21],y}async function pg(t,e,s,n,i,r){if(!Gf(e)){xe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!BA(l,e)){const c=e8(e).parts.map(u=>r(u)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):xe.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){xe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const u=await d,h={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};FN(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),xe.error(`Failed to load file "${s.name}"`)}}function BD(t){const e=U.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,r=ce(),l=A.useRef(FD);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r?(a=()=>{l.current=async(h,f)=>{await pg(s,n,h,f,i,r)}},c=[s,n,i,r],e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=a,e[5]=c):(a=e[4],c=e[5]),A.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new ji("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new Yc({key:h,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const y=g.dataTransfer?.files;if(!y||y.length===0)return!1;g.preventDefault();const _=p.posAtCoords({left:g.clientX,top:g.clientY});if(!_)return!1;const L=Array.from(y);return(async()=>{let v=_.pos;for(const S of L)await l.current?.(S,v),v=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(zD);return b.length===0?!1:(g.preventDefault(),(async()=>{let y=p.state.selection.from;for(const _ of b){const L=_.getAsFile();L&&(await l.current?.(L,y),y=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(h)}},u=[s],e[6]=s,e[7]=d,e[8]=u):(d=e[7],u=e[8]),A.useEffect(d,u),null}function zD(t){return t.kind==="file"}function FD(){return Promise.resolve()}function UD(t){const e=U.c(43),{info:s,onClose:n}=t,i=ce(),r=s!==null;let l;e[0]!==n?(l=N=>!N&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:o.jsx(Qo,{size:18})}),e[4]=d):d=e[4];let u;e[5]!==i?(u=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(Gt,{className:"text-xl font-semibold tracking-tight",children:u}),e[7]=u,e[8]=h):h=e[8];const f=s?.fileName;let m;e[9]!==f?(m=o.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=o.jsxs(Tn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==h?(x=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,o.jsxs(ms,{className:"relative gap-4",children:[d,o.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,e[18]=x):x=e[18];const b=s?.modelName??"";let y;e[19]!==i||e[20]!==b?(y=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=y):y=e[21];let _;e[22]!==y?(_=o.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:y}),e[22]=y,e[23]=_):_=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(N6,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const v=s?.accepted;let S;e[25]!==v?(S=o.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,o.jsx("span",{className:"capitalize",children:v})]}),e[25]=v,e[26]=S):S=e[26];let w;e[27]!==_||e[28]!==S?(w=o.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:o.jsxs("div",{className:"rounded-xl border border-border p-4",children:[_,S]})}),e[27]=_,e[28]=S,e[29]=w):w=e[29];let k;e[30]!==i?(k=i("chat.uploader.gotIt"),e[30]=i,e[31]=k):k=e[31];let j;e[32]!==n||e[33]!==k?(j=o.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:o.jsx(fe,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let C;e[35]!==x||e[36]!==w||e[37]!==j?(C=o.jsxs(Ft,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:HD,children:[x,w,j]}),e[35]=x,e[36]=w,e[37]=j,e[38]=C):C=e[38];let V;return e[39]!==r||e[40]!==l||e[41]!==C?(V=o.jsx(Ut,{open:r,onOpenChange:l,children:C}),e[39]=r,e[40]=l,e[41]=C,e[42]=V):V=e[42],V}function HD(t){return t.preventDefault()}function KD(){const t=U.c(3),[e,s]=A.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var gg=UN;var WD=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Am=WD.join(","),x7=typeof Element>"u",ku=x7?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Bh=!x7&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},zh=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),r=i===""||i==="true",l=r||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):zh(e.parentNode));return l},qD=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},GD=function(e,s,n){if(zh(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Am));return s&&ku.call(e,Am)&&i.unshift(e),i=i.filter(n),i},Pm=function(e,s,n){for(var i=[],r=Array.from(e);r.length;){var l=r.shift();if(!zh(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=Pm(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=ku.call(l,Am);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!zh(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=Pm(h===!0?l.children:h.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else r.unshift.apply(r,l.children)}}return i},b7=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},v7=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||qD(e))&&!b7(e)?0:e.tabIndex},YD=function(e,s){var n=v7(e);return n<0&&s&&!b7(e)?0:n},JD=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},y7=function(e){return e.tagName==="INPUT"},XD=function(e){return y7(e)&&e.type==="hidden"},QD=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},ZD=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},eM=function(e){if(!e.name)return!0;var s=e.form||Bh(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var r=ZD(i,e.form);return!r||r===e},tM=function(e){return y7(e)&&e.type==="radio"},sM=function(e){return tM(e)&&!eM(e)},nM=function(e){var s,n=e&&Bh(e),i=(s=n)===null||s===void 0?void 0:s.host,r=!1;if(n&&n!==e){var l,a,c;for(r=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!r&&i;){var d,u,h;n=Bh(i),i=(d=n)===null||d===void 0?void 0:d.host,r=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return r},Xx=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},iM=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var r=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!r}if(getComputedStyle(e).visibility==="hidden")return!0;var l=ku.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(ku.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,u=Bh(e);if(d&&!d.shadowRoot&&i(d)===!0)return Xx(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(nM(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Xx(e);return!1},rM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return ku.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},oM=function(e,s){return!(s.disabled||XD(s)||iM(s,e)||QD(s)||rM(s))},Qx=function(e,s){return!(sM(s)||v7(s)<0||!oM(e,s))},lM=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},_7=function(e){var s=[],n=[];return e.forEach(function(i,r){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=YD(a,l),d=l?_7(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:r,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(JD).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(s)},L7=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Pm([e],s.includeContainer,{filter:Qx.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:lM}):n=GD(e,s.includeContainer,Qx.bind(null,s)),_7(n)};function aM(){return/apple/i.test(navigator.vendor)}const Zx="data-floating-ui-focusable";function cM(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function Em(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&IC(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function _d(t){return"composedPath"in t?t.composedPath()[0]:t.target}function l1(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function dM(t){return t.matches("html,body")}function ju(t){return t?.ownerDocument||document}function uM(t){return t?t.hasAttribute(Zx)?t:t.querySelector("["+Zx+"]")||t:null}function ph(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var r;return i.parentId===e&&(!s||((r=i.context)==null?void 0:r.open))}).flatMap(i=>[i,...ph(t,i.id,s)])}function hM(t){return"nativeEvent"in t}var fM=typeof document<"u",mM=function(){},kl=fM?A.useLayoutEffect:mM;const pM={...Ay},gM=pM.useInsertionEffect,xM=gM||(t=>t());function bc(t){const e=A.useRef(()=>{});return xM(()=>{e.current=t}),A.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const S7=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function w7(t,e){const s=L7(t,S7()),n=s.length;if(n===0)return;const i=cM(ju(t)),r=s.indexOf(i),l=r===-1?e===1?0:n-1:r+e;return s[l]}function bM(t){return w7(ju(t).body,1)||t}function vM(t){return w7(ju(t).body,-1)||t}function a1(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Em(s,n)}function yM(t){L7(t,S7()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function e4(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const _M="data-floating-ui-focusable",t4="active",s4="selected",LM={...Ay};let n4=!1,SM=0;const i4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+SM++;function wM(){const[t,e]=A.useState(()=>n4?i4():void 0);return kl(()=>{t==null&&e(i4())},[]),A.useEffect(()=>{n4=!0},[]),t}const kM=LM.useId,xg=kM||wM;function jM(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const CM=A.createContext(null),NM=A.createContext(null),k7=()=>{var t;return((t=A.useContext(CM))==null?void 0:t.id)||null},j7=()=>A.useContext(NM);function bg(t){return"data-floating-ui-"+t}const VM={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},r4=A.forwardRef(function(e,s){const[n,i]=A.useState();kl(()=>{aM()&&i("button")},[]);const r={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[bg("focus-guard")]:"",style:VM};return o.jsx("span",{...e,...r})}),TM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},C7=A.createContext(null),o4=bg("portal");function AM(t){t===void 0&&(t={});const{id:e,root:s}=t,n=xg(),i=EM(),[r,l]=A.useState(null),a=A.useRef(null);return kl(()=>()=>{r?.remove(),queueMicrotask(()=>{a.current=null})},[r]),kl(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(o4,""),c.appendChild(d),a.current=d,l(d)},[e,n]),kl(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!UC(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const u=document.createElement("div");u.id=n,u.setAttribute(o4,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),r}function PM(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,r=AM({id:s,root:n}),[l,a]=A.useState(null),c=A.useRef(null),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||r);return A.useEffect(()=>{if(!r||!i||f)return;function g(x){r&&a1(x)&&(x.type==="focusin"?e4:yM)(r)}return r.addEventListener("focusin",g,!0),r.addEventListener("focusout",g,!0),()=>{r.removeEventListener("focusin",g,!0),r.removeEventListener("focusout",g,!0)}},[r,i,f]),A.useEffect(()=>{r&&(m||e4(r))},[m,r]),o.jsxs(C7.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:r,setFocusManagerState:a}),[i,r]),children:[p&&r&&o.jsx(r4,{"data-type":"outside",ref:c,onFocus:g=>{if(a1(g,r)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,y=vM(b);y?.focus()}}}),p&&r&&o.jsx("span",{"aria-owns":r.id,style:TM}),r&&qn.createPortal(e,r),p&&r&&o.jsx(r4,{"data-type":"outside",ref:d,onFocus:g=>{if(a1(g,r)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,y=bM(b);y?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const EM=()=>A.useContext(C7),RM={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},DM={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},l4=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function MM(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:r}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=j7(),x=bc(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,y=A.useRef(!1),{escapeKey:_,outsidePress:L}=l4(m),{escapeKey:v,outsidePress:S}=l4(p),w=A.useRef(!1),k=bc(P=>{var E;if(!s||!l||!a||P.key!=="Escape"||w.current)return;const R=(E=r.current.floatingContext)==null?void 0:E.nodeId,M=g?ph(g.nodesRef.current,R):[];if(!_&&(P.stopPropagation(),M.length>0)){let I=!0;if(M.forEach(D=>{var $;if(($=D.context)!=null&&$.open&&!D.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}n(!1,hM(P)?P.nativeEvent:P,"escape-key")}),j=bc(P=>{var E;const R=()=>{var M;k(P),(M=_d(P))==null||M.removeEventListener("keydown",R)};(E=_d(P))==null||E.addEventListener("keydown",R)}),C=bc(P=>{var E;const R=r.current.insideReactTree;r.current.insideReactTree=!1;const M=y.current;if(y.current=!1,d==="click"&&M||R||typeof b=="function"&&!b(P))return;const I=_d(P),D="["+bg("inert")+"]",$=ju(i.floating).querySelectorAll(D);let O=Ji(I)?I:null;for(;O&&!e1(O);){const W=BC(O);if(e1(W)||!Ji(W))break;O=W}if($.length&&Ji(I)&&!dM(I)&&!Em(I,i.floating)&&Array.from($).every(W=>!Em(O,W)))return;if(zC(I)&&T){const W=e1(I),K=FC(I),H=/auto|scroll/,q=W||H.test(K.overflowX),G=W||H.test(K.overflowY),Q=q&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,se=G&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,Z=K.direction==="rtl",te=se&&(Z?P.offsetX<=I.offsetWidth-I.clientWidth:P.offsetX>I.clientWidth),X=Q&&P.offsetY>I.clientHeight;if(te||X)return}const B=(E=r.current.floatingContext)==null?void 0:E.nodeId,F=g&&ph(g.nodesRef.current,B).some(W=>{var K;return l1(P,(K=W.context)==null?void 0:K.elements.floating)});if(l1(P,i.floating)||l1(P,i.domReference)||F)return;const z=g?ph(g.nodesRef.current,B):[];if(z.length>0){let W=!0;if(z.forEach(K=>{var H;if((H=K.context)!=null&&H.open&&!K.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}n(!1,P,"outside-press")}),V=bc(P=>{var E;const R=()=>{var M;C(P),(M=_d(P))==null||M.removeEventListener(d,R)};(E=_d(P))==null||E.addEventListener(d,R)});A.useEffect(()=>{if(!s||!l)return;r.current.__escapeKeyBubbles=_,r.current.__outsidePressBubbles=L;let P=-1;function E($){n(!1,$,"ancestor-scroll")}function R(){window.clearTimeout(P),w.current=!0}function M(){P=window.setTimeout(()=>{w.current=!1},$C()?5:0)}const I=ju(i.floating);a&&(I.addEventListener("keydown",v?j:k,v),I.addEventListener("compositionstart",R),I.addEventListener("compositionend",M)),b&&I.addEventListener(d,S?V:C,S);let D=[];return f&&(Ji(i.domReference)&&(D=Z9(i.domReference)),Ji(i.floating)&&(D=D.concat(Z9(i.floating))),!Ji(i.reference)&&i.reference&&i.reference.contextElement&&(D=D.concat(Z9(i.reference.contextElement)))),D=D.filter($=>{var O;return $!==((O=I.defaultView)==null?void 0:O.visualViewport)}),D.forEach($=>{$.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(I.removeEventListener("keydown",v?j:k,v),I.removeEventListener("compositionstart",R),I.removeEventListener("compositionend",M)),b&&I.removeEventListener(d,S?V:C,S),D.forEach($=>{$.removeEventListener("scroll",E)}),window.clearTimeout(P)}},[r,i,a,b,d,s,n,f,l,_,L,k,v,j,C,S,V]),A.useEffect(()=>{r.current.insideReactTree=!1},[r,b,d]);const N=A.useMemo(()=>({onKeyDown:k,...u&&{[RM[h]]:P=>{n(!1,P.nativeEvent,"reference-press")},...h!=="click"&&{onClick(P){n(!1,P.nativeEvent,"reference-press")}}}}),[k,n,u,h]),T=A.useMemo(()=>{function P(E){E.button===0&&(y.current=!0)}return{onKeyDown:k,onMouseDown:P,onMouseUp:P,[DM[d]]:()=>{r.current.insideReactTree=!0}}},[k,d,r]);return A.useMemo(()=>l?{reference:N,floating:T}:{},[l,N,T])}function IM(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=xg(),r=A.useRef({}),[l]=A.useState(()=>jM()),a=k7()!=null,[c,d]=A.useState(n.reference),u=bc((m,p,g)=>{r.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),h=A.useMemo(()=>({setPositionReference:d}),[]),f=A.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return A.useMemo(()=>({dataRef:r,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function OM(t){t===void 0&&(t={});const{nodeId:e}=t,s=IM({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[r,l]=A.useState(null),[a,c]=A.useState(null),u=i?.domReference||r,h=A.useRef(null),f=j7();kl(()=>{u&&(h.current=u)},[u]);const m=OC({...t,elements:{...i,...a&&{reference:a}}}),p=A.useCallback(_=>{const L=Ji(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(L),m.refs.setReference(L)},[m.refs]),g=A.useCallback(_=>{(Ji(_)||_===null)&&(h.current=_,l(_)),(Ji(m.refs.reference.current)||m.refs.reference.current===null||_!==null&&!Ji(_))&&m.refs.setReference(_)},[m.refs]),x=A.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=A.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),y=A.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return kl(()=>{n.dataRef.current.floatingContext=y;const _=f?.nodesRef.current.find(L=>L.id===e);_&&(_.context=y)}),A.useMemo(()=>({...m,context:y,refs:x,elements:b}),[m,x,b,y])}function c1(t,e,s){const n=new Map,i=s==="item";let r=t;if(i&&t){const{[t4]:l,[s4]:a,...c}=t;r=c}return{...s==="floating"&&{tabIndex:-1,[_M]:""},...r,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,u]=c;if(!(i&&[t4,s4].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof u=="function"){var h;(h=n.get(d))==null||h.push(u),l[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=u}),l),{})}}function $M(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=A.useCallback(a=>c1(a,t,"reference"),e),r=A.useCallback(a=>c1(a,t,"floating"),s),l=A.useCallback(a=>c1(a,t,"item"),n);return A.useMemo(()=>({getReferenceProps:i,getFloatingProps:r,getItemProps:l}),[i,r,l])}const BM=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function zM(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:r,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=xg(),u=((s=r.domReference)==null?void 0:s.id)||d,h=A.useMemo(()=>{var y;return((y=uM(r.floating))==null?void 0:y.id)||l},[r.floating,l]),f=(n=BM.get(c))!=null?n:c,p=k7()!=null,g=A.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?h:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?h:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,h,p,i,u,c]),x=A.useMemo(()=>{const y={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?y:{...y,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=A.useCallback(y=>{let{active:_,selected:L}=y;const v={role:"option",..._&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...v,"aria-selected":L}}return{}},[h,c]);return A.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function FM(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:l,$position:a}=t,c=n&&!i,d=WN(s),u=new RegExp(`\\s${d}$`),h=l?"^":"",f=i?"":d,m=c?new RegExp(`${h}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),y=new RegExp(`^[${r?.join("")}\0]?$`).test(b);if(r!==null&&!y)return null;const _=g+x.index;let L=_+x[0].length;return c&&u.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),_<a.pos&&L>=a.pos?{range:{from:_,to:L},query:x[0].slice(s.length),text:x[0]}:null}function UM(t){return t.docChanged?t.steps.some(e=>{const s=e.slice;if(!s?.content)return!1;const n=s.content.textBetween(0,s.content.size,`
|
|
3
3
|
`);return/\s/.test(n)}):!1}function HM(t){return()=>{const e=t.state.selection.$anchor.pos,{top:s,right:n,bottom:i,left:r}=t.view.coordsAtPos(e);try{return new DOMRect(r,s,n-r,i-s)}catch{return null}}}function KM(t,e,s,n){return s?()=>{const i=n.getState(t.state),r=i?.decorationId,l=e.dom.querySelector(`[data-decoration-id="${r}"]`);return l?.getBoundingClientRect()||null}:HM(t)}function WM({match:t,dismissedRange:e,state:s,transaction:n,editor:i,shouldResetDismissed:r,effectiveAllowSpaces:l}){return r?.({editor:i,state:s,range:e,match:t,transaction:n,allowSpaces:l})?!1:l?t.range.from===e.from:t.range.from===e.from&&!UM(n)}function qM({view:t,pluginKeyRef:e}){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}function GM({pluginKey:t,decorationTag:e,decorationClass:s,decorationContent:n,decorationEmptyClass:i,renderer:r,dispatchExit:l}){return{handleKeyDown(a,c){var d;const u=t.getState(a.state);if(!u.active)return!1;if(c.key==="Escape"||c.key==="Esc"){var h;return r==null||(h=r.onKeyDown)===null||h===void 0||h.call(r,{view:a,event:c,range:u.range}),l(a),!0}return(r==null||(d=r.onKeyDown)===null||d===void 0?void 0:d.call(r,{view:a,event:c,range:u.range}))||!1},decorations(a){const{active:c,range:d,decorationId:u,query:h}=t.getState(a);if(!c)return null;const f=!h?.length,m=[s];return f&&m.push(i),HN.create(a.doc,[KN.inline(d.from,d.to,{nodeName:e,class:m.join(" "),"data-decoration-id":u||void 0,"data-decoration-content":n})])}}}function YM({editor:t,char:e,effectiveAllowSpaces:s,allowToIncludeChar:n,allowedPrefixes:i,startOfLine:r,findSuggestionMatch:l,allow:a,shouldShow:c,shouldKeepDismissed:d,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(h,f,m,p){const{isEditable:g}=t,{composing:x}=t.view,{selection:b}=h,{empty:y,from:_}=b,L={...f},v=h.getMeta(u);if(v&&v.exit)return L.active=!1,L.decorationId=null,L.range={from:0,to:0},L.query=null,L.text=null,L.dismissedRange=f.active?{...f.range}:f.dismissedRange,L;if(L.composing=x,h.docChanged&&L.dismissedRange!==null&&(L.dismissedRange={from:h.mapping.map(L.dismissedRange.from),to:h.mapping.map(L.dismissedRange.to)}),g&&(y||t.view.composing)){(_<f.range.from||_>f.range.to)&&!x&&!f.composing&&(L.active=!1);const S=l({char:e,allowSpaces:s,allowToIncludeChar:n,allowedPrefixes:i,startOfLine:r,$position:b.$from}),w=`id_${Math.floor(Math.random()*4294967295)}`;S&&a({editor:t,state:p,range:S.range,isActive:f.active})&&(!c||c({editor:t,range:S.range,query:S.query,text:S.text,transaction:h}))?(L.dismissedRange!==null&&!d({match:S,dismissedRange:L.dismissedRange,state:p,transaction:h})&&(L.dismissedRange=null),L.dismissedRange===null?(L.active=!0,L.decorationId=f.decorationId||w,L.range=S.range,L.query=S.query,L.text=S.text):L.active=!1):(S||(L.dismissedRange=null),L.active=!1)}else L.active=!1;return L.active||(L.decorationId=null,L.range={from:0,to:0},L.query=null,L.text=null),L}}}function JM({editor:t,items:e}){let s=null,n=null,i=null;const r=()=>{n!==null&&(clearTimeout(n),n=null),i?.(),i=null},l=d=>new Promise(u=>{i=u,n=setTimeout(()=>{n=null;const h=i;i=null,h?.()},d)}),a=()=>{s?.abort(),r(),s=null};return{abort:a,fetch:async(d,u)=>{a(),s=new AbortController;const h=s;if(u>0&&await l(u),s!==h||h.signal.aborted)return{status:"aborted"};try{const f=await e({editor:t,query:d,signal:h.signal});return s!==h||h.signal.aborted?{status:"aborted"}:{status:"resolved",items:f}}catch{return s!==h||h.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function XM({placement:t,offset:e,flip:s,floatingUi:n}){var i,r,l,a;const c=[c2({mainAxis:(i=e.mainAxis)!==null&&i!==void 0?i:4,crossAxis:(r=e.crossAxis)!==null&&r!==void 0?r:0})];return s&&c.push(d2()),!(n==null||(l=n.middleware)===null||l===void 0)&&l.length&&c.push(...n.middleware),{placement:t,strategy:(a=n?.strategy)!==null&&a!==void 0?a:"absolute",middleware:c}}function QM(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{const e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function ZM({getReferenceRect:t,contextElement:e,config:s,container:n,dismissOnOutsideClick:i,dismiss:r}){return(l,a={})=>{const c={getBoundingClientRect:()=>{var p;return(p=t())!==null&&p!==void 0?p:new DOMRect},contextElement:e};let d=!1;const u=!l.isConnected;u&&QM(n).appendChild(l),a.onPosition||(l.style.visibility="hidden",l.style.width="max-content");const f=Py(c,l,()=>{u2(c,l,{placement:s.placement,strategy:s.strategy,middleware:s.middleware}).then(({x:p,y:g,placement:x,strategy:b})=>{if(a.onPosition){a.onPosition({x:p,y:g,placement:x,strategy:b});return}Object.assign(l.style,{position:b,left:`${p}px`,top:`${g}px`}),d||(d=!0,l.style.visibility="")})},a.autoUpdate);let m;return i&&(m=p=>{const g=p.target;!(g instanceof Node)||l.contains(g)||e.contains(g)||r()},document.addEventListener("pointerdown",m,!0)),()=>{f(),m&&document.removeEventListener("pointerdown",m,!0),u&&l.remove()}}}function eI({editor:t,pluginKey:e,items:s,renderer:n,minQueryLength:i,debounce:r,initialItems:l,placement:a,offset:c,container:d,flip:u,floatingUi:h,dismissOnOutsideClick:f,command:m,clientRectFor:p,dispatchExit:g}){let x;const b=JM({editor:t,items:s}),y=XM({placement:a,offset:c,flip:u,floatingUi:h});function _(L,v){switch(L){case"started":var S;n==null||(S=n.onStart)===null||S===void 0||S.call(n,v);break;case"updated":var w;n==null||(w=n.onUpdate)===null||w===void 0||w.call(n,v);break;case"stopped":var k;n==null||(k=n.onExit)===null||k===void 0||k.call(n,v)}}return{update:async(L,v)=>{var S,w;const k=e.getState(v),j=e.getState(L.state);if(!k||!j)return;let C=null;const V=k.query!==j.query,N=k.text!==j.text,T=k.range.from!==j.range.from||k.range.to!==j.range.to,P=V||N||T;if(!k.active&&j.active)C="started";else if(k.active&&!j.active)C="stopped";else if(j.active&&P)C="updated";else return;const E=C==="stopped"?k:j,R=L.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),M=p(L,R),I=i===0||(E.query?E.query.length>=i:!1),D=(C==="started"||C==="updated")&&I;if(x={editor:t,range:E.range,query:E.query||"",text:E.text||"",items:l??[],command:B=>m({editor:t,range:E.range,props:B}),decorationNode:R,clientRect:M,loading:D,placement:a,offset:{mainAxis:(S=c.mainAxis)!==null&&S!==void 0?S:4,crossAxis:(w=c.crossAxis)!==null&&w!==void 0?w:0},container:d,flip:u,floatingUi:y,mount:ZM({getReferenceRect:M,contextElement:L.dom,config:y,container:d,dismissOnOutsideClick:f,dismiss:()=>g(t.view)})},C==="started"){var $;n==null||($=n.onBeforeStart)===null||$===void 0||$.call(n,x)}if(C==="updated"){var O;n==null||(O=n.onBeforeUpdate)===null||O===void 0||O.call(n,x)}if(C==="started"&&_(C,x),C==="started"||C==="updated")if(!D)b.abort(),x={...x,items:l??[],loading:!1};else{x={...x,items:l??[],loading:!0},C="updated",_(C,x);const B=await b.fetch(E.query||"",r);if(B.status==="aborted")return;const F=e.getState(L.state);if(!F?.active){b.abort();return}x=B.status==="resolved"?{...x,items:B.items,loading:!1}:{...x,loading:!1}}if(C==="stopped"){b.abort(),_(C,x),x=void 0;return}C==="updated"&&_(C,x)},destroy:()=>{var L;b.abort(),x&&(n==null||(L=n.onExit)===null||L===void 0||L.call(n,x))}}}const N7=new ji("suggestion");function V7({pluginKey:t=N7,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:r=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],minQueryLength:m=0,debounce:p=0,initialItems:g,placement:x="bottom-start",offset:b={},container:y,flip:_=!0,floatingUi:L,dismissOnOutsideClick:v=!0,render:S=()=>({}),allow:w=()=>!0,findSuggestionMatch:k=FM,shouldShow:j,shouldResetDismissed:C}){const V=S?.(),N=n&&!i,T=(R,M)=>KM(e,R,M,t);function P(R){return WM({...R,editor:e,shouldResetDismissed:C,effectiveAllowSpaces:N})}const E=R=>qM({view:R,pluginKeyRef:t});return new Yc({key:t,view:()=>eI({editor:e,pluginKey:t,items:f,renderer:V,minQueryLength:m,debounce:p,initialItems:g,placement:x,offset:b,container:y,flip:_,floatingUi:L,dismissOnOutsideClick:v,command:h,clientRectFor:T,dispatchExit:E}),state:YM({editor:e,char:s,effectiveAllowSpaces:N,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:l,findSuggestionMatch:k,allow:w,shouldShow:j,shouldKeepDismissed:P,pluginKey:t}),props:GM({pluginKey:t,decorationTag:a,decorationClass:c,decorationContent:d,decorationEmptyClass:u,renderer:V,dispatchExit:E})})}function T7(t,e=N7){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}var tI=V7;function sI(t){const e=U.c(24),{editor:s,query:n,items:i,onSelect:r,onClose:l}=t,[a,c]=A.useState(0),d=A.useRef(i),u=A.useRef(a),h=A.useRef(r),f=A.useRef(l),m=A.useDeferredValue(n);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{c(0)},e[0]=p):p=e[0];let g;e[1]!==m?(g=[m],e[1]=m,e[2]=g):g=e[2],A.useEffect(p,g);let x,b;e[3]!==i.length||e[4]!==a?(x=()=>{a>=i.length&&i.length>0&&c(0)},b=[i.length,a],e[3]=i.length,e[4]=a,e[5]=x,e[6]=b):(x=e[5],b=e[6]),A.useEffect(x,b);let y,_;e[7]!==i?(y=()=>{d.current=i},_=[i],e[7]=i,e[8]=y,e[9]=_):(y=e[8],_=e[9]),A.useEffect(y,_);let L,v;e[10]!==a?(L=()=>{u.current=a},v=[a],e[10]=a,e[11]=L,e[12]=v):(L=e[11],v=e[12]),A.useEffect(L,v);let S,w;e[13]!==r?(w=()=>{h.current=r},S=[r],e[13]=r,e[14]=S,e[15]=w):(S=e[14],w=e[15]),A.useEffect(w,S);let k,j;e[16]!==l?(k=()=>{f.current=l},j=[l],e[16]=l,e[17]=k,e[18]=j):(k=e[17],j=e[18]),A.useEffect(k,j);let C,V;e[19]!==s?(C=()=>{if(s?.isDestroyed)return;let P;try{P=s.view.dom}catch{return}if(!P)return;const E=M=>{const I=d.current;if(!I.length)return!1;const D=()=>c(O=>(O+1)%I.length),$=()=>c(O=>(O-1+I.length)%I.length);switch(M.key){case"ArrowUp":return M.preventDefault(),$(),!0;case"ArrowDown":return M.preventDefault(),D(),!0;case"Tab":return M.preventDefault(),M.shiftKey?$():D(),!0;case"Home":return M.preventDefault(),c(0),!0;case"End":return M.preventDefault(),c(I.length-1),!0;case"Enter":{if(M.isComposing)return!1;M.preventDefault();const O=u.current;return O!==-1&&I[O]&&h.current?.(I[O],O),!0}case"Escape":return M.preventDefault(),f.current?.(),!0;default:return!1}},R=M=>{E(M)};return P.addEventListener("keydown",R,!0),()=>{P?.removeEventListener("keydown",R,!0)}},V=[s],e[19]=s,e[20]=C,e[21]=V):(C=e[20],V=e[21]),A.useEffect(C,V);const N=i.length?a:void 0;let T;return e[22]!==N?(T={selectedIndex:N,setSelectedIndex:c},e[22]=N,e[23]=T):T=e[23],T}function nI(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const A7=A.createContext(void 0);function P7(){const t=A.useContext(A7);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function iI(t){const e=U.c(16),{editor:s,char:n,pluginKey:i,allow:r,onOpenChange:l}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[c,d]=A.useReducer(nI,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=A.useEffectEvent(u);let f;e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof ji?i:new ji(i);s.state.plugins.find(y=>y.spec.key===g)&&s.unregisterPlugin(g);const b=V7({pluginKey:g,editor:s,char:n,allow(y){const _=s.state.doc.resolve(y.range.from);for(let L=_.depth;L>0;L--)if(_.node(L).type.name==="image")return!1;return!(r&&!r(y))},command(){},render:()=>({onStart:y=>{d({type:"ON_START",payload:{element:y.decorationNode??null,query:y.query,range:y.range}}),h(!0)},onUpdate:y=>{d({type:"ON_UPDATE",payload:{element:y.decorationNode??null,query:y.query,range:y.range}})},onKeyDown:y=>y.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),h(!1)}}),items:rI});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=r,e[5]=s,e[6]=h,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==r||e[11]!==s||e[12]!==i?(m=[s,i,n,d,r],e[9]=n,e[10]=r,e[11]=s,e[12]=i,e[13]=m):m=e[13],A.useEffect(f,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function rI(){return[]}function oI({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:r}=P7(),l=A.useDeferredValue(i.query),{data:a}=Tf({queryKey:it.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{r({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){r({type:"SET_SELECTED_ITEM",payload:h});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(x.to+=1),await n({range:x,item:h})===!1?r({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=sI({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function lI({children:t}){const{state:e,dispatch:s}=P7(),{open:n,element:i}=e,r=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=OM({placement:"bottom-start",open:n,onOpenChange:f=>{f||r()},elements:{reference:i},middleware:[HC(10),KC(),WC()],whileElementsMounted:Py}),d=MM(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=zM(c,{role:"listbox"}),{getFloatingProps:h}=$M([d,u]);return n?o.jsx(PM,{children:o.jsx("div",{ref:l.setFloating,style:a,...h(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const aI=t=>{const e=U.c(29),{item:s,isSelected:n,onSelect:i,isLoading:r,ref:l}=t;let a;if(e[0]!==s){const S=$r(s._meta);a=s.title||x2(s.name,S),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,u=s.icon,h=n&&"bg-accent text-accent-foreground",f=r&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=ae("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",h,f),e[2]=h,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==u||e[6]!==c?(p=u!==void 0&&o.jsx(Ur,{icon:u,name:c,size:"xs",className:"mr-2"}),e[5]=u,e[6]=c,e[7]=p):p=e[7];let g;e[8]!==c?(g=o.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),e[8]=c,e[9]=g):g=e[9];let x;e[10]!==r?(x=r&&o.jsx(st,{size:"xs"}),e[10]=r,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let y;e[15]!==d?(y=d&&o.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=y):y=e[16];let _;e[17]!==b||e[18]!==y?(_=o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,y]}),e[17]=b,e[18]=y,e[19]=_):_=e[19];let L;e[20]!==s.drillable?(L=s.drillable&&o.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=L):L=e[21];let v;return e[22]!==i||e[23]!==l||e[24]!==_||e[25]!==L||e[26]!==m||e[27]!==p?(v=o.jsxs("div",{ref:l,onClick:i,className:m,children:[p,_,L]}),e[22]=i,e[23]=l,e[24]=_,e[25]=L,e[26]=m,e[27]=p,e[28]=v):v=e[28],v},cI=t=>{const e=U.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:r}=t,l=ce();let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:r},e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:h}=oI(a);if(!c.length){let g;e[5]!==l?(g=l("chat.mention.noItemsFound"),e[5]=l,e[6]=g):g=e[6];let x;return e[7]!==g?(x=o.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:g}),e[7]=g,e[8]=x):x=e[8],x}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=f):f=e[9];let m;if(e[10]!==u||e[11]!==c||e[12]!==d||e[13]!==h?.name){let g;e[15]!==u||e[16]!==d||e[17]!==h?.name?(g=(x,b)=>o.jsx(aI,{item:x,isSelected:b===d,ref:b===d?hI:void 0,onSelect:()=>u(x,b),isLoading:h?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=u,e[16]=d,e[17]=h?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=u,e[11]=c,e[12]=d,e[13]=h?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=o.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:o.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function dI(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"p-1",children:[...Array(3)].map(uI)}),t[0]=e):e=t[0],e}function uI(t,e){return o.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[o.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),o.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function E7(t){const e=U.c(18),{editor:s,char:n,pluginKey:i,queryKey:r,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let u;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(u={editor:s,char:n,pluginKey:i,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=i,e[5]=u):u=e[5];const{state:h,dispatch:f}=iI(u);let m;e[6]!==f||e[7]!==h?(m={state:h,dispatch:f},e[6]=f,e[7]=h,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(dI,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==r?(g=o.jsx(lI,{children:o.jsx(A.Suspense,{fallback:p,children:o.jsx(cI,{editor:s,queryKey:r,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=r,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=o.jsx(A7.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function hI(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const fI=t=>{const e=U.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,r=ce(),l=Ms(),{org:a}=Fe(),c=Xc();let d;e[0]!==c?(d=n8(c),e[0]=c,e[1]=d):d=e[1];const u=d;let h;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(h={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=h):h=e[5];const f=$s(h);let m;e[6]!==a.id||e[7]!==n?(m=it.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=A.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const y=A.useEffectEvent(b),_=A.useRef(null),L=A.useRef(!1),v=n??"default";let S;e[11]!==g||e[12]!==a.id||e[13]!==v?(S=["at-mention",a.id,v,g],e[11]=g,e[12]=a.id,e[13]=v,e[14]=S):S=e[14];const w=S;let k;e[15]!==r?(k=r("chat.mentionAt.agentsTitle"),e[15]=r,e[16]=k):k=e[16];let j;e[17]!==r?(j=r("chat.mentionAt.agentsDescription"),e[17]=r,e[18]=j):j=e[18];let C;e[19]!==k||e[20]!==j?(C={name:"agents",title:k,description:j,kind:"category",drillable:!0},e[19]=k,e[20]=j,e[21]=C):C=e[21];let V;e[22]!==r?(V=r("chat.mentionAt.resourcesTitle"),e[22]=r,e[23]=V):V=e[23];let N;e[24]!==r?(N=r("chat.mentionAt.resourcesDescription"),e[24]=r,e[25]=N):N=e[25];let T;e[26]!==V||e[27]!==N?(T={name:"resources",title:V,description:N,kind:"category",drillable:!0},e[26]=V,e[27]=N,e[28]=T):T=e[28];let P;e[29]!==T||e[30]!==C?(P=[C,T],e[29]=T,e[30]=C,e[31]=P):P=e[31];const E=P;let R;e[32]!==f||e[33]!==s||e[34]!==r?(R=async F=>{const{item:z,range:W}=F;if(qe("chat_picker_item_selected",{picker:"@",item_kind:z.kind,item_name:z.name}),z.kind!=="category"&&(L.current=!0),z.kind==="category")return x(z.name==="agents"?"agents":"resources"),!1;if(z.kind==="agent"&&z.agentId){Rc(s,W,{id:z.agentId,name:z.name,metadata:{agentId:z.agentId,title:z.name},char:"@"}),x("categories");return}if(z.kind==="resource"&&z.uri&&f){try{const K=await Ey(f,z.uri);Rc(s,W,{id:z.uri,name:z.uri,metadata:K.contents,char:"@"})}catch(K){console.error("[at-mention] Failed to fetch resource:",K),xe.error(r("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=r,e[35]=R):R=e[35];const M=R;let I;e[36]!==c||e[37]!==E||e[38]!==f||e[39]!==u||e[40]!==y||e[41]!==l||e[42]!==p||e[43]!==n?(I=async F=>{const{query:z}=F,W=y();if(W==="categories"){if(!z.trim())return E;const q=z.toLowerCase(),G=c.filter(se=>se.status==="active"&&(!se.id||!xm(se.id))&&!u.has(se.id)&&se.id!==n&&(se.title.toLowerCase().includes(q)||se.description?.toLowerCase().includes(q))).map(mI),Q=await(async()=>{if(!f)return[];let se=l.getQueryData(p);return se||(se=await l.fetchQuery({queryKey:p,queryFn:()=>Qd(f),staleTime:6e4})),(se?.resources??[]).filter(Z=>Z.uri.toLowerCase().includes(q)||Z.name?.toLowerCase().includes(q)||Z.description?.toLowerCase().includes(q)).map(pI)})();return[...G,...Q]}if(W==="agents"){let q=c.filter(G=>G.status==="active"&&(!G.id||!xm(G.id))&&!u.has(G.id)&&G.id!==n);if(z.trim()){const G=z.toLowerCase();q=q.filter(Q=>Q.title.toLowerCase().includes(G)||Q.description?.toLowerCase().includes(G))}return q.map(gI)}if(!f)return[];let K=l.getQueryData(p);K?l.fetchQuery({queryKey:p,queryFn:()=>Qd(f),staleTime:6e4}).catch(xI):K=await l.fetchQuery({queryKey:p,queryFn:()=>Qd(f),staleTime:6e4});let H=K?.resources??[];if(z.trim()){const q=z.toLowerCase();H=H.filter(G=>G.uri.toLowerCase().includes(q)||G.name?.toLowerCase().includes(q)||G.description?.toLowerCase().includes(q))}return H.map(bI)},e[36]=c,e[37]=E,e[38]=f,e[39]=u,e[40]=y,e[41]=l,e[42]=p,e[43]=n,e[44]=I):I=e[44];const D=I;let $;e[45]!==i?($=F=>{if(i&&(i.current=F),F)_.current=Date.now(),L.current=!1,qe("chat_picker_opened",{picker:"@"});else{const z=_.current;qe("chat_picker_closed",{picker:"@",outcome:L.current?"selected":"dismissed",duration_ms:z?Date.now()-z:null}),_.current=null,x("categories")}},e[45]=i,e[46]=$):$=e[46];const O=$;let B;return e[47]!==s||e[48]!==D||e[49]!==M||e[50]!==O||e[51]!==w?(B=o.jsx(E7,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:w,queryFn:D,onSelect:M,onOpenChange:O}),e[47]=s,e[48]=D,e[49]=M,e[50]=O,e[51]=w,e[52]=B):B=e[52],B};function mI(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function pI(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function gI(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function xI(){}function bI(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function a4(t,e,s,n,i,r,l){try{const a=await Mf(s,n,r);Rc(t,e,{id:n,name:$u(n,i),metadata:a.messages,char:"/",kind:"prompt",args:r})}catch(a){console.error("[slash] Failed to fetch prompt:",a),xe.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function vI(t,e,s,n,i){try{const r=await Ey(s,n);Rc(t,e,{id:n,name:n,metadata:r.contents,char:"/",kind:"resource"})}catch(r){console.error("[slash] Failed to fetch resource:",r),xe.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function yI(t,e,s,n,i){try{const{files:r,omittedPaths:l}=await XA(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:r,omittedPaths:l};Rc(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(r){console.error("[slash] Failed to fetch skill:",r),xe.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const _I=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=ce(),i=Ms(),{org:r}=Fe(),l=$s({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=it.virtualMcpPrompts(e,r.id),c=it.virtualMcpResources(e,r.id),d=it.slashSkills(r.id),u=["slash-mention",r.id,e??"default"],[h,f]=A.useState(null),[m,p]=A.useState(null),g=qN(t);g&&(g.onEditChip=async w=>{if(l)try{const j=(await c4(i,a,l)).find(C=>C.name===w.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...w,prompt:j})}catch(k){console.error("[slash] Failed to load prompt for editing:",k),xe.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=A.useRef(null),b=A.useRef(!1),y=async({item:w,range:k})=>{if(qe("chat_picker_item_selected",{picker:"/",item_kind:w.kind,item_name:w.name}),b.current=!0,!!l)if(w.kind==="prompt"){if(w.arguments&&w.arguments.length>0){f({range:k,item:w});return}const j=$r(w._meta);await a4(t,k,l,w.name,j,void 0,{t:n})}else w.kind==="skill"?w.skill&&await yI(t,k,r.slug,w.skill,{t:n}):w.uri&&await vI(t,k,l,w.uri,{t:n})},_=async w=>{if(!h||!l)return;const{range:k,item:j}=h,C=$r(j._meta);await a4(t,k,l,j.name,C,w,{t:n}),f(null)},L=async w=>{if(!(!m||!l)){if(!GN(t,m.pos,m.promptId)){xe.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const k=await Mf(l,m.promptId,w),j=$r(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,g2({id:m.promptId,name:$u(m.promptId,j),metadata:k.messages,char:"/",kind:"prompt",args:w})).run(),qe("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(k){console.error("[slash] Failed to update prompt:",k),xe.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},v=async w=>{const{query:k}=w;if(!l)return[];const[j,C,V]=await Promise.all([c4(i,a,l),SI(i,c,l),LI(i,d,r.slug)]),N=k.trim().toLowerCase(),T=(j??[]).filter(R=>!N||R.name.toLowerCase().includes(N)||R.title?.toLowerCase().includes(N)||R.description?.toLowerCase().includes(N)).map(R=>({name:R.name,title:R.title,description:R.description,kind:"prompt",arguments:R.arguments,_meta:R._meta})),P=(C??[]).filter(R=>!N||R.uri.toLowerCase().includes(N)||R.name?.toLowerCase().includes(N)||R.description?.toLowerCase().includes(N)).map(R=>({name:R.name??R.uri,title:R.name,description:R.description,kind:"resource",uri:R.uri})),E=(V??[]).filter(R=>!N||R.name.toLowerCase().includes(N)||R.id.toLowerCase().includes(N)||R.description?.toLowerCase().includes(N)).map(R=>({name:R.name,title:R.name,description:R.description??void 0,kind:"skill",skill:R}));return[...T,...P,...E]},S=h?.item.kind==="prompt"?{name:h.item.name,title:h.item.title,arguments:h.item.arguments,description:h.item.description,_meta:h.item._meta}:null;return o.jsxs(o.Fragment,{children:[o.jsx(E7,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:v,onSelect:y,onOpenChange:w=>{if(s&&(s.current=w),w)x.current=Date.now(),b.current=!1,qe("chat_picker_opened",{picker:"/"});else{const k=x.current;qe("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:k?Date.now()-k:null}),x.current=null}}}),o.jsx(Ph,{prompt:S,setPrompt:()=>f(null),onSubmit:_}),o.jsx(Ph,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:L,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function c4(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>bm(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>bm(s),staleTime:6e4}),n?.prompts??[]}async function LI(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>QA(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function SI(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>Qd(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>Qd(s),staleTime:6e4}),n?.resources??[]}const R7="Ask anything, / for prompts & skills, @ for agents & resources...";function wI(t){return[Ef.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),gg.configure({placeholder:()=>t.current??R7,showOnlyWhenEditable:!1}),JN,XN]}function D7({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:r,suggestionOpenRef:l,children:a}){const c=A.useRef(r),d=A.useRef(e),u=A.useRef(n),h=A.useRef(i),f=Pf({extensions:wI(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":i??R7,class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&u.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return A.useEffect(()=>{f?.setEditable(!s)},[f,s]),A.useEffect(()=>{c.current=r},[r]),A.useEffect(()=>{d.current=e},[e]),A.useEffect(()=>{u.current=n},[n]),A.useEffect(()=>{h.current=i},[i]),A.useEffect(()=>{if(!f||f.isDestroyed)return;const m=JSON.stringify(f.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&f.commands.setContent(t||{type:"doc",content:[]})},[f,t]),o.jsx(YN.Provider,{value:{editor:f},children:a})}function M7(t){const e=U.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:r,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=Bu();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const C=f.state.doc.textContent.trim()==="";f.commands.focus("end"),C||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,C)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),C)){f.commands.focus("end");const V=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:V?" "+C:C})}},restoreContent:j=>{f&&f.commands.setContent(j||{type:"doc",content:[]})}}),p=[f],e[0]=f,e[1]=m,e[2]=p):(m=e[1],p=e[2]),A.useImperativeHandle(c??null,m,p),!f)return null;const g=u&&"cursor-not-allowed opacity-70",x=u&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=ae("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let y;e[7]!==f||e[8]!==b?(y=o.jsx(Rf,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=y):y=e[9];const _=n??null;let L;e[10]!==f||e[11]!==a||e[12]!==_?(L=o.jsx(A.Suspense,{fallback:null,children:o.jsx(_I,{editor:f,virtualMcpId:_,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=_,e[13]=L):L=e[13];const v=n??null;let S;e[14]!==f||e[15]!==a||e[16]!==v?(S=o.jsx(A.Suspense,{fallback:null,children:o.jsx(fI,{editor:f,virtualMcpId:v,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=v,e[17]=S):S=e[17];let w;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==r||e[22]!==h?(w=h&&r&&!u?o.jsx(BD,{editor:f,selectedModel:r,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=r,e[22]=h,e[23]=w):w=e[23];let k;return e[24]!==L||e[25]!==S||e[26]!==w||e[27]!==y?(k=o.jsxs(o.Fragment,{children:[y,L,S,w]}),e[24]=L,e[25]=S,e[26]=w,e[27]=y,e[28]=k):k=e[28],k}function I7(t){const e=U.c(3),[s]=fr();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&nP(t.dataUri).catch(r=>{console.warn(`[sound] ${t.name} playback failed:`,r)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const kI={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},jI=qV.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),CI=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function NI(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center -space-x-1.5",children:CI.map(VI)}),t[0]=e):e=t[0],e}function VI(t){return o.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function TI({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:r}){const l=ce(),[a,c]=A.useState(!1),d=I7(kI),{org:u}=Fe(),{editor:h}=Bu(),f=A.useRef(null),m=Gf(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async H=>{const q=H.target.files;if(!q||q.length===0||!h)return;const G=Array.from(q);try{let Q=h.state.selection.from;for(const se of G)await pg(h,n??null,se,Q,r,l),Q=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=$s({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=it.virtualMcpPrompts(s,u.id),{data:y,isLoading:_}=Qt({queryKey:b,queryFn:()=>bm(x),staleTime:6e4,enabled:a&&!!x}),L=y?.prompts??[],[v,S]=A.useState(null),{chatMode:w,setChatMode:k}=Kl(),[j,C]=fr(),V=xl.find(H=>H.value===j.toolApprovalLevel)??xl[0],N=l(V.shortKey),T=H=>{const q=xl.find(G=>G.value===H);if(q){if(q.value===j.toolApprovalLevel){c(!1);return}d(),qe("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:q.value,source:"tools_popover"}),C({...j,toolApprovalLevel:q.value}),c(!1)}},P=w==="plan",E=()=>{d();const H=P?"default":"plan";qe("chat_mode_changed",{from_mode:w,to_mode:H,source:"tools_popover"}),k(H),c(!1)},R=()=>{e(),c(!1)},M=async(H,q)=>{if(!h||!x)return;const G=$r(H._meta),Q={from:h.state.selection.from,to:h.state.selection.to};try{const se=await Mf(x,H.name,q);Rc(h,Q,{id:H.name,name:$u(H.name,G),metadata:se.messages,char:"/",kind:"prompt",args:q})}catch{xe.error(l("chat.toolsPopover.failedLoadPrompt"))}},I=async H=>{c(!1);const q=!!(H.arguments&&H.arguments.length>0);if(qe("chat_prompt_inserted",{prompt_name:H.name,with_arguments:q}),q){S(H);return}await M(H)},D=async H=>{v&&(await M(v,H),S(null))},$=()=>{d();const H=w==="gen-image"?"default":"gen-image";qe("chat_mode_changed",{from_mode:w,to_mode:H,source:"tools_popover"}),k(H),c(!1)},O=()=>{d();const H=w==="web-search"?"default":"web-search";qe("chat_mode_changed",{from_mode:w,to_mode:H,source:"tools_popover"}),k(H),c(!1)},B=()=>{d();const H=w==="deep-research"?"default":"deep-research";qe("chat_mode_changed",{from_mode:w,to_mode:H,source:"tools_popover"}),k(H),c(!1)},F=w==="gen-image",z=w==="web-search",W=w==="deep-research",K=o.jsx("input",{ref:f,type:"file",multiple:!0,accept:zA(n??null),className:"hidden",onChange:g,disabled:i});return o.jsxs(o.Fragment,{children:[K,o.jsxs(Ht,{open:a,onOpenChange:H=>{H&&!a&&qe("chat_tools_popover_opened",{chat_mode:w}),c(H)},children:[o.jsx(Kt,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ae("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[o.jsx(V6,{size:14}),o.jsx("span",{className:ae("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:l("chat.toolsPopover.tools")})]})}),o.jsxs(Wt,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?o.jsxs(Ze,{onClick:p,disabled:i,children:[o.jsx(Yt,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(Ze,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:H=>H.preventDefault(),children:[o.jsx(Yt,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),o.jsx(Ke,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),o.jsxs(Ze,{onClick:E,className:ae(P&&"text-special"),children:[o.jsx(Mc,{size:16,className:ae(P&&"text-special")}),o.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),o.jsx("span",{className:ae("text-xs text-muted-foreground",P&&"text-special font-medium"),children:jI})]}),o.jsxs(Ze,{onClick:$,className:ae(F&&"text-special"),children:[o.jsx(li,{size:16,className:ae(F&&"text-special")}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),F&&o.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),o.jsxs(Ze,{onClick:O,className:ae(z&&"text-special"),children:[o.jsx(Hr,{size:16,className:ae(z&&"text-special")}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),z&&o.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),o.jsxs(Ze,{onClick:B,className:ae(W&&"text-special"),children:[o.jsx(T6,{size:16,className:ae(W&&"text-special")}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),W&&o.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),o.jsxs(Zi,{children:[o.jsxs(er,{className:"gap-2",children:[o.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.prompts")})]}),o.jsx(tr,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:_?o.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[o.jsx(st,{className:"size-3.5"}),l("chat.toolsPopover.loadingPrompts")]}):L.length===0?o.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):L.map(H=>o.jsxs(Ze,{onClick:()=>I(H),className:"flex flex-col items-start gap-0.5",children:[o.jsx("span",{className:"font-medium text-sm capitalize",children:H.title||x2(H.name,$r(H._meta))}),H.description&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:H.description})]},H.name))})]}),o.jsxs(Zi,{children:[o.jsxs(er,{className:"gap-2",children:[o.jsx(Bf,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),o.jsx(tr,{className:"w-48 p-1.5",children:o.jsx(Ih,{value:j.toolApprovalLevel,onValueChange:T,children:xl.map(H=>o.jsx(Io,{value:H.value,children:l(H.labelKey)},H.value))})})]}),o.jsxs(Ze,{onClick:R,children:[o.jsx(Z2,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),o.jsx(A.Suspense,{children:o.jsx(NI,{})})]})]})]}),o.jsx(Ph,{prompt:v,setPrompt:S,onSubmit:D})]})}const AI=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function PI(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center -space-x-1",children:AI.map(EI)}),t[0]=e):e=t[0],e}function EI(t){return o.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function RI(t){const e=U.c(10),{onClick:s}=t,n=ce();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ae("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("chat.connectionsBanner.description"),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:r}),e[3]=r,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(PI,{}),c=o.jsx(qs,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=a,e[6]=c):(a=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==l?(d=o.jsxs("button",{type:"button",onClick:s,className:i,children:[l,a,c]}),e[7]=s,e[8]=l,e[9]=d):d=e[9],d}const Bd=48;function DI(){const t=U.c(9),[e,s]=A.useState("idle"),[n,i]=A.useState(""),[r,l]=A.useState(""),[a,c]=A.useState(OI),d=A.useRef(null),u=A.useRef(null),h=A.useRef(null),f=A.useRef(null),m=A.useRef(0),p=A.useRef(!1),g=A.useRef(""),x=A.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let y;t[0]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),u.current?.close().catch(II),f.current?.getTracks().forEach(MI),h.current=null,u.current=null,f.current=null},t[0]=y):y=t[0];const _=y;let L;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const V=N=>{f.current=N;const T=new AudioContext;u.current=T;const P=T.createMediaStreamSource(N),E=T.createAnalyser();E.fftSize=128,E.smoothingTimeConstant=.8,P.connect(E),h.current=E;const R=new Uint8Array(E.frequencyBinCount),M=()=>{if(!h.current)return;h.current.getByteFrequencyData(R);const I=[];for(let D=0;D<Bd;D++){const $=Math.floor(D/Bd*R.length);I.push(Math.max(.04,(R[$]??0)/255))}c(I),m.current=requestAnimationFrame(M)};M()};L=async()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N)return s("unsupported"),"unsupported";let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),V(T);const P=new N;d.current=P,P.interimResults=!0,P.continuous=!0,P.lang=navigator.language||"en-US",P.onresult=E=>{if(d.current!==P)return;let R="",M="";for(let I=E.resultIndex;I<E.results.length;I++){const D=E.results[I],$=D?.[0]?.transcript??"";D?.isFinal?M=M+$:R=R+$}M&&(g.current=g.current+M,i(g.current)),x.current=R,l(R)},P.onerror=E=>{d.current===P&&E.error!=="no-speech"&&(p.current=!1,d.current=null,_(),s(E.error==="not-allowed"?"permission-denied":"idle"))},P.onend=()=>{if(d.current===P&&p.current)try{P.start()}catch{}};try{P.start()}catch{return p.current=!1,d.current=null,_(),s("idle"),"idle"}return"recording"},t[1]=L}else L=t[1];const v=L;let S;t[2]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{p.current=!1,d.current?.stop(),_(),s("idle"),c(Array(Bd).fill(.05)),l("");const V=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",V},t[2]=S):S=t[2];const w=S;let k;t[3]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.abort(),_(),s("idle"),i(""),l(""),c(Array(Bd).fill(.05)),g.current="",x.current=""},t[3]=k):k=t[3];const j=k;let C;return t[4]!==r||t[5]!==e||t[6]!==n||t[7]!==a?(C={status:e,transcript:n,interimTranscript:r,waveformData:a,isSupported:b,startRecording:v,stopRecording:w,cancelRecording:j},t[4]=r,t[5]=e,t[6]=n,t[7]=a,t[8]=C):C=t[8],C}function MI(t){return t.stop()}function II(){}function OI(){return Array(Bd).fill(.05)}function $I(t){const e=U.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(BI),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=o.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=i):i=e[3],i}function BI(t,e){return o.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function zI(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function C0(t){const e=U.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??o.jsx(Gc,{size:14,className:"shrink-0"}),e[0]=n,e[1]=i):i=e[1];const r=s??"";let l;e[2]!==r?(l=o.jsx("span",{className:"text-sm",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function FI(t,e,s){const n=U.c(7),{editor:i}=Bu(),r=ce(),[l,a]=A.useState(!1),c=A.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==r?(d=()=>{const h=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,a(!0))},f=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&a(!1)},m=UI,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!Gf(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let y=i.state.selection.from;for(const _ of b)await pg(i,t,_,y,e,r),y=i.state.selection.to})()};return window.addEventListener("dragenter",h),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",h),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},u=[i,t,e,r,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=r,n[5]=d,n[6]=u):(d=n[5],u=n[6]),A.useEffect(d,u),l}function UI(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function HI(t){const e=U.c(14),{selectedModel:s}=t,n=ce();let i,r,l;if(e[0]!==s||e[1]!==n){const{parts:d}=e8(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Jn,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let u;e[6]!==n?(u=h=>n(h),e[6]=n,e[7]=u):u=e[7],r=n("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=r,e[4]=l}else i=e[2],r=e[3],l=e[4];let a;e[8]!==i||e[9]!==r?(a=o.jsx("span",{className:i,children:r}),e[8]=i,e[9]=r,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=o.jsxs(o.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function KI(){const t=U.c(5),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Gc,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs(o.Fragment,{children:[s,o.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function WI(t){const e=U.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,r=FI(s,n,i);let l;e[0]!==s?(l=Gf(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r?"opacity-100":"opacity-0 pointer-events-none",d=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==d?(u=ae("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==s||e[6]!==a?(h=a?o.jsx(HI,{selectedModel:s}):o.jsx(KI,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=o.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function N0(t){const e=U.c(14),{onClick:s,label:n,icon:i,colorClass:r,maxWidthClass:l}=t;let a;e[0]!==r?(a=ae("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",r),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==l?(c=ae("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",l),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=o.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ws,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let h;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(h=o.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,u]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=h):h=e[13],h}function qI(){const t=U.c(6),e=ln(),{org:s,locator:n}=Fe(),{create:i}=Fu();let r;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(r=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),u=c?.id??ql(s.id).id;FV(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:UV};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:h})},t[0]=i,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=r):r=t[5],r}function GI({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=ce(),n=p2(),i=_s(),r=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||TR,h=qI(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:y,chatMode:_,setChatMode:L}=Kl(),{data:v}=Pn.useSession(),S=v?.user?.id,{org:w,locator:k}=Fe(),j=ql(w.id).id,C=Vs(m?.id),V=Sn(C?.id).runtime==="cms",N=j2(C,i?.currentBranch??null),T=I7(iP),[P,E]=A.useState(!1),{unsupportedFile:R,onUnsupportedFile:M,clearUnsupportedFile:I}=KD(),D=DI(),$=A.useRef(void 0),O=async()=>{$.current=Z;const Le=await D.startRecording();qe("chat_voice_started",{thread_id:d,outcome:Le==="recording"?"started":Le==="unsupported"?"unsupported":Le==="permission-denied"?"permission_denied":"unknown"})},B=()=>{qe("chat_voice_confirmed",{thread_id:d});const Le=D.stopRecording();le.current?.syncVoiceText($.current,Le),le.current?.focus()},F=()=>{qe("chat_voice_cancelled",{thread_id:d}),D.cancelRecording(),le.current?.restoreContent($.current)};A.useEffect(()=>{if(D.status!=="recording")return;const Le=(D.transcript+(D.interimTranscript?" "+D.interimTranscript:"")).trim();le.current?.syncVoiceText($.current,Le)},[D.transcript,D.interimTranscript,D.status]);const z=i?.activeTask??null,W=z?.created_by,K=!!(S&&W&&W!==S),{data:H}=Qf({enabled:K}),q=(H?.data?.members??[]).find(Le=>Le.userId===W),G=q?.user?.name??q?.user?.email?.split("@")[0]??null,Q=sd(),se=e6({isDesktopApp:Q,harnessId:z?.harness_id}),[Z,te]=A.useState(()=>Kx(sessionStorage,k,u)??void 0),X=Le=>{te(Le),g.current=Le,i7(sessionStorage,k,u,Le,{onQuotaExceeded:({docSizeBytes:_e})=>{qe("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:_e}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},Y=A.useRef(d);if(Y.current!==d){Y.current=d;const Le=Kx(sessionStorage,k,u)??void 0;te(Le),g.current=Le}const re=[...r].reverse().find(Le=>Le.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,le=A.useRef(null),ne=A.useRef(!1),me=_==="plan",ee=Le=>{T(),qe("chat_mode_changed",{from_mode:Le,to_mode:"default",source:"pill_dismiss"}),L("default")};A.useEffect(()=>{const Le=_e=>{p6(_e)&&_e.code==="KeyL"&&(_e.preventDefault(),_e.shiftKey&&L(_==="plan"?"default":"plan"),le.current?.focus())};return document.addEventListener("keydown",Le),()=>document.removeEventListener("keydown",Le)},[_,L]);const oe=t6(r),ue=[...r].reverse().find(Le=>Le.role==="assistant"&&Le.metadata?.usage)?.metadata?.usage?.contextTokens??0,J=!p&&!n7(Z),he=zI({hasDraft:J,isStreaming:l,isRunInProgress:a}),ve=he==="send",je=he==="stop",Ce=Le=>{if(Le?.preventDefault(),he==="send"&&Z){if(qe("chat_message_sent",{thread_id:d||null,mode:_,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:Le?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){xe.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(Z)}else h({tiptapDoc:Z,virtualMcp:m});PR(sessionStorage,k,u),X(void 0)}else he==="stop"&&(qe("chat_message_stopped",{thread_id:d}),c())};if(K)return o.jsx(C0,{message:G?s("chat.input.readOnlyOthersChatNamed",{name:G}):s("chat.input.readOnlyOthersChat"),icon:G?o.jsx(Ks,{shape:"circle",size:"2xs",url:q?.user?.image??void 0,fallback:G.slice(0,2).toUpperCase()}):void 0});if(z?.metadata?.read_only)return o.jsx(C0,{message:s("chat.input.readOnlyThread")});if(Yl(C)&&N&&i)return o.jsx(RR,{virtualMcpId:C?.id??""});if(se)return o.jsx(C0,{message:s("chat.input.codingAgentRequiresDesktop")});if(V){if(!i)return o.jsx(C0,{message:s("chat.input.fastPreviewUnavailable")});const Le=()=>{const _e=i.createTask({runtime:"sandbox"});qe("coding_session_started",{thread_id:_e})};return o.jsxs("button",{type:"button",onClick:Le,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[o.jsx(Qc,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),o.jsx(mr,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-col w-full justify-end",children:o.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&o.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&i&&o.jsx(o9,{}),n&&i&&d?o.jsx(ND,{taskId:d}):null,o.jsx(D7,{tiptapDoc:Z,setTiptapDoc:X,disabled:D.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:Ce,suggestionOpenRef:ne,children:o.jsxs("form",{onSubmit:Ce,className:ae("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[o.jsx(WI,{selectedModel:f,onUnsupportedFile:M,disabled:D.status==="recording"}),o.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:o.jsx(M7,{ref:le,disabled:D.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:M,suggestionOpenRef:ne})}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:D.status==="recording"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx($I,{data:D.waveformData.slice(0,28)}),o.jsx("button",{type:"button",onClick:F,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:o.jsx(Ws,{size:16})}),o.jsx("button",{type:"button",onClick:B,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:o.jsx(zt,{size:16})})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[o.jsx(TI,{disabled:!1,onOpenConnections:()=>{qe("connections_dialog_opened",{source:"tools_popover",mode:"add"}),E(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:M}),me&&o.jsx(N0,{onClick:()=>ee("plan"),label:s("chat.input.planMode"),icon:o.jsx(Mc,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),_==="gen-image"&&x&&o.jsx(N0,{onClick:()=>ee("gen-image"),label:s("chat.input.createImage"),icon:o.jsx(li,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),_==="web-search"&&b&&o.jsx(N0,{onClick:()=>ee("web-search"),label:s("chat.input.webSearch"),icon:o.jsx(Hr,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),_==="deep-research"&&y&&o.jsx(N0,{onClick:()=>ee("deep-research"),label:s("chat.input.deepResearch"),icon:o.jsx(T6,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),re&&ue>0&&o.jsx(QN,{usage:oe,totalTokens:ue,contextWindow:re,onOpenContextPanel:t})]}),o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[o.jsx($D,{}),D.isSupported&&o.jsx(fe,{type:"button",onClick:O,disabled:!1,variant:"ghost",size:"icon",className:ae("size-8 rounded-lg transition-colors",D.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:D.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":D.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:o.jsx(dT,{size:18})}),o.jsx(fe,{type:je?"button":"submit",onClick:Le=>{je&&(Le.preventDefault(),Le.stopPropagation(),c())},variant:ve||je?"default":"ghost",size:"icon",disabled:!ve&&!je,className:ae("size-8 rounded-lg transition-all",!ve&&!je&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(he==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(he==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:je?o.jsx(uT,{size:20}):o.jsx(Af,{size:20})})]})]})})]})},d),e&&o.jsx(RI,{onClick:()=>{qe("connections_banner_clicked",{source:"home_chat_input"}),qe("connections_dialog_opened",{source:"home_banner",mode:"add"}),E(!0)}})]})}),o.jsx(W6,{mode:"browse",open:P,onOpenChange:E,defaultTab:"all"}),o.jsx(UD,{info:R,onClose:I})]})}function YI(t){let e=0;for(const s of t)for(const n of s.parts??[]){const i=n;i.type==="tool-load_repo"&&i.state==="output-available"&&i.output?.success===!0&&e++}return e}function JI(){const t=U.c(8),{openPanel:e}=pr(),s=S2(),n=p2()?.messages??[],i=_s()?.taskId??null;let r;t[0]!==n?(r=YI(n),t[0]=n,t[1]=r):r=t[1];const l=r,a=A.useRef(null),c=A.useRef(null);let d,u;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const h=`${i}:${l}`;c.current!==h&&(c.current=h,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e("site-editor"))},u=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=u):(d=t[6],u=t[7]),A.useEffect(d,u)}const XI={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function O7(t){return`deco-credits-empty-dismissed:${t}`}function QI(t){try{return localStorage.getItem(O7(t))==="1"}catch{return!1}}function ZI(){const t=U.c(68),e=ce(),{org:s}=Fe(),n=ln(),{decoKeyId:i}=H2(),r=ys(),[l,a]=A.useState(!0),[c,d]=A.useState(""),[u,h]=A.useState(!1),[f,m]=A.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{qe("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(O7(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,y;t[2]!==l||t[3]!==s.id?(b=()=>{l&&qe("credits_empty_state_shown",{organization_id:s.id})},y=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=y):(b=t[4],y=t[5]),A.useEffect(b,y);let _;t[6]!==f||t[7]!==r?(_=async G=>{const{url:Q}=await r.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:G,currency:f});return Q},t[6]=f,t[7]=r,t[8]=_):_=t[8];let L;t[9]!==x?(L=G=>{G&&window.open(G,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=L):L=t[10];let v;t[11]!==e?(v=G=>{xe.error(e("chat.creditsEmptyState.topUpFailed",{message:G.message}))},t[11]=e,t[12]=v):v=t[12];let S;t[13]!==_||t[14]!==L||t[15]!==v?(S={mutationFn:_,onSuccess:L,onError:v},t[13]=_,t[14]=L,t[15]=v,t[16]=S):S=t[16];const{mutate:w,isPending:k}=Rs(S),j=parseFloat(c),C=!isNaN(j)&&j>=1;if(!l)return null;let V;t[17]!==x?(V=G=>!G&&x(),t[17]=x,t[18]=V):V=t[18];let N;t[19]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=N):N=t[19];let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:o.jsx(A6,{size:20,className:"text-warning"})}),t[20]=T):T=t[20];let P;t[21]!==e?(P=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=P):P=t[22];let E;t[23]!==P?(E=o.jsx(Gt,{className:"text-lg font-semibold",children:P}),t[23]=P,t[24]=E):E=t[24];let R;t[25]!==e?(R=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=R):R=t[26];let M;t[27]!==R?(M=o.jsx(Tn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:R}),t[27]=R,t[28]=M):M=t[28];let I;t[29]!==E||t[30]!==M?(I=o.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[N,o.jsxs(ms,{className:"relative gap-3",children:[T,o.jsxs("div",{className:"text-center",children:[E,M]})]})]}),t[29]=E,t[30]=M,t[31]=I):I=t[31];let D;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==C||t[38]!==k||t[39]!==u||t[40]!==e||t[41]!==w?(D=i&&o.jsxs("div",{className:"px-6 pb-5",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(Wf,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:G=>{G&&m(G)},children:[o.jsx(Ic,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Ic,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:XI[f].map(G=>{const{dollars:Q,labelKey:se}=G;return o.jsxs("button",{type:"button",disabled:k,onClick:()=>{qe("credits_topup_clicked",{amount_cents:Q*100,currency:f,tier_label:se,source:"empty_state"}),w(Q*100)},className:ae("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,Q]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e(se)})]},Q)})}),u?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(kt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:G=>d(G.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(fe,{className:"h-10",disabled:!C||k,onClick:()=>{qe("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),w(Math.round(j*100))},children:e(k?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>h(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=C,t[38]=k,t[39]=u,t[40]=e,t[41]=w,t[42]=D):D=t[42];let $;t[43]!==x||t[44]!==n||t[45]!==s.slug?($=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=$):$=t[46];let O;t[47]!==e?(O=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=O):O=t[48];let B;t[49]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(mr,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=B):B=t[49];let F;t[50]!==$||t[51]!==O?(F=o.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:$,children:[O,B]}),t[50]=$,t[51]=O,t[52]=F):F=t[52];let z;t[53]!==e?(z=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=z):z=t[54];let W;t[55]!==x||t[56]!==z?(W=o.jsx(fe,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:z}),t[55]=x,t[56]=z,t[57]=W):W=t[57];let K;t[58]!==F||t[59]!==W?(K=o.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,W]}),t[58]=F,t[59]=W,t[60]=K):K=t[60];let H;t[61]!==I||t[62]!==D||t[63]!==K?(H=o.jsxs(Ft,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:eO,children:[I,D,K]}),t[61]=I,t[62]=D,t[63]=K,t[64]=H):H=t[64];let q;return t[65]!==H||t[66]!==V?(q=o.jsx(Ut,{open:!0,onOpenChange:V,children:H}),t[65]=H,t[66]=V,t[67]=q):q=t[67],q}function eO(t){return t.preventDefault()}function tO(t){const e=U.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const i=n;let r,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=ae("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=o.jsx(A6,{size:13,className:"text-success"}),e[2]=r,e[3]=l):(r=e[2],l=e[3]);let a;return e[4]!==i?(a=o.jsxs("div",{className:r,children:[l,o.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=a):a=e[5],a}function sO(){const t=U.c(8),{org:e}=Fe(),s=ln();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let i,r,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ae("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),r=o.jsx(yn,{size:13,className:"text-warning"}),l=o.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=r,t[5]=l):(i=t[3],r=t[4],l=t[5]);let a;return t[6]!==n?(a=o.jsxs("button",{type:"button",onClick:n,className:i,children:[r,l]}),t[6]=n,t[7]=a):a=t[7],a}function nO(t){const e=U.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:r,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==s||e[4]!==n?(a=()=>{const d=n.current,u=s.current;if(!d||!u||!i)return;const h=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||r||!i)return;const p=u.scrollHeight,g=u.scrollTop;await l(),requestAnimationFrame(()=>{const x=u.scrollHeight;u.scrollTop=g+(x-p)})},{root:u,rootMargin:"200px 0px 0px 0px"});return h.observe(d),()=>h.disconnect()},c=[s,n,i,r,l],e[0]=l,e[1]=i,e[2]=r,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),A.useEffect(a,c)}function iO(t){const e=U.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ae("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=o.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function rO(t){const e=U.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ae("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=o.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function oO(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function lO(){const t=ce(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:r}=ci(),{taskId:l}=an();JI();const a=Zy(l??""),c=EN(a),d=c.size===0?e:e.filter(y=>!c.has(y.id)),u=ZN(d),h=u.at(-1),m=VR()*pR+16,p=A.useRef(null),g=A.useRef(null);nO({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:r});const x=eV({initial:!1}),b=y=>{p.current=y,x.scrollRef(y)};return o.jsx(tV,{messages:e,children:o.jsxs("div",{className:"relative h-full w-full min-w-0",children:[o.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:o.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[o.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[o.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&o.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),u.slice(0,-1).map((y,_)=>o.jsx(wx,{pair:y,isLastPair:!1,status:_===u.length-1?s:void 0},`pair-${y.user?.id??y.assistant?.id}`))]}),h&&o.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:o.jsx(wx,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&o.jsx(fe,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:o.jsx(_N,{size:14})})]})})}function aO(t){const e=U.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ae("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=o.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}const dn=Object.assign(iO,{Main:rO,Messages:lO,EmptyState:oO,Footer:aO,Input:GI,Provider:PN,ActiveTaskProvider:AN,ThreadlessProvider:TN,IceBreakers:mR,NoAiProviderEmptyState:FA,CreditsEmptyState:ZI,CreditsEyebrow:tO,NoCreditsEyebrow:sO,CreditsExhaustedBanner:m7});function vg(t){return`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`}function yg(t,e,s){return["decofile-write",t,e,s]}function _g(t){return`/api/${t.orgSlug}/decofile/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}`}async function l9(t,e){const s=await t.json().catch(()=>({}));throw new Error(s.error??`${e} failed (${t.status})`)}function Lg(t,e,s){t.setQueryData(it.decofileDraft(vg(e)),s)}function cO(t){const e=U.c(4);let s;e[0]!==t?(s=it.decofileDraft(t?vg(t):""),e[0]=t,e[1]=s):s=e[1];let n;e[2]!==s?(n={queryKey:s,enabled:!1,queryFn:dO,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},e[2]=s,e[3]=n):n=e[3];const{data:i}=Qt(n);return i??null}async function dO(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function uO(t,e){const s=await fetch(_g(e),{cache:"no-store"});if(!s.ok){const i=new Error(`Failed to fetch decofile: ${s.status}`);throw i.status=s.status,i}const n=await s.json();return n.token&&Lg(t,e,{version:n.version,token:n.token,apiHost:n.apiHost??window.location.host}),n.decofile}const hO=2880*60*1e3;function fO(t,e,s=hO){if(!t)return!1;const n=new Date(t).getTime();return Number.isNaN(n)?!1:e-n>s}async function mO(t){const e=await fetch(`${_g(t)}/status`,{cache:"no-store"});return e.ok?await e.json():l9(e,"Status")}function pO(t){return{queryKey:it.decofileStatus(vg(t)),queryFn:()=>mO(t),staleTime:3e4}}async function $7(t,e){const s=await fetch(_g(t),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!s.ok)return l9(s,"Save");const n=await s.json();return{...n,apiHost:n.apiHost??window.location.host}}function gO({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function xO(){const t=U.c(3),e=Jf(),n=_s()?.isThreadLocked??!1,i=e.length>0;let r;return t[0]!==n||t[1]!==i?(r=gO({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=r):r=t[2],r}function Ld(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function d1(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function bO(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function vO(t){const e=U.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(yO),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=i):i=e[3],i}function yO(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function _O(t){const e=U.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,r=ce(),l=s+n+i,a=l>0?s/l*100:0,c=l>0?n/l*100:0,d=l>0?i/l*100:0;let u;e[0]!==a?(u=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==c?(h=c>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=h):h=e[3];let f;e[4]!==d?(f=d>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==u||e[7]!==h||e[8]!==f?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[u,h,f]}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==r||e[12]!==a?(g=r("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=r,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[p,o.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let y;e[17]!==c||e[18]!==r?(y=r("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=r,e[19]=y):y=e[19];let _;e[20]!==y?(_=o.jsxs("div",{className:"flex items-center gap-1.5",children:[b,o.jsx("span",{className:"text-xs text-muted-foreground",children:y})]}),e[20]=y,e[21]=_):_=e[21];let L;e[22]!==d||e[23]!==i||e[24]!==r?(L=i>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=r,e[25]=L):L=e[25];let v;e[26]!==_||e[27]!==L||e[28]!==x?(v=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,_,L]}),e[26]=_,e[27]=L,e[28]=x,e[29]=v):v=e[29];let S;return e[30]!==v||e[31]!==m?(S=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,v]}),e[30]=v,e[31]=m,e[32]=S):S=e[32],S}function LO(t){const e=U.c(14),{agentId:s,isError:n}=t,i=Vs(s),r=ce();let l;e[0]!==i?.title||e[1]!==r?(l=i?.title??r("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=r,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=o.jsx(so,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=d):d=e[5];const u=n?"text-destructive":"text-foreground";let h;e[6]!==u?(h=ae("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=o.jsx("span",{className:h,children:a}),e[8]=a,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==f?(m=o.jsxs(o.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function SO(t){const e=U.c(12),{isError:s}=t,n=ce();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const r=i;let l;e[2]!==r?(l=o.jsx(so,{icon:null,name:r,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=r,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ae("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==r||e[7]!==c?(d=o.jsx("span",{className:c,children:r}),e[6]=r,e[7]=c,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==d?(u=o.jsxs(o.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function wO(t){const e=U.c(18),{part:s}=t,n=s.input?.agent_id,i=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,r=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==r?(a=o.jsx(SO,{isError:r}),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==r?(c=o.jsx(LO,{agentId:n,isError:r}),e[2]=n,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=o.jsx(A.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==s.input?(u=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=u):u=e[9];let h;e[10]!==l||e[11]!==r||e[12]!==i?(h=o.jsx("span",{className:"ml-auto shrink-0",children:i?o.jsx(st,{className:"size-3 text-muted-foreground"}):r?o.jsx(cT,{size:12,className:"text-destructive"}):l?o.jsx(yn,{size:12,className:"text-warning"}):o.jsx(gr,{size:12,className:"text-success"})}),e[10]=l,e[11]=r,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,u,h]}),e[14]=d,e[15]=u,e[16]=h,e[17]=f):f=e[17],f}function kO(t){const e=U.c(78),{onClose:s,back:n,className:i}=t,r=ce(),[l,a]=A.useState(null),{messages:c}=ci(),{activeTask:d}=an(),{selectedModel:u,selectedVirtualMcp:h}=Kl();let f,m,p,g,x,b,y,_;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==u||e[7]!==h?.title||e[8]!==r){_=Symbol.for("react.early_return_sentinel");e:{const S=t6(c),w=[...c].reverse().find(MO),k=w?.metadata?.usage,j=w?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,C=k?.contextTokens??0,V=j&&j>0?(C/j*100).toFixed(1):null,N=c;let T;e[17]!==N?(T=N.filter(DO).reduce(RO,0),e[17]=N,e[18]=T):T=e[18];const P=T,E=c;let R;e[19]!==E?(R=E.filter(EO).reduce(PO,0),e[19]=E,e[20]=R):R=e[20];const M=R,I=Math.max(0,S.totalTokens-P-M),D=c[0],$=c.at(-1),O=D?.metadata?.created_at??d?.created_at,B=$?.metadata?.created_at??d?.updated_at,F=c.filter(AO),z=c.flatMap(VO),W=u?.modelId?bO(u.modelId):"—",K=h?.title??"Super Agent",H=[{label:r("chat.contextPanel.sessionLabel"),value:d?.title??r("chat.contextPanel.newChat")},{label:r("chat.contextPanel.messagesLabel"),value:F.length},{label:r("chat.contextPanel.agentLabel"),value:K},{label:r("chat.contextPanel.modelLabel"),value:W},{label:r("chat.contextPanel.contextLimitLabel"),value:j?Ld(j):"—"},{label:r("chat.contextPanel.sessionTokensLabel"),value:S.totalTokens>0?Ld(S.totalTokens):"0"},{label:r("chat.contextPanel.usageLabel"),value:V!==null?`${V}%`:"—"},{label:r("chat.contextPanel.inputTokensLabel"),value:S.inputTokens>0?Ld(S.inputTokens):"0"},{label:r("chat.contextPanel.outputTokensLabel"),value:S.outputTokens>0?Ld(S.outputTokens):"0"},{label:r("chat.contextPanel.reasoningTokensLabel"),value:S.reasoningTokens>0?Ld(S.reasoningTokens):"0"},{label:r("chat.contextPanel.costLabel"),value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:r("chat.contextPanel.sessionCreatedLabel"),value:d1(O)},{label:r("chat.contextPanel.lastActivityLabel"),value:d1(B)}];if(!d&&F.length===0){let Y;e[21]!==i?(Y=ae("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=Y):Y=e[22];let de;e[23]!==r?(de=r("chat.contextPanel.title"),e[23]=r,e[24]=de):de=e[24];let re;e[25]!==de?(re=o.jsx("span",{className:"text-sm font-medium text-foreground",children:de}),e[25]=de,e[26]=re):re=e[26];let le;e[27]!==n?(le=n?o.jsx(Mh,{size:14,className:"text-muted-foreground"}):o.jsx(Ni,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=le):le=e[28];let ne;e[29]!==s||e[30]!==le?(ne=o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:le}),e[29]=s,e[30]=le,e[31]=ne):ne=e[31];let me;e[32]!==re||e[33]!==ne?(me=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[re,ne]}),e[32]=re,e[33]=ne,e[34]=me):me=e[34];let ee;e[35]!==r?(ee=r("chat.contextPanel.emptyState"),e[35]=r,e[36]=ee):ee=e[36];let oe;e[37]!==ee?(oe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:ee})}),e[37]=ee,e[38]=oe):oe=e[38];let ie;e[39]!==Y||e[40]!==me||e[41]!==oe?(ie=o.jsxs("div",{className:Y,children:[me,oe]}),e[39]=Y,e[40]=me,e[41]=oe,e[42]=ie):ie=e[42],_=ie;break e}e[43]!==i?(b=ae("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",i),e[43]=i,e[44]=b):b=e[44];let q;e[45]!==r?(q=r("chat.contextPanel.title"),e[45]=r,e[46]=q):q=e[46];let G;e[47]!==q?(G=o.jsx("span",{className:"text-sm font-medium text-foreground",children:q}),e[47]=q,e[48]=G):G=e[48];let Q;e[49]!==n?(Q=n?o.jsx(Mh,{size:14}):o.jsx(Ni,{size:14}),e[49]=n,e[50]=Q):Q=e[50];let se;e[51]!==s||e[52]!==Q?(se=o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:Q}),e[51]=s,e[52]=Q,e[53]=se):se=e[53],e[54]!==G||e[55]!==se?(y=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[G,se]}),e[54]=G,e[55]=se,e[56]=y):y=e[56],f="flex flex-col gap-8 p-6",m=z.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.contextPanel.subtasksSection")}),o.jsx("div",{className:"flex flex-col gap-1",children:z.map(NO)})]}),p=o.jsx(vO,{items:H});let Z;e[57]!==r?(Z=r("chat.contextPanel.contextBreakdownSection"),e[57]=r,e[58]=Z):Z=e[58];let te;e[59]!==Z?(te=o.jsx("span",{className:"text-xs text-muted-foreground",children:Z}),e[59]=Z,e[60]=te):te=e[60];let X;e[61]!==M||e[62]!==I||e[63]!==P?(X=o.jsx(_O,{userTokens:P,assistantTokens:M,otherTokens:I}),e[61]=M,e[62]=I,e[63]=P,e[64]=X):X=e[64],e[65]!==te||e[66]!==X?(g=o.jsxs("div",{className:"flex flex-col gap-3",children:[te,X]}),e[65]=te,e[66]=X,e[67]=g):g=e[67],x=F.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.contextPanel.rawMessagesSection")}),o.jsx("div",{className:"flex flex-col gap-1",children:F.map(Y=>{const de=Y.metadata?.created_at,re=l?.id===Y.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(re?null:Y),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:ae("shrink-0 font-medium",Y.role==="user"?"text-chart-1":"text-chart-2"),children:Y.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Y.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:d1(de)})]}),re&&o.jsxs(o.Fragment,{children:[Y.role==="assistant"&&(()=>{const le=Y.metadata?._request;if(!le)return null;const ne=le.systemSections??[],me=Math.max(1,...ne.map(CO)),ee=ne.reduce(jO,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:r("chat.contextPanel.requestLabel")}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[le.activeTools??0," / ",le.tools??0," ",r("chat.contextPanel.toolsActive")]})]}),ne.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:[r("chat.contextPanel.systemPromptLabel")," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ee/4).toLocaleString()," ",r("chat.contextPanel.tokAbbrev")]})]}),ne.map((oe,ie)=>{const ue=oe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ie}`,J=oe.chars/me*100,he=Math.round(oe.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:ue}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",he.toLocaleString()," ",r("chat.contextPanel.tokAbbrev")]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${J}%`}})})]},ie)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(Y,null,2)})]})]},Y.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=u,e[7]=h?.title,e[8]=r,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=y,e[16]=_}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],y=e[15],_=e[16];if(_!==Symbol.for("react.early_return_sentinel"))return _;let L;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(L=o.jsxs("div",{className:f,children:[m,p,g,x]}),e[68]=f,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=L):L=e[73];let v;return e[74]!==b||e[75]!==y||e[76]!==L?(v=o.jsxs("div",{className:b,children:[y,L]}),e[74]=b,e[75]=y,e[76]=L,e[77]=v):v=e[77],v}function jO(t,e){return t+e.chars}function CO(t){return t.chars}function NO(t,e){return o.jsx(wO,{part:t},e)}function VO(t){return(t.parts??[]).filter(TO)}function TO(t){return t.type==="tool-subtask"}function AO(t){return t.role!=="system"}function PO(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function EO(t){return t.role==="assistant"}function RO(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function DO(t){return t.role==="user"}function MO(t){return t.role==="assistant"&&t.metadata?.usage}function IO(t){const e=U.c(21),{onOpenContextPanel:s}=t,{org:n}=Fe(),{selectedVirtualMcp:i}=Kl();let r;e[0]!==n.id?(r=ql(n.id),e[0]=n.id,e[1]=r):r=e[1];const a=i??r,d=Vs(a.id)??a,u=d.title??"Super Agent",h=d.icon??null,f=d.description??null;let m;e[2]!==h||e[3]!==u?(m=o.jsx(Ur,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=o.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:u}),e[5]=u,e[6]=p):p=e[6];let g;e[7]!==f?(g=f?o.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=o.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(dn.IceBreakers,{className:"pb-3"}),e[15]=y):y=e[15];let _;e[16]!==s?(_=o.jsxs(dn.Footer,{children:[y,o.jsx(dn.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=_):_=e[17];let L;return e[18]!==b||e[19]!==_?(L=o.jsxs(o.Fragment,{children:[b,_]}),e[18]=b,e[19]=_,e[20]=L):L=e[20],L}function d4(t){const e=U.c(17),{outputs:s,collapsed:n,onToggle:i,variant:r}=t,l=r==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==l?(a=ae(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let u;e[3]!==d?(u=ae("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=o.jsx(Ls,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(f=o.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,h]}),e[7]=i,e[8]=h,e[9]=f):f=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&o.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(OO)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==a||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function OO(t){return o.jsx(nV,{file:t},t.key)}function $O(){const t=U.c(13),e=_s()?.taskId??null,s=sV();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=s6(e,n),[r,l]=A.useState(!1),[a,c]=A.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(zO),t[2]=d):d=t[2];let u;t[3]!==r||t[4]!==i?(u=o.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:o.jsx(d4,{variant:"card",outputs:i,collapsed:r,onToggle:d})}),t[3]=r,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(BO),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=o.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:o.jsx(d4,{variant:"bar",outputs:i,collapsed:a,onToggle:h})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==u||t[11]!==f?(m=o.jsxs(o.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function BO(t){return!t}function zO(t){return!t}function FO(){const t=U.c(31),{org:e}=Fe(),s=_s(),{isChatEmpty:n}=ci(),[i,r]=A.useState("chat"),l=H2(),a=xO(),{runtime:c}=Sn(s?.virtualMcpId);if(a&&c!=="cms"){let C;return t[0]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(dn,{className:"animate-in fade-in-0 duration-200",children:o.jsx(dn.Main,{className:"flex flex-col items-center",children:o.jsx(dn.EmptyState,{children:o.jsx(dn.NoAiProviderEmptyState,{})})})}),t[0]=C):C=t[0],C}let u;t[1]!==l.hasDecoKey||t[2]!==l.hasOnlyDecoProvider||t[3]!==l.isLoading||t[4]!==l.isZeroBalance||t[5]!==n||t[6]!==e?(u=l.hasDecoKey&&l.isZeroBalance&&l.hasOnlyDecoProvider&&!l.isLoading&&n&&!QI(e.id),t[1]=l.hasDecoKey,t[2]=l.hasOnlyDecoProvider,t[3]=l.isLoading,t[4]=l.isZeroBalance,t[5]=n,t[6]=e,t[7]=u):u=t[7];const h=u;let f;t[8]!==h?(f=h&&o.jsx(dn.CreditsEmptyState,{}),t[8]=h,t[9]=f):f=t[9];const m=i!=="chat"?!0:void 0,p=i!=="chat",g=i!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=ae("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?o.jsx(IO,{onOpenContextPanel:()=>r("context")}):o.jsxs(o.Fragment,{children:[o.jsxs(dn.Main,{className:"relative flex flex-col overflow-hidden @container",children:[o.jsx($O,{}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(dn.Messages,{})})]}),o.jsx(dn.Footer,{children:o.jsx(dn.Input,{onOpenContextPanel:()=>r("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let y;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(y=o.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=y):y=t[19];const _=i!=="context"?!0:void 0,L=i!=="context",v=i==="context"?"opacity-100":"opacity-0 pointer-events-none";let S;t[20]!==v?(S=ae("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[20]=v,t[21]=S):S=t[21];let w;t[22]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(kO,{back:!0,onClose:()=>r("chat")}),t[22]=w):w=t[22];let k;t[23]!==S||t[24]!==_||t[25]!==L?(k=o.jsx("div",{inert:_,"aria-hidden":L,className:S,children:w}),t[23]=S,t[24]=_,t[25]=L,t[26]=k):k=t[26];let j;return t[27]!==f||t[28]!==k||t[29]!==y?(j=o.jsxs(dn,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,y,k]}),t[27]=f,t[28]=k,t[29]=y,t[30]=j):j=t[30],j}function B7(){const t=U.c(7),e=ce();let s;t[0]!==e?(s=e("agentShellLayout.agentShellLayout.chatLoadingError"),t[0]=e,t[1]=s):s=t[1];let n;t[2]!==s?(n=o.jsx("div",{role:"alert",className:"flex h-full flex-1 items-center justify-center text-sm text-muted-foreground",children:s}),t[2]=s,t[3]=n):n=t[3];let i;t[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ki,{children:o.jsx(FO,{})}),t[4]=i):i=t[4];let r;return t[5]!==n?(r=o.jsx(rn,{fallback:n,children:i}),t[5]=n,t[6]=r):r=t[6],r}async function UO(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const i=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(i)}return n}const z7=["SANDBOX_START"],V0=new Map,HO=t=>`${t.virtualMcpId}::${t.branch??""}`,KO=t=>t.message.includes("retry shortly"),u1=new Set,Rm={mark:(t,e)=>u1.add(`${t}::${e}`),clear:(t,e)=>u1.delete(`${t}::${e}`),isStopped:(t,e)=>u1.has(`${t}::${e}`)};function F7(t,e){const s=Ms();return Rs({mutationKey:z7,retry:(n,i)=>KO(i)&&n<6,retryDelay:n=>Gu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&Rm.clear(n.virtualMcpId,n.branch);const i=HO(n),r=V0.get(i);if(r)return r;const l=(async()=>(await UO(t,"SANDBOX_START",n)).structuredContent)();V0.set(i,l);try{return await l}finally{V0.get(i)===l&&V0.delete(i)}},onSuccess:()=>{xu(s),e?.onStarted?.()}})}function WO(t,e){const s=U.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:z7,predicate:r=>{if(!t)return!1;const l=r.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],F8(n)>0}function U7(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e={select:qO},t[0]=e):e=t[0],qC(e)}function qO(t){for(let e=t.matches.length-1;e>=0;e--){const s=t.matches[e]?.staticData.defaultMain;if(s)return s}return null}function H7(t){return!!t.harness_id||!!t.title&&t.title!=="New chat"}function GO(t){return{threadId:t.routeThreadId,providerKey:t.routeThreadId??t.fallbackKey}}function u4(t,e){return Number(e.sidePanelOpen)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanelOpen:e.mainOpen}function YO(t){return t.sidePanelOpen||t.mainOpen?t:{...t,sidePanelOpen:!0}}function JO(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",n=t.mainPanelParam??(t.panelNamed||!!t.routeDefaultMain||!s),i=t.routeDefaultMain?!1:s||t.entityMetadata?.chatDefaultOpen===!0||t.threadHasMessages===!0,r=t.sidePanelParamPresent?t.sidePanelParamValue===!0:i;return YO({sidePanelOpen:r,mainOpen:n})}function h4(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanelOpen?u4("side",e)?{sidepanel:!1}:null:{sidepanel:!0};case"toggleMain":return e.mainOpen?u4("main",e)?{mainpanel:!1}:null:{mainpanel:!0};case"openSidePanel":return e.sidePanelOpen?null:{sidepanel:!0}}}function XO(t){return t.sidePanelOpen&&t.mainOpen?{side:33,main:67}:t.sidePanelOpen?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function QO(t){const{sidePanelOpen:e,mainOpen:s}=t.visibility;return e&&(t.sidePanelParamPresent||!s)?"chat":s?"main":"chat"}function ZO(t){return{sidepanel:!0,mainpanel:!1}}function e$(t,e){const s=ln(),n=HV(),i=Zo({strict:!1}),r=el({strict:!1}),{create:l}=Fu(),{threads:a}=w2(),{virtualMcpId:c,isAgentRoute:d}=e,u=U7(),h=qu(),f=If(),m=A.useRef(crypto.randomUUID()),{threadId:p,providerKey:g}=GO({routeThreadId:f,fallbackKey:m.current}),x=p!=null?a.find(j=>j.id===p):void 0,{sidePanelOpen:b,mainOpen:y}=JO({entityMetadata:t,mainPanelParam:i.mainpanel,panelNamed:h!==void 0,sidePanelParamPresent:i.sidepanel!==void 0,sidePanelParamValue:i.sidepanel,routeDefaultMain:u,threadHasMessages:x?H7(x):!1}),_={sidePanelOpen:b,mainOpen:y},L=d&&!r.project?{virtualmcpid:c}:{},v=(j,C)=>{s({to:".",search:V=>({...V,...j}),replace:C?.replace??!1})},S=()=>{const j=h4({type:"toggleMain"},_);j&&v(j,{replace:!0})},w=()=>{const j=h4({type:"toggleSidePanel"},_);j&&v(j,{replace:!0})},k=async()=>{const j=crypto.randomUUID(),C=a.find(V=>V.id===p)?.branch??null;try{await l({id:j,virtual_mcp_id:c,...C?{branch:C}:{}})}catch{}n(j,()=>({...L}))};return{threadId:p,providerKey:g,sidePanelOpen:b,mainOpen:y,sidePanelParamPresent:i.sidepanel!==void 0,toggleMain:S,toggleSidePanel:w,createNewTask:k}}function t$(t){const e=U.c(10),{org:s}=Fe(),n=S2(),{data:i}=Pn.useSession(),r=i?.user?.id,l=t?.id??null,a=!!t&&!!r&&!!t.created_by&&t.created_by!==r;let c;e[0]!==s.id||e[1]!==l?(c=it.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let u;e[3]!==n||e[4]!==l?(u=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==d||e[8]!==u?(h={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:u},e[6]=c,e[7]=d,e[8]=u,e[9]=h):h=e[9],Qt(h)}function s$(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function n$(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function i$(t){return t/100*window.innerHeight}function r$(t){return t/100*window.innerWidth}function o$(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function zd({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,r]=o$(s);switch(r){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=n$(e,i);break}case"em":{n=s$(e,i);break}case"vh":{n=i$(i);break}case"vw":{n=r$(i);break}}return n}function jn(t){return parseFloat(t.toFixed(3))}function $c({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,i)=>(n+=e==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function Dm(t){const{panels:e}=t,s=$c({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:i,panelConstraints:r}=n;let l=0;if(r.collapsedSize!==void 0){const u=zd({groupSize:s,panelElement:i,styleProp:r.collapsedSize});l=jn(u/s*100)}let a;if(r.defaultSize!==void 0){const u=zd({groupSize:s,panelElement:i,styleProp:r.defaultSize});a=jn(u/s*100)}let c=0;if(r.minSize!==void 0){const u=zd({groupSize:s,panelElement:i,styleProp:r.minSize});c=jn(u/s*100)}let d=100;if(r.maxSize!==void 0){const u=zd({groupSize:s,panelElement:i,styleProp:r.maxSize});d=jn(u/s*100)}return{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:l,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Xt(t,e="Assertion error"){if(!t)throw Error(e)}function Mm(t,e){return Array.from(e).sort(t==="horizontal"?l$:a$)}function l$(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function a$(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function K7(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function W7(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function c$({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,r=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=W7(n,l),d=t==="horizontal"?a:c;d<r&&(r=d,i=l)}return Xt(i,"No rect found"),i}let T0;function d$(){return T0===void 0&&(typeof matchMedia=="function"?T0=!!matchMedia("(pointer:coarse)").matches:T0=!1),T0}function q7(t){const{element:e,orientation:s,panels:n,separators:i}=t,r=Mm(s,Array.from(e.children).filter(K7).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,u=-1,h=0,f,m=[];{let p=-1;for(const g of r)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(h++,d===-1&&(d=p),u=p))}if(h>1){let p=-1;for(const g of r)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),y=g.getBoundingClientRect();let _;if(c){const L=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),v=s==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(m.length){case 0:{_=[L,v];break}case 1:{const S=m[0],w=c$({orientation:s,rects:[b,y],targetRect:S.element.getBoundingClientRect()});_=[S,w===b?v:L];break}default:{_=m;break}}}else m.length?_=m:_=[s==="horizontal"?new DOMRect(b.right,y.top,y.left-b.right,y.height):new DOMRect(y.left,b.bottom,y.width,y.top-b.bottom)];for(const L of _){let v="width"in L?L:L.element.getBoundingClientRect();const S=d$()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(v.width<S){const k=S-v.width;v=new DOMRect(v.x-k/2,v.y,v.width+k,v.height)}if(v.height<S){const k=S-v.height;v=new DOMRect(v.x,v.y-k/2,v.width,v.height+k)}const w=p<=d||p>u;!a&&!w&&l.push({group:t,groupSize:$c({group:t}),panels:[f,x],separator:"width"in L?void 0:L,rect:v}),a=!1}}c=!1,f=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?m.push(x):(f=void 0,m=[])}else c=!0}return l}let G7=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let i=!1,r=null;const l=Array.from(n);for(let a=0;a<l.length;a++){const c=l[a];try{c.call(null,s)}catch(d){r===null&&(i=!0,r=d)}}if(i)throw r}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(s);i>=0&&n.splice(i,1)}}},Cc={cursorFlags:0,state:"inactive"};const Sg=new G7;function Al(){return Cc}function u$(t){return Sg.addListener("change",t)}function h$(t){const e=Cc,s={...Cc};s.cursorFlags=t,Cc=s,Sg.emit("change",{prev:e,next:s})}function Nc(t){const e=Cc;Cc=t,Sg.emit("change",{prev:e,next:t})}const f$=t=>t,h1=()=>{},Y7=1,J7=2,X7=4,Q7=8,f4=3,m4=12;let A0;function p4(){return A0===void 0&&(A0=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(A0=!0)),A0}function m$({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(r=>{if(!r.mutableState.disableCursor)switch(r.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&p4()){const r=(t&Y7)!==0,l=(t&J7)!==0,a=(t&X7)!==0,c=(t&Q7)!==0;if(r)return a?"se-resize":c?"ne-resize":"e-resize";if(l)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return p4()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const g4=new WeakMap;function wg(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=g4.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=Al();switch(n.state){case"active":case"hover":{const i=m$({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),r=`*, *:hover {cursor: ${i} !important; }`;if(e===r)return;e=r,i?s.cssRules.length===0?s.insertRule(r):s.replaceSync(r):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}g4.set(t,{prevStyle:e,styleSheet:s})}let nr=new Map;const Z7=new G7;function p$(t){nr=new Map(nr),nr.delete(t)}function x4(t,e){for(const[s]of nr)if(s.id===t)return s}function Oo(t,e){for(const[s,n]of nr)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function Zl(){return nr}function kg(t,e){return Z7.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function Zr(t,e,s){const n=nr.get(t);nr=new Map(nr),nr.set(t,e),Z7.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function e_(t){const e=Al();let s=!1;return e.state==="active"&&(Nc({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(wg(t),s=!0,e.hitRegions.forEach(n=>{const i=Oo(n.group.id,!0);Zr(n.group,i,{isUserInteraction:!0})}))),s}function b4(t){t.defaultPrevented||e_(t.currentTarget)}function g$(t,e,s){let n,i={x:1/0,y:1/0};for(const r of e){const l=W7(s,r.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=r,i=l);break}case"vertical":{l.y<=i.y&&(n=r,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function x$(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function b$(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:_4(t),b:_4(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Xt(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:y4(v4(s.a)),b:y4(v4(s.b))};if(i.a===i.b){const r=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=r.length;for(;a--;){const c=r[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const v$=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function y$(t){const e=getComputedStyle(t_(t)??t).display;return e==="flex"||e==="inline-flex"}function _$(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||y$(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||v$.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function v4(t){let e=t.length;for(;e--;){const s=t[e];if(Xt(s,"Missing node"),_$(s))return s}return null}function y4(t){return t&&Number(getComputedStyle(t).zIndex)||0}function _4(t){const e=[];for(;t;)e.push(t),t=t_(t);return e}function t_(t){const{parentNode:e}=t;return x$(e)?e.host:e}function L$(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function S$({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!K7(s)||s.contains(t)||t.contains(s))return!0;if(b$(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(L$(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function jg(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const r=q7(i),l=g$(i.orientation,r,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&S$({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function w$(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!=e[s])return!1;return!0}function xn(t,e,s=0){return Math.abs(jn(t)-jn(e))<=s}function Yi(t,e){return xn(t,e)?0:t>e?1:-1}function _c({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:r,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(Yi(n,c)<0)if(r){const d=(i+c)/2;Yi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=jn(n),n}function Cu({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:r}){if(xn(t,0))return e;const l=r==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Xt(u!=null,"Invalid first pivot index"),Xt(h!=null,"Invalid second pivot index");let f=0;switch(r){case"keyboard":{{const g=t<0?h:u,x=s[g];Xt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:y,minSize:_=0}=x;if(y){const L=a[g];if(Xt(L!=null,`Previous layout not found for panel index ${g}`),xn(L,b)){const v=_-L;Yi(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}{const g=t<0?u:h,x=s[g];Xt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:y,minSize:_=0}=x;if(y){const L=a[g];if(Xt(L!=null,`Previous layout not found for panel index ${g}`),xn(L,_)){const v=L-b;Yi(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}break}default:{const g=t<0?h:u,x=s[g];Xt(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:y,collapsedSize:_,minSize:L}=x;if(y&&Yi(b,L)<0)if(t>0){const v=L-_,S=v/2,w=b+t;Yi(w,L)<0&&(t=Yi(t,S)<=0?0:v)}else{const v=L-_,S=100-v/2,w=b-t;Yi(w,L)<0&&(t=Yi(100+t,S)>0?0:-v)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const _=a[x];Xt(_!=null,`Previous layout not found for panel index ${x}`);const L=_c({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:_,size:100})-_;if(b+=L,x+=g,x<0||x>=s.length)break}const y=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-y:y}{let g=t<0?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Xt(b!=null,`Previous layout not found for panel index ${g}`);const y=b-x,_=_c({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:y});if(!xn(b,_)&&(f+=b-_,d[g]=_,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(w$(c,d))return i;{const g=t<0?h:u,x=a[g];Xt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,y=_c({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=y,!xn(y,b)){let _=b-y,L=t<0?h:u;for(;L>=0&&L<s.length;){const v=d[L];Xt(v!=null,`Previous layout not found for panel index ${L}`);const S=v+_,w=_c({overrideDisabledPanels:l,panelConstraints:s[L],prevSize:v,size:S});if(xn(v,w)||(_-=w-v,d[L]=w),xn(_,0))break;t>0?L--:L++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!xn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function Pl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Yi(t[s],e[s])!==0)return!1;return!0}function El({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],i=n.reduce((a,c)=>a+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!xn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Xt(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let r=0;for(let a=0;a<e.length;a++){const c=s[a];Xt(c!=null,`No layout data found for index ${a}`);const d=n[a];Xt(d!=null,`No layout data found for index ${a}`);const u=_c({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(r+=d-u,n[a]=u)}if(!xn(r,0))for(let a=0;a<e.length;a++){const c=n[a];Xt(c!=null,`No layout data found for index ${a}`);const d=c+r,u=_c({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(r-=u-c,n[a]=u,xn(r,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function s_({groupId:t,panelId:e}){const s=()=>{const c=Zl();for(const[d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:d,groupSize:m,layout:f,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},i=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},r=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},l=({nextSize:c,panels:d,prevLayout:u,derivedPanelConstraints:h})=>{const f=r(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<f&&(p||d.slice(0,m).every((x,b)=>{const y=h[b];return y?.collapsible&&xn(y.collapsedSize,u[y.panelId])}))){const x=d.slice(0,m).reduce((b,y)=>b+u[y.id],0);return{...u,[e]:jn(100-x)}}return Cu({delta:g?f-c:c-f,initialLayout:u,panelConstraints:h,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:u,trigger:"imperative-api"})},a=c=>{const d=r();if(c===d)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:h}),b=El({layout:x,panelConstraints:h});Pl(p,b)||Zr(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=r();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=r();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=r(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=r();return c&&xn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=$c({group:d}),f=zd({groupSize:h,panelElement:u,styleProp:c}),m=jn(f/h*100);a(m)}}}function L4(t){if(t.defaultPrevented)return;const e=Zl();jg(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,r=s_({groupId:s.group.id,panelId:n.id});r&&i!==void 0&&(r.resize(i),t.preventDefault())}}})}function gh(t){const e=Zl();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function n_({groupId:t}){const e=()=>{const s=Zl();for(const[n,i]of s)if(n.id===t)return{group:n,...i};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:r,groupSize:l,layout:a,separatorToPanels:c}=e(),d=El({layout:s,panelConstraints:i});return n?a:(Pl(a,d)||Zr(r,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function al(t,e){const s=gh(t),n=Oo(s.id,!0),i=s.separators.find(u=>u.element===t);Xt(i,"Matching separator not found");const r=n.separatorToPanels.get(i);Xt(r,"Matching panels not found");const l=r.map(u=>s.panels.indexOf(u)),a=n_({groupId:s.id}).getLayout(),c=Cu({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=El({layout:c,panelConstraints:n.derivedPanelConstraints});Pl(a,d)||Zr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function S4(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=gh(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&al(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&al(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&al(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&al(e,-5);break}case"End":{t.preventDefault(),al(e,100);break}case"Enter":{t.preventDefault();const n=gh(e),i=Oo(n.id,!0),{derivedPanelConstraints:r,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Xt(c,"Matching separator not found");const d=a.get(c);Xt(d,"Matching panels not found");const u=d[0],h=r.find(f=>f.panelId===u.id);if(Xt(h,"Panel metadata not found"),h.collapsible){const f=l[u.id],m=h.collapsedSize===f?n.mutableState.expandedPanelSizes[u.id]??h.minSize:h.collapsedSize;al(e,m-f)}break}case"F6":{t.preventDefault();const n=gh(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Xt(i!==null,"Index not found");const r=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[r].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),al(e,-100);break}}}function w4(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=Zl(),s=jg(t,e),n=new Map;let i=!1;s.forEach(r=>{r.separator&&(i||(i=!0,r.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(r.group);l&&n.set(r.group,l.layout)}),Nc({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function i_({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:r,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:u,groupSize:h}=d,{orientation:f,panels:m}=u,{disableCursor:p}=u.mutableState;let g=0;r?f==="horizontal"?g=(e.clientX-r.x)/h*100:g=(e.clientY-r.y)/h*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(u),b=i.get(u);if(!x||!b)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:_,groupSize:L,layout:v,separatorToPanels:S}=b;if(_&&v&&S){const w=Cu({delta:g,initialLayout:x,panelConstraints:_,pivotIndices:d.panels.map(k=>m.indexOf(k)),prevLayout:v,trigger:"mouse-or-touch"});if(Pl(w,v)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?Y7:J7;break}case"vertical":{a|=g<0?X7:Q7;break}}}else Zr(d.group,{defaultLayoutDeferred:y,derivedPanelConstraints:_,groupSize:L,layout:w,separatorToPanels:S})}});let c=0;e.movementX===0?c|=l&f4:c|=a&f4,e.movementY===0?c|=l&m4:c|=a&m4,h$(c),wg(t)}function k4(t){const e=Zl(),s=Al();s.state==="active"&&i_({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function j4(t){if(t.defaultPrevented)return;const e=Al(),s=Zl();switch(e.state){case"active":{if(t.buttons===0){Nc({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=Oo(n.group.id,!0);Zr(n.group,i,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:i}=n.separator;i.hasPointerCapture?.(t.pointerId)||i.setPointerCapture?.(t.pointerId)}i_({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=jg(t,s);n.length===0?e.state!=="inactive"&&Nc({cursorFlags:0,state:"inactive"}):Nc({cursorFlags:0,hitRegions:n,state:"hover"}),wg(t.currentTarget);break}}}function C4(t){t.relatedTarget instanceof HTMLIFrameElement&&Al().state==="hover"&&Nc({cursorFlags:0,state:"inactive"})}function N4(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||e_(t.currentTarget)&&t.preventDefault()}function V4(t){let e=0,s=0;const n={};for(const r of t)if(r.defaultSize!==void 0){e++;const l=jn(r.defaultSize);s+=l,n[r.panelId]=l}else n[r.panelId]=void 0;const i=t.length-e;if(i!==0){const r=jn((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=r)}return n}function k$(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=$c({group:t}),r=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:jn(r/i*100),inPixels:r};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function j$(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function C$({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,r=0,l=!1;const a=new Map,c=[];for(const h of t.panels){const f=n[h.id]??0;if(h.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=jn(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),r+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),r>0)for(const h of c){const f=n[h]??0;u[h]=jn(f/r*d)}else{const h=jn(d/c.length);for(const f of c)u[f]=h}return u}function N$(t,e){const s=t.map(i=>i.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const i of s)if(!n.includes(i))return!1;return!0}const cc=new Map;function V$(t){let e=!0;Xt(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,r=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const y=$c({group:t});if(y===0)return;const _=Oo(t.id);if(!_)return;const L=Dm(t),v=_.defaultLayoutDeferred?V4(L):_.layout,S=C$({group:t,nextGroupSize:y,prevGroupSize:_.groupSize,prevLayout:v}),w=El({layout:S,panelConstraints:L});if(!_.defaultLayoutDeferred&&Pl(_.layout,w)&&j$(_.derivedPanelConstraints,L)&&_.groupSize===y)return;Zr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:y,layout:w,separatorToPanels:_.separatorToPanels})}}else k$(t,b,x)}});r.observe(t.element),t.panels.forEach(p=>{Xt(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&r.observe(p.element)});const l=$c({group:t}),a=Dm(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(N$(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??V4(a),h=El({layout:u,panelConstraints:a}),f=t.element.ownerDocument;cc.set(f,(cc.get(f)??0)+1);const m=new Map;return q7(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),Zr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Xt(!i.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),i.add(p.id),p.element.addEventListener("keydown",S4)}),cc.get(f)===1&&(f.addEventListener("contextmenu",b4,!0),f.addEventListener("dblclick",L4,!0),f.addEventListener("pointerdown",w4,!0),f.addEventListener("pointerleave",k4),f.addEventListener("pointermove",j4),f.addEventListener("pointerout",C4),f.addEventListener("pointerup",N4,!0)),function(){e=!1,cc.set(f,Math.max(0,(cc.get(f)??0)-1)),p$(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",S4)}),cc.get(f)||(f.removeEventListener("contextmenu",b4,!0),f.removeEventListener("dblclick",L4,!0),f.removeEventListener("pointerdown",w4,!0),f.removeEventListener("pointerleave",k4),f.removeEventListener("pointermove",j4),f.removeEventListener("pointerout",C4),f.removeEventListener("pointerup",N4,!0)),r.disconnect()}}function T$(){const[t,e]=A.useState({}),s=A.useCallback(()=>e({}),[]);return[t,s]}function Cg(t){const e=A.useId();return`${t??e}`}const ea=typeof window<"u"?A.useLayoutEffect:A.useEffect;function eu(t){const e=A.useRef(t);return ea(()=>{e.current=t},[t]),A.useCallback((...s)=>e.current?.(...s),[e])}function Ng(...t){return eu(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function Vg(t){const e=A.useRef({...t});return ea(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const r_=A.createContext(null);function A$(t,e){const s=A.useRef({getLayout:()=>({}),setLayout:f$});A.useImperativeHandle(e,()=>s.current,[]),ea(()=>{Object.assign(s.current,n_({groupId:t}))})}function o_({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:r,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=A.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=eu(V=>{Pl(p.current.onLayoutChange,V)||(p.current.onLayoutChange=V,c?.(V))}),x=eu((V,N)=>{Pl(p.current.onLayoutChanged,V)||(p.current.onLayoutChanged=V,d?.(V,{isUserInteraction:N}))}),b=Cg(a),y=A.useRef(null),[_,L]=T$(),v=A.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),S=Ng(y,r);A$(b,l);const w=eu((V,N)=>{const T=Al(),P=x4(V),E=Oo(V);if(E){let R=!1;return T.state==="active"&&(R=T.hitRegions.some(M=>M.group===P)),{flexGrow:E.layout[N]??1,pointerEvents:R?"none":void 0}}if(s?.[N])return{flexGrow:s?.[N]}}),k=Vg({defaultLayout:s,disableCursor:n}),j=A.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:w,id:b,orientation:u,registerPanel:V=>{const N=v.current;return N.panels=Mm(u,[...N.panels,V]),L(),()=>{N.panels=N.panels.filter(T=>T!==V),L()}},registerSeparator:V=>{const N=v.current;return N.separators=Mm(u,[...N.separators,V]),L(),()=>{N.separators=N.separators.filter(T=>T!==V),L()}},updatePanelProps:(V,{disabled:N})=>{const T=v.current.panels.find(R=>R.id===V);T&&(T.panelConstraints.disabled=N);const P=x4(b),E=Oo(b);P&&E&&Zr(P,{...E,derivedPanelConstraints:Dm(P)})},updateSeparatorProps:(V,{disabled:N,disableDoubleClick:T})=>{const P=v.current.separators.find(E=>E.id===V);P&&(P.disabled=N,P.disableDoubleClick=T)}}),[w,b,L,u,k]),C=A.useRef(null);return ea(()=>{const V=y.current;if(V===null)return;const N=v.current;let T;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===N.panels.length){T={};for(const $ of N.panels){const O=k.defaultLayout[$.id];O!==void 0&&(T[$.id]=O)}}const P={disabled:!!i,element:V,id:b,mutableState:{defaultLayout:T,disableCursor:!!k.disableCursor,expandedPanelSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:u,panels:N.panels,resizeTargetMinimumSize:N.resizeTargetMinimumSize,separators:N.separators};C.current=P;const E=V$(P),{defaultLayoutDeferred:R,derivedPanelConstraints:M,layout:I}=Oo(P.id,!0);!R&&M.length>0&&(g(I),x(I,!1));const D=kg(b,$=>{const{defaultLayoutDeferred:O,derivedPanelConstraints:B,layout:F}=$.next;if(O||B.length===0)return;const z=P.panels.map(({id:K})=>K).join(",");P.mutableState.layouts[z]=F,B.forEach(K=>{if(K.collapsible){const{layout:H}=$.prev??{};if(H){const q=xn(K.collapsedSize,F[K.panelId]),G=xn(K.collapsedSize,H[K.panelId]);q&&!G&&(P.mutableState.expandedPanelSizes[K.panelId]=H[K.panelId])}}});const W=Al().state!=="active";g(F),W&&x(F,$.isUserInteraction)});return()=>{C.current=null,E(),D()}},[i,b,x,g,u,_,k]),A.useEffect(()=>{const V=C.current;V&&(V.mutableState.defaultLayout=s,V.mutableState.disableCursor=!!n)}),o.jsx(r_.Provider,{value:j,children:o.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:S,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}o_.displayName="Group";function Tg(){const t=A.useContext(r_);return Xt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function P$(t,e){const{id:s}=Tg(),n=A.useRef({collapse:h1,expand:h1,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:h1});A.useImperativeHandle(e,()=>n.current,[]),ea(()=>{Object.assign(n.current,s_({groupId:s,panelId:t}))})}function l_({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:r,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:d="100%",minSize:u="0%",onResize:h,panelRef:f,style:m,...p}){const g=!!c,x=Cg(c),b=Vg({disabled:r}),y=A.useRef(null),_=Ng(y,l),{getPanelStyles:L,id:v,orientation:S,registerPanel:w,updatePanelProps:k}=Tg(),j=h!==null,C=eu((P,E,R)=>{h?.(P,c,R)});ea(()=>{const P=y.current;if(P!==null){const E={element:P,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?C:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return w(E)}},[a,s,n,i,j,x,g,d,u,C,w,b]),A.useEffect(()=>{k(x,{disabled:r})},[r,x,k]),P$(x,f);const V=()=>{const P=L(v,x);if(P)return JSON.stringify(P)},N=A.useSyncExternalStore(P=>kg(v,P),V,V);let T;return N?T=JSON.parse(N):i!==void 0?T={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:T={flexGrow:1},o.jsx("div",{...p,"data-disabled":r||void 0,"data-panel":!0,"data-testid":x,id:x,ref:_,style:{...E$,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...T},children:o.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:S==="horizontal"?"pan-y":"pan-x"},children:t})})}l_.displayName="Panel";const E$={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function R$({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,r;const l=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,d=a.collapsible?a.collapsedSize:a.minSize,u=[n,n+1];r=El({layout:Cu({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=El({layout:Cu({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:r,valueNow:l}}function a_({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:r,style:l,...a}){const c=Cg(r),d=Vg({disabled:s,disableDoubleClick:n}),[u,h]=A.useState({}),[f,m]=A.useState("inactive"),[p,g]=A.useState(!1),x=A.useRef(null),b=Ng(x,i),{disableCursor:y,id:_,orientation:L,registerSeparator:v,updateSeparatorProps:S}=Tg(),w=L==="horizontal"?"vertical":"horizontal";ea(()=>{const C=x.current;if(C!==null){const V={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:C,id:c},N=v(V),T=u$(E=>{m(E.next.state!=="inactive"&&E.next.hitRegions.some(R=>R.separator===V)?E.next.state:"inactive")}),P=kg(_,E=>{const{derivedPanelConstraints:R,layout:M,separatorToPanels:I}=E.next,D=I.get(V);if(D){const $=D[0],O=D.indexOf($);h(R$({layout:M,panelConstraints:R,panelId:$.id,panelIndex:O}))}});return()=>{T(),P(),N()}}},[_,c,v,d]),A.useEffect(()=>{S(c,{disabled:s,disableDoubleClick:n})},[s,n,c,S]);let k;s&&!y&&(k="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,o.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":w,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:k,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}a_.displayName="Separator";function Im(t){const e=U.c(10);let s,n,i;e[0]!==t?({className:s,ref:i,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==s?(r=ae("flex h-full w-full",s),e[4]=s,e[5]=r):r=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==r?(l=o.jsx(o_,{groupRef:i,"data-slot":"resizable-panel-group",className:r,...n}),e[6]=n,e[7]=i,e[8]=r,e[9]=l):l=e[9],l}function Lc(t){const e=U.c(10);let s,n,i;e[0]!==t?({ref:n,style:i,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==i?(r={overflow:"hidden",...i},e[4]=i,e[5]=r):r=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==r?(l=o.jsx(l_,{panelRef:n,"data-slot":"resizable-panel",style:r,...s}),e[6]=s,e[7]=n,e[8]=r,e[9]=l):l=e[9],l}function Om(t){const e=U.c(12);let s,n,i;e[0]!==t?({withHandle:i,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==s?(r=ae("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]!==i?(l=i&&o.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:o.jsx(zf,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==r||e[10]!==l?(a=o.jsx(a_,{"data-slot":"resizable-handle",className:r,...n,children:l}),e[8]=n,e[9]=r,e[10]=l,e[11]=a):a=e[11],a}function T4(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function D$(t,e){const s=U.c(8);let n;s[0]!==e?(n=c=>T4(c,e),s[0]=e,s[1]=n):n=s[1];const[i,r]=h2(t,n);let l;s[2]!==e||s[3]!==i?(l=T4(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==r||s[6]!==l?(a=[l,r],s[5]=r,s[6]=l,s[7]=a):a=s[7],a}const M$=33;function I$(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Vf.sidePanelWidth(),t[0]=e):e=t[0],D$(e,M$)}function eo(t,e,s){const n=`/api/${t.orgSlug}/sandbox/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}/${e}`,i=new URLSearchParams;t.threadId&&i.set("thread",t.threadId);for(const[l,a]of Object.entries(s??{}))a!==void 0&&i.set(l,a);const r=i.toString();return r?`${n}?${r}`:n}const O$={phase:null,lifecycle:{phase:"idle"},status:{state:"running"},branch:{kind:"unknown"},notFound:!1,scripts:[],activeProcesses:[],getBuffer:()=>"",hasData:()=>!1,subscribeChunks:()=>()=>{},subscribeReload:()=>()=>{}},c_=A.createContext(O$),A4=16384;class $${data="";append(e){this.data+=e,this.data.length>A4&&(this.data=this.data.slice(this.data.length-A4))}get(){return this.data}clear(){this.data=""}}const B$=1e3,z$=3e4,F$=3e3,P4=["lifecycle","status","tasks","scripts","branch","reload","file-changed"],E4="log";function U$(t){if(!t)return null;try{return new URL("/_sandbox/events",t).href}catch{return null}}function H$(t){return t===404}async function K$(t){try{const e=await fetch(t,{headers:{Accept:"text/event-stream"},cache:"no-store",signal:AbortSignal.timeout(F$)});return await e.body?.cancel().catch(()=>{}),H$(e.status)}catch{return!1}}function W$({virtualMcpId:t,branch:e,previewUrl:s=null,enabled:n=!0,children:i}){const{org:r}=Fe(),l=Ms(),a=_s()?.taskId??null,[c,d]=A.useState(null),[u,h]=A.useState({phase:"idle"}),[f,m]=A.useState({state:"running"}),[p,g]=A.useState({kind:"unknown"}),[x,b]=A.useState(!1),[y,_]=A.useState([]),[L,v]=A.useState([]),[,S]=A.useState(0),w=A.useRef(new Map),k=A.useRef(new Set),j=A.useRef(new Set),C=A.useRef(null),V=U$(s),N=Vs(t)?.metadata?.runtime?.selected==="deno",T=E=>{let R=w.current.get(E);return R||(R=new $$,w.current.set(E,R)),R};A.useEffect(()=>{if(d(null),h({phase:"idle"}),m({state:"running"}),g({kind:"unknown"}),C.current=null,b(!1),_([]),v([]),w.current.clear(),!t||!e||!n)return;const E=eo({orgSlug:r.slug,virtualMcpId:t,branch:e,threadId:a??null},"events");let R=!1,M=0,I=null,D=null,$=null,O=null,B=null,F=null;const z=Z=>{try{const te=JSON.parse(Z.data);d(te),te.kind!=="failed"&&(b(!1),M=0),te.kind==="ready"&&G()}catch(te){console.warn("[vm-events] bad phase payload",te)}},W=()=>{b(!0),d(null),h({phase:"idle"}),m({state:"running"}),g({kind:"unknown"}),_([]),v([]),w.current.clear()},K=Z=>{try{const te=JSON.parse(Z.data);if(typeof te.data!="string")return;M=0;const X=te.data.replace(/\r?\n/g,`\r
|
|
4
4
|
`);T(te.source).append(X);for(const Y of k.current)try{Y(te.source,X)}catch{}S(Y=>Y+1)}catch{}},H=Z=>{const te=Z.type;try{const X=JSON.parse(Z.data);switch(M=0,te){case"lifecycle":{const Y=X;h(Y.state);const de=`${r.slug}/${t}/${e}`;if(Ux(Y.state.phase)&&!(F&&Ux(F))){xu(l,r.id);const ne=it.decofile(de);l.getQueryData(ne)===void 0&&l.invalidateQueries({queryKey:ne})}Y.state.phase==="running"&&F!=="running"&&(xu(l,r.id),l.invalidateQueries({queryKey:it.decofile(de)}),l.invalidateQueries({queryKey:it.liveMeta(r.slug,t,e)})),F=Y.state.phase;const re=Y.state.phase==="running"?Y.state.port:null,le=C.current;if(C.current=re,le!==null&&re!==null&&le!==re)for(const ne of j.current)try{ne()}catch{}return}case"status":m(X);return;case"tasks":{const de=X.active.map(re=>re.logName??"").filter(Boolean);v(de);return}case"scripts":_(X.scripts);return;case"branch":{const Y=X.meta;g(Y);return}case"reload":for(const Y of j.current)try{Y()}catch{}return;case"file-changed":{const{path:Y}=X,de=`${r.slug}/${t}/${e}`;if(Y.startsWith(".deco/")||Y.includes("/.deco/")){if(!(F==="running"))return;$&&clearTimeout($),$=setTimeout(()=>{if($=null,l.invalidateQueries({queryKey:it.decofile(de)}),N)for(const ne of j.current)try{ne()}catch{}},500)}else D&&clearTimeout(D),D=setTimeout(()=>{D=null,l.invalidateQueries({queryKey:it.liveMeta(r.slug,t,e)})},1e3);return}}}catch{}};function q(){if(R)return;const Z=new EventSource(E);O=Z,Z.onopen=()=>{},Z.onerror=()=>{O===Z&&Z.readyState===EventSource.CLOSED&&se("studio")},Z.addEventListener("phase",z),Z.addEventListener("gone",W),Z.addEventListener(E4,K);for(const te of P4)Z.addEventListener(te,H)}function G(){if(R||!V||B)return;const Z=new EventSource(V);B=Z;let te=!1;Z.onopen=()=>{if(R||B!==Z)return;te=!0,M=0;const X=O;O=null,X?.close()},Z.onerror=()=>{B===Z&&Z.readyState===EventSource.CLOSED&&Q(Z,te)},Z.addEventListener(E4,K);for(const X of P4)Z.addEventListener(X,H)}async function Q(Z,te){const X=V?await K$(V):!1;if(!(R||B!==Z)){if(Z.close(),B=null,X){W(),O||q();return}te&&se("direct")}}function se(Z){if(R||I)return;const te=Gu(z$,B$,M,2,0);M++,I=setTimeout(()=>{if(I=null,!R){if(Z==="direct"){B?.close(),B=null,G();return}O?.close(),O=null,q()}},te)}return q(),()=>{R=!0,O?.close(),B?.close(),I&&clearTimeout(I),D&&clearTimeout(D),$&&clearTimeout($)}},[t,e,r.slug,n,a,V,l,N]);const P={phase:c,lifecycle:u,status:f,branch:p,notFound:x,scripts:y,activeProcesses:L,getBuffer:E=>w.current.get(E)?.get()??"",hasData:E=>(w.current.get(E)?.get().length??0)>0,subscribeChunks:E=>(k.current.add(E),()=>{k.current.delete(E)}),subscribeReload:E=>(j.current.add(E),()=>{j.current.delete(E)})};return o.jsx(c_,{value:P,children:i})}function fi(){return A.use(c_)}function d_(t){const{subscribeChunks:e}=fi(),s=A.useRef(t);s.current=t,A.useEffect(()=>e((r,l)=>{s.current?.(r,l)}),[e])}function q$(t){const{subscribeReload:e}=fi(),s=A.useRef(t);s.current=t,A.useEffect(()=>e(()=>{s.current?.()}),[e])}function G$(t){return t.appPaused||t.userStopped?{kind:"suspended"}:t.startError&&!t.previewUrl?{kind:"errored",error:t.startError}:t.previewUrl?{kind:"iframe",previewUrl:t.previewUrl}:{kind:"starting"}}const $m={githubNotAuthenticated:"GITHUB_NOT_AUTHENTICATED",githubConnectionMissing:"GITHUB_CONNECTION_MISSING"},R4="::";function Y$(t){const e=t.indexOf(R4);if(e>0){const s=t.slice(0,e);if(Object.values($m).includes(s))return{code:s,message:t.slice(e+R4.length)}}return{code:null,message:t}}function J$(t){return t.executionEnabled&&t.sessionRuntime==="sandbox"&&t.hasActiveGithubRepo&&!!t.userId&&!!t.branch&&!t.vmEntry&&!t.userStopped&&!t.isPending&&!t.attempted}function X$(t){return t.threadLoaded&&t.isOwner&&t.hasActiveGithubRepo&&!t.branch&&!t.attempted}function Q$(t){return t.executionEnabled&&t.notFound&&!!t.deadVmId&&!t.isPending&&!t.userStopped&&t.deadVmId!==t.lastDeadVmId}function Z$(t){const{agentSandboxMap:e,threadSandboxMap:s,userId:n,branch:i}=t,r=t.ownerId??n;if(!n||!r||!i)return e;const l=s?.[r]?.[i];return l?{...e??{},[n]:{...e?.[n]??{},[i]:l}}:e}function P0(t,e,s){const n={virtualMcpId:t};return e&&(n.branch=e),s&&(n.threadId=s),n}const u_=2,eB=new Set(["scheduling-timeout","reconciler-error","claim-never-created","unknown"]);function h_(t){return eB.has(t)}function tB(t){return t.executionEnabled&&t.failedReason!==null&&h_(t.failedReason)&&t.attempts<u_&&!t.isPending&&!t.userStopped&&!t.alreadyHandled}const sB={branch:null,count:0,handled:!1};function nB(t,e){return t.branch===e?t:{branch:e,count:0,handled:!1}}function iB(t){return t.mutationError?t.mutationError:t.phase?.kind==="failed"&&!t.startPending&&t.claimRetryExhausted?{code:null,message:t.phase.message}:null}function rB(t){switch(t.kind){case"suspended":return"suspended";case"iframe":return"running";case"starting":return"starting";case"errored":return"errored"}}function f_(t,e){return`${t??""}::${e??""}`}function oB(t){const e=t.vmEntry?.previewUrl??null;return e||(t.seeded?.key===t.key?t.seeded.url:null)}function E0(t){const{data:e,virtualMcpId:s,branch:n}=t;e?.branch&&!n&&t.setCurrentTaskBranch(e.branch),e?.previewUrl&&t.setSeededPreviewUrl({key:f_(s,e.branch??n),url:e.previewUrl})}const lB={branch:null,previewState:{kind:"starting"},status:"idle",vmEntry:null,previewUrl:null,userStopped:!1,start:()=>{},stop:async()=>{},restart:async()=>{},retry:()=>{},resume:()=>{}},m_=A.createContext(lB);function nl(){return A.use(m_)}function aB({executionEnabled:t,virtualMcpId:e,branch:s,userId:n,hasActiveGithubRepo:i,vmEntry:r,threadId:l,children:a}){const{org:c}=Fe(),{setCurrentTaskBranch:d}=an(),u=S2(),h=fi(),f=Ms(),m=Sn(e),p=m.resolved?m.runtime:null,g=_s()?.taskId??null,x=$s({connectionId:Jc,orgId:c.id,orgSlug:c.slug}),b=F7(x,{onStarted:()=>{l&&u?.refreshThreadMetadata(l)}}),{mutate:y,reset:_}=b,[L,v]=A.useState(null),S=A.useRef(new Set),w=A.useRef(null),[k,j]=A.useState(sB),C=nB(k,s);C!==k&&j(C);const V=h.phase?.kind==="failed"?h.phase:null,N=oB({vmEntry:r,seeded:V?null:L,key:f_(e,s)}),T=!!e&&!!s&&Rm.isStopped(e,s),P=h.status.state==="paused",E=!V||!h_(V.reason)||C.count>=u_,R=iB({mutationError:b.isError&&b.error?Y$(b.error.message):null,phase:h.phase,startPending:b.isPending,claimRetryExhausted:E}),M=G$({previewUrl:N,appPaused:P,userStopped:T,startError:R}),I=rB(M),D=s??"",$=S.current.has(D),O=J$({executionEnabled:t,hasActiveGithubRepo:i,userId:n,branch:s,vmEntry:r,userStopped:T,isPending:b.isPending,attempted:$,sessionRuntime:p});A.useEffect(()=>{if(!O||!e)return;S.current.add(D);const se=P0(e,s,g);y(se,{onSuccess:Z=>{E0({data:Z,virtualMcpId:e,branch:s,setCurrentTaskBranch:d,setSeededPreviewUrl:v})},onError:Z=>{console.error("[sandbox-lifecycle] auto-start failed:",Z)}})},[O,D,s,e,g,y,d,v]);const B=h.notFound?r?.sandboxHandle??null:null,F=Q$({executionEnabled:t,notFound:h.notFound,deadVmId:B,lastDeadVmId:w.current,isPending:b.isPending,userStopped:T});A.useEffect(()=>{if(!F||!B||!e)return;w.current=B;const se=P0(e,s,g);y(se,{onSuccess:Z=>{E0({data:Z,virtualMcpId:e,branch:s,setCurrentTaskBranch:d,setSeededPreviewUrl:v})},onError:Z=>{console.error("[sandbox-lifecycle] self-heal failed:",Z)}})},[F,B,e,s,g,y,d,v]);const z=tB({executionEnabled:t,failedReason:V?.reason??null,attempts:C.count,isPending:b.isPending,userStopped:T,alreadyHandled:C.handled});A.useEffect(()=>{if(!V){j(Z=>Z.handled?{...Z,handled:!1}:Z);return}if(!z||!e)return;j(Z=>({...Z,handled:!0,count:Z.count+1}));const se=P0(e,s,g);y(se,{onSuccess:Z=>{E0({data:Z,virtualMcpId:e,branch:s,setCurrentTaskBranch:d,setSeededPreviewUrl:v})},onError:Z=>{console.error("[sandbox-lifecycle] claim auto-retry failed:",Z)}})},[V,z,e,s,g,y,d,v]);const W=()=>{if(!t||!e)return;const se=P0(e,s,g);y(se,{onSuccess:Z=>{E0({data:Z,virtualMcpId:e,branch:s,setCurrentTaskBranch:d,setSeededPreviewUrl:v})},onError:Z=>{console.error("[sandbox-lifecycle] user start failed:",Z)}})},K=async()=>{if(!(!t||!e||!s)&&r){Rm.mark(e,s);try{await x.callTool({name:"SANDBOX_DELETE",arguments:{virtualMcpId:e,branch:s}})}catch{}xu(f)}},H=async()=>{await K(),W()},q=()=>{S.current=new Set,w.current=null,j({branch:s,count:0,handled:!1}),_(),W()},Q={branch:s,previewState:M,status:I,vmEntry:r,previewUrl:N,userStopped:T,start:W,stop:K,restart:H,retry:q,resume:q};return o.jsx(m_,{value:Q,children:a})}const p_={overview:E6,settings:fT,automations:tl,"site-editor":An,code:hT,content:Ai,assets:ig,hosting:P6,e2e:m8,analytics:vm,cdn:Hr,git:sr,files:Ho};function cB(t){return t in p_}function D4(t){const e=Ff(t);if(e.type==="icon"){const s=Jl(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function R0(t){if(t.kind==="system")return cB(t.tabId)?{kind:"component",Component:p_[t.tabId]}:{kind:"fallback"};const e=D4(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(i=>i.id===t.appId);if(!s)return{kind:"fallback"};const n=D4(s.icon);return n||{kind:"fallback"}}function g_(t){const{org:e}=Fe(),s=ys(),n=Of(),i=A.useSyncExternalStore(n.threads.subscribe,n.threads.get),r=t===null?null:i.find(a=>a.id===t)??null,{data:l}=Tf({queryKey:it.ensureTask(e.id,t),queryFn:async()=>{if(t===null)return null;try{const{item:a}=await s.call("COLLECTION_THREADS_GET",{id:t});return a??null}catch{return null}},select:a=>a?.metadata??null,staleTime:3e4});return r?.metadata??l??null}function dB(t,e){return!!t&&!!e&&e===`thread:${t}`}function x_(t){return t.threadHasRepo?"repo":dB(t.threadId,t.sandboxBranch)?"none":t.agentHasRepo?"repo":"none"}function Ag(t){const e=U.c(46),s=ce(),{openPanel:n,closePanel:i}=pr();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const l=Zo(r),a=qu(),c=U7(),d=Vs(t.virtualMcpId),u=g_(t.taskId),{org:h}=Fe(),{currentBranch:f,activeTask:m}=an(),p=sd();let g;e[1]!==d?(g=sl(d),e[1]=d,e[2]=g):g=e[2];const x=g,b=x?.connectionId??"",y=x?.owner??"",_=x?.name??"",L=x?f:null;let v;e[3]!==h.id||e[4]!==h.slug||e[5]!==b||e[6]!==y||e[7]!==_||e[8]!==L?(v={orgId:h.id,orgSlug:h.slug,connectionId:b,owner:y,repo:_,branch:L},e[3]=h.id,e[4]=h.slug,e[5]=b,e[6]=y,e[7]=_,e[8]=L,e[9]=v):v=e[9];const S=$f(v),w=S.data?.state==="open",k=d?.metadata.ui?.layout??null,j=k?.tabs??[],C=d?.id?MV(d.id):null,V=u?.expanded_tools??[],N=i8(d),T=t8(),{scopeId:P,project:E}=td(),R=YT(P,E,d),M=q6(R.project),I=JT(R.resolvedScopeId,bn(R.project?.metadata),M.presence);let D;e[10]===Symbol.for("react.memo_cache_sentinel")?(D={includeVirtual:!0},e[10]=D):D=e[10];const $=Ti(D),O=fi(),{vmEntry:B,previewUrl:F}=nl(),z=m?.branch??f;let W;e[11]!==m?.metadata||e[12]!==t.taskId||e[13]!==d?.metadata||e[14]!==u||e[15]!==z?(W=x_({threadId:t.taskId,sandboxBranch:z,agentHasRepo:bn(d?.metadata),threadHasRepo:bn(u)||bn(m?.metadata)}),e[11]=m?.metadata,e[12]=t.taskId,e[13]=d?.metadata,e[14]=u,e[15]=z,e[16]=W):W=e[16];const K=W,H=O.lifecycle.phase==="running",{runtime:q,resolved:G}=Sn(t.virtualMcpId);let Q;e[17]!==p||e[18]!==F||e[19]!==B?(Q=void 0,e[17]=p,e[18]=F,e[19]=B,e[20]=Q):Q=e[20];const se=Q,Z=DV({connectionId:C??void 0,orgId:h.id,orgSlug:h.slug,mcpUrl:se}),te=Z,X=!!Z&&H;let Y;e[21]!==te||e[22]!==X?(Y={client:te,enabled:X},e[21]=te,e[22]=X,e[23]=Y):Y=e[23];const{data:de}=y6(Y),re=C&&H?(de?.tools??[]).filter(mB).map(Me=>({connectionId:C,toolName:Me.name,label:Eh(Me.name),icon:null})):[],le=re[0],ne=le?re:[],me=le&&C?{type:"ext-apps",id:C,toolName:le.toolName}:k?.defaultMainView??null,ee=e0(k),oe={assets:M.assetsPending,siteAccess:M.siteAccessPending},{activeTab:ie,mainOpen:ue}=GC({panelTabId:a,mainPanelParam:l.mainpanel,routeDefaultMain:c,metadata:me||k?{defaultMainView:me,tabs:j.map(fB)}:null}),J=N&&(w||S.isPending&&ie==="git"),he=me||k?{defaultMainView:me,tabs:j.map(hB)}:null,ve=GV({hasSource:K==="repo"||T,runtime:q,cmsMode:ee}),je=ve.includes("content"),Ce=Lx(he),Le=me?.type,_e=XT(Le,I,oe,ve,G),Ne=_e?Lx(null):Ce,ge=QT(ie,I,oe),Te=!ve.includes("code")&&G&&fm(ie)!==null,Se=!a&&!c&&_e||ie==="git"&&!J&&!S.isPending||ie==="content"&&!je||Te||ge?Ne:ie,we=ie==="git"&&!J&&!S.isPending?!1:ue,Ye=Ry(Se);let Ge;e[24]!==s?(Ge=Me=>s(Me==="site-editor"?"common.mainPanelTabs.preview":Me==="content"?"common.mainPanelTabs.content":"common.mainPanelTabs.code"),e[24]=s,e[25]=Ge):Ge=e[25];const Ie=Ge,Oe=[];J&&Oe.push({id:"git",title:s("common.mainPanelTabs.reviewChanges")});const pt=new Map;for(const Me of V){const ht=Sx(Me.appId,Me.toolName);pt.set(ht,{id:ht,title:Me.toolName,appId:Me.appId,iconKey:Me.toolName})}for(const Me of ne){if(Me.toolName==="fetch_assets")continue;const ht=Sx(Me.connectionId,Me.toolName);pt.set(ht,{id:ht,title:Me.label||Me.toolName,appId:Me.connectionId,iconKey:Me.toolName,iconUrl:Me.icon??null})}const nt=Dy(Se),lt=nt?nt.key.split("/").pop()??nt.key:null,gt=lt?[{id:Se,title:lt,kind:"file",icon:{kind:"component",Component:Me=>A.createElement(Ko,{filename:lt,...Me})}}]:[],bt=My(Se),rt=bt?[{id:Se,title:(bt.path.split("/").pop()??bt.path).replace(/\.html$/i,""),kind:"file",icon:{kind:"component",Component:Me=>A.createElement(bt.path.startsWith("pages/")?An:h8,Me)}}]:[],ct=Iy(Se),Qe=ct?ct.path.split("/").pop()??ct.path:null,dt=Qe?[{id:Se,title:Qe,kind:"file",icon:{kind:"component",Component:Me=>A.createElement(Ko,{filename:Qe,...Me})}}]:[],ye=k2(Se)?ve.map(Me=>({id:Me==="code"&&fm(Se)?Se:Me,title:Ie(Me),kind:"system",icon:R0({tabId:Me,kind:"system",connections:$})})):[];let ke;e[26]!==$?(ke=Me=>({id:Me.id,title:Me.title,kind:"agent",icon:R0({tabId:Me.id,kind:"agent",appId:Me.view.appId,connections:$})}),e[26]=$,e[27]=ke):ke=e[27];const et=[...ye,...Oe.map(Me=>({id:Me.id,title:Me.title,kind:"system",icon:R0({tabId:Me.id,kind:"system",connections:$})})),...gt,...rt,...dt,...j.map(ke),...Array.from(pt.values()).map(Me=>({id:Me.id,title:Me.title,kind:"expanded",icon:R0({tabId:Me.iconKey,kind:"expanded",appId:Me.appId,iconUrl:Me.iconUrl,connections:$})}))],tt=new Set,ut=et.filter(Me=>tt.has(Me.id)?!1:(tt.add(Me.id),!0)),jt=t.virtualMcpId;let mt;e[28]!==h.id?(mt=Dh(h.id),e[28]=h.id,e[29]=mt):mt=e[29];const ft=jt===mt;let at;e[30]!==Se||e[31]!==i||e[32]!==we||e[33]!==ft||e[34]!==n||e[35]!==h.id||e[36]!==T?(at=Me=>{if(g6({reportsOnly:T,onReportAgent:ft,tabId:Me})){n(Me,{virtualmcpid:Dh(h.id),search:uB});return}const ht=YC({clickedId:Me,activeTab:Se,mainOpen:we});"close"in ht?i():n(ht.tabId)},e[30]=Se,e[31]=i,e[32]=we,e[33]=ft,e[34]=n,e[35]=h.id,e[36]=T,e[37]=at):at=e[37];const vt=at;let wt;return e[38]!==Se||e[39]!==Ye||e[40]!==V||e[41]!==j||e[42]!==we||e[43]!==vt||e[44]!==ut?(wt={activeTab:Se,mainOpen:we,setActiveTab:vt,layoutTabs:j,expandedTools:V,automationTabParsed:Ye,tabs:ut},e[38]=Se,e[39]=Ye,e[40]=V,e[41]=j,e[42]=we,e[43]=vt,e[44]=ut,e[45]=wt):wt=e[45],wt}function uB(t){return{...t,thread:void 0}}function hB(t){return{id:t.id}}function fB(t){return{id:t.id}}function mB(t){return!!f8(t._meta)}function b_(t){const{managerAgentId:e,managerName:s,kind:n,id:i,instructions:r}=t,l=` to improve the instructions of ${n} "${i}". Here are its current instructions.
|
|
5
5
|
<current_instructions>${r}</current_instructions>`;return{type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Use "},{type:"mention",attrs:{id:e,name:s,char:"@",metadata:{agentId:e,title:s}}},{type:"text",text:l}]}]}}function pB(t){const e=U.c(9),s=ys();let n;e[0]!==t?(n=it.user(t),e[0]=t,e[1]=n):n=e[1];let i;e[2]!==s||e[3]!==t?(i=async()=>{const{user:a}=await s.call("USER_GET",{id:t});return a},e[2]=s,e[3]=t,e[4]=i):i=e[4];const r=!!t;let l;return e[5]!==n||e[6]!==i||e[7]!==r?(l={queryKey:n,queryFn:i,staleTime:3e5,retry:1,enabled:r},e[5]=n,e[6]=i,e[7]=r,e[8]=l):l=e[8],Qt(l)}function v_(t){const e=U.c(37),{id:s,size:n,showEmail:i,avatarOnly:r,className:l}=t,a=n===void 0?"xs":n,c=i===void 0?!1:i,d=r===void 0?!1:r,u=ce(),{data:h,isLoading:f,isError:m}=pB(s);if(f){let _;e[0]!==l?(_=ae("flex items-center gap-2",l),e[0]=l,e[1]=_):_=e[1];let L;e[2]!==a?(L=o.jsx(Ks.Skeleton,{shape:"circle",size:a}),e[2]=a,e[3]=L):L=e[3];let v;e[4]!==d||e[5]!==c?(v=!d&&o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"h-3 w-24 bg-muted animate-pulse rounded"}),c&&o.jsx("div",{className:"h-2 w-32 bg-muted animate-pulse rounded"})]}),e[4]=d,e[5]=c,e[6]=v):v=e[6];let S;return e[7]!==_||e[8]!==L||e[9]!==v?(S=o.jsxs("div",{className:_,children:[L,v]}),e[7]=_,e[8]=L,e[9]=v,e[10]=S):S=e[10],S}if(m||!h){let _;e[11]!==l?(_=ae("flex items-center gap-2",l),e[11]=l,e[12]=_):_=e[12];let L;e[13]!==a?(L=o.jsx(Ks,{shape:"circle",size:a,fallback:"?",muted:!0}),e[13]=a,e[14]=L):L=e[14];let v;e[15]!==d||e[16]!==u?(v=!d&&o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"text-sm text-muted-foreground",children:u("user.user.unknownUser")})}),e[15]=d,e[16]=u,e[17]=v):v=e[17];let S;return e[18]!==_||e[19]!==L||e[20]!==v?(S=o.jsxs("div",{className:_,children:[L,v]}),e[18]=_,e[19]=L,e[20]=v,e[21]=S):S=e[21],S}let p;e[22]!==l?(p=ae("flex items-center gap-2",l),e[22]=l,e[23]=p):p=e[23];const g=h.image??void 0;let x;e[24]!==a||e[25]!==g||e[26]!==h.name?(x=o.jsx(Ks,{shape:"circle",size:a,url:g,fallback:h.name}),e[24]=a,e[25]=g,e[26]=h.name,e[27]=x):x=e[27];let b;e[28]!==d||e[29]!==c||e[30]!==h.email||e[31]!==h.name?(b=!d&&o.jsxs("div",{className:"flex flex-col",children:[o.jsx("div",{className:"text-sm font-medium",children:h.name}),c&&o.jsx("div",{className:"text-xs text-muted-foreground",children:h.email})]}),e[28]=d,e[29]=c,e[30]=h.email,e[31]=h.name,e[32]=b):b=e[32];let y;return e[33]!==p||e[34]!==x||e[35]!==b?(y=o.jsxs("div",{className:p,children:[x,b]}),e[33]=p,e[34]=x,e[35]=b,e[36]=y):y=e[36],y}function gB(t){const e=U.c(82),{value:s,onChange:n,onColorChange:i,name:r,size:l,className:a,avatarClassName:c,showHoverOverlay:d,disabled:u}=t,h=l===void 0?"lg":l,f=d===void 0?!0:d,m=u===void 0?!1:u,p=ce(),[g,x]=A.useState(!1),[b,y]=A.useState("icons"),[_,L]=A.useState(""),[v,S]=A.useState("blue");let w;e[0]!==s?(w=Ff(s),e[0]=s,e[1]=w):w=e[1];const k=w,j=k.type==="icon"||k.type==="url"&&k.color?k.color:v;let C;e[2]!==n||e[3]!==j?(C=J=>{n(n1(J,j))},e[2]=n,e[3]=j,e[4]=C):C=e[4];const V=C;let N;e[5]!==n||e[6]!==i||e[7]!==k.name||e[8]!==k.type||e[9]!==k.url?(N=J=>{S(J),i?.(J),k.type==="icon"?n(n1(k.name,J)):k.type==="url"&&n(Vx(k.url,J))},e[5]=n,e[6]=i,e[7]=k.name,e[8]=k.type,e[9]=k.url,e[10]=N):N=e[10];const T=N;let P;e[11]!==n||e[12]!==j?(P=J=>{n(Vx(J,j)),x(!1)},e[11]=n,e[12]=j,e[13]=P):P=e[13];const E=P;let R;e[14]!==n||e[15]!==j?(R=()=>{const J=P2(),he=J[Math.floor(Math.random()*J.length)];n(n1(he,j))},e[14]=n,e[15]=j,e[16]=R):R=e[16];const M=R,I=m?!1:g,D=m?"cursor-default opacity-50":"cursor-pointer";let $;e[17]!==a||e[18]!==h||e[19]!==D?($=ae("relative group overflow-hidden",D,mT(h),a),e[17]=a,e[18]=h,e[19]=D,e[20]=$):$=e[20];let O;e[21]!==c||e[22]!==r||e[23]!==h||e[24]!==s?(O=o.jsx(Ur,{icon:s,name:r,size:h,className:c}),e[21]=c,e[22]=r,e[23]=h,e[24]=s,e[25]=O):O=e[25];let B;e[26]!==m||e[27]!==f?(B=f&&!m&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(Uf,{size:16,className:"text-white"})}),e[26]=m,e[27]=f,e[28]=B):B=e[28];let F;e[29]!==m||e[30]!==$||e[31]!==O||e[32]!==B?(F=o.jsx(ds,{asChild:!0,children:o.jsxs("button",{type:"button","data-testid":"icon-picker-trigger","aria-label":"Change icon",disabled:m,className:$,children:[O,B]})}),e[29]=m,e[30]=$,e[31]=O,e[32]=B,e[33]=F):F=e[33];let z;e[34]!==r||e[35]!==s?(z=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Ur,{icon:s,name:r,size:"xl"})}),e[34]=r,e[35]=s,e[36]=z):z=e[36];let W;e[37]!==b?(W=J=>{if(J.key!=="ArrowLeft"&&J.key!=="ArrowRight")return;J.preventDefault();const he=b==="icons"?"upload":"icons";y(he),document.getElementById(`icon-picker-tab-${he}`)?.focus()},e[37]=b,e[38]=W):W=e[38];const K=b==="icons",H=b==="icons"?0:-1;let q;e[39]===Symbol.for("react.memo_cache_sentinel")?(q=()=>y("icons"),e[39]=q):q=e[39];const G=b==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let Q;e[40]!==G?(Q=ae("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",G),e[40]=G,e[41]=Q):Q=e[41];let se;e[42]!==p?(se=p("common.iconPicker.iconsTab"),e[42]=p,e[43]=se):se=e[43];let Z;e[44]!==K||e[45]!==H||e[46]!==Q||e[47]!==se?(Z=o.jsx("button",{id:"icon-picker-tab-icons",type:"button",role:"tab","aria-selected":K,"aria-controls":"icon-picker-panel-icons",tabIndex:H,onClick:q,className:Q,children:se}),e[44]=K,e[45]=H,e[46]=Q,e[47]=se,e[48]=Z):Z=e[48];const te=b==="upload",X=b==="upload"?0:-1;let Y;e[49]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>y("upload"),e[49]=Y):Y=e[49];const de=b==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let re;e[50]!==de?(re=ae("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[50]=de,e[51]=re):re=e[51];let le;e[52]!==p?(le=p("common.iconPicker.uploadTab"),e[52]=p,e[53]=le):le=e[53];let ne;e[54]!==te||e[55]!==X||e[56]!==re||e[57]!==le?(ne=o.jsx("button",{id:"icon-picker-tab-upload",type:"button",role:"tab","aria-selected":te,"aria-controls":"icon-picker-panel-upload",tabIndex:X,onClick:Y,className:re,children:le}),e[54]=te,e[55]=X,e[56]=re,e[57]=le,e[58]=ne):ne=e[58];let me;e[59]===Symbol.for("react.memo_cache_sentinel")?(me=o.jsx("div",{className:"flex-1"}),e[59]=me):me=e[59];let ee;e[60]!==W||e[61]!==Z||e[62]!==ne?(ee=o.jsxs("div",{role:"tablist","aria-label":"Icon source",className:"flex items-center border-b border-border px-3",onKeyDown:W,children:[Z,ne,me]}),e[60]=W,e[61]=Z,e[62]=ne,e[63]=ee):ee=e[63];let oe;e[64]!==T||e[65]!==M||e[66]!==V||e[67]!==E||e[68]!==k.name||e[69]!==k.type||e[70]!==_||e[71]!==j||e[72]!==b?(oe=b==="icons"?o.jsx("div",{id:"icon-picker-panel-icons",role:"tabpanel","aria-labelledby":"icon-picker-tab-icons",children:o.jsx(yB,{search:_,onSearchChange:L,selectedColor:j,onColorChange:T,onSelectIcon:V,onRandom:M,currentIconName:k.type==="icon"?k.name:null})}):o.jsx("div",{id:"icon-picker-panel-upload",role:"tabpanel","aria-labelledby":"icon-picker-tab-upload",children:o.jsx(_B,{onUpload:E})}),e[64]=T,e[65]=M,e[66]=V,e[67]=E,e[68]=k.name,e[69]=k.type,e[70]=_,e[71]=j,e[72]=b,e[73]=oe):oe=e[73];let ie;e[74]!==z||e[75]!==ee||e[76]!==oe?(ie=o.jsx(hs,{align:"start",className:"w-80 p-0",onOpenAutoFocus:xB,children:o.jsxs("div",{className:"flex flex-col",children:[z,ee,oe]})}),e[74]=z,e[75]=ee,e[76]=oe,e[77]=ie):ie=e[77];let ue;return e[78]!==F||e[79]!==ie||e[80]!==I?(ue=o.jsxs(fs,{open:I,onOpenChange:x,children:[F,ie]}),e[78]=F,e[79]=ie,e[80]=I,e[81]=ue):ue=e[81],ue}function xB(t){return t.preventDefault()}function bB(t){const e=U.c(33),{selectedColor:s,onColorChange:n}=t,i=ce(),[r,l]=A.useState(!1);let a,c,d,u,h,f,m;if(e[0]!==r||e[1]!==s){const v=R6(s);c=fs,f=r,m=l,a=ds,h=!0,d="button",u=ae("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",v.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=c,e[4]=d,e[5]=u,e[6]=h,e[7]=f,e[8]=m}else a=e[2],c=e[3],d=e[4],u=e[5],h=e[6],f=e[7],m=e[8];let p;e[9]!==i?(p=i("common.iconPicker.changeColor"),e[9]=i,e[10]=p):p=e[10];let g;e[11]!==i?(g=i("common.iconPicker.changeColor"),e[11]=i,e[12]=g):g=e[12];let x;e[13]!==d||e[14]!==u||e[15]!==p||e[16]!==g?(x=o.jsx("button",{type:d,className:u,title:p,"aria-label":g}),e[13]=d,e[14]=u,e[15]=p,e[16]=g,e[17]=x):x=e[17];let b;e[18]!==a||e[19]!==h||e[20]!==x?(b=o.jsx(a,{asChild:h,children:x}),e[18]=a,e[19]=h,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==n||e[23]!==s?(y=gT.map(v=>o.jsx("button",{type:"button",onClick:()=>{n(v.name),l(!1)},className:ae("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",v.dot,s===v.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:v.name,"aria-label":v.name},v.name)),e[22]=n,e[23]=s,e[24]=y):y=e[24];let _;e[25]!==y?(_=o.jsx(hs,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:vB,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:y})}),e[25]=y,e[26]=_):_=e[26];let L;return e[27]!==c||e[28]!==_||e[29]!==f||e[30]!==m||e[31]!==b?(L=o.jsxs(c,{open:f,onOpenChange:m,children:[b,_]}),e[27]=c,e[28]=_,e[29]=f,e[30]=m,e[31]=b,e[32]=L):L=e[32],L}function vB(t){return t.preventDefault()}function yB(t){const e=U.c(55),{search:s,onSearchChange:n,selectedColor:i,onColorChange:r,onSelectIcon:l,onRandom:a,currentIconName:c}=t,d=ce();let u,h,f,m,p,g,x;if(e[0]!==c||e[1]!==r||e[2]!==a||e[3]!==n||e[4]!==l||e[5]!==s||e[6]!==i||e[7]!==d){const v=P2(),S=R6(i);h=D6(v,s),g="flex flex-col";let w;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(wu,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[15]=w):w=e[15];let k;e[16]!==n?(k=R=>n(R.target.value),e[16]=n,e[17]=k):k=e[17];let j;e[18]!==d?(j=d("common.iconPicker.filterPlaceholder"),e[18]=d,e[19]=j):j=e[19];let C;e[20]!==s||e[21]!==k||e[22]!==j?(C=o.jsxs("div",{className:"relative flex-1",children:[w,o.jsx(kt,{value:s,onChange:k,placeholder:j,className:"h-8 text-xs pl-7"})]}),e[20]=s,e[21]=k,e[22]=j,e[23]=C):C=e[23];let V;e[24]!==d?(V=d("common.iconPicker.randomIcon"),e[24]=d,e[25]=V):V=e[25];let N;e[26]!==d?(N=d("common.iconPicker.randomIcon"),e[26]=d,e[27]=N):N=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(pT,{size:14,className:"text-muted-foreground"}),e[28]=T):T=e[28];let P;e[29]!==a||e[30]!==V||e[31]!==N?(P=o.jsx("button",{type:"button",onClick:a,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:V,"aria-label":N,children:T}),e[29]=a,e[30]=V,e[31]=N,e[32]=P):P=e[32];let E;e[33]!==r||e[34]!==i?(E=o.jsx(bB,{selectedColor:i,onColorChange:r}),e[33]=r,e[34]=i,e[35]=E):E=e[35],e[36]!==P||e[37]!==E||e[38]!==C?(x=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[C,P,E]}),e[36]=P,e[37]=E,e[38]=C,e[39]=x):x=e[39],u=Ql,p="h-56",f="grid grid-cols-9 gap-0.5 px-2 pb-2",m=h.map(R=>{const M=Jl(R);return M?o.jsx("button",{type:"button",onClick:()=>l(R),className:ae("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",c===R?ae(S.bg,S.text):ae(S.text,"hover:bg-accent")),title:R,"aria-label":ym(R),children:o.jsx(M,{size:18})},R):null}),e[0]=c,e[1]=r,e[2]=a,e[3]=n,e[4]=l,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g,e[14]=x}else u=e[8],h=e[9],f=e[10],m=e[11],p=e[12],g=e[13],x=e[14];let b;e[40]!==f||e[41]!==m?(b=o.jsx("div",{className:f,children:m}),e[40]=f,e[41]=m,e[42]=b):b=e[42];let y;e[43]!==h.length||e[44]!==d?(y=h.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:d("common.iconPicker.noIconsFound")}),e[43]=h.length,e[44]=d,e[45]=y):y=e[45];let _;e[46]!==u||e[47]!==p||e[48]!==b||e[49]!==y?(_=o.jsxs(u,{className:p,children:[b,y]}),e[46]=u,e[47]=p,e[48]=b,e[49]=y,e[50]=_):_=e[50];let L;return e[51]!==g||e[52]!==x||e[53]!==_?(L=o.jsxs("div",{className:g,children:[x,_]}),e[51]=g,e[52]=x,e[53]=_,e[54]=L):L=e[54],L}function _B(t){const e=U.c(46),{onUpload:s}=t,n=ce(),i=A.useRef(null);let r;e[0]!==s||e[1]!==n?(r=P=>{const E=P.target.files?.[0];if(!E)return;if(E.size>2097152){xe.error(n("common.iconPicker.imageTooLarge")),P.target.value="";return}const R=new FileReader;R.onerror=()=>{xe.error(n("common.iconPicker.failedToReadImage")),i.current&&(i.current.value="")},R.onloadend=()=>{R.readyState===FileReader.DONE&&R.result&&s(R.result),i.current&&(i.current.value="")},R.readAsDataURL(E)},e[0]=s,e[1]=n,e[2]=r):r=e[2];const l=r,[a,c]=A.useState("");let d;e[3]!==s||e[4]!==a?(d=()=>{const P=a.trim();P&&(s(P),c(""))},e[3]=s,e[4]=a,e[5]=d):d=e[5];const u=d;let h;e[6]!==l?(h=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=()=>i.current?.click(),e[8]=f):f=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Jn,{size:20}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("common.iconPicker.uploadHint"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==p?(g=o.jsxs("button",{type:"button",onClick:f,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[m,o.jsx("span",{className:"text-xs",children:p})]}),e[12]=p,e[13]=g):g=e[13];let x;e[14]!==n?(x=n("common.iconPicker.or"),e[14]=n,e[15]=x):x=e[15];let b;e[16]!==x?(b=o.jsx("span",{className:"text-xs text-muted-foreground",children:x}),e[16]=x,e[17]=b):b=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"flex-1 h-px bg-border"}),e[18]=y):y=e[18];let _;e[19]!==b?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[b,y]}),e[19]=b,e[20]=_):_=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=P=>c(P.target.value),e[21]=L):L=e[21];let v;e[22]!==n?(v=n("common.iconPicker.pasteUrlPlaceholder"),e[22]=n,e[23]=v):v=e[23];let S;e[24]!==u?(S=P=>{P.key==="Enter"&&(P.preventDefault(),u())},e[24]=u,e[25]=S):S=e[25];let w;e[26]!==a||e[27]!==v||e[28]!==S?(w=o.jsx(kt,{value:a,onChange:L,placeholder:v,className:"h-8 text-xs flex-1",onKeyDown:S}),e[26]=a,e[27]=v,e[28]=S,e[29]=w):w=e[29];let k;e[30]!==a?(k=a.trim(),e[30]=a,e[31]=k):k=e[31];const j=!k;let C;e[32]!==n?(C=n("common.iconPicker.apply"),e[32]=n,e[33]=C):C=e[33];let V;e[34]!==u||e[35]!==j||e[36]!==C?(V=o.jsx(fe,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:u,disabled:j,children:C}),e[34]=u,e[35]=j,e[36]=C,e[37]=V):V=e[37];let N;e[38]!==w||e[39]!==V?(N=o.jsxs("div",{className:"flex items-center gap-1.5",children:[w,V]}),e[38]=w,e[39]=V,e[40]=N):N=e[40];let T;return e[41]!==_||e[42]!==N||e[43]!==h||e[44]!==g?(T=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[h,g,_,N]}),e[41]=_,e[42]=N,e[43]=h,e[44]=g,e[45]=T):T=e[45],T}const y_=25*1024*1024,f1="home",m1="knowledge";function M4(t){return t==null?"":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function cl(t){return t.split("/").pop()??t}function LB(t){const e=U.c(64),{form:s}=t,n=ce(),{upload:i}=vu(f1),r=Wu(),l=A.useRef(null),[a,c]=A.useState(!1),[d,u]=A.useState(""),[h,f]=A.useState(!1);let m;e[0]!==a?(m={enabled:a},e[0]=a,e[1]=m):m=e[1];const{data:p}=l8(60,m),g=p===void 0?[]:p;let x;e[2]!==a?(x={enabled:a},e[2]=a,e[3]=x):x=e[3];const{data:b}=ZA(x),y=b===void 0?[]:b;let _;e[4]!==s?(_=()=>s.getValues("metadata.knowledge")??[],e[4]=s,e[5]=_):_=e[5];const[L,v]=A.useState(_);let S;e[6]!==s?(S=ie=>{v(ie),s.setValue("metadata.knowledge",ie,{shouldDirty:!0})},e[6]=s,e[7]=S):S=e[7];const w=S;let k;e[8]!==r||e[9]!==L||e[10]!==w||e[11]!==n||e[12]!==i?(k=async ie=>{if(!ie||ie.length===0)return;const ue=Array.from(ie),J=ue.filter(VB),he=ue.filter(NB);if(he.length>0&&xe.warning(n("virtualMcp.filesSection.fileTooLargeTitle"),{description:n("virtualMcp.filesSection.fileTooLargeDescription",{names:he.map(CB).join(", ")})}),J.length!==0){try{await i.mutateAsync({dir:m1,files:J})}catch(ve){const je=ve;xe.error(je instanceof Error?je.message:n("virtualMcp.filesSection.failedUploadFile"));return}w([...L,...J.map(ve=>({id:crypto.randomUUID(),name:ve.name,volume:f1,path:`${m1}/${ve.name}`,url:r(f1,`${m1}/${ve.name}`),contentType:ve.type||null,size:ve.size,addedAt:new Date().toISOString()}))])}},e[8]=r,e[9]=L,e[10]=w,e[11]=n,e[12]=i,e[13]=k):k=e[13];const j=k;let C;e[14]!==r||e[15]!==L||e[16]!==w?(C=ie=>{L.some(ue=>ue.volume===ie.volume&&ue.path===ie.path)||(w([...L,{id:crypto.randomUUID(),name:cl(ie.path),volume:ie.volume,path:ie.path,url:r(ie.volume,ie.path),contentType:null,size:ie.size??null,addedAt:new Date().toISOString()}]),c(!1))},e[14]=r,e[15]=L,e[16]=w,e[17]=C):C=e[17];const V=C;let N;e[18]!==r||e[19]!==L||e[20]!==w?(N=ie=>{L.some(ue=>ue.volume===ie.volume&&ue.path===ie.path)||(w([...L,{id:crypto.randomUUID(),name:cl(ie.path),kind:"skill",volume:ie.volume,path:ie.path,url:r(ie.volume,ie.path),contentType:null,size:null,addedAt:new Date().toISOString()}]),c(!1))},e[18]=r,e[19]=L,e[20]=w,e[21]=N):N=e[21];const T=N;let P;e[22]!==L||e[23]!==w?(P=ie=>{w(L.filter(ue=>ue.id!==ie))},e[22]=L,e[23]=w,e[24]=P):P=e[24];const E=P;let R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=ie=>{c(ie),ie&&u("")},e[25]=R):R=e[25];const M=R;let I;e[26]!==L?(I=new Set(L.map(jB)),e[26]=L,e[27]=I):I=e[27];const D=I,$=d.toLowerCase();let O;e[28]!==D?(O=ie=>!D.has(`${ie.volume}/${ie.path}`),e[28]=D,e[29]=O):O=e[29];const B=g.filter(kB).filter(O).filter(ie=>cl(ie.path).toLowerCase().includes($)).slice(0,5);let F;e[30]!==D?(F=ie=>!D.has(`${ie.volume}/${ie.path}`),e[30]=D,e[31]=F):F=e[31];const z=y.filter(F).filter(ie=>cl(ie.path).toLowerCase().includes($)).slice(0,5),W=ie=>o.jsxs(Ht,{open:a,onOpenChange:M,children:[o.jsx(Kt,{asChild:!0,children:ie}),o.jsxs(Wt,{align:"end",className:"w-56",children:[o.jsxs(Ze,{onSelect:()=>{l.current?.click()},children:[o.jsx(xT,{size:16}),n("virtualMcp.filesSection.uploadFile")]}),o.jsxs(Zi,{children:[o.jsxs(er,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[o.jsx(Ho,{size:16}),n("virtualMcp.filesSection.selectFileOrFolder")]}),o.jsxs(tr,{className:"w-72 p-0",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[o.jsx(wu,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("input",{value:d,onChange:ue=>u(ue.target.value),onKeyDown:wB,placeholder:n("virtualMcp.filesSection.searchFilesPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:B.length===0?o.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:n("virtualMcp.filesSection.noFilesFound")}):B.map(ue=>o.jsxs(Ze,{onSelect:()=>V(ue),children:[o.jsx(Ko,{filename:cl(ue.path),className:"h-5 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:cl(ue.path)}),ue.size!=null&&o.jsx("span",{className:"text-xs text-muted-foreground",children:M4(ue.size)})]},`${ue.volume}/${ue.path}`))})]})]}),o.jsxs(Zi,{children:[o.jsxs(er,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[o.jsx(zr,{size:16}),n("virtualMcp.filesSection.selectSkill")]}),o.jsxs(tr,{className:"w-72 p-0",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[o.jsx(wu,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("input",{value:d,onChange:ue=>u(ue.target.value),onKeyDown:SB,placeholder:n("virtualMcp.filesSection.searchSkillsPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:z.length===0?o.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:n("virtualMcp.filesSection.noSkillsFound")}):z.map(ue=>o.jsxs(Ze,{onSelect:()=>T(ue),children:[o.jsx(zr,{size:16,className:"shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:cl(ue.path)})]},`${ue.volume}/${ue.path}`))})]})]})]})]}),K="flex flex-col gap-3";let H;e[32]!==n?(H=n("virtualMcp.filesSection.filesAndSkills"),e[32]=n,e[33]=H):H=e[33];let q;e[34]!==H?(q=o.jsx("h2",{className:"text-sm font-medium text-foreground",children:H}),e[34]=H,e[35]=q):q=e[35];let G;e[36]!==n?(G=n("virtualMcp.filesSection.description"),e[36]=n,e[37]=G):G=e[37];let Q;e[38]!==G?(Q=o.jsx("p",{className:"text-sm text-muted-foreground",children:G}),e[38]=G,e[39]=Q):Q=e[39];let se;e[40]!==q||e[41]!==Q?(se=o.jsxs("div",{className:"flex flex-col gap-1",children:[q,Q]}),e[40]=q,e[41]=Q,e[42]=se):se=e[42];const Z=L.length>0&&W(o.jsxs(fe,{variant:"outline",size:"sm",disabled:i.isPending,children:[i.isPending?o.jsx(st,{size:"xs"}):o.jsx(Yt,{size:14}),n("virtualMcp.filesSection.add")]}));let te;e[43]!==se||e[44]!==Z?(te=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[se,Z]}),e[43]=se,e[44]=Z,e[45]=te):te=e[45];let X;e[46]!==j?(X=o.jsx("input",{ref:l,type:"file",multiple:!0,className:"hidden",onChange:ie=>{j(ie.target.files),ie.target.value=""}}),e[46]=j,e[47]=X):X=e[47];let Y,de;e[48]===Symbol.for("react.memo_cache_sentinel")?(Y=ie=>{ie.preventDefault(),f(!0)},de=()=>f(!1),e[48]=Y,e[49]=de):(Y=e[48],de=e[49]);let re;e[50]!==j?(re=ie=>{ie.preventDefault(),ie.stopPropagation(),f(!1),j(ie.dataTransfer.files)},e[50]=j,e[51]=re):re=e[51];const le=h&&"outline outline-2 outline-dashed outline-primary";let ne;e[52]!==le?(ne=ae("flex flex-col gap-2 rounded-lg",le),e[52]=le,e[53]=ne):ne=e[53];const me=L.length===0?W(o.jsxs("button",{type:"button",className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent/50 transition-colors w-full text-left cursor-pointer",children:[o.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:o.jsx(Yt,{size:16})}),o.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:n("virtualMcp.filesSection.noFilesOrSkillsYet")})]})):L.map(ie=>o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border bg-card",children:[ie.kind==="skill"?o.jsx("div",{className:"flex items-center justify-center h-8 w-6.5 shrink-0 rounded-md bg-muted text-muted-foreground",children:o.jsx(zr,{size:16})}):o.jsx(Ko,{filename:ie.name,className:"h-8 w-6.5 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:ie.name}),o.jsx("p",{className:"text-xs text-muted-foreground",children:ie.kind==="skill"?n("virtualMcp.filesSection.kindSkill"):ie.size!=null?M4(ie.size):n("virtualMcp.filesSection.kindFile")})]}),o.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>E(ie.id),"aria-label":n("virtualMcp.filesSection.removeAriaLabel",{name:ie.name}),children:o.jsx(on,{size:16})})]},ie.id));let ee;e[54]!==Y||e[55]!==de||e[56]!==re||e[57]!==ne||e[58]!==me?(ee=o.jsx("div",{onDragOver:Y,onDragLeave:de,onDrop:re,className:ne,children:me}),e[54]=Y,e[55]=de,e[56]=re,e[57]=ne,e[58]=me,e[59]=ee):ee=e[59];let oe;return e[60]!==te||e[61]!==X||e[62]!==ee?(oe=o.jsxs("section",{className:K,children:[te,X,ee]}),e[60]=te,e[61]=X,e[62]=ee,e[63]=oe):oe=e[63],oe}function SB(t){return t.stopPropagation()}function wB(t){return t.stopPropagation()}function kB(t){return t.kind!=="dir"}function jB(t){return`${t.volume}/${t.path}`}function CB(t){return t.name}function NB(t){return t.size>y_}function VB(t){return t.size<=y_}function TB(t){return t==null?"all":t.length===0?"self":"selected"}function AB(t){const e=U.c(88),{form:s,currentAgentId:n}=t,i=ce(),{org:r}=Fe(),l=Xc(),[a,c]=A.useState(!1);let d;e[0]!==s?(d=s.getValues("metadata.subAgents")??null,e[0]=s,e[1]=d):d=e[1];const u=d;let h;e[2]!==u?(h=()=>TB(u),e[2]=u,e[3]=h):h=e[3];const[f,m]=A.useState(h);let p;e[4]!==u?(p=u??[],e[4]=u,e[5]=p):p=e[5];const[g,x]=A.useState(p);let b,y,_,L,v,S;if(e[6]!==l||e[7]!==n||e[8]!==s||e[9]!==f||e[10]!==r||e[11]!==g||e[12]!==i){let C;e[19]!==n||e[20]!==r?(C=Y=>Y.id!==n&&Y.id!==r.id&&Y.status==="active",e[19]=n,e[20]=r,e[21]=C):C=e[21],b=l.filter(C);let V;e[22]!==g?(V=Y=>g.includes(Y.id),e[22]=g,e[23]=V):V=e[23];const N=b.filter(V);let T;e[24]!==s?(T=(Y,de)=>s.setValue("metadata.subAgents",Y==="all"?null:Y==="self"?[]:de,{shouldDirty:!0}),e[24]=s,e[25]=T):T=e[25];const P=T;let E;e[26]!==P||e[27]!==g?(E=Y=>{m(Y),P(Y,g)},e[26]=P,e[27]=g,e[28]=E):E=e[28];const R=E;let M;e[29]!==P||e[30]!==g?(M=Y=>{const de=g.includes(Y)?g.filter(re=>re!==Y):[...g,Y];x(de),P("selected",de)},e[29]=P,e[30]=g,e[31]=M):M=e[31],y=M,v="flex flex-col gap-3";let I;e[32]!==i?(I=i("virtualMcp.subAgentsSection.title"),e[32]=i,e[33]=I):I=e[33];let D;e[34]!==I?(D=o.jsx("h2",{className:"text-sm font-medium text-foreground",children:I}),e[34]=I,e[35]=D):D=e[35];let $;e[36]!==f||e[37]!==i?($=f==="all"&&o.jsx("p",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.canDelegateToAnyAgent")}),e[36]=f,e[37]=i,e[38]=$):$=e[38];let O;e[39]!==f||e[40]!==i?(O=f==="self"&&o.jsx("p",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.canOnlyDelegateToItself")}),e[39]=f,e[40]=i,e[41]=O):O=e[41];let B;e[42]!==D||e[43]!==$||e[44]!==O?(B=o.jsxs("div",{className:"flex flex-col gap-1",children:[D,$,O]}),e[42]=D,e[43]=$,e[44]=O,e[45]=B):B=e[45];const F=f==="selected"&&N.length>0&&o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>c(!0),children:[o.jsx(Yt,{size:14}),i("virtualMcp.subAgentsSection.addSubAgent")]});let z;e[46]!==R?(z=Y=>R(Y),e[46]=R,e[47]=z):z=e[47];let W;e[48]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(js,{size:"sm",className:"w-auto",children:o.jsx(Ds,{})}),e[48]=W):W=e[48];let K;e[49]!==i?(K=i("virtualMcp.subAgentsSection.anyAgent"),e[49]=i,e[50]=K):K=e[50];let H;e[51]!==K?(H=o.jsx(Ot,{value:"all",children:K}),e[51]=K,e[52]=H):H=e[52];let q;e[53]!==i?(q=i("virtualMcp.subAgentsSection.specificAgents"),e[53]=i,e[54]=q):q=e[54];let G;e[55]!==q?(G=o.jsx(Ot,{value:"selected",children:q}),e[55]=q,e[56]=G):G=e[56];let Q;e[57]!==i?(Q=i("virtualMcp.subAgentsSection.onlyItself"),e[57]=i,e[58]=Q):Q=e[58];let se;e[59]!==Q?(se=o.jsx(Ot,{value:"self",children:Q}),e[59]=Q,e[60]=se):se=e[60];let Z;e[61]!==H||e[62]!==G||e[63]!==se?(Z=o.jsxs(Cs,{align:"end",children:[H,G,se]}),e[61]=H,e[62]=G,e[63]=se,e[64]=Z):Z=e[64];let te;e[65]!==f||e[66]!==z||e[67]!==Z?(te=o.jsxs(ks,{value:f,onValueChange:z,children:[W,Z]}),e[65]=f,e[66]=z,e[67]=Z,e[68]=te):te=e[68];let X;e[69]!==F||e[70]!==te?(X=o.jsxs("div",{className:"flex items-center gap-2",children:[F,te]}),e[69]=F,e[70]=te,e[71]=X):X=e[71],e[72]!==B||e[73]!==X?(S=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[B,X]}),e[72]=B,e[73]=X,e[74]=S):S=e[74],_="flex flex-col gap-2",L=f==="selected"&&(N.length>0?N.map(Y=>o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border bg-background",children:[o.jsx(so,{icon:Y.icon,name:Y.title,size:"sm",className:"shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:Y.title}),Y.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Y.description})]}),o.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>y(Y.id),children:o.jsx(Ni,{size:16})})]},Y.id)):o.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent/50 transition-colors w-full text-left cursor-pointer",children:[o.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:o.jsx(Yt,{size:16})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.emptyStateMessage")})]})),e[6]=l,e[7]=n,e[8]=s,e[9]=f,e[10]=r,e[11]=g,e[12]=i,e[13]=b,e[14]=y,e[15]=_,e[16]=L,e[17]=v,e[18]=S}else b=e[13],y=e[14],_=e[15],L=e[16],v=e[17],S=e[18];let w;e[75]!==_||e[76]!==L?(w=o.jsx("div",{className:_,children:L}),e[75]=_,e[76]=L,e[77]=w):w=e[77];let k;e[78]!==b||e[79]!==y||e[80]!==a||e[81]!==g?(k=o.jsx(PB,{open:a,onOpenChange:c,candidates:b,selectedIds:g,onToggle:y}),e[78]=b,e[79]=y,e[80]=a,e[81]=g,e[82]=k):k=e[82];let j;return e[83]!==v||e[84]!==S||e[85]!==w||e[86]!==k?(j=o.jsxs("section",{className:v,children:[S,w,k]}),e[83]=v,e[84]=S,e[85]=w,e[86]=k,e[87]=j):j=e[87],j}function PB(t){const e=U.c(39),{open:s,onOpenChange:n,candidates:i,selectedIds:r,onToggle:l}=t,a=ce(),[c,d]=A.useState("");let u,h,f,m,p,g,x,b,y;if(e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==s||e[4]!==c||e[5]!==r||e[6]!==a){const S=c.toLowerCase(),w=i.filter(C=>C.title.toLowerCase().includes(S)||C.description?.toLowerCase().includes(S));h=Ut,b=s,y=n,u=Ft,p="max-w-md";let k;e[16]!==a?(k=a("virtualMcp.subAgentsSection.title"),e[16]=a,e[17]=k):k=e[17],e[18]!==k?(g=o.jsx(ms,{children:o.jsx(Gt,{children:k})}),e[18]=k,e[19]=g):g=e[19];let j;e[20]!==a?(j=a("virtualMcp.subAgentsSection.searchPlaceholder"),e[20]=a,e[21]=j):j=e[21],e[22]!==c||e[23]!==j?(x=o.jsx(e9,{value:c,onChange:d,placeholder:j,className:"w-full"}),e[22]=c,e[23]=j,e[24]=x):x=e[24],f="flex flex-col gap-1 max-h-80 overflow-y-auto",m=w.length===0?o.jsx("p",{className:"text-sm text-muted-foreground px-1 py-4 text-center",children:a("virtualMcp.subAgentsSection.noAgentsFound")}):w.map(C=>o.jsxs("button",{type:"button",onClick:()=>l(C.id),className:"flex items-center gap-3 px-2 py-2 rounded-lg hover:bg-accent/50 transition-colors cursor-pointer w-full text-left",children:[o.jsx(id,{checked:r.includes(C.id),className:"pointer-events-none",tabIndex:-1}),o.jsx(so,{icon:C.icon,name:C.title,size:"sm",className:"shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:C.title}),C.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.description})]})]},C.id)),e[0]=i,e[1]=n,e[2]=l,e[3]=s,e[4]=c,e[5]=r,e[6]=a,e[7]=u,e[8]=h,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=y}else u=e[7],h=e[8],f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],y=e[15];let _;e[25]!==f||e[26]!==m?(_=o.jsx("div",{className:f,children:m}),e[25]=f,e[26]=m,e[27]=_):_=e[27];let L;e[28]!==u||e[29]!==p||e[30]!==g||e[31]!==x||e[32]!==_?(L=o.jsxs(u,{className:p,children:[g,x,_]}),e[28]=u,e[29]=p,e[30]=g,e[31]=x,e[32]=_,e[33]=L):L=e[33];let v;return e[34]!==h||e[35]!==b||e[36]!==y||e[37]!==L?(v=o.jsx(h,{open:b,onOpenChange:y,children:L}),e[34]=h,e[35]=b,e[36]=y,e[37]=L,e[38]=v):v=e[38],v}function Fd(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(st,{className:"size-6 text-muted-foreground"})}),t[0]=e):e=t[0],e}function D0(t,e){return({error:s})=>s?.message?.includes("Method not found")||s?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Qo,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:e("virtualMcp.dependencySelectionDialog.somethingWentWrong")}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:s?.message?s.message.length>200?`${s.message.slice(0,200)}...`:s.message:e("virtualMcp.dependencySelectionDialog.unexpectedError")})]})]})}function __(t){const e=U.c(23),{item:s,isSelected:n,onToggle:i,disabled:r}=t,l=r?"cursor-not-allowed opacity-50":"cursor-pointer",a=n?"bg-accent/25":"hover:bg-muted/50";let c;e[0]!==l||e[1]!==a?(c=ae("flex items-start gap-3 p-4 rounded-lg transition-colors",l,a),e[0]=l,e[1]=a,e[2]=c):c=e[2];let d;e[3]!==s.name?(d=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=d):d=e[4];let u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let h;e[7]!==d||e[8]!==u?(h=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d,u]}),e[7]=d,e[8]=u,e[9]=h):h=e[9];let f;e[10]!==s.description?(f=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=f):f=e[11];let m;e[12]!==h||e[13]!==f?(m=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[h,f]}),e[12]=h,e[13]=f,e[14]=m):m=e[14];let p;e[15]!==r||e[16]!==n||e[17]!==i?(p=o.jsx(id,{checked:n,onCheckedChange:i,disabled:r,className:"mt-0.5"}),e[15]=r,e[16]=n,e[17]=i,e[18]=p):p=e[18];let g;return e[19]!==c||e[20]!==m||e[21]!==p?(g=o.jsxs("label",{className:c,children:[m,p]}),e[19]=c,e[20]=m,e[21]=p,e[22]=g):g=e[22],g}function EB(t){const e=U.c(35),{activeTab:s,onTabChange:n,showSelectAll:i,isAllSelected:r,handleSelectAll:l}=t,a=ce();let c;e[0]!==a?(c=a("virtualMcp.dependencySelectionDialog.tabTools"),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==c?(d={id:"tools",label:c},e[2]=c,e[3]=d):d=e[3];let u;e[4]!==a?(u=a("virtualMcp.dependencySelectionDialog.tabActive"),e[4]=a,e[5]=u):u=e[5];let h;e[6]!==u?(h={id:"active",label:u},e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a?(f=a("virtualMcp.dependencySelectionDialog.tabResources"),e[8]=a,e[9]=f):f=e[9];let m;e[10]!==f?(m={id:"resources",label:f},e[10]=f,e[11]=m):m=e[11];let p;e[12]!==a?(p=a("virtualMcp.dependencySelectionDialog.tabPrompts"),e[12]=a,e[13]=p):p=e[13];let g;e[14]!==p?(g={id:"prompts",label:p},e[14]=p,e[15]=g):g=e[15];let x;e[16]!==d||e[17]!==h||e[18]!==m||e[19]!==g?(x=[d,h,m,g],e[16]=d,e[17]=h,e[18]=m,e[19]=g,e[20]=x):x=e[20];let b;e[21]!==n?(b=v=>n(v),e[21]=n,e[22]=b):b=e[22];let y;e[23]!==s||e[24]!==b||e[25]!==x?(y=o.jsx(L8,{tabs:x,activeTab:s,onTabChange:b}),e[23]=s,e[24]=b,e[25]=x,e[26]=y):y=e[26];let _;e[27]!==l||e[28]!==r||e[29]!==i||e[30]!==a?(_=i&&o.jsx("button",{type:"button",onClick:l,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:a(r?"virtualMcp.dependencySelectionDialog.deselectAll":"virtualMcp.dependencySelectionDialog.selectAll")}),e[27]=l,e[28]=r,e[29]=i,e[30]=a,e[31]=_):_=e[31];let L;return e[32]!==y||e[33]!==_?(L=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[y,_]}),e[32]=y,e[33]=_,e[34]=L):L=e[34],L}function Pg(t){const e=U.c(13),{items:s,selections:n,onToggle:i,emptyMessage:r,disabled:l}=t;let a,c,d;if(e[0]!==l||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==n){d=Symbol.for("react.early_return_sentinel");e:{const h=s.map(RB);if(s.length===0){let f;e[8]!==r?(f=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:r})}),e[8]=r,e[9]=f):f=e[9],d=f;break e}a="flex-1 overflow-auto px-4 py-3 space-y-1",c=s.map(f=>o.jsx(__,{item:f,isSelected:n===null||n?.includes(f.id),onToggle:()=>i(f.id,h),disabled:l},f.id))}e[0]=l,e[1]=r,e[2]=s,e[3]=i,e[4]=n,e[5]=a,e[6]=c,e[7]=d}else a=e[5],c=e[6],d=e[7];if(d!==Symbol.for("react.early_return_sentinel"))return d;let u;return e[10]!==a||e[11]!==c?(u=o.jsx("div",{className:a,children:c}),e[10]=a,e[11]=c,e[12]=u):u=e[12],u}function RB(t){return t.id}function DB(t){const e=U.c(22),{connectionId:s,toolSelections:n,onToggleTool:i}=t,r=ce(),{org:l}=Fe();let a;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(a={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=a):a=e[3];const c=$s(a);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u}=_6(d),h=u.tools;let f,m,p;if(e[6]!==u.tools||e[7]!==i||e[8]!==r||e[9]!==n){p=Symbol.for("react.early_return_sentinel");e:{const x=h.map(IB);let b;e[13]!==n?(b=L=>n===null||n.includes(L.name),e[13]=n,e[14]=b):b=e[14];const _=u.tools.filter(b).map(MB);if(_.length===0){let L;e[15]!==r?(L=r("virtualMcp.dependencySelectionDialog.noActiveToolsSelected"),e[15]=r,e[16]=L):L=e[16];let v;e[17]!==L?(v=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:L})}),e[17]=L,e[18]=v):v=e[18],p=v;break e}f="flex-1 overflow-auto px-4 py-3 space-y-1",m=_.map(L=>o.jsx(__,{item:L,isSelected:!0,onToggle:()=>i(L.id,x)},L.id))}e[6]=u.tools,e[7]=i,e[8]=r,e[9]=n,e[10]=f,e[11]=m,e[12]=p}else f=e[10],m=e[11],p=e[12];if(p!==Symbol.for("react.early_return_sentinel"))return p;let g;return e[19]!==f||e[20]!==m?(g=o.jsx("div",{className:f,children:m}),e[19]=f,e[20]=m,e[21]=g):g=e[21],g}function MB(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(S8,{annotations:t.annotations,_meta:t._meta})}}function IB(t){return t.name}function OB(t){const e=U.c(16),{connectionId:s,selections:n,onToggle:i,disabled:r}=t,{org:l}=Fe();let a;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(a={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=a):a=e[3];const c=$s(a);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u}=_6(d);let h;e[6]!==u.tools?(h=u.tools.map($B),e[6]=u.tools,e[7]=h):h=e[7];const f=h,m=ce();let p;e[8]!==m?(p=m("virtualMcp.dependencySelectionDialog.noToolsAvailable"),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==r||e[11]!==f||e[12]!==i||e[13]!==n||e[14]!==p?(g=o.jsx(Pg,{items:f,selections:n,onToggle:i,emptyMessage:p,disabled:r}),e[10]=r,e[11]=f,e[12]=i,e[13]=n,e[14]=p,e[15]=g):g=e[15],g}function $B(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(S8,{annotations:t.annotations,_meta:t._meta})}}function BB(t){const e=U.c(16),{connectionId:s,selections:n,onToggle:i,disabled:r}=t,{org:l}=Fe();let a;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(a={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=a):a=e[3];const c=$s(a);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u}=JC(d);let h;e[6]!==u.resources?(h=u.resources.map(zB),e[6]=u.resources,e[7]=h):h=e[7];const f=h,m=ce();let p;e[8]!==m?(p=m("virtualMcp.dependencySelectionDialog.noResourcesAvailable"),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==r||e[11]!==f||e[12]!==i||e[13]!==n||e[14]!==p?(g=o.jsx(Pg,{items:f,selections:n,onToggle:i,emptyMessage:p,disabled:r}),e[10]=r,e[11]=f,e[12]=i,e[13]=n,e[14]=p,e[15]=g):g=e[15],g}function zB(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function FB(t){const e=U.c(16),{connectionId:s,selections:n,onToggle:i,disabled:r}=t,{org:l}=Fe();let a;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(a={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=a):a=e[3];const c=$s(a);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u}=h6(d);let h;e[6]!==u.prompts?(h=u.prompts.map(UB),e[6]=u.prompts,e[7]=h):h=e[7];const f=h,m=ce();let p;e[8]!==m?(p=m("virtualMcp.dependencySelectionDialog.noPromptsAvailable"),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==r||e[11]!==f||e[12]!==i||e[13]!==n||e[14]!==p?(g=o.jsx(Pg,{items:f,selections:n,onToggle:i,emptyMessage:p,disabled:r}),e[10]=r,e[11]=f,e[12]=i,e[13]=n,e[14]=p,e[15]=g):g=e[15],g}function UB(t){return{id:t.name,name:t.name,description:t.description}}function HB(t){const e=U.c(58),{currentConnection:s,activeTab:n,selectedId:i,formData:r,toggleTool:l,toggleResource:a,togglePrompt:c,toggleAllTools:d,toggleAllResources:u,toggleAllPrompts:h,onTabChange:f}=t,m=ce(),p=r[i],g=n==="tools"?p?.tools===null:n==="resources"?p?.resources===null:n==="prompts"?p?.prompts===null:!1,x=n!=="active";let b;e[0]!==n||e[1]!==i||e[2]!==h||e[3]!==u||e[4]!==d?(b=()=>{n==="tools"?d(i):n==="resources"?u(i):n==="prompts"&&h(i)},e[0]=n,e[1]=i,e[2]=h,e[3]=u,e[4]=d,e[5]=b):b=e[5];const y=b;let _;e[6]!==s.icon||e[7]!==s.title?(_=o.jsx(so,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=_):_=e[8];let L;e[9]!==s.title?(L=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=L):L=e[10];let v;e[11]!==s.description?(v=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=v):v=e[12];let S;e[13]!==L||e[14]!==v?(S=o.jsxs("div",{className:"flex-1 min-w-0",children:[L,v]}),e[13]=L,e[14]=v,e[15]=S):S=e[15];let w;e[16]!==_||e[17]!==S?(w=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[_,S]})}),e[16]=_,e[17]=S,e[18]=w):w=e[18];let k;e[19]!==n||e[20]!==y||e[21]!==g||e[22]!==f||e[23]!==x?(k=o.jsx(EB,{activeTab:n,onTabChange:f,showSelectAll:x,isAllSelected:g,handleSelectAll:y}),e[19]=n,e[20]=y,e[21]=g,e[22]=f,e[23]=x,e[24]=k):k=e[24];let j;e[25]!==n||e[26]!==r||e[27]!==i||e[28]!==m||e[29]!==l?(j=n==="active"&&o.jsx(rn,{fallback:D0(m("virtualMcp.dependencySelectionDialog.toolsNotSupported"),m),children:o.jsx(A.Suspense,{fallback:o.jsx(Fd,{}),children:o.jsx(DB,{connectionId:i,toolSelections:r[i]?r[i].tools:[],onToggleTool:(E,R)=>l(i,E,R)})})}),e[25]=n,e[26]=r,e[27]=i,e[28]=m,e[29]=l,e[30]=j):j=e[30];let C;e[31]!==n||e[32]!==r||e[33]!==i||e[34]!==m||e[35]!==l?(C=n==="tools"&&o.jsx(rn,{fallback:D0(m("virtualMcp.dependencySelectionDialog.toolsNotSupported"),m),children:o.jsx(A.Suspense,{fallback:o.jsx(Fd,{}),children:o.jsx(OB,{connectionId:i,selections:r[i]?r[i].tools:[],onToggle:(E,R)=>l(i,E,R)})})}),e[31]=n,e[32]=r,e[33]=i,e[34]=m,e[35]=l,e[36]=C):C=e[36];let V;e[37]!==n||e[38]!==r||e[39]!==i||e[40]!==m||e[41]!==a?(V=n==="resources"&&o.jsx(rn,{fallback:D0(m("virtualMcp.dependencySelectionDialog.resourcesNotSupported"),m),children:o.jsx(A.Suspense,{fallback:o.jsx(Fd,{}),children:o.jsx(BB,{connectionId:i,selections:r[i]?r[i].resources:[],onToggle:(E,R)=>a(i,E,R)})})}),e[37]=n,e[38]=r,e[39]=i,e[40]=m,e[41]=a,e[42]=V):V=e[42];let N;e[43]!==n||e[44]!==r||e[45]!==i||e[46]!==m||e[47]!==c?(N=n==="prompts"&&o.jsx(rn,{fallback:D0(m("virtualMcp.dependencySelectionDialog.promptsNotSupported"),m),children:o.jsx(A.Suspense,{fallback:o.jsx(Fd,{}),children:o.jsx(FB,{connectionId:i,selections:r[i]?r[i].prompts:[],onToggle:(E,R)=>c(i,E,R)})})}),e[43]=n,e[44]=r,e[45]=i,e[46]=m,e[47]=c,e[48]=N):N=e[48];let T;e[49]!==V||e[50]!==N||e[51]!==j||e[52]!==C?(T=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[j,C,V,N]}),e[49]=V,e[50]=N,e[51]=j,e[52]=C,e[53]=T):T=e[53];let P;return e[54]!==T||e[55]!==w||e[56]!==k?(P=o.jsxs(o.Fragment,{children:[w,k,T]}),e[54]=T,e[55]=w,e[56]=k,e[57]=P):P=e[57],P}function KB(t){const e=U.c(7),{onClose:s}=t,n=ce();let i;e[0]!==s?(i=()=>s(!1),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=n("virtualMcp.dependencySelectionDialog.done"),e[2]=n,e[3]=r):r=e[3];let l;return e[4]!==i||e[5]!==r?(l=o.jsx(Yn,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(fe,{variant:"outline",onClick:i,children:r})}),e[4]=i,e[5]=r,e[6]=l):l=e[6],l}function WB(t){const e=U.c(23),{connectionId:s,onAuthenticate:n,children:i}=t,r=ce();let l;e[0]!==s?(l={connectionId:s},e[0]=s,e[1]=l):l=e[1];const a=w8(l);if(a.supportsOAuth&&!a.isAuthenticated){let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(lP,{size:22,className:"text-muted-foreground"})}),e[2]=u):u=e[2];let h;e[3]!==r?(h=r("virtualMcp.dependencySelectionDialog.authorizationRequired"),e[3]=r,e[4]=h):h=e[4];let f;e[5]!==h?(f=o.jsx("p",{className:"text-sm font-medium",children:h}),e[5]=h,e[6]=f):f=e[6];let m;e[7]!==r?(m=r("virtualMcp.dependencySelectionDialog.authorizationDescription"),e[7]=r,e[8]=m):m=e[8];let p;e[9]!==m?(p=o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:m}),e[9]=m,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=o.jsxs("div",{className:"space-y-1",children:[f,p]}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==s||e[15]!==n||e[16]!==r?(x=n&&o.jsx(fe,{variant:"outline",size:"sm",onClick:()=>n(s),children:r("virtualMcp.dependencySelectionDialog.authorize")}),e[14]=s,e[15]=n,e[16]=r,e[17]=x):x=e[17];let b;return e[18]!==g||e[19]!==x?(b=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[u,g,x]}),e[18]=g,e[19]=x,e[20]=b):b=e[20],b}let d;return e[21]!==i?(d=o.jsx(o.Fragment,{children:i}),e[21]=i,e[22]=d):d=e[22],d}function qB(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function I4(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function O4(t,e,s,n){const i=t[e]??{tools:null,resources:null,prompts:null};return{...t,[e]:{...i,[s]:n}}}function GB(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function YB(t){const e=U.c(49),{open:s,onOpenChange:n,selectedId:i,form:r,connections:l,onAuthenticate:a}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={activeTab:"tools"},e[0]=c):c=e[0];const[d,u]=A.useReducer(GB,c),h=tg(i??"");let f;e[1]!==l?(f=l??[],e[1]=l,e[2]=f):f=e[2];let m;e[3]!==f?(m=qB(f),e[3]=f,e[4]=m):m=e[4];const p=m;let g;e[5]!==r||e[6]!==p?(g=(B,F,z,W)=>{const K=p[B]?.[F];let H;K===null?H=W.filter(q=>q!==z):K?.includes(z)?H=K.filter(q=>q!==z):(H=[...K??[],z],H.length===W.length&&(H=null)),r.setValue("connections",I4(O4(p,B,F,H)),{shouldDirty:!0,shouldTouch:!0})},e[5]=r,e[6]=p,e[7]=g):g=e[7];const x=g;let b;e[8]!==r||e[9]!==p?(b=(B,F)=>{const W=p[B]?.[F]===null?[]:null;r.setValue("connections",I4(O4(p,B,F,W)),{shouldDirty:!0,shouldTouch:!0})},e[8]=r,e[9]=p,e[10]=b):b=e[10];const y=b;let _;e[11]!==x?(_=(B,F,z)=>x(B,"tools",F,z),e[11]=x,e[12]=_):_=e[12];const L=_;let v;e[13]!==x?(v=(B,F,z)=>x(B,"resources",F,z),e[13]=x,e[14]=v):v=e[14];const S=v;let w;e[15]!==x?(w=(B,F,z)=>x(B,"prompts",F,z),e[15]=x,e[16]=w):w=e[16];const k=w;let j;e[17]!==y?(j=B=>y(B,"tools"),e[17]=y,e[18]=j):j=e[18];const C=j;let V;e[19]!==y?(V=B=>y(B,"resources"),e[19]=y,e[20]=V):V=e[20];const N=V;let T;e[21]!==y?(T=B=>y(B,"prompts"),e[21]=y,e[22]=T):T=e[22];const P=T;if(!i||!h)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Fd,{}),e[23]=E):E=e[23];let R;e[24]===Symbol.for("react.memo_cache_sentinel")?(R=B=>u({type:"SET_ACTIVE_TAB",payload:B}),e[24]=R):R=e[24];let M;e[25]!==h||e[26]!==d.activeTab||e[27]!==p||e[28]!==i||e[29]!==P||e[30]!==N||e[31]!==C||e[32]!==k||e[33]!==S||e[34]!==L?(M=o.jsx(HB,{currentConnection:h,activeTab:d.activeTab,selectedId:i,formData:p,toggleTool:L,toggleResource:S,togglePrompt:k,toggleAllTools:C,toggleAllResources:N,toggleAllPrompts:P,onTabChange:R},i),e[25]=h,e[26]=d.activeTab,e[27]=p,e[28]=i,e[29]=P,e[30]=N,e[31]=C,e[32]=k,e[33]=S,e[34]=L,e[35]=M):M=e[35];let I;e[36]!==a||e[37]!==i||e[38]!==M?(I=o.jsx(A.Suspense,{fallback:E,children:o.jsx(WB,{connectionId:i,onAuthenticate:a,children:M})}),e[36]=a,e[37]=i,e[38]=M,e[39]=I):I=e[39];let D;e[40]!==n?(D=o.jsx(KB,{onClose:n}),e[40]=n,e[41]=D):D=e[41];let $;e[42]!==I||e[43]!==D?($=o.jsxs(Ft,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[I,D]}),e[42]=I,e[43]=D,e[44]=$):$=e[44];let O;return e[45]!==n||e[46]!==s||e[47]!==$?(O=o.jsx(Ut,{open:s,onOpenChange:n,children:$}),e[45]=n,e[46]=s,e[47]=$,e[48]=O):O=e[48],O}const $4="__new_instance__";function JB(t){const e=U.c(23),{connection_id:s,usedConnectionIds:n,onOpenSettings:i,onRemove:r,onAuthenticate:l,onSwitchInstance:a,onNewInstance:c}=t,d=tg(s),{org:u}=Fe();if(!d)return null;let h;e[0]!==d?(h=wP(d),e[0]=d,e[1]=h):h=e[1];const f=h;let m;e[2]!==s?(m=o.jsx(ZB,{connection_id:s}),e[2]=s,e[3]=m):m=e[3];let p;e[4]!==d.app_name||e[5]!==d.connection_type||e[6]!==d.description||e[7]!==d.icon||e[8]!==d.status||e[9]!==d.title||e[10]!==s||e[11]!==l||e[12]!==c||e[13]!==i||e[14]!==r||e[15]!==a||e[16]!==u.slug||e[17]!==f||e[18]!==n?(p=o.jsx(QB,{connection_id:s,connectionTitle:d.title,connectionDescription:d.description,connectionIcon:d.icon,connectionType:d.connection_type,connectionStatus:d.status,slug:f,orgSlug:u.slug,appName:d.app_name,usedConnectionIds:n,onOpenSettings:i,onRemove:r,onAuthenticate:l,onSwitchInstance:a,onNewInstance:c}),e[4]=d.app_name,e[5]=d.connection_type,e[6]=d.description,e[7]=d.icon,e[8]=d.status,e[9]=d.title,e[10]=s,e[11]=l,e[12]=c,e[13]=i,e[14]=r,e[15]=a,e[16]=u.slug,e[17]=f,e[18]=n,e[19]=p):p=e[19];let g;return e[20]!==m||e[21]!==p?(g=o.jsx(A.Suspense,{fallback:m,children:p}),e[20]=m,e[21]=p,e[22]=g):g=e[22],g}function XB(t){const e=U.c(24),{appName:s,connectionId:n,usedConnectionIds:i,onSwitchInstance:r,onNewInstance:l}=t,a=ce();let c;e[0]!==s?(c={filters:[{column:"app_name",value:s}]},e[0]=s,e[1]=c):c=e[1];const d=Ti(c);if(d.length<=1)return null;let u;e[2]!==n||e[3]!==l||e[4]!==r?(u=x=>{x===$4?l?.():r(n,x)},e[2]=n,e[3]=l,e[4]=r,e[5]=u):u=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(js,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:o.jsx(Ds,{})}),e[6]=h):h=e[6];let f;if(e[7]!==n||e[8]!==d||e[9]!==i){let x;e[11]!==n||e[12]!==i?(x=b=>o.jsx(Ot,{value:b.id,className:"text-xs",disabled:b.id!==n&&i.has(b.id),children:b.title},b.id),e[11]=n,e[12]=i,e[13]=x):x=e[13],f=d.map(x),e[7]=n,e[8]=d,e[9]=i,e[10]=f}else f=e[10];let m;e[14]!==l||e[15]!==a?(m=l&&o.jsxs(Ot,{value:$4,className:"text-xs text-muted-foreground",children:["+ ",a("virtualMcp.connectionItem.newInstance")]}),e[14]=l,e[15]=a,e[16]=m):m=e[16];let p;e[17]!==f||e[18]!==m?(p=o.jsxs(Cs,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=p):p=e[19];let g;return e[20]!==n||e[21]!==u||e[22]!==p?(g=o.jsxs(ks,{value:n,onValueChange:u,children:[h,p]}),e[20]=n,e[21]=u,e[22]=p,e[23]=g):g=e[23],g}function QB({connection_id:t,connectionTitle:e,connectionDescription:s,connectionIcon:n,connectionType:i,connectionStatus:r,slug:l,orgSlug:a,appName:c,usedConnectionIds:d,onOpenSettings:u,onRemove:h,onAuthenticate:f,onSwitchInstance:m,onNewInstance:p}){const g=w8({connectionId:t}),x=sg(),y=!(i==="VIRTUAL")&&g.supportsOAuth&&!g.isAuthenticated,_=r!=="active",L=ce(),v=async S=>{try{await x.update.mutateAsync({id:t,data:{status:S}}),xe.success(L(S==="active"?"virtualMcp.connectionItem.connectionEnabled":"virtualMcp.connectionItem.connectionDisabled"))}catch{xe.error(L("virtualMcp.connectionItem.failedToUpdateConnection"))}};return o.jsxs("div",{className:ae("rounded-xl border overflow-hidden transition-colors",y||_?"border-destructive/50 bg-destructive/5":"border-border bg-card"),children:[o.jsxs(Ao,{to:"/$org/settings/connections/$appSlug",params:{org:a,appSlug:l},className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[o.jsx(so,{icon:n,name:e,size:"sm",className:"shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:e}),y?o.jsx("span",{className:"text-xs text-destructive font-medium",children:L("virtualMcp.connectionItem.needsAuthorization")}):_?o.jsx("span",{className:"text-xs text-destructive font-medium",children:L(r==="error"?"virtualMcp.connectionItem.disabledError":"virtualMcp.connectionItem.disabled")}):s&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s})]}),y?o.jsx(fe,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:S=>{S.preventDefault(),S.stopPropagation(),f(t)},children:L("virtualMcp.connectionItem.authorize")}):_?o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:S=>{S.preventDefault(),S.stopPropagation(),v("active")},children:[o.jsx(bT,{size:13}),L("virtualMcp.connectionItem.enable")]}):o.jsxs(We,{delayDuration:0,children:[o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:o.jsx(kP,{size:16})})}),o.jsx(Ke,{side:"bottom",children:L("virtualMcp.connectionItem.connectionSettings")})]})]}),o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[c&&o.jsx(XB,{appName:c,connectionId:t,usedConnectionIds:d,onSwitchInstance:m,onNewInstance:p}),o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[o.jsxs(We,{delayDuration:0,children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:u,"aria-label":L("virtualMcp.connectionItem.configureResources"),children:o.jsx(V6,{size:13})})}),o.jsx(Ke,{side:"bottom",children:L("virtualMcp.connectionItem.configureResources")})]}),!_&&o.jsxs(We,{delayDuration:0,children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>v("inactive"),"aria-label":L("virtualMcp.connectionItem.disableConnection"),children:o.jsx(vT,{size:13})})}),o.jsx(Ke,{side:"bottom",children:L("virtualMcp.connectionItem.disable")})]}),o.jsxs(We,{delayDuration:0,children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:h,"aria-label":L("virtualMcp.connectionItem.removeConnection"),children:o.jsx(Ni,{size:13})})}),o.jsx(Ke,{side:"bottom",children:L("virtualMcp.connectionItem.remove")})]})]})]})]})}function ZB(t){const e=U.c(17),{connection_id:s}=t,n=tg(s);if(!n){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(L_,{}),e[0]=h):h=e[0],h}let i;e[1]!==n.icon||e[2]!==n.title?(i=o.jsx(so,{icon:n.icon,name:n.title,size:"sm",className:"shrink-0"}),e[1]=n.icon,e[2]=n.title,e[3]=i):i=e[3];let r;e[4]!==n.title?(r=o.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[4]=n.title,e[5]=r):r=e[5];let l;e[6]!==n.description?(l=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[6]=n.description,e[7]=l):l=e[7];let a;e[8]!==r||e[9]!==l?(a=o.jsxs("div",{className:"flex-1 min-w-0",children:[r,l]}),e[8]=r,e[9]=l,e[10]=a):a=e[10];let c;e[11]!==i||e[12]!==a?(c=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[i,a]}),e[11]=i,e[12]=a,e[13]=c):c=e[13];let d;e[14]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=d):d=e[14];let u;return e[15]!==c?(u=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[c,d]}),e[15]=c,e[16]=u):u=e[16],u}function L_(){const t=U.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),o.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),t[1]=s):s=t[1];let n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[s,o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),t[2]=n):n=t[2],n}function ez(t){const e=U.c(5),{value:s}=t;let n;if(e[0]!==s){n=Symbol.for("react.early_return_sentinel");e:{const r=Ff(s);if(r.type==="icon"){const l=Jl(r.name);if(l){let a;e[2]!==l?(a=o.jsx(l,{size:16,className:"text-muted-foreground"}),e[2]=l,e[3]=a):a=e[3],n=a;break e}}}e[0]=s,e[1]=n}else n=e[1];if(n!==Symbol.for("react.early_return_sentinel"))return n;let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Oy,{size:16,className:"text-muted-foreground"}),e[4]=i):i=e[4],i}function tz(t){const e=U.c(74),{value:s,onChange:n,className:i,disabled:r}=t,l=ce(),[a,c]=A.useState(!1),[d,u]=A.useState("");let h;e[0]!==s?(h=Ff(s),e[0]=s,e[1]=h):h=e[1];const f=h,m=f.type==="icon"?f.name:null;let p,g,x,b,y,_,L,v,S,w,k,j,C,V,N;if(e[2]!==i||e[3]!==m||e[4]!==r||e[5]!==n||e[6]!==a||e[7]!==d||e[8]!==l||e[9]!==s){const D=P2();b=D6(D,d),x=fs,y=r?!1:a,_=c;let $;e[25]!==l?($=l("common.simpleIconPicker.changeIcon"),e[25]=l,e[26]=$):$=e[26];const O=r?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let B;e[27]!==i||e[28]!==O?(B=ae("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",O,i),e[27]=i,e[28]=O,e[29]=B):B=e[29];let F;e[30]!==s?(F=o.jsx(ez,{value:s}),e[30]=s,e[31]=F):F=e[31],e[32]!==r||e[33]!==$||e[34]!==B||e[35]!==F?(L=o.jsx(ds,{asChild:!0,children:o.jsx("button",{type:"button",disabled:r,"aria-label":$,className:B,children:F})}),e[32]=r,e[33]=$,e[34]=B,e[35]=F,e[36]=L):L=e[36],g=hs,C="start",V="w-64 p-0",N=sz,k="flex flex-col";let z;e[37]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(wu,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[37]=z):z=e[37];let W;e[38]===Symbol.for("react.memo_cache_sentinel")?(W=q=>u(q.target.value),e[38]=W):W=e[38];let K;e[39]!==l?(K=l("common.simpleIconPicker.filterPlaceholder"),e[39]=l,e[40]=K):K=e[40],e[41]!==d||e[42]!==K?(j=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[z,o.jsx(kt,{value:d,onChange:W,placeholder:K,className:"h-7 text-xs pl-7"})]})}),e[41]=d,e[42]=K,e[43]=j):j=e[43],p=Ql,w="h-48",v="grid grid-cols-8 gap-0.5 px-2 pb-2";let H;e[44]!==m||e[45]!==n?(H=q=>{const G=Jl(q);return G?o.jsx("button",{type:"button",onClick:()=>{n(`icon://${q}`),c(!1)},className:ae("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===q?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:ym(q),"aria-label":ym(q),children:o.jsx(G,{size:16})},q):null},e[44]=m,e[45]=n,e[46]=H):H=e[46],S=b.map(H),e[2]=i,e[3]=m,e[4]=r,e[5]=n,e[6]=a,e[7]=d,e[8]=l,e[9]=s,e[10]=p,e[11]=g,e[12]=x,e[13]=b,e[14]=y,e[15]=_,e[16]=L,e[17]=v,e[18]=S,e[19]=w,e[20]=k,e[21]=j,e[22]=C,e[23]=V,e[24]=N}else p=e[10],g=e[11],x=e[12],b=e[13],y=e[14],_=e[15],L=e[16],v=e[17],S=e[18],w=e[19],k=e[20],j=e[21],C=e[22],V=e[23],N=e[24];let T;e[47]!==v||e[48]!==S?(T=o.jsx("div",{className:v,children:S}),e[47]=v,e[48]=S,e[49]=T):T=e[49];let P;e[50]!==b.length||e[51]!==l?(P=b.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:l("common.simpleIconPicker.noIconsFound")}),e[50]=b.length,e[51]=l,e[52]=P):P=e[52];let E;e[53]!==p||e[54]!==T||e[55]!==P||e[56]!==w?(E=o.jsxs(p,{className:w,children:[T,P]}),e[53]=p,e[54]=T,e[55]=P,e[56]=w,e[57]=E):E=e[57];let R;e[58]!==E||e[59]!==k||e[60]!==j?(R=o.jsxs("div",{className:k,children:[j,E]}),e[58]=E,e[59]=k,e[60]=j,e[61]=R):R=e[61];let M;e[62]!==g||e[63]!==R||e[64]!==C||e[65]!==V||e[66]!==N?(M=o.jsx(g,{align:C,className:V,onOpenAutoFocus:N,children:R}),e[62]=g,e[63]=R,e[64]=C,e[65]=V,e[66]=N,e[67]=M):M=e[67];let I;return e[68]!==x||e[69]!==y||e[70]!==_||e[71]!==L||e[72]!==M?(I=o.jsxs(x,{open:y,onOpenChange:_,children:[L,M]}),e[68]=x,e[69]=y,e[70]=_,e[71]=L,e[72]=M,e[73]=I):I=e[73],I}function sz(t){return t.preventDefault()}const S_="site-editor",nz=new Set([S_,"content"]);function iz(t){const e=U.c(10),{viewId:s}=t;if(s==="overview"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(E6,{size:16}),e[0]=i):i=e[0],i}if(s==="reports"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(vm,{size:16}),e[1]=i):i=e[1],i}if(s==="board"){let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(E2,{size:16}),e[2]=i):i=e[2],i}if(s==="site-editor"){let i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(h8,{size:16}),e[3]=i):i=e[3],i}if(s==="assets"){let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(li,{size:16}),e[4]=i):i=e[4],i}if(s==="hosting"){let i;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(P6,{size:16}),e[5]=i):i=e[5],i}if(s==="e2e"){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(m8,{size:16}),e[6]=i):i=e[6],i}if(s==="analytics"){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(vm,{size:16}),e[7]=i):i=e[7],i}if(s==="cdn"){let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Hr,{size:16}),e[8]=i):i=e[8],i}let n;return e[9]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(tl,{size:16}),e[9]=n):n=e[9],n}function rz({virtualMcpId:t,form:e,flushAndSave:s}){const n=ce(),i=ys(),r=Vs(t),l=q6(r),a=G6(t),c=ZT(t),d=(r?.connections??[]).map(z=>z.connection_id).sort(),{data:u}=Qt({queryKey:it.projectConnectionDetails(t,d),enabled:d.length>0,queryFn:async()=>await Promise.all(d.map(async W=>{try{const{item:K}=await i.call("COLLECTION_CONNECTIONS_GET",{id:W}),H=(K?.tools??[]).flatMap(q=>{const G=f8(q._meta);return G?[{name:q.name,title:q.title,description:q.description,resourceUri:G}]:[]});return{fetchOk:!0,id:W,title:K?.title??W,icon:K?.icon??null,uiTools:H}}catch{return{fetchOk:!1,id:W,title:W,icon:null,uiTools:[]}}}))}),h=(u??[]).filter(z=>z.uiTools.length>0),f=new Set([...XC,...QC]),m=e.watch("metadata.ui.pinnedViews")??[],p=e.watch("metadata.ui.layout")??null,g=p?.defaultMainView??null,x=p?.chatDefaultOpen??!1,b=Sm(wm({sidebarViews:e.watch("metadata.sidebarViews"),ui:{layout:p}}),e.watch("metadata.sidebarViewsVersion")),y=c??(r?Sm(wm(r.metadata),r.metadata.sidebarViewsVersion):b),_=(()=>{if(!g||g.type==="chat")return"";const z=ZC(g.type);return z==="instructions"||z==="connections"||z==="layout"?"settings":nz.has(z)?S_:f.has(z)?z:`${z}:${g.id??""}:${g.toolName??""}`})(),L=_==="",v=z=>{const[W,K,H]=z.split(":");return W?f.has(W)?{type:W}:W==="ext-apps"&&K?{type:"ext-apps",id:K,toolName:H||void 0}:null:null},S=z=>{e.setValue("metadata.ui.pinnedViews",z,{shouldDirty:!0})},w=z=>{e.setValue("metadata.ui.layout",{...p,...z},{shouldDirty:!0})},k=A.useRef(!1);if(u&&u.length>0&&!k.current){k.current=!0;const z=new Set((u??[]).filter(q=>q.fetchOk).map(q=>q.id)),W=new Set(h.flatMap(q=>q.uiTools.map(G=>`${q.id}:${G.name}`))),K=new Set(d),H=m.filter(q=>K.has(q.connectionId)&&(!z.has(q.connectionId)||W.has(`${q.connectionId}:${q.toolName}`)));H.length!==m.length&&(S(H),g?.type==="ext-apps"&&!H.some(q=>q.connectionId===g.id&&q.toolName===g.toolName)&&w({defaultMainView:{type:"settings"}}))}const j=(z,W)=>{if(m.some(H=>H.connectionId===z&&H.toolName===W)){const H=m.filter(G=>!(G.connectionId===z&&G.toolName===W));S(H);const q=`ext-apps:${z}:${W}`;_===q&&w({defaultMainView:{type:"settings"}})}else{const H=h.find(q=>q.id===z)?.uiTools.find(q=>q.name===W)?.title;S([...m,{connectionId:z,toolName:W,label:H??Eh(W),icon:null}])}s()},C=(z,W,K)=>{S(m.map(H=>H.connectionId===z&&H.toolName===W?{...H,label:K}:H))},V=()=>{s()},N=(z,W,K)=>{S(m.map(H=>H.connectionId===z&&H.toolName===W?{...H,icon:K}:H)),s()},T=z=>{w({defaultMainView:v(z)}),s()},P=(z,W)=>{const K=nA(y,z,W,1);e.setValue("metadata.sidebarViews",K,{shouldDirty:!0}),e.setValue("metadata.sidebarViewsVersion",1,{shouldDirty:!0}),a.stage(K,y);const H=iA(g,z,W);H!==g&&w({defaultMainView:H})},E=d.length===0,R=u&&h.length===0,M=bn(r?.metadata),I=eA(M,l.presence),D=tA(I),$=sA(y,I,1),O={overview:n("sidebar.navDestinations.home"),reports:n("sidebar.navDestinations.reports"),board:n("sidebar.navDestinations.tasks"),"site-editor":n("virtualMcp.layoutTabContent.siteEditor"),assets:n("common.mainPanelTabs.assets"),hosting:n("common.mainPanelTabs.hosting"),e2e:n("common.mainPanelTabs.e2e"),analytics:n("common.mainPanelTabs.analytics"),cdn:n("common.mainPanelTabs.cdn"),automations:n("virtualMcp.layoutTabContent.automations")},B=[];for(const z of $)z!=="automations"&&B.push({value:z,label:O[z]});for(const z of m)B.push({value:`ext-apps:${z.connectionId}:${z.toolName}`,label:z.label||z.toolName});$.includes("automations")&&B.push({value:"automations",label:O.automations}),B.push({value:"settings",label:n("virtualMcp.layoutTabContent.settings")});const F=D.length>0||h.length>0||E||R;return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-3",children:o.jsx("h2",{className:"text-sm font-medium text-foreground",children:n("virtualMcp.layoutTabContent.layout")})}),o.jsxs(Ah,{className:"p-6 gap-5",children:[o.jsxs(bl,{className:"p-0 space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Mt,{className:"font-normal text-foreground",children:n("virtualMcp.layoutTabContent.mainView")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n("virtualMcp.layoutTabContent.mainViewDescription")})]}),o.jsxs(ks,{value:_,onValueChange:T,children:[o.jsx(js,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(Ds,{placeholder:n("virtualMcp.layoutTabContent.noMainView")})}),o.jsx(Cs,{children:B.map(z=>o.jsx(Ot,{value:z.value,className:"capitalize",children:z.label},z.value))})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Mt,{className:"font-normal text-foreground",children:n("virtualMcp.layoutTabContent.showChat")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n("virtualMcp.layoutTabContent.showChatDescription")})]}),o.jsxs(We,{delayDuration:0,children:[o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(ii,{checked:L?!0:x,disabled:L,onCheckedChange:z=>{w({chatDefaultOpen:z}),s()}})})}),L&&o.jsx(Ke,{side:"top",children:n("virtualMcp.layoutTabContent.chatAlwaysShown")})]})]})]}),F&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(bl,{className:"p-0 space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Mt,{className:"font-normal text-foreground",children:n("virtualMcp.layoutTabContent.sidebarViews")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n("virtualMcp.layoutTabContent.sidebarViewsDescription")})]})}),D.length>0&&o.jsx("div",{className:"space-y-1.5 pt-1",children:D.map(z=>{const W=`sidebar-view-${z}`;return o.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2 rounded-lg border border-border",children:[o.jsxs(Mt,{htmlFor:W,className:"min-w-0 flex flex-1 items-center gap-2 font-normal text-foreground",children:[o.jsx(iz,{viewId:z}),o.jsx("span",{className:"truncate",children:O[z]})]}),o.jsx(ii,{id:W,checked:y.includes(z),onCheckedChange:K=>P(z,K)})]},z)})}),D.length>0&&(E||R||h.length>0)&&o.jsx("div",{className:"border-t border-border -mx-6"}),E&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n("virtualMcp.layoutTabContent.addConnectionMessage")}),R&&!E&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n("virtualMcp.layoutTabContent.noInteractiveTools")}),h.length>0&&o.jsx("div",{className:"space-y-4 pt-1",children:h.map((z,W)=>o.jsxs("div",{children:[W>0&&o.jsx("div",{className:"border-t border-border -mx-6 mb-4"}),o.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[o.jsx(so,{icon:z.icon,name:z.title,size:"xs",className:"shrink-0"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:z.title})]}),o.jsx("div",{className:"space-y-1.5",children:z.uiTools.map(K=>{const H=m.some(G=>G.connectionId===z.id&&G.toolName===K.name),q=m.find(G=>G.connectionId===z.id&&G.toolName===K.name);return o.jsxs("div",{className:ae("flex items-center justify-between gap-3 px-3 py-2 rounded-lg border transition-colors",H?"bg-accent/40 border-border":"bg-transparent border-border"),children:[o.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[o.jsx(tz,{value:q?.icon??null,onChange:G=>N(z.id,K.name,G),disabled:!H}),o.jsx(kt,{value:H&&q?q.label:K.title??Eh(K.name),onChange:G=>C(z.id,K.name,G.target.value),onBlur:V,className:"h-7 text-sm w-40",disabled:!H,readOnly:!H})]}),o.jsx(ii,{checked:H,onCheckedChange:()=>j(z.id,K.name)})]},K.name)})})]},z.id))})]})]})]})]})}const p1={tools:null,resources:null,prompts:null},oz=rR.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function lz(t){const s=new TextEncoder().encode(t),n=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(n)}function w_(t){return{"x-studio-client":t,"x-mesh-client":t}}function az(t){const e=U.c(15),{url:s,agentId:n}=t,i=ce(),[r,l]=A.useState(!1);let a;e[0]!==n||e[1]!==i||e[2]!==s?(a=async()=>{qe("agent_connect_action",{agent_id:n,action:"copy_url"}),await navigator.clipboard.writeText(s),l(!0),xe.success(i("virtualMcp.virtualMcpShareModal.agentUrlCopied")),await rd(2e3),l(!1)},e[0]=n,e[1]=i,e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==r?(d=r?o.jsx(zt,{size:20,className:"text-success"}):o.jsx(vn,{size:20}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==r||e[7]!==i?(u=i(r?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.copyUrl"),e[6]=r,e[7]=i,e[8]=u):u=e[8];let h;e[9]!==u?(h=o.jsx("span",{className:"text-xs font-medium",children:u}),e[9]=u,e[10]=h):h=e[10];let f;return e[11]!==c||e[12]!==d||e[13]!==h?(f=o.jsxs(fe,{type:"button",variant:"outline",onClick:c,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[d,h]}),e[11]=c,e[12]=d,e[13]=h,e[14]=f):f=e[14],f}function cz(t){const e=U.c(13),{url:s,serverName:n,agentId:i}=t,r=ce();let l;e[0]!==i||e[1]!==n||e[2]!==r||e[3]!==s?(l=()=>{qe("agent_connect_action",{agent_id:i,action:"install_cursor"});const f=k8(n),m={type:"http",url:s,headers:w_("Cursor")},p=lz(JSON.stringify(m,null,2)),g=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(f)}&config=${encodeURIComponent(p)}`;window.open(g,"_blank"),xe.success(r("virtualMcp.virtualMcpShareModal.openingCursor"))},e[0]=i,e[1]=n,e[2]=r,e[3]=s,e[4]=l):l=e[4];const a=l;let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),e[5]=c):c=e[5];let d;e[6]!==r?(d=r("virtualMcp.virtualMcpShareModal.installOnCursor"),e[6]=r,e[7]=d):d=e[7];let u;e[8]!==d?(u=o.jsx("span",{className:"text-xs font-medium",children:d}),e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==a||e[11]!==u?(h=o.jsxs(fe,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,u]}),e[10]=a,e[11]=u,e[12]=h):h=e[12],h}function dz(t){const e=U.c(16),{url:s,serverName:n,agentId:i}=t,r=ce(),[l,a]=A.useState(!1);let c;e[0]!==i||e[1]!==n||e[2]!==r||e[3]!==s?(c=async()=>{qe("agent_connect_action",{agent_id:i,action:"install_claude_code"});const p=k8(n),g={type:"http",url:s,headers:w_("Claude Code")},x=JSON.stringify(g,null,2),b=`claude mcp add-json "${p}" '${x.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(b),a(!0),xe.success(r("virtualMcp.virtualMcpShareModal.claudeCodeCommandCopied")),await rd(2e3),a(!1)},e[0]=i,e[1]=n,e[2]=r,e[3]=s,e[4]=c):c=e[4];const d=c;let u;e[5]!==l?(u=l?o.jsx(zt,{size:20,className:"text-success"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[5]=l,e[6]=u):u=e[6];let h;e[7]!==l||e[8]!==r?(h=r(l?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.installOnClaudeCode"),e[7]=l,e[8]=r,e[9]=h):h=e[9];let f;e[10]!==h?(f=o.jsx("span",{className:"text-xs font-medium",children:h}),e[10]=h,e[11]=f):f=e[11];let m;return e[12]!==d||e[13]!==u||e[14]!==f?(m=o.jsxs(fe,{type:"button",variant:"outline",onClick:d,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[u,f]}),e[12]=d,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function uz({virtualMcp:t}){const e=ce(),s=ys(),[n,i]=A.useState(null),[r,l]=A.useState(!1),[a,c]=A.useState(!1),d=t.id,u=t.title||`agent-${d.slice(0,8)}`,h=n?`bunx @decocms/typegen@latest --mcp ${d} --key ${n} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${d} --key <api-key> --output client.ts`,f=async()=>{l(!0);try{const{key:p}=await s.call("API_KEY_CREATE",{name:`typegen-${u}`,permissions:{[d]:["*"]}});if(!p)throw new Error("No key in response");i(p),qe("agent_typegen_key_generated",{agent_id:d})}catch{qe("agent_typegen_key_failed",{agent_id:d}),xe.error(e("virtualMcp.virtualMcpShareModal.failedGenerateApiKey"))}finally{l(!1)}},m=async()=>{qe("agent_connect_action",{agent_id:d,action:"typegen_copy_command",has_api_key:!!n}),await navigator.clipboard.writeText(h),c(!0),xe.success(e("virtualMcp.virtualMcpShareModal.commandCopied")),await rd(2e3),c(!1)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClient")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClientDescription")})]}),!n&&o.jsxs(fe,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:f,disabled:r,children:[r?o.jsx(st,{className:"size-3.5"}):o.jsx(Zf,{size:14}),o.jsx("span",{children:e(r?"virtualMcp.virtualMcpShareModal.generating":"virtualMcp.virtualMcpShareModal.generateApiKey")})]})]}),n&&o.jsx("p",{className:"rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs text-warning",children:e("virtualMcp.virtualMcpShareModal.storeKeySecurely")}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateClientLabel")}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:h}),o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:m,children:a?o.jsx(zt,{size:12,className:"text-success"}):o.jsx(vn,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.runtimeVariables")}),o.jsx(hz,{apiKey:n,agentId:d})]})}function hz(t){const e=U.c(21),{apiKey:s,agentId:n}=t,[i,r]=A.useState(!1),l=window.location.origin,a=s?`STUDIO_API_KEY=${s}`:"STUDIO_API_KEY=<api-key>",c=`STUDIO_BASE_URL=${l}`,d=`${a}
|
|
@@ -617,10 +617,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
617
617
|
22% { opacity: 0; }
|
|
618
618
|
}
|
|
619
619
|
`}),e[27]=v):v=e[27];let S;return e[28]!==L||e[29]!==h?(S=o.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[h,L,v]}),e[28]=L,e[29]=h,e[30]=S):S=e[30],S}function Y0(t){const e=U.c(10),{phase:s,current:n,children:i}=t,r=s-n,l=r<0,a=r===0,c=l?90:r*-22,d=l?.94:1-Math.max(r,0)*.04,u=l?0:a?1:r===1?.8:.55,h=l?10:30-r,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ae("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==u||e[2]!==p||e[3]!==g||e[4]!==h?(x={transform:p,opacity:u,zIndex:h,transitionDuration:"1000ms",pointerEvents:g},e[1]=u,e[2]=p,e[3]=g,e[4]=h,e[5]=x):x=e[5];let b;return e[6]!==i||e[7]!==f||e[8]!==x?(b=o.jsx("div",{"aria-hidden":f,className:m,style:x,children:i}),e[6]=i,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function C9(t){const e=U.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,r,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:ae("size-2.5 rounded-full",ei)}),r=o.jsx("div",{className:ae("size-2.5 rounded-full",ei)}),l=o.jsx("div",{className:ae("size-2.5 rounded-full",ei)}),e[0]=i,e[1]=r,e[2]=l):(i=e[0],r=e[1],l=e[2]);let a;e[3]!==n?(a=n&&o.jsx("div",{className:ae("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",Xi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,r,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function IZ(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(C9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"flex flex-1 px-8 py-5",children:o.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:AZ.map(OZ)})})]}),t[1]=s):s=t[1],s}function OZ(t,e){if(e===fw)return o.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return o.jsx("div",{className:ae("relative rounded-md",ei),children:o.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${mw}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function $Z(){const t=U.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(C9,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:ae("w-[18%] rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=i):i=t[3];let r;return t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[o.jsx("div",{className:ae("rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),o.jsx("div",{className:ae("rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=r):r=t[4],r}function BZ(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(C9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:o.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:RZ.map(zZ)})})]}),t[1]=s):s=t[1],s}function zZ(t,e){return o.jsx("div",{className:ae("aspect-square rounded-md",DZ[e]?"bg-chart-2/70":ei),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function FZ(){const t=U.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(C9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,r,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=o.jsx("div",{className:ae("h-1.5 w-[70%] rounded-sm",ei)}),i=o.jsx("div",{className:ae("h-1.5 w-[55%] rounded-sm",ei)}),r=o.jsx("div",{className:ae("h-1.5 w-[80%] rounded-sm",ei)}),l=o.jsx("div",{className:ae("h-1.5 w-[50%] rounded-sm",ei)}),t[1]=s,t[2]=n,t[3]=i,t[4]=r,t[5]=l):(s=t[1],n=t[2],i=t[3],r=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,n,i,r,l,o.jsx("div",{className:"mt-auto",children:o.jsx("div",{className:ae("h-4 rounded-md",ei)})})]}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:o.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[o.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),o.jsx("div",{className:ae("h-1.5 w-[55%] rounded-sm",Xi)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[o.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),o.jsx("div",{className:ae("h-4 w-10 rounded-full",Xi)}),o.jsx("div",{className:ae("h-4 w-14 rounded-full",Xi)})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:ae("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",Xi),children:[o.jsx("div",{className:ae("h-1.5 w-[50%] rounded-sm",ei)}),o.jsx("div",{className:ae("h-1 w-[75%] rounded-sm",ei)})]}),t[9]=u):u=t[9];let h;return t[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[u,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[o.jsx("div",{className:ae("rounded-md",Xi)}),o.jsx("div",{className:ae("rounded-md",Xi)})]})]})]})]})]})]}),t[10]=h):h=t[10],h}function Pc(t){const e=U.c(52),s=ce();if(t.kind==="starting"){let m;return e[0]!==t.claimPhase||e[1]!==t.progress?(m=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsx(MZ,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=m):m=e[2],m}if(t.kind==="errored"){const m=t.error.code===$m.githubNotAuthenticated,p=t.error.code===$m.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Qo,{className:"size-12 text-destructive"}),e[3]=g):g=e[3];let x;e[4]!==s?(x=s("sandbox.stateCard.erroredHeadline"),e[4]=s,e[5]=x):x=e[5];let b;e[6]!==x?(b=o.jsx("h3",{className:"text-lg font-medium",children:x}),e[6]=x,e[7]=b):b=e[7];let y;e[8]!==p||e[9]!==m||e[10]!==t.error.message||e[11]!==s?(y=p?s("sandbox.stateCard.githubConnectionMissingMessage"):m?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=p,e[9]=m,e[10]=t.error.message,e[11]=s,e[12]=y):y=e[12];let _;e[13]!==y?(_=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:y}),e[13]=y,e[14]=_):_=e[14];let L;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(L=(m||p)&&t.connectionsHref&&o.jsx(fe,{asChild:!0,children:o.jsx("a",{href:t.connectionsHref,children:s(p?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=p,e[16]=m,e[17]=t.connectionsHref,e[18]=s,e[19]=L):L=e[19];const v=t.onRetry;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx($n,{className:"size-4"}),e[20]=S):S=e[20];let w;e[21]!==s?(w=s("sandbox.stateCard.retry"),e[21]=s,e[22]=w):w=e[22];let k;e[23]!==t.onRetry||e[24]!==w?(k=o.jsxs(fe,{variant:"outline",onClick:v,children:[S," ",w]}),e[23]=t.onRetry,e[24]=w,e[25]=k):k=e[25];let j;e[26]!==L||e[27]!==k?(j=o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[L,k]}),e[26]=L,e[27]=k,e[28]=j):j=e[28];let C;return e[29]!==j||e[30]!==b||e[31]!==_?(C=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[g,b,_,j]})}),e[29]=j,e[30]=b,e[31]=_,e[32]=C):C=e[32],C}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(kT,{className:"size-12 text-blue-500"}),e[33]=n):n=e[33];let i;e[34]!==s?(i=s("sandbox.stateCard.suspendedHeadline"),e[34]=s,e[35]=i):i=e[35];let r;e[36]!==i?(r=o.jsx("h3",{className:"text-lg font-medium",children:i}),e[36]=i,e[37]=r):r=e[37];let l;e[38]!==s?(l=s("sandbox.stateCard.resumeToContinue"),e[38]=s,e[39]=l):l=e[39];let a;e[40]!==l?(a=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:l}),e[40]=l,e[41]=a):a=e[41];const c=t.onResume;let d;e[42]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Tl,{className:"size-4"}),e[42]=d):d=e[42];let u;e[43]!==s?(u=s("sandbox.stateCard.resume"),e[43]=s,e[44]=u):u=e[44];let h;e[45]!==t.onResume||e[46]!==u?(h=o.jsxs(fe,{onClick:c,className:"mt-2",children:[d," ",u]}),e[45]=t.onResume,e[46]=u,e[47]=h):h=e[47];let f;return e[48]!==r||e[49]!==a||e[50]!==h?(f=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,r,a,h]})}),e[48]=r,e[49]=a,e[50]=h,e[51]=f):f=e[51],f}function V3(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function UZ(t){if(!t)return null;try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e)||typeof e.path!="string"||!e.path.startsWith("/"))return null;const s=typeof e.pageKey=="string"?e.pageKey:null,n={};if(e.params&&typeof e.params=="object")for(const[i,r]of Object.entries(e.params))typeof r=="string"&&(n[i]=r);return{path:e.path,pageKey:s,params:n}}catch{return null}}function T3(t){try{return UZ(localStorage.getItem(t))}catch{return null}}function HZ(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function pw(t){switch(t.lifecycle.phase){case"cloning":case"checking-out":return{step:"cloning",status:"doing"};case"clone-failed":return{step:"cloning",status:"failed"};case"installing":return{step:"install",status:"doing"};case"install-failed":return{step:"install",status:"failed"};case"starting":return{step:"dev",status:"doing"};case"running":return{step:"dev",status:"done"};case"start-failed":return{step:"dev",status:"failed"};case"crashed":return{step:"dev",status:"failed"};case"idle":return t.claimPhase&&t.claimPhase.kind!=="ready"&&t.claimPhase.kind!=="failed"?{step:"provision",status:"doing"}:{step:"cloning",status:"doing"}}}const lb="site-links",KZ=/details?page|\bpdp\b/i,WZ=/listingpage|\bplp\b/i;function qZ(t,e,s){const n=new Set;for(const a of s)KZ.test(a)&&n.add("product"),WZ.test(a)&&n.add("category");const i=tf($o(t)),r=i[i.length-1],l=i[i.length-2];return r?.type==="text"&&r.text==="/p"&&l?.type==="param"&&l.name===e&&n.add("product"),e==="*"&&i.some(a=>a.type==="param"&&a.name==="*")&&n.add("category"),n}const GZ=["rosa","preto","pink","black"];function J0(t,e){const s=e.trim();return s?t(s):GZ.flatMap(n=>t(n))}function YZ(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const r=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:r,count:10}}),n}const gw=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function A3(t){return t.split("/")[0]??""}function JZ(t){const e=new Set;for(const s of t){const n=A3(s);gw.has(n)&&e.add(n)}return e}function XZ(t,e){const s=A3(t);return!gw.has(s)||e.size===0?!0:e.has(s)}const QZ=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>J0(s=>YZ(t,s),e),optionsFromPayload:X0},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>J0(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:X0},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>J0(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:X0},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>J0(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:X0},{kind:"category",test:t=>t==="vtex/loaders/categories/tree.ts"||/categor(y|ies).*tree/i.test(t),clientFilter:!0,buildRequests:t=>[{resolveType:t,props:{}}],optionsFromPayload:ree}];function ZZ(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of QZ){if(d.kind!==a)continue;const u=n.find(h=>d.test(h)&&XZ(h,s));u&&c.push({cand:d,resolveType:u})}return c.find(d=>s.has(A3(d.resolveType)))??c[0]},r=(a,c,d)=>({kind:a.kind,id:`${a.kind}:${c}`,resolveType:c,clientFilter:a.clientFilter,isFallback:d,buildRequests:u=>a.buildRequests(c,u),optionsFromPayload:a.optionsFromPayload}),l=[];for(const a of["product","category"]){if(!t.has(a))continue;const c=i(a);c&&l.push(r(c.cand,c.resolveType,!1))}return t.size>0&&l.push(eee(t.has("category")?"category":"product")),l}function eee(t){return{kind:t,id:lb,resolveType:lb,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>dee(e,s)}}function yl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function tee(t,e,s){const n=new Set,i=new Set,r=l=>{if(Array.isArray(l)){for(const d of l)r(d);return}const a=yl(l);if(!a)return;const c=a.__resolveType;if(typeof c=="string"){if(s(c))n.add(c);else if(c in e&&!i.has(c)){i.add(c);const d=yl(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),r(e[c])}}for(const d of Object.values(a))r(d)};return r(t),n}function xw(t){const e=new Set,s=[];for(const n of t)for(const i of n)e.has(i.value)||(e.add(i.value),s.push(i));return s}function bw(t){try{return decodeURIComponent(t)}catch{return t}}function see(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nee(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=see(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function vw(t,e,s){if(typeof t!="string"||!t)return null;let n;try{n=new URL(t,"https://placeholder.invalid").pathname}catch{return null}n=n.replace(/\/+$/,"");const i=tf($o(e)),{pattern:r,order:l}=nee(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(r);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?bw(d):null}function X0(t,e){const s=yl(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],r=new Set;for(const l of n){const a=yl(l);if(!a)continue;const c=vw(a.url,e.template,e.paramName);if(!c||r.has(c))continue;r.add(c);const d=yl(a.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,h=Array.isArray(a.image)?yl(a.image[0]):null,f=typeof h?.url=="string"?h.url:void 0;i.push({value:c,label:u,image:f})}return i}function iee(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const s=e.replace(/^\/+|\/+$/g,"");return s?bw(s):null}function ree(t){const e=[],s=new Set,n=(i,r)=>{const l=yl(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...r,a]:r,d=iee(l.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(l.children))for(const u of l.children)n(u,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const oee=new Set(["login","logout","signin","sign-in","signup","sign-up","register","account","myaccount","my-account","minha-conta","conta","cart","carrinho","checkout","wishlist","favoritos","favorites","orders","pedidos","help","hc","sac","atendimento","contato","contact","institucional","newsletter","customer","sales","catalogsearch","search","busca","privacy-policy-cookie-restriction-mode"]);function lee(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function aee(t){if(typeof t!="string"||!t)return[];const e=[],s=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let n,i=0;for(;(n=s.exec(t))!==null&&i++<5e3;){const r=n[1]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:r,text:l})}return e}function cee(t){if(typeof t!="string"||!t)return[];const e=[],s=new Set,n=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,i=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let r,l=0;for(;(r=n.exec(t))!==null&&l++<3e3;){const a=(r[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(r.index,r.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:r[2]??"",image:c||void 0})}return e}function dee(t,e){const s=[],n=new Set,i=(r,l,a,c)=>{if(s.length>=200)return;const d=vw(r,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&oee.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:lee(d),kind:a,image:c}))};for(const{url:r,name:l,image:a}of cee(t))i(r,l,"product",a);for(const{href:r,text:l}of aee(t))r.startsWith("/")&&!r.startsWith("//")&&i(r,l,"category");return s}function Cd(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(r=>r.label.toLowerCase().includes(n)||r.value.toLowerCase().includes(n)):t).slice(0,s)}const yw=1e4;function uee(t){return{product:{noun:t("sandbox.pathParamPickerChip.kindProductNoun"),heading:t("sandbox.pathParamPickerChip.kindProductHeading")},category:{noun:t("sandbox.pathParamPickerChip.kindCategoryNoun"),heading:t("sandbox.pathParamPickerChip.kindCategoryHeading")}}}async function hee(t,{resolveType:e,props:s}){const n=await fetch(ES(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(yw)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function ab(t,e){const s=await fetch(PS(t,e),{signal:AbortSignal.timeout(yw)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function fee(t,e,s){const n=e.optionsFromPayload(await ab(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const r=Rr(s.template,{[s.paramName]:i.value});if(r==="/")return n;try{const l=e.optionsFromPayload(await ab(t,r),s).filter(a=>a.kind==="product");return xw([n,l])}catch{return n}}function mee(t,e,s){return it.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function pee(t,e,s,n){if(e.homepageLinks)return fee(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const r=await Promise.allSettled(i.map(a=>hee(t,a))),l=r.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=r.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return xw(l.map(a=>e.optionsFromPayload(a,n)))}function dp(t,e,s,n,i){return{queryKey:mee(t,e,s),queryFn:()=>pee(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Nd(t){const e=U.c(16),{heading:s,iconKind:n,options:i,template:r,paramName:l,keyPrefix:a,onSelect:c}=t;if(i.length===0)return null;let d;if(e[0]!==n||e[1]!==a||e[2]!==c||e[3]!==i||e[4]!==l||e[5]!==r){let h;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r?(h=f=>o.jsxs(us,{value:`${a}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:f.image?o.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):o.jsx(O2,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:f.label}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Rr(r,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=h):h=e[12],d=i.map(h),e[0]=n,e[1]=a,e[2]=c,e[3]=i,e[4]=l,e[5]=r,e[6]=d}else d=e[6];let u;return e[13]!==s||e[14]!==d?(u=o.jsx(Es,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=u):u=e[15],u}function cb(t){const e=U.c(2),{text:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function gee(t){const e=U.c(52),{sources:s,template:n,paramName:i,value:r,sandboxRef:l,onCommit:a}=t,c=ce(),[d,u]=A.useState(!1),[h,f]=A.useState(""),[m,p]=A.useState(""),g=A.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=uee(c),_=[...new Set(s.map(Se=>b[Se.kind].noun))].join(" or ");let L;e[0]!==c||e[1]!==_?(L=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:_}),e[0]=c,e[1]=_,e[2]=L):L=e[2];const v=L,S={template:n,paramName:i};let w;e[3]!==h?(w=(Se,we)=>({source:Se,query:we,options:Se.clientFilter?Cd(we.data??[],h):we.data??[]}),e[3]=h,e[4]=w):w=e[4];const k=w,j=s.filter(wee),C=s.filter(See),V=Nm({queries:j.map(Se=>dp(l,Se,m,S,d))});let N;e[5]!==V||e[6]!==k?(N=(Se,we)=>k(Se,V[we]),e[5]=V,e[6]=k,e[7]=N):N=e[7];const T=j.map(N),P=T.length===0||T.every(Lee),E=Nm({queries:C.map(Se=>dp(l,Se,m,S,d&&P))});let R;e[8]!==E||e[9]!==k?(R=(Se,we)=>k(Se,E[we]),e[8]=E,e[9]=k,e[10]=R):R=e[10];const M=C.map(R),I=P?M:T,D=I.length===1&&I[0]?.source.homepageLinks?I[0]:null,O=D&&!D.query.isLoading&&!D.query.isError?D?.query.data??[]:[],B=Cd(O.filter(_ee),h),F=Cd(O.filter(yee),h),z=B.length>0&&F.length>0,W=Se=>{u(Se),g.current&&clearTimeout(g.current),f(Se?r:""),p(Se?r:"")};let K;e[11]===Symbol.for("react.memo_cache_sentinel")?(K=Se=>{f(Se),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(Se)},300)},e[11]=K):K=e[11];const H=K,q=Se=>{a(Se),W(!1)},G=BS(h),Q=Rr(n,{[i]:G}),se=Ut,Z=Ft,te="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",X=vee;let Y;e[12]!==x||e[13]!==c?(Y=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=Y):Y=e[14];let de;e[15]!==Y?(de=o.jsx(ms,{className:"sr-only",children:o.jsx(Gt,{children:Y})}),e[15]=Y,e[16]=de):de=e[16];let re;e[17]===Symbol.for("react.memo_cache_sentinel")?(re=o.jsx(O2,{size:16,className:"shrink-0 text-foreground"}),e[17]=re):re=e[17];let le;e[18]!==c?(le=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=le):le=e[19];let ne;e[20]!==x?(ne=o.jsx("span",{className:"rounded-sm bg-violet-500/15 px-1 py-0.5 font-mono text-[12px] text-violet-600 dark:text-violet-400",children:x}),e[20]=x,e[21]=ne):ne=e[21];let me;e[22]!==le||e[23]!==ne?(me=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[re,o.jsxs("span",{className:"text-sm font-medium text-foreground",children:[le," ",ne]})]}),e[22]=le,e[23]=ne,e[24]=me):me=e[24];const ee=Di,oe=!1,ie="min-h-0 flex-1";let ue;e[25]!==v||e[26]!==h?(ue=o.jsx(ui,{autoFocus:!0,placeholder:v,value:h,onValueChange:H}),e[25]=v,e[26]=h,e[27]=ue):ue=e[27];const J=hi,he="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ve;e[28]!==c?(ve=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ve):ve=e[29];let je;e[30]!==ve?(je=o.jsx(Bn,{children:ve}),e[30]=ve,e[31]=je):je=e[31];const Ce=G&&o.jsx(Es,{className:"shrink-0",children:o.jsxs(us,{value:`__raw__:${G}`,className:"gap-3 py-2",onSelect:()=>q(G),children:[o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:o.jsx(mr,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:G,paramLabel:x})}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Q})]})]})}),Le=z?o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:o.jsx(Nd,{heading:b.category.heading,iconKind:"category",options:B,template:n,paramName:i,keyPrefix:`${D?.source.id}:cat`,onSelect:q})}),o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:o.jsx(Nd,{heading:b.product.heading,iconKind:"product",options:F,template:n,paramName:i,keyPrefix:`${D?.source.id}:prod`,onSelect:q})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:I.map(Se=>{const{source:we,query:Ye,options:Ge}=Se,{noun:Ie}=b[we.kind];if(Ye.isLoading)return o.jsx(cb,{text:c("sandbox.pathParamPickerChip.loading",{noun:Ie})},we.id);if(Ye.isError)return o.jsx(cb,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},we.id);if(we.homepageLinks){const Oe=Ye.data??[];return o.jsxs(A.Fragment,{children:[o.jsx(Nd,{heading:b.category.heading,iconKind:"category",options:Cd(Oe.filter(bee),h),template:n,paramName:i,keyPrefix:`${we.id}:cat`,onSelect:q}),o.jsx(Nd,{heading:b.product.heading,iconKind:"product",options:Cd(Oe.filter(xee),h),template:n,paramName:i,keyPrefix:`${we.id}:prod`,onSelect:q})]},we.id)}return o.jsx(Nd,{heading:I.length>1?b[we.kind].heading:void 0,iconKind:we.kind,options:Ge,template:n,paramName:i,keyPrefix:we.id,onSelect:q},we.id)})});let _e;e[32]!==J||e[33]!==je||e[34]!==Ce||e[35]!==Le?(_e=o.jsxs(J,{className:he,children:[je,Ce,Le]}),e[32]=J,e[33]=je,e[34]=Ce,e[35]=Le,e[36]=_e):_e=e[36];let Ne;e[37]!==ee||e[38]!==ue||e[39]!==_e?(Ne=o.jsxs(ee,{shouldFilter:oe,className:ie,children:[ue,_e]}),e[37]=ee,e[38]=ue,e[39]=_e,e[40]=Ne):Ne=e[40];let ge;e[41]!==Z||e[42]!==de||e[43]!==me||e[44]!==Ne||e[45]!==X?(ge=o.jsxs(Z,{className:te,onClick:X,children:[de,me,Ne]}),e[41]=Z,e[42]=de,e[43]=me,e[44]=Ne,e[45]=X,e[46]=ge):ge=e[46];let Te;return e[47]!==se||e[48]!==W||e[49]!==d||e[50]!==ge?(Te=o.jsx(se,{open:d,onOpenChange:W,children:ge}),e[47]=se,e[48]=W,e[49]=d,e[50]=ge,e[51]=Te):Te=e[51],o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",title:c("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:x}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-sm bg-violet-500/15 px-1 py-0.5 text-[12px] text-violet-600 hover:bg-violet-500/25 dark:text-violet-400",onClick:Se=>{Se.stopPropagation(),W(!0)},children:r||x}),Te]})}function xee(t){return t.kind==="product"}function bee(t){return t.kind!=="product"}function vee(t){return t.stopPropagation()}function yee(t){return t.kind==="product"}function _ee(t){return t.kind!=="product"}function Lee(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function See(t){return t.isFallback}function wee(t){return!t.isFallback}function kee(t){const e=U.c(8),{sources:s,template:n,paramName:i,sandboxRef:r,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==r||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(jee);c=Nm,a=p.map(g=>dp(r,g,"",m,!0)),e[0]=i,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=c}else a=e[4],c=e[5];let d;e[6]!==a?(d={queries:a},e[6]=a,e[7]=d):d=e[7];const u=c(d),[h,f]=A.useState(!1);if(!h)for(const m of u){if(m.isLoading)break;const p=m.data?.[0];if(p){f(!0),queueMicrotask(()=>l(p.value));break}}return null}function jee(t){return!t.isFallback}function Cee(t){const e=U.c(31),{name:s,value:n,onCommit:i}=t,r=ce(),[l,a]=A.useState(n),[c,d]=A.useState(!1),u=A.useRef(!1);let h;e[0]!==s||e[1]!==r?(h=s==="*"?r("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=r,e[2]=h):h=e[2];const f=h,m=l||f;let p;e[3]!==m?(p=o.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:m}),e[3]=m,e[4]=p):p=e[4];let g;e[5]!==f||e[6]!==r?(g=r("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=r,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=k=>a(k.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let y;e[10]!==n?(y=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(u.current=!0,a(n),k.currentTarget.blur())},e[10]=n,e[11]=y):y=e[11];let _;e[12]!==l||e[13]!==i||e[14]!==n?(_=()=>{if(d(!1),u.current){u.current=!1;return}const k=BS(l);a(k),k!==n&&i(k)},e[12]=l,e[13]=i,e[14]=n,e[15]=_):_=e[15];let L;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==y||e[20]!==_?(L=o.jsx("input",{type:"text",value:l,placeholder:f,title:g,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-violet-500/15 px-1 text-[12px] text-violet-600 outline-none placeholder:text-violet-500/60 focus:bg-violet-500/25 dark:text-violet-400",onClick:Nee,onChange:x,onFocus:b,onKeyDown:y,onBlur:_}),e[16]=l,e[17]=f,e[18]=g,e[19]=y,e[20]=_,e[21]=L):L=e[21];let v;e[22]!==p||e[23]!==L?(v=o.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,L]}),e[22]=p,e[23]=L,e[24]=v):v=e[24];let S;e[25]!==c||e[26]!==r?(S=c&&o.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-[10px] text-muted-foreground",children:[o.jsx(jT,{size:10}),r("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=r,e[27]=S):S=e[27];let w;return e[28]!==S||e[29]!==v?(w=o.jsxs(o.Fragment,{children:[v,S]}),e[28]=S,e[29]=v,e[30]=w):w=e[30],w}function Nee(t){return t.stopPropagation()}function Vee(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const s=new URL(e),n=t.resolvedPath==="/"?"":t.resolvedPath;return`${s.host}${n}`}catch{return e}}function Tee(t){return t.showPreviewToolbar&&t.contentEditingEnabled}const db={resolveType:"website/pages/Page.tsx",seoResolveType:"website/sections/Seo/SeoV2.tsx"};function P3(t){return`pages-${encodeURIComponent(t)}-${crypto.randomUUID()}`}function _w(t,e){return{name:t,path:e,sections:[],seo:{__resolveType:db.seoResolveType},__resolveType:db.resolveType}}const Aee=700;function m0({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ms(),i=_s()?.taskId??null,r=f0(e),l=Sn(e).runtime==="cms";return Rs({mutationKey:yg(t,e,s),mutationFn:async({blockKey:a,data:c})=>{if(l){const f=await $7({orgSlug:t,virtualMcpId:e,branch:s},{set:{[a]:c}});return Lg(n,{orgSlug:t,virtualMcpId:e,branch:s},f),await n.invalidateQueries({queryKey:u0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),f}const d=h0(r,p8(a)),u=JSON.stringify(c,null,2),h=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:d,content:u})});return h.ok?h.json():l9(h,"Write")},onMutate:async({blockKey:a,data:c})=>{const d=`${t}/${e}/${s}`,u=it.decofile(d);await n.cancelQueries({queryKey:u});const h=n.getQueryData(u),f=!!h&&a in h,m=h?.[a];return n.setQueryData(u,p=>({...p??{},[a]:c})),{queryKey:u,blockKey:a,hadKey:f,previousValue:m}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>{if(!u)return u;if(!d.hadKey){const{[d.blockKey]:h,...f}=u;return f}return{...u,[d.blockKey]:d.previousValue}})},onSuccess:(a,{blockKey:c,data:d})=>{const u=`${t}/${e}/${s}`;n.setQueryData(it.decofile(u),h=>({...h??{},[c]:d}))}})}function E3(t,e){const s=U.c(16),n=m0(t),i=ce();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Map,s[0]=r):r=s[0];const l=A.useRef(r);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a=new Map,s[1]=a):a=s[1];const c=A.useRef(a);let d;s[2]!==e||s[3]!==n||s[4]!==i?(d=y=>{const _=l.current.get(y);if(!_)return;const L=typeof _=="function"?_():_;l.current.delete(y),L&&n.mutate({blockKey:y,data:L},{onSuccess:()=>e?.onSaved?.(),onError:v=>xe.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:v.message}))})},s[2]=e,s[3]=n,s[4]=i,s[5]=d):d=s[5];const u=d;let h;s[6]!==u?(h=()=>{for(const y of c.current.values())clearTimeout(y);c.current.clear();for(const y of[...l.current.keys()])u(y)},s[6]=u,s[7]=h):h=s[7];const f=h;let m,p;s[8]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{const y=c.current;return()=>{for(const _ of y.values())clearTimeout(_)}},p=[],s[8]=m,s[9]=p):(m=s[8],p=s[9]),A.useEffect(m,p);let g;s[10]!==u?(g=(y,_)=>{l.current.set(y,_);const L=c.current.get(y);L&&clearTimeout(L),c.current.set(y,setTimeout(()=>{c.current.delete(y),u(y)},Aee))},s[10]=u,s[11]=g):g=s[11];const x=g;let b;return s[12]!==f||s[13]!==x||s[14]!==n.isPending?(b={save:x,flush:f,isPending:n.isPending},s[12]=f,s[13]=x,s[14]=n.isPending,s[15]=b):b=s[15],b}function Pee(t){const e=U.c(5);let s;e[0]!==t?(s=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=s):s=e[1];const n=m0(s);let i;return e[2]!==t||e[3]!==n?(i={mutationFn:async r=>{const{name:l,path:a,template:c}=r;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const d=P3(l),u=c?{...c,name:l,path:a}:_w(l,a);return await n.mutateAsync({blockKey:d,data:u}),{key:d,name:l,path:a}}},e[2]=t,e[3]=n,e[4]=i):i=e[4],Rs(i)}const Bo="__blank__";function Lw(t){const e=U.c(65),{id:s,value:n,onChange:i,templates:r,disabled:l}=t,a=ce(),[c,d]=A.useState(!1);let u;if(e[0]!==r||e[1]!==n){let D;e[3]!==n?(D=$=>$.key===n,e[3]=n,e[4]=D):D=e[4],u=r.find(D),e[0]=r,e[1]=n,e[2]=u}else u=e[2];const h=u;let f;e[5]!==h?.name||e[6]!==a?(f=h?.name??a("sectionsEditor.pageTemplateSelect.blankPageDefaultLabel"),e[5]=h?.name,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("span",{className:"truncate",children:f}),e[8]=f,e[9]=m):m=e[9];let p;e[10]!==h?(p=h?.path?o.jsx("span",{className:"truncate text-muted-foreground",children:h.path}):null,e[10]=h,e[11]=p):p=e[11];let g;e[12]!==m||e[13]!==p?(g=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m,p]}),e[12]=m,e[13]=p,e[14]=g):g=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(s9,{className:"shrink-0 opacity-50"}),e[15]=x):x=e[15];let b;e[16]!==l||e[17]!==s||e[18]!==c||e[19]!==g?(b=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{id:s,type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:l,className:"w-full justify-between font-normal",children:[g,x]})}),e[16]=l,e[17]=s,e[18]=c,e[19]=g,e[20]=b):b=e[20];let y;e[21]===Symbol.for("react.memo_cache_sentinel")?(y={width:"var(--radix-popover-trigger-width)"},e[21]=y):y=e[21];let _;e[22]!==a?(_=a("sectionsEditor.pageTemplateSelect.searchPlaceholder"),e[22]=a,e[23]=_):_=e[23];let L;e[24]!==_?(L=o.jsx(ui,{placeholder:_,className:"h-9"}),e[24]=_,e[25]=L):L=e[25];let v;e[26]!==a?(v=a("sectionsEditor.pageTemplateSelect.noPagesFoundMessage"),e[26]=a,e[27]=v):v=e[27];let S;e[28]!==v?(S=o.jsx(Bn,{children:v}),e[28]=v,e[29]=S):S=e[29];let w;e[30]!==a?(w=a("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[30]=a,e[31]=w):w=e[31];let k;e[32]!==i?(k=()=>{i(Bo),d(!1)},e[32]=i,e[33]=k):k=e[33];let j;e[34]!==a?(j=a("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[34]=a,e[35]=j):j=e[35];const C=n===Bo?"opacity-100":"opacity-0";let V;e[36]!==C?(V=ae("ml-auto",C),e[36]=C,e[37]=V):V=e[37];let N;e[38]!==V?(N=o.jsx(zt,{className:V}),e[38]=V,e[39]=N):N=e[39];let T;e[40]!==w||e[41]!==k||e[42]!==j||e[43]!==N?(T=o.jsxs(us,{value:w,onSelect:k,children:[j,N]}),e[40]=w,e[41]=k,e[42]=j,e[43]=N,e[44]=T):T=e[44];let P;if(e[45]!==i||e[46]!==r||e[47]!==n){let D;e[49]!==i||e[50]!==n?(D=$=>o.jsxs(us,{value:`${$.name} ${$.path}`,onSelect:()=>{i($.key),d(!1)},children:[o.jsxs("div",{className:"flex min-w-0 flex-col",children:[o.jsx("span",{className:"truncate",children:$.name}),o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:$.path})]}),o.jsx(zt,{className:ae("ml-auto",n===$.key?"opacity-100":"opacity-0")})]},$.key),e[49]=i,e[50]=n,e[51]=D):D=e[51],P=r.map(D),e[45]=i,e[46]=r,e[47]=n,e[48]=P}else P=e[48];let E;e[52]!==T||e[53]!==P?(E=o.jsxs(Es,{children:[T,P]}),e[52]=T,e[53]=P,e[54]=E):E=e[54];let R;e[55]!==S||e[56]!==E?(R=o.jsxs(hi,{onWheel:Eee,children:[S,E]}),e[55]=S,e[56]=E,e[57]=R):R=e[57];let M;e[58]!==L||e[59]!==R?(M=o.jsx(hs,{className:"p-0",style:y,children:o.jsxs(Di,{children:[L,R]})}),e[58]=L,e[59]=R,e[60]=M):M=e[60];let I;return e[61]!==c||e[62]!==M||e[63]!==b?(I=o.jsxs(fs,{open:c,onOpenChange:d,children:[b,M]}),e[61]=c,e[62]=M,e[63]=b,e[64]=I):I=e[64],I}function Eee(t){const e=t.deltaMode===1?16:1;t.currentTarget.scrollTop=t.currentTarget.scrollTop+t.deltaY*e}function Ree(t){const e=U.c(89),{open:s,onOpenChange:n,isPending:i,error:r,templates:l,onSubmit:a}=t,c=i===void 0?!1:i,d=ce();let u;e[0]!==d?(u=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=u):u=e[1];const[h,f]=A.useState(u);let m;e[2]!==d?(m=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=m):m=e[3];const[p,g]=A.useState(m),[x,b]=A.useState(Bo),[y,_]=A.useState(null),[L,v]=A.useState(s);s!==L&&(v(s),s&&(f(d("sectionsEditor.createPageModal.defaultPageName")),g(d("sectionsEditor.createPageModal.defaultPagePath")),b(Bo),_(null)));const S=!!l?.length;let w;e[4]!==c||e[5]!==n?(w=le=>{!le&&!c&&(_(null),n(!1))},e[4]=c,e[5]=n,e[6]=w):w=e[6];const k=w;let j;e[7]!==c||e[8]!==h||e[9]!==a||e[10]!==p||e[11]!==S||e[12]!==x?(j=async le=>{le.preventDefault();const ne=h.trim(),me=p.trim();if(!ne||!me||c)return;const ee=w9(me);if(ee){_(ee);return}_(null),await a({name:ne,path:me,templateKey:S&&x!==Bo?x:null})},e[7]=c,e[8]=h,e[9]=a,e[10]=p,e[11]=S,e[12]=x,e[13]=j):j=e[13];const C=j,V=y??r;let N;e[14]!==d?(N=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=N):N=e[15];let T;e[16]!==N?(T=o.jsx(ms,{children:o.jsx(Gt,{children:N})}),e[16]=N,e[17]=T):T=e[17];let P;e[18]!==d?(P=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=P):P=e[19];let E;e[20]!==P?(E=o.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:P}),e[20]=P,e[21]=E):E=e[21];let R;e[22]===Symbol.for("react.memo_cache_sentinel")?(R=le=>f(le.target.value),e[22]=R):R=e[22];let M;e[23]!==d?(M=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=M):M=e[24];let I;e[25]!==c||e[26]!==h||e[27]!==M?(I=o.jsx(kt,{id:"new-page-name",value:h,onChange:R,placeholder:M,autoFocus:!0,disabled:c}),e[25]=c,e[26]=h,e[27]=M,e[28]=I):I=e[28];let D;e[29]!==I||e[30]!==E?(D=o.jsxs("div",{className:"space-y-1.5",children:[E,I]}),e[29]=I,e[30]=E,e[31]=D):D=e[31];let $;e[32]!==d?($=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=$):$=e[33];let O;e[34]!==$?(O=o.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:$}),e[34]=$,e[35]=O):O=e[35];let B;e[36]===Symbol.for("react.memo_cache_sentinel")?(B=le=>g(le.target.value),e[36]=B):B=e[36];let F;e[37]!==d?(F=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=F):F=e[38];let z;e[39]!==c||e[40]!==p||e[41]!==F?(z=o.jsx(kt,{id:"new-page-path",value:p,onChange:B,placeholder:F,disabled:c}),e[39]=c,e[40]=p,e[41]=F,e[42]=z):z=e[42];let W;e[43]!==O||e[44]!==z?(W=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[43]=O,e[44]=z,e[45]=W):W=e[45];let K;e[46]!==c||e[47]!==S||e[48]!==d||e[49]!==x||e[50]!==l?(K=S&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:d("sectionsEditor.createPageModal.templateLabel")}),o.jsx(Lw,{id:"new-page-template",value:x,onChange:b,templates:l??[],disabled:c})]}),e[46]=c,e[47]=S,e[48]=d,e[49]=x,e[50]=l,e[51]=K):K=e[51];let H;e[52]!==V?(H=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[52]=V,e[53]=H):H=e[53];let q;e[54]!==D||e[55]!==W||e[56]!==K||e[57]!==H?(q=o.jsxs("div",{className:"space-y-4 py-4",children:[D,W,K,H]}),e[54]=D,e[55]=W,e[56]=K,e[57]=H,e[58]=q):q=e[58];let G;e[59]!==n?(G=()=>n(!1),e[59]=n,e[60]=G):G=e[60];let Q;e[61]!==d?(Q=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=Q):Q=e[62];let se;e[63]!==c||e[64]!==G||e[65]!==Q?(se=o.jsx(fe,{type:"button",variant:"outline",onClick:G,disabled:c,children:Q}),e[63]=c,e[64]=G,e[65]=Q,e[66]=se):se=e[66];let Z;e[67]!==c||e[68]!==h||e[69]!==p?(Z=!h.trim()||!p.trim()||c,e[67]=c,e[68]=h,e[69]=p,e[70]=Z):Z=e[70];let te;e[71]!==c||e[72]!==d?(te=c?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=c,e[72]=d,e[73]=te):te=e[73];let X;e[74]!==Z||e[75]!==te?(X=o.jsx(fe,{type:"submit",disabled:Z,children:te}),e[74]=Z,e[75]=te,e[76]=X):X=e[76];let Y;e[77]!==se||e[78]!==X?(Y=o.jsxs(Yn,{children:[se,X]}),e[77]=se,e[78]=X,e[79]=Y):Y=e[79];let de;e[80]!==C||e[81]!==q||e[82]!==Y||e[83]!==T?(de=o.jsx(Ft,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:C,children:[T,q,Y]})}),e[80]=C,e[81]=q,e[82]=Y,e[83]=T,e[84]=de):de=e[84];let re;return e[85]!==k||e[86]!==s||e[87]!==de?(re=o.jsx(Ut,{open:s,onOpenChange:k,children:de}),e[85]=k,e[86]=s,e[87]=de,e[88]=re):re=e[88],re}const Dee={loaders:"loader",actions:"action"},Sw=new Set(["workflows"]);function ww(t){return Dee[t]}function kw(t,e,s){const n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(s)&&e in r)return!0;return!1}function Mee(t,e,s){return/\.tsx?$/.test(e)?!0:kw(t,e,s)}function Iee(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(r))s.add(l);return s}function Oee(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function jw(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[r,l]of Object.entries(s))if(r.includes(e))for(const a of Object.keys(l))i.add(a);for(const r of i){if(r.toLowerCase().includes("preview")||qS.has(r)||Sw.has(R3(r))||Oee(r,i))continue;const l=rl(r,t);if(l.hidden)continue;const a=l.title&&l.title!==r?l.title:bs(r);n.push({resolveType:r,title:a})}return n.sort((r,l)=>r.title.localeCompare(l.title))}function ub(t,e){return jw(t,e).length}function R3(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const $ee={deco:"Deco",std:"Deco Standard",website:"Website"};function Bee(t){return $ee[t]??t}function Cw(t){const e=R3(t);let n=t.split("/").filter(Boolean).slice(t.startsWith("deco-sites/")?2:1);return(n[0]==="loaders"||n[0]==="actions")&&(n=n.slice(1)),[e,...n.slice(0,-1)]}function Nw(t,e,s){const n=[];for(const[i,r]of Object.entries(e)){if(Mee(t,i,s)||S9(i)||!r||typeof r!="object"||Array.isArray(r))continue;const l=r,a=l.__resolveType;typeof a=="string"&&(qS.has(a)||Sw.has(R3(a))||kw(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,r)=>i.title.localeCompare(r.title))}function Vw(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...r}=s??{},l=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:r,title:l}}const zee={target:null,editSeoPageKey:null,variantOverride:null};function Fee(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null,editSeoPageKey:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key,variantOverride:null};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const Tw=A.createContext(null);function hb(t){const e=U.c(9),{children:s}=t,[n,i]=A.useReducer(Fee,zee);let r,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h=>i({type:"select",target:h}),l=h=>i({type:"edit-seo",target:h}),a=()=>i({type:"consume-edit-seo"}),c=h=>i({type:"variant-override",params:h}),e[0]=r,e[1]=l,e[2]=a,e[3]=c):(r=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:r,editSeo:l,consumeEditSeo:a,setVariantOverride:c},e[4]=n,e[5]=d):d=e[5];let u;return e[6]!==s||e[7]!==d?(u=o.jsx(Tw,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=u):u=e[8],u}function Aw(){const t=A.use(Tw);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}const Pw=A.createContext(!1),Uee=Pw.Provider;function N9(){return A.useContext(Pw)}const Ew=A.createContext(null),Hee=Ew.Provider;function Kee(){return A.useContext(Ew)}function Rw(t){const e=U.c(9),{readOnly:s,virtualMcpId:n,className:i,children:r}=t;let l;e[0]!==r||e[1]!==s?(l=o.jsx(Uee,{value:s,children:r}),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a;e[3]!==l||e[4]!==n?(a=o.jsx(Hee,{value:n,children:l}),e[3]=l,e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==i||e[7]!==a?(c=o.jsx("div",{className:i,children:a}),e[6]=i,e[7]=a,e[8]=c):c=e[8],c}function Wee(t){const e=U.c(8),{virtualMcpId:s}=t,n=ce(),i=v6(s);let r;e[0]!==i?(r=()=>{i()},e[0]=i,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Yt,{size:14,className:"shrink-0"}),e[2]=l):l=e[2];let a;e[3]!==n?(a=n("thread.branchPicker.newVersion"),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==r||e[6]!==a?(c=o.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1.5 self-start rounded-md bg-background px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-foreground",children:[l,a]}),e[5]=r,e[6]=a,e[7]=c):c=e[7],c}function qee(){const t=U.c(9),e=ce(),s=Kee();let n;t[0]!==e?(n=e("sectionsEditor.readOnlyFieldTooltip"),t[0]=e,t[1]=n):n=t[1];let i;t[2]!==n?(i=o.jsx("p",{className:"text-xs text-balance",children:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]!==s?(r=s?o.jsx(Wee,{virtualMcpId:s}):null,t[4]=s,t[5]=r):r=t[5];let l;return t[6]!==i||t[7]!==r?(l=o.jsxs(hs,{align:"center",className:"flex w-fit max-w-[260px] flex-col gap-2.5 border-transparent bg-foreground p-3 text-background",children:[i,r]}),t[6]=i,t[7]=r,t[8]=l):l=t[8],l}function Gee(t){const e=U.c(5),{children:s}=t;let n;e[0]!==s?(n=o.jsx(ds,{asChild:!0,children:s}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(qee,{}),e[2]=i):i=e[2];let r;return e[3]!==n?(r=o.jsxs(fs,{children:[n,i]}),e[3]=n,e[4]=r):r=e[4],r}function Yee(t){const e=U.c(5),{children:s}=t;let n;e[0]!==s?(n=o.jsx("div",{inert:!0,children:s}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"absolute inset-0 cursor-pointer"}),e[2]=i):i=e[2];let r;return e[3]!==n?(r=o.jsx(Gee,{children:o.jsxs("div",{className:"relative opacity-70",children:[n,i]})}),e[3]=n,e[4]=r):r=e[4],r}function D3(t){return(e,s)=>{fP(e),t(e,s)}}const Jee="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function V9(t){return Vs(t)?.metadata?.fieldDescriptionTooltips??!1}function M3(t){const e=U.c(9),{description:s,virtualMcpId:n,children:i}=t,r=V9(n);if(!s||!r)return i;let l;e[0]!==i?(l=A.cloneElement(i,{className:ae(i.props.className,Jee)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx(He,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=o.jsx(Ke,{className:"max-w-64",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs(We,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Hs(t){const e=U.c(17),{htmlFor:s,label:n,description:i,labelClassName:r,virtualMcpId:l}=t;if(!V9(l)){let u;e[0]!==s||e[1]!==n||e[2]!==r?(u=o.jsx(Mt,{htmlFor:s,className:r,children:n}),e[0]=s,e[1]=n,e[2]=r,e[3]=u):u=e[3];let h;e[4]!==i?(h=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=h):h=e[5];let f;return e[6]!==u||e[7]!==h?(f=o.jsxs("div",{className:"space-y-0.5",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==r?(c=o.jsx(Mt,{htmlFor:s,className:r,children:n}),e[9]=s,e[10]=n,e[11]=r,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==l?(d=o.jsx(M3,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}const Xee=di.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(s=>e.updateAttributes(s,{textAlign:t})).some(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:s})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var Qee=Xee;const Zee=20,Dw=(t,e=0)=>{const s=[];return!t.children.length||e>Zee||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...Dw(n,e+1))}),s},ete=t=>{if(!t.children.length)return;const e=Dw(t);e&&e.forEach(s=>{var n;const i=s.getAttribute("style"),r=(n=s.parentElement)===null||n===void 0||(n=n.closest("span"))===null||n===void 0?void 0:n.getAttribute("style");s.setAttribute("style",`${r};${i}`)})},Mw=jV.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&ete(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",cr(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(s,n)=>{if(!s.isInline)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(r=>!!r))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),tte=di.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=(e=zu(t,"background-color"))!==null&&e!==void 0?e:t.style.backgroundColor;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Iw=di.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=(e=zu(t,"color"))!==null&&e!==void 0?e:t.style.color;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),ste=di.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=zu(t,"font-family"))!==null&&e!==void 0?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ow=di.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=zu(t,"font-size"))!==null&&e!==void 0?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),nte=di.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=zu(t,"line-height"))!==null&&e!==void 0?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});di.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(tte.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Iw.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(ste.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(Ow.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(nte.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(Mw.configure(this.options.textStyle)),t}});const ite=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function rte(t){const e=U.c(30),{editor:s,currentColor:n,open:i,onOpenChange:r}=t,l=ce(),[a,c]=A.useState("#000000");let d;e[0]!==s||e[1]!==r?(d=S=>{s.chain().focus().setColor(S).run(),r(!1)},e[0]=s,e[1]=r,e[2]=d):d=e[2];const u=d;let h;e[3]!==s||e[4]!==r?(h=()=>{s.chain().focus().unsetColor().run(),r(!1)},e[3]=s,e[4]=r,e[5]=h):h=e[5];const f=h,m=i||n!==null;let p;e[6]!==l?(p=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=p):p=e[7];let g;e[8]!==r||e[9]!==i?(g=()=>r(!i),e[8]=r,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Tm,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let y;e[12]!==b?(y=o.jsxs("span",{className:"relative flex flex-col items-center",children:[x,o.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=y):y=e[13];let _;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==y?(_=o.jsx(Zt,{active:m,label:p,onClick:g,children:y}),e[14]=m,e[15]=p,e[16]=g,e[17]=y,e[18]=_):_=e[18];let L;e[19]!==u||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==r||e[24]!==i||e[25]!==l?(L=i&&o.jsxs("div",{tabIndex:-1,className:"absolute left-0 top-full z-20 mt-1.5 flex w-56 flex-col gap-2 rounded-md border bg-popover p-2 shadow-md",onBlur:S=>{S.currentTarget.contains(S.relatedTarget)||r(!1)},children:[o.jsx("div",{className:"grid grid-cols-6 gap-1",children:ite.map(S=>o.jsx("button",{type:"button","aria-label":S,"aria-pressed":n===S,onMouseDown:ate,onClick:()=>u(S),className:ae("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===S&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:S}},S))}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("label",{className:"flex flex-1 items-center gap-1.5 rounded bg-muted/40 px-2 py-1 text-xs text-muted-foreground cursor-pointer",children:[o.jsx("input",{type:"color",value:a,onMouseDown:lte,onChange:S=>c(S.target.value),onBlur:()=>u(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),o.jsx("button",{type:"button",onMouseDown:ote,onClick:f,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:l("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=u,e[20]=f,e[21]=n,e[22]=a,e[23]=r,e[24]=i,e[25]=l,e[26]=L):L=e[26];let v;return e[27]!==L||e[28]!==_?(v=o.jsxs("div",{className:"relative",children:[_,L]}),e[27]=L,e[28]=_,e[29]=v):v=e[29],v}function ote(t){return t.preventDefault()}function lte(t){return t.stopPropagation()}function ate(t){return t.preventDefault()}const Q0=[1,2,3,4,5,6];function cte(t){const e=new DOMParser().parseFromString(t,"text/html").body,s=Array.from(e.children);return s.length===0?e.innerHTML:s.map(n=>n.innerHTML).join("<br>")}const dte=8,ute=128,hte=16,fb=1;function fte({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r,inline:l=!1}){const a=ce(),c=typeof e=="string"?e:"",d=A.useRef(s);d.current=s;const[u,h]=A.useState(!1),[f,m]=A.useState(!1),p=Pf({extensions:[Ef.configure({heading:l?!1:{levels:[...Q0]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[Qee.configure({types:["heading","paragraph"]})],Mw,Ow,Iw],content:c||"",editorProps:{attributes:{class:ae("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:v})=>{const S=v.getHTML(),w=l?cte(S):S;d.current(w==="<p></p>"||w===""?"":w)}}),g=r6({editor:p,selector:({editor:v})=>({bold:v?.isActive("bold")??!1,italic:v?.isActive("italic")??!1,underline:v?.isActive("underline")??!1,strike:v?.isActive("strike")??!1,headingLevel:Q0.find(S=>v?.isActive("heading",{level:S})??!1)??0,fontSize:v?.getAttributes("textStyle").fontSize??null,color:v?.getAttributes("textStyle").color??null,bulletList:v?.isActive("bulletList")??!1,orderedList:v?.isActive("orderedList")??!1,link:v?.isActive("link")??!1,alignLeft:v?.isActive({textAlign:"left"})??!1,alignCenter:v?.isActive({textAlign:"center"})??!1,alignRight:v?.isActive({textAlign:"right"})??!1,alignJustify:v?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=v=>{const S=p.chain().focus();if(v==="paragraph"){S.setParagraph().run();return}const w=Q0.find(k=>`h${k}`===v);w&&S.setHeading({level:w}).run()},y=g.fontSize?parseInt(g.fontSize,10):NaN,_=Number.isFinite(y)?y:hte,L=v=>{const S=Math.min(ute,Math.max(dte,v));p.chain().focus().setFontSize(`${S}px`).run()};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Hs,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),o.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[o.jsx(Zt,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:o.jsx(I6,{size:14})}),o.jsx(Zt,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:o.jsx(O6,{size:14})}),o.jsx(Zt,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:o.jsx(CT,{size:14})}),o.jsx(Zt,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:o.jsx($6,{size:14})}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs(ks,{value:x,onValueChange:b,children:[o.jsx(js,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:v=>v.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:o.jsx(Ds,{})}),o.jsxs(Cs,{children:[o.jsx(Ot,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),Q0.map(v=>o.jsx(Ot,{value:`h${v}`,children:a("sectionsEditor.richTextField.styleHeading",{level:v})},v))]})]})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(Zt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>L(_-fb),children:o.jsx(NT,{size:14})}),o.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:_}),o.jsx(Zt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>L(_+fb),children:o.jsx(Yt,{size:14})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(rte,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Zt,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:o.jsx(Y2,{size:14})}),o.jsx(Zt,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(GK,{editor:p,active:g.link,open:u,onOpenChange:h}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Zt,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:o.jsx(sE,{size:14})}),o.jsx(Zt,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:o.jsx(VT,{size:14})}),o.jsx(Zt,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:o.jsx(TT,{size:14})}),o.jsx(Zt,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:o.jsx(AT,{size:14})})]})]}),o.jsx(Rf,{editor:p})]})]})}const Sc=t=>String(t).padStart(2,"0"),mte="1900-01-01",pte="2099-12-31",gte="1900-01-01T00:00",xte="2099-12-31T23:59";function bte(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const s=new Date(t);return Number.isNaN(s.getTime())?"":`${s.getUTCFullYear()}-${Sc(s.getUTCMonth()+1)}-${Sc(s.getUTCDate())}`}function vte(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function yte(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Sc(e.getMonth()+1)}-${Sc(e.getDate())}T${Sc(e.getHours())}:${Sc(e.getMinutes())}`}function _te(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Lte(t){const e=U.c(41),{id:s,withTime:n,value:i,onChange:r,calendarLabel:l}=t,[a,c]=A.useState(!1);let d;e[0]!==n?(d=D=>n?yte(D):bte(D),e[0]=n,e[1]=d):d=e[1];const u=d;let h;e[2]!==n?(h=D=>n?_te(D):vte(D),e[2]=n,e[3]=h):h=e[3];const f=h;let m;e[4]!==u||e[5]!==i?(m=()=>u(i),e[4]=u,e[5]=i,e[6]=m):m=e[6];const[p,g]=A.useState(m),[x,b]=A.useState(i);if(i!==x){b(i);const D=u(i);D!==p&&g(D)}let y;e[7]!==r||e[8]!==f?(y=D=>{g(D.target.value),r(f(D.target.value))},e[7]=r,e[8]=f,e[9]=y):y=e[9];const _=y;let L;if(e[10]!==i){const D=i?new Date(i):null;L=D&&!Number.isNaN(D.getTime())?D:null,e[10]=i,e[11]=L}else L=e[11];const v=L;let S;e[12]!==r||e[13]!==v||e[14]!==u||e[15]!==n?(S=D=>{if(!D)return;n&&v?D.setHours(v.getHours(),v.getMinutes(),0,0):D.setHours(0,0,0,0);const $=D.toISOString();g(u($)),b($),r($),c(!1)},e[12]=r,e[13]=v,e[14]=u,e[15]=n,e[16]=S):S=e[16];const w=S,k=n?"datetime-local":"date",j=n?gte:mte,C=n?xte:pte;let V;e[17]!==u||e[18]!==i?(V=()=>g(u(i)),e[17]=u,e[18]=i,e[19]=V):V=e[19];let N;e[20]!==_||e[21]!==s||e[22]!==p||e[23]!==V||e[24]!==k||e[25]!==j||e[26]!==C?(N=o.jsx(kt,{id:s,type:k,min:j,max:C,value:p,onChange:_,onBlur:V,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=_,e[21]=s,e[22]=p,e[23]=V,e[24]=k,e[25]=j,e[26]=C,e[27]=N):N=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Zc,{className:"h-4 w-4"}),e[28]=T):T=e[28];let P;e[29]!==l?(P=o.jsx(ds,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:T})}),e[29]=l,e[30]=P):P=e[30];const E=v??void 0;let R;e[31]!==w||e[32]!==E?(R=o.jsx(hs,{className:"w-auto p-0",align:"end",onCloseAutoFocus:Ste,children:o.jsx(Df,{mode:"single",selected:E,onSelect:w,initialFocus:!0})}),e[31]=w,e[32]=E,e[33]=R):R=e[33];let M;e[34]!==a||e[35]!==P||e[36]!==R?(M=o.jsxs(fs,{open:a,onOpenChange:c,children:[P,R]}),e[34]=a,e[35]=P,e[36]=R,e[37]=M):M=e[37];let I;return e[38]!==N||e[39]!==M?(I=o.jsxs("div",{className:"flex gap-1",children:[N,M]}),e[38]=N,e[39]=M,e[40]=I):I=e[40],I}function Ste(t){return t.preventDefault()}function Z0(t){const e=U.c(76),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=ce(),d=typeof n=="string"?n:"",u=s.format;if(u==="rich-text"||u==="rich-text-inline"||u==="html"){const _=u==="rich-text-inline";let L;return e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==s||e[5]!==_||e[6]!==n?(L=o.jsx(fte,{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a,inline:_}),e[0]=l,e[1]=i,e[2]=r,e[3]=a,e[4]=s,e[5]=_,e[6]=n,e[7]=L):L=e[7],L}if(u==="textarea"||u==="markdown"){const _=a?.virtualMcpId;let L;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==_?(L=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=_,e[12]=L):L=e[12];let v;e[13]!==i?(v=k=>i(k.target.value),e[13]=i,e[14]=v):v=e[14];let S;e[15]!==r||e[16]!==d||e[17]!==v?(S=o.jsx(Wo,{id:r,value:d,onChange:v,rows:4}),e[15]=r,e[16]=d,e[17]=v,e[18]=S):S=e[18];let w;return e[19]!==L||e[20]!==S?(w=o.jsxs("div",{className:"space-y-2",children:[L,S]}),e[19]=L,e[20]=S,e[21]=w):w=e[21],w}const h=u==="date-time"||u==="datetime";if(u==="date"||h){const _=a?.virtualMcpId;let L;e[22]!==l||e[23]!==r||e[24]!==s.description||e[25]!==_?(L=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[22]=l,e[23]=r,e[24]=s.description,e[25]=_,e[26]=L):L=e[26];let v;e[27]!==c?(v=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=v):v=e[28];let S;e[29]!==h||e[30]!==i||e[31]!==r||e[32]!==d||e[33]!==v?(S=o.jsx(Lte,{id:r,withTime:h,value:d,onChange:i,calendarLabel:v}),e[29]=h,e[30]=i,e[31]=r,e[32]=d,e[33]=v,e[34]=S):S=e[34];let w;return e[35]!==L||e[36]!==S?(w=o.jsxs("div",{className:"space-y-2",children:[L,S]}),e[35]=L,e[36]=S,e[37]=w):w=e[37],w}if(u==="color-input"||u==="color"){const _=a?.virtualMcpId;let L;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==_?(L=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=_,e[42]=L):L=e[42];const v=d||"#000000";let S;e[43]!==i?(S=N=>i(N.target.value),e[43]=i,e[44]=S):S=e[44];let w;e[45]!==v||e[46]!==S?(w=o.jsx("input",{type:"color",value:v,onChange:S,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=v,e[46]=S,e[47]=w):w=e[47];let k;e[48]!==i?(k=N=>i(N.target.value),e[48]=i,e[49]=k):k=e[49];let j;e[50]!==r||e[51]!==d||e[52]!==k?(j=o.jsx(kt,{id:r,value:d,onChange:k,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=r,e[51]=d,e[52]=k,e[53]=j):j=e[53];let C;e[54]!==w||e[55]!==j?(C=o.jsxs("div",{className:"flex items-center gap-2",children:[w,j]}),e[54]=w,e[55]=j,e[56]=C):C=e[56];let V;return e[57]!==L||e[58]!==C?(V=o.jsxs("div",{className:"space-y-2",children:[L,C]}),e[57]=L,e[58]=C,e[59]=V):V=e[59],V}const f=a?.virtualMcpId;let m;e[60]!==l||e[61]!==r||e[62]!==s.description||e[63]!==f?(m=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:f}),e[60]=l,e[61]=r,e[62]=s.description,e[63]=f,e[64]=m):m=e[64];const p=u==="url"?"url":"text";let g;e[65]!==i?(g=_=>i(_.target.value),e[65]=i,e[66]=g):g=e[66];const x=s.default!=null?String(s.default):void 0;let b;e[67]!==r||e[68]!==d||e[69]!==p||e[70]!==g||e[71]!==x?(b=o.jsx(kt,{id:r,type:p,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=r,e[68]=d,e[69]=p,e[70]=g,e[71]=x,e[72]=b):b=e[72];let y;return e[73]!==m||e[74]!==b?(y=o.jsxs("div",{className:"space-y-2",children:[m,b]}),e[73]=m,e[74]=b,e[75]=y):y=e[75],y}const wte=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,kte=/^[+-]?\d*$/;function jte(t,e){return(e?kte:wte).test(t)}function Cte(t){const e=U.c(16),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,u]=A.useState(c),[h,f]=A.useState(c);c!==h&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||u(c));const m=a?.virtualMcpId;let p;e[0]!==l||e[1]!==r||e[2]!==s.description||e[3]!==m?(p=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=r,e[2]=s.description,e[3]=m,e[4]=p):p=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=_=>{const L=_.target.value,v=s.type==="integer";if(L!==""&&!jte(L,v))return;u(L);const S=Number(L);i(L===""||Number.isNaN(S)?void 0:S)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==r||e[9]!==d||e[10]!==g||e[11]!==x?(b=o.jsx(kt,{id:r,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=r,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let y;return e[13]!==p||e[14]!==b?(y=o.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=y):y=e[15],y}function Nte(t){const e=U.c(14),{value:s,onChange:n,path:i,label:r,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let u;e[0]!==r||e[1]!==i||e[2]!==l.description||e[3]!==d?(u=o.jsx(Hs,{htmlFor:i,label:r,description:l.description,virtualMcpId:d}),e[0]=r,e[1]=i,e[2]=l.description,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=p=>n(p),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==h?(f=o.jsx(ii,{id:i,checked:c,onCheckedChange:h}),e[7]=c,e[8]=i,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==u||e[12]!==f?(m=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13],m}const I3="__enum_empty__",$w="__enum_clear__";function O3(t){return t===""?I3:String(t)}function Vte(t,e){if(t===I3)return"";const s=e.find(n=>O3(n)===t);return s!==void 0?s:t}function Tte(t,e){if(t!==$w)return Vte(t,e)}function Ate(t,e){return t==null?e.some(s=>s==="")?I3:void 0:O3(t)}function Pte(t){return t===""?"":String(t)}function Ete(t){const e=U.c(39),{schema:s,value:n,onChange:i,path:r,label:l,required:a,sandbox:c}=t,d=ce();let u;e[0]!==s.enum?(u=s.enum??[],e[0]=s.enum,e[1]=u):u=e[1];const h=u;let f;e[2]!==h||e[3]!==n?(f=Ate(n,h),e[2]=h,e[3]=n,e[4]=f):f=e[4];const m=f;let p;e[5]!==h||e[6]!==a?(p=!a&&!h.some(Dte),e[5]=h,e[6]=a,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==x?(b=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:x}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let y;e[13]!==i||e[14]!==h?(y=V=>i(Tte(V,h)),e[13]=i,e[14]=h,e[15]=y):y=e[15];let _;e[16]!==d?(_=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=_):_=e[17];let L;e[18]!==_?(L=o.jsx(Ds,{placeholder:_}),e[18]=_,e[19]=L):L=e[19];let v;e[20]!==r||e[21]!==L?(v=o.jsx(js,{id:r,className:"h-10 w-full min-w-0",children:L}),e[20]=r,e[21]=L,e[22]=v):v=e[22];let S;e[23]!==g||e[24]!==d?(S=g&&o.jsx(Ot,{value:$w,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=S):S=e[25];let w;e[26]!==h?(w=h.map(Rte),e[26]=h,e[27]=w):w=e[27];let k;e[28]!==S||e[29]!==w?(k=o.jsxs(Cs,{children:[S,w]}),e[28]=S,e[29]=w,e[30]=k):k=e[30];let j;e[31]!==m||e[32]!==k||e[33]!==y||e[34]!==v?(j=o.jsxs(ks,{value:m,onValueChange:y,children:[v,k]}),e[31]=m,e[32]=k,e[33]=y,e[34]=v,e[35]=j):j=e[35];let C;return e[36]!==j||e[37]!==b?(C=o.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=C):C=e[38],C}function Rte(t){const e=O3(t);return o.jsx(Ot,{value:e,children:Pte(t)},e)}function Dte(t){return t===""}const Bw={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function zw(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function ou(t){return zw(t)?.variants?.[0]?.rule?.__resolveType===hd}function mb(t){return{__resolveType:Yo,variants:[{value:t,rule:{__resolveType:hd}}]}}function Fw(t){return ou(t)?zw(t)?.variants?.[0]?.value:t}function wc(t){return ou(t)?Fw(t):t}function $3(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Ns(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function Mte(t){return t.includes("flags/multivariate")}function Ite(t){return bs(t)}function Ote(t){const e=t.title?ip(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:rp(t.resolveType)??bs(t.resolveType))}function $te(t,e){const s=[...t],n=new Set(s.map(r=>r.resolveType)),i=(r,l)=>{!r||n.has(r)||(n.add(r),s.push({resolveType:r,title:l??Ite(r)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const r=$3(e.editorValue);r?.includes("/")&&i(r)}return s}function Bte(t,e,s){const n=e[0]?.resolveType??"";if(s)return s;if(!t||typeof t!="object"||Array.isArray(t))return n;const i=t,r=i.__resolveType;if(typeof r=="string"){if(ri(r)){const h=e.find(f=>f.resolveType===r);return h?h.resolveType:r}const d=e.find(h=>Z5(h.resolveType,r));if(d)return d.resolveType;const u=e.find(h=>h.resolveType===r);if(u)return u.resolveType;if(r.includes("/"))return r}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(u=>u.discriminatorValue===l||u.resolveType===l||Z5(u.resolveType,l));if(d)return d.resolveType}let a=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const h=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>i[f]!==void 0).length;h>0&&h>c&&(c=h,a=d.resolveType)}return c>0,a}function pb(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=$3(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=zn(n,e);return i||(n.includes("/")?null:s??null)}function zte(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const s={...t.properties};return delete s[e],{...t,properties:s}}function Uw(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Ns(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function Fte(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=$3(s);return n&&Mte(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function B3(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(Array.isArray(e.variants)){const s=e.variants,n=s.find(r=>r.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(r=>typeof r.value=="string");if(i)return i.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}const Ute=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Hte=5,Kte=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function gb(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const r=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:Kte.format(d)},l=r(n),a=r(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function Hc(t,e=0){if(!t)return"Default";if(e>Hte)return"...";const s=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(s)||s==="")return"Default";switch(s){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:i,tablet:r,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),r&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(Ute).join(" & "):bs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return gb(t)??bs(s);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:i}=t;return typeof i=="number"?`${Math.ceil(i*100)}% of sessions`:bs(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:r}=t,l=[];return i&&l.push(i),r&&l.push(r),l.length>0?l.join(" - "):bs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:r,pathname:l}=i??{};return r&&l?`Pathname ${r} ${l}`:bs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:r}=t,l=d=>[d.city,d.regionCode,d.country].filter(Boolean).join(" - "),a=i?.[0];if(a){const d=(i?.length??0)-1;return`${l(a)}${d>0?` +${d}`:""}`}const c=r?.[0];if(c){const d=(r?.length??0)-1;return`Except ${l(c)}${d>0?` +${d}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:i,op:r="AND"}=t;if(i&&i.length>0){const l=r==="OR"?"OR":"AND";return i.map(a=>Hc(a,e+1)).join(` ${l} `)}return bs(s)}default:{const i=gb(t);return i||bs(s)||"Default"}}}function Hw(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Kw(t,e){if(e.length===0)return 0;const s=Hw(t);for(let r=0;r<e.length;r++){const l=e[r].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return r}let n=0,i=-1;for(let r=0;r<e.length;r++){const l=e[r],a=new Set(Object.keys(l.discriminators??{})),d=l.propertyKeys.filter(u=>!a.has(u)).filter(u=>s[u]!==void 0&&s[u]!==null&&s[u]!=="").length;d>i&&(i=d,n=r)}return n}function Wte(t,e){const s=Hw(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}const qte="$live/matchers/MatchAlways.ts";function Gte(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType===v3||i.rule?.__resolveType===qte)??e.find(i=>i.value!=null);if(n&&n.value!=null)return n.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function up(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(up);const e=t;if(e.__resolveType){const s=Gte(e);return s===void 0?t:up(s)}return Ww(e)}function Ww(t){const e={};for(const[s,n]of Object.entries(t))e[s]=up(n);return e}function Yte(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function qw(t){return t==null?"":Array.isArray(t)?t.map(qw).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function df(t,e){if(!t.includes("{"))return;const s=Ww(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,r,l)=>{const a=(r??l??"").trim();return qw(Yte(s,a))}).trim()||void 0}function Jte(t){return t.replace(/<[^>]*>/g,"").trim()}function Xte(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function Qte(t){return/^Option \d+$/.test(t)}function Zte(t,e){if(e.includes("{"))return df(e,t);const s=t[e];if(typeof s=="string"&&s)return s;if(Array.isArray(s)){const n=s.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(n)return n}}function Gw(t,e,s){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let n=wc(t);const i=Uw(n);if(i&&(n=i,n=wc(n)),s?.titleBy){const l=Zte(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=Kw(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!Qte(a)){const c=df(a,n);if(c)return c;if(!a.includes("{"))return a}}for(const l of["name","label","title","alt","text","href","id","key"]){const a=n[l];if(typeof a=="string"&&a.trim()){const c=s?.properties?.[l]?.format;if(c==="rich-text"||c==="html"){const d=Jte(a);if(d)return d;continue}return a}if(Array.isArray(a)){const c=a.map(d=>d==null?"":String(d)).filter(Boolean).join(",");if(c)return c}}const r=n.__resolveType;if(typeof r=="string"&&r)return r.includes("/matchers/")?Hc(n):bs(r);if(s?.title){const l=df(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function uf(t,e){return t.map((s,n)=>Gw(s,n,e))}function Yw(t,e,s){return Gw(t,e,s)}function ese(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const s=e.properties;return s?.mobile?"{{{image.mobile}}}":s?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function xb(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=ese(e);if(!s)return;const n=df(s,t);if(!n)return;const i=B3(n)||n;return nE(i)}function z3(t){return t===to||t===Yo}function T9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function hf(t,e){const s=t.__resolveType??"";if(!s)return null;if(Ns(s)){const n=t.section??{};return Jw(n,e)}if(z3(s)){const n=t.variants?.[0]?.value;return n?hf(n,e):null}return!ri(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:T9(s,e)}function Jw(t,e){const s=t.__resolveType??"";if(!s)return null;if(z3(s)){const n=t.variants?.[0]?.value;return n?hf(n,e):null}return!ri(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:T9(s,e)}function Xw(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!ri(n)||!Object.hasOwn(e,n))return null;const i=T9(n,e);return i?{blockKey:n,...i}:null}function g2e(t,e){if(!e.isSavedBlock)return null;if(e.isHidden){const r=(Ns(t.__resolveType)?t.section:t)?.variants?.[0]?.value;if(!r)return null;const l=r.__resolveType??"";return Ns(l)?r.section?.__resolveType??l??null:l||null}return(e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType)||null}function tse(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock&&!e.isHidden){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return T9(n,s)}if(e.isHidden){const r=(Ns(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,l=r.__resolveType??"",a=Ns(l)?r.section?.__resolveType??l:l;return z3(a)?null:hf(r,s)}if(e.isLazy||Ns(t.__resolveType)){const n=t.section??{};return Jw(n,s)}return hf(t,s)}function Nn(t){return typeof t=="string"?t:t.label}function md(t){return typeof t=="object"}function bb(t){return md(t)?t.arrayLabel:void 0}function vb(t){return md(t)?t.fieldKey:void 0}function sse(t){return md(t)?t.ownerPath:void 0}function yb(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function Pu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ol(t){return t.normalize("NFC").trim()}function nse(t,e){return e.length>0&&Ol(Nn(e[0]))===Ol(t)?e:[t,...e]}function ise(t,e){return e.map(s=>{if(!md(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function ss(t,e){return Ol(t)===Ol(e)}function ff(t,e){return Ol(t).replace(/\s+/g,"").toLowerCase()===Ol(e).replace(/\s+/g,"").toLowerCase()}function rse(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||ss(e,t)||s?.arrayKey!=null&&ss(e,s.arrayKey)}function eh(t,e,s,n,i){const r=Ol(s);if(t.some(a=>ss(Nn(a),r)||ss(Nn(a),s)))return t;const l={label:s,itemIndex:n};return rse(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function ose(t,e){return t.slice(0,t.length-e.length)}function lse(t,e,s,n){if(s.length===0)return s;const i=s[0];if(md(i))return s;const r=n??$l(t,e),l=Nn(i);return ss(l,r)||ss(l,t)?s.slice(1):s}function $l(t,e){return e.title??Pu(t)}function Eu(t,e,s){const n=s[t];if(!n)return Pu(t);const i=$l(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&$l(l,a)===i})?Pu(t):i}function x2e(t,e){return e.isMultivariateSectionTop?0:t-2}function b2e(t,e){return e<=0?[]:t.slice(0,e)}function Ec(t,e){return t.type==="array"&&t.items||j9(t)?!0:Array.isArray(e)}function Qw(t,e=0){if(e>6||!t.properties)return!1;for(const s of Object.keys(t.properties)){const n=t.properties[s];if(n&&(Ec(n)||n.type==="object"&&Qw(n,e+1)))return!0}return!1}function Zw(t,e=0){if(e>6||t==null||typeof t!="object")return!1;if(Array.isArray(t))return t.some(s=>s!=null&&typeof s=="object"&&!Array.isArray(s));for(const[s,n]of Object.entries(t))if(!s.startsWith("__")&&Zw(n,e+1))return!0;return!1}function ase(t,e,s={}){const n=t.filter(i=>{const r=e[i];if(!r)return!1;if(r.type==="object"&&Qw(r))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?Zw(l):!1});return n.length>1?new Set(n):new Set}function _b(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function cse(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=Yw(t,e);return s===`Item ${e+1}`?void 0:s}function lu(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;if(Array.isArray(t)){for(let i=0;i<t.length;i++){const r=t[i];if(--s.n<=0)return!1;const l=cse(r,i);if(l&&ss(l,e)||lu(r,e,s,n+1))return!0}return!1}for(const[i,r]of Object.entries(t))if(!i.startsWith("__")){if(--s.n<=0)return!1;if((Array.isArray(r)||r!=null&&typeof r=="object")&&(ff(Pu(i),e)||ff(i,e))||lu(r,e,s,n+1))return!0}return!1}function hp(t,e,s,n=0){if(!s||n>4||t==null||typeof t!="object")return!1;const i=t.__resolveType;if(typeof i!="string"||!i)return!1;const r=zn(i,s)?.properties;if(!r)return!1;const l=Object.keys(r);for(const a of l){const c=r[a];if(!c)continue;if(Ec(c)){const u=Eu(a,l,r);if(ss(u,e)||ss(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&hp(d,e,s,n+1))return!0}return!1}function _l(t,e,s,n,i,r){if(n.length===0)return null;const l=Nn(n[0]),a=vb(n[0]);if(a!=null)for(const b of t){const y=e[b];if(!(!y||!Ec(y,s[b]))&&b===a)return b}const c=n.flatMap(b=>sse(b)??[]);if(c.length>0){const b=t.filter(y=>e[y]?.type==="block-ref"&&c.includes(y));if(b.length===1)return b[0]}for(const b of t){const y=e[b];if(!y||!Ec(y,s[b]))continue;const _=Eu(b,t,e);if(ss(l,_)||ss(l,b)||n.some(L=>{if(ss(Nn(L),_)||ss(Nn(L),b))return!0;const v=bb(L);return v!=null&&(ss(v,_)||ss(v,b))}))return b}for(const b of t){const y=e[b];if(!y||!Ec(y,s[b]))continue;const _=s[b];if(!Array.isArray(_))continue;if(uf(_,y.items).some(v=>ss(v,l)))return b}let d=null,u=!1,h=null,f=!1;for(const b of t){const y=e[b];if(y?.type!=="object"||!y.properties)continue;const _=Object.keys(y.properties),L=_b(s[b]),v=Eu(b,t,e);if((ss(l,v)||ss(l,b))&&_l(_,y.properties,L,n.slice(1),i,r)!=null){d===null?d=b:u=!0;continue}_l(_,y.properties,L,n,i,r)!=null&&(h===null?h=b:f=!0)}if(d!==null)return u?null:d;if(h!==null)return f?null:h;for(const b of t){const y=e[b];if(y?.type!=="inline-union"||!y.inlineUnionBranches?.length)continue;const _=_b(s[b]),L=$l(b,y);for(const v of y.inlineUnionBranches){const S=v.schema?.properties;if(!S)continue;const w=Object.keys(S);if(_l(w,S,_,n,i,r)||(ss(l,L)||ss(l,b))&&_l(w,S,_,n.slice(1),i,r))return b}}let m=null;const p=[],g=n.map(bb).filter(b=>b!=null),x=n.map(vb).filter(b=>b!=null);for(const b of t){const y=e[b];if(y?.type!=="block-ref")continue;const _=$l(b,y);if(l!==_&&l!==b){const L=s[b],S=(i?Xw(L,i):null)?.data??L;(lu(S,l)||x.some(w=>lu(S,w)||hp(S,w,r))||g.some(w=>lu(S,w)||hp(S,w,r)))&&p.push(b);continue}if(n.length>1){const L=s[b];if(L&&typeof L=="object"&&!Array.isArray(L)){const v=Nn(n[1]);if(Object.keys(L).some(w=>!w.startsWith("__")&&(ff(Pu(w),v)||ff(w,v))))return b}}m||(m=b)}return m||(p.length===1?p[0]:(p.length>1,null))}function dse(t,e,s,n,i,r){return _l(t,e,s,n,i,r)}function use(t,e,s,n,i,r,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if(_l(a,s.properties,n,i,r,l))return!0;const c=Nn(i[0]);return!ss(c,e)&&!ss(c,t)?!1:i.length>1||_l(a,s.properties,n,i.slice(1),r,l)!==null}function Lb(t,e,s,n,i){if(!md(s))return-1;if(s.fieldKey!=null&&i!=null)return s.fieldKey!==i?-1:s.itemIndex>=0&&s.itemIndex<t.length?s.itemIndex:-1;const r=uf(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&ss(r[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const l=n!=null?r[n]:void 0;return l!==void 0&&ss(l,s.label)?n:r.findIndex(a=>ss(a,s.label))}function hse(t,e,s,n,i,r){if(e.length===0)return null;for(let a=0;a<e.length;a++){const c=e[a],d=Lb(s,n,c,i,r);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>ss(Nn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=Lb(s,n,a,i,r);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function P1(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===to}function fse(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>P1(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>P1(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>P1(s.resolveType)):!1}function mse(t,e){if(e==="global"||e==="sections"||j9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?fse(s):!1}function Sb(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ek(t){return t.map((e,s)=>({...e,index:s}))}function pse(t,e){if(e===t.length)return t;if(e<t.length)return ek(t.slice(0,e));const s=Array.from({length:e-t.length},(n,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...s]}function gse(t,e){const s=t.findIndex(r=>r.index===e),n=t.map(r=>r.index>e?{...r,index:r.index+1}:r),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function xse(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const bse="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",vse="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-6 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-6 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",yse="w-6 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function wb(t,e){return ae("h-6 shrink-0 overflow-hidden",e?bse:t?yse:vse)}function _se(t){const e=U.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(zf,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n&&o.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==s?(l=o.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=o.jsxs(o.Fragment,{children:[i,o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[r,l]})]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Lse(t){const e=U.c(75),{sortableId:s,labelText:n,imageSrc:i,hidden:r,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,u=ce(),h=N9();let f;e[0]!==s?(f={id:s,animateLayoutChanges:jse},e[0]=s,e[1]=f):f=e[1];const{attributes:m,listeners:p,setNodeRef:g,transform:x,isDragging:b}=Hg(f);let y;e[2]!==x?(y=ur.Transform.toString(x?{...x,x:0}:null),e[2]=x,e[3]=y):y=e[3];const _=b?0:void 0;let L;e[4]!==y||e[5]!==_?(L={transform:y,opacity:_},e[4]=y,e[5]=_,e[6]=L):L=e[6];const v=L;let S;e[7]!==m||e[8]!==h?(S=h?{}:m,e[7]=m,e[8]=h,e[9]=S):S=e[9];let w;e[10]!==p||e[11]!==h?(w=h?{}:p,e[10]=p,e[11]=h,e[12]=w):w=e[12];let k;e[13]!==a?(k=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),a())},e[13]=a,e[14]=k):k=e[14];const j=b?"cursor-grabbing":"cursor-pointer";let C;e[15]!==j?(C=ae("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",j),e[15]=j,e[16]=C):C=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(zf,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[17]=V):V=e[17];let N;e[18]!==i?(N=i&&o.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[18]=i,e[19]=N):N=e[19];const T=r&&"line-through opacity-50";let P;e[20]!==T?(P=ae("min-w-0 flex-1 truncate text-sm",T),e[20]=T,e[21]=P):P=e[21];let E;e[22]!==n||e[23]!==P?(E=o.jsx("span",{className:P,children:n}),e[22]=n,e[23]=P,e[24]=E):E=e[24];let R;e[25]!==r||e[26]!==l||e[27]!==h||e[28]!==u?(R=l&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",disabled:h,"aria-label":u(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ae(wb(r===!0,r===!0)),onClick:Z=>{Z.stopPropagation(),l()},onPointerDown:kse,children:r?o.jsx(jP,{size:14}):o.jsx(Xu,{size:14})})}),o.jsx(Ke,{side:"bottom",children:u(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[25]=r,e[26]=l,e[27]=h,e[28]=u,e[29]=R):R=e[29];let M;e[30]!==n||e[31]!==u?(M=u("sectionsEditor.arrayField.openActionsFor",{label:n}),e[30]=n,e[31]=u,e[32]=M):M=e[32];let I;e[33]!==r?(I=ae(wb(r===!0,!1),"data-[state=open]:ml-0 data-[state=open]:w-6 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]"),e[33]=r,e[34]=I):I=e[34];let D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(Ci,{size:14}),e[35]=D):D=e[35];let $;e[36]!==h||e[37]!==M||e[38]!==I?($=o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",disabled:h,"aria-label":M,className:I,onClick:wse,onPointerDown:Sse,children:D})}),e[36]=h,e[37]=M,e[38]=I,e[39]=$):$=e[39];let O;e[40]!==c?(O=Z=>{Z.stopPropagation(),c()},e[40]=c,e[41]=O):O=e[41];let B;e[42]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(vn,{size:14}),e[42]=B):B=e[42];let F;e[43]!==u?(F=u("sectionsEditor.arrayField.duplicate"),e[43]=u,e[44]=F):F=e[44];let z;e[45]!==O||e[46]!==F?(z=o.jsxs(Ze,{onClick:O,children:[B,F]}),e[45]=O,e[46]=F,e[47]=z):z=e[47];let W;e[48]!==d?(W=Z=>{Z.stopPropagation(),d()},e[48]=d,e[49]=W):W=e[49];let K;e[50]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(on,{size:14}),e[50]=K):K=e[50];let H;e[51]!==u?(H=u("sectionsEditor.arrayField.delete"),e[51]=u,e[52]=H):H=e[52];let q;e[53]!==W||e[54]!==H?(q=o.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:W,children:[K,H]}),e[53]=W,e[54]=H,e[55]=q):q=e[55];let G;e[56]!==z||e[57]!==q?(G=o.jsxs(Wt,{align:"end",children:[z,q]}),e[56]=z,e[57]=q,e[58]=G):G=e[58];let Q;e[59]!==$||e[60]!==G?(Q=o.jsxs(Ht,{children:[$,G]}),e[59]=$,e[60]=G,e[61]=Q):Q=e[61];let se;return e[62]!==n||e[63]!==a||e[64]!==g||e[65]!==v||e[66]!==N||e[67]!==E||e[68]!==R||e[69]!==Q||e[70]!==S||e[71]!==w||e[72]!==k||e[73]!==C?(se=o.jsxs("div",{ref:g,style:v,...S,...w,role:"button",tabIndex:0,onClick:a,onKeyDown:k,className:C,title:n,children:[V,N,E,R,Q]}),e[62]=n,e[63]=a,e[64]=g,e[65]=v,e[66]=N,e[67]=E,e[68]=R,e[69]=Q,e[70]=S,e[71]=w,e[72]=k,e[73]=C,e[74]=se):se=e[74],se}function Sse(t){return t.stopPropagation()}function wse(t){return t.stopPropagation()}function kse(t){return t.stopPropagation()}function jse(){return!1}function Cse(t,e,s,n,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const r=t.__resolveType;if(typeof r=="string"&&s){const l=zn(r,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=zn(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function Nse(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function th({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:r=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:u,containerResolveType:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=ce(),b=N9(),y=V9(g?.virtualMcpId),_=Array.isArray(e)?e:[],L=t.items,v=Nse(n),S={arrayKey:v,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(L?.titleBy||L?.inlineUnionBranches?.length)},w=mse(t,v),k=!w&&L?.type==="object",[j,C]=A.useState(null),V=hse(i,r,_,L,j,v),N=V?.index??null;V===null?j!==null&&C(null):V.index!==j&&C(V.index);const[T,P]=A.useState(()=>Sb(_.length)),[E,R]=A.useState(null),[M,I]=A.useState(n),[D,$]=A.useState(_.length),O=A.useRef(!1),B=A.useRef(null);M!==n?(I(n),$(_.length),P(Sb(_.length)),C(null)):D!==_.length&&($(_.length),P(ee=>pse(ee,_.length)));const F=(ee,oe)=>Yw(wc(ee),oe,L),z=ee=>{if(O.current)return;const oe=F(_[ee],ee);C(ee),l?.(eh(r,i,oe,ee,S))},W=ee=>{const oe=[..._,ee];s(oe);const ie=oe.length-1;C(ie);const ue=F(ee,ie);l?.(eh(r,i,ue,ie,S))},K=()=>{const ee=L?.type,oe=L?.default!==void 0?L.default:ee==="object"?{}:ee==="block-ref"?(()=>{const he=L?.anyOfRefs?.[0]?.resolveType;return typeof he!="string"||ru(he)?{}:{__resolveType:he}})():ee==="number"||ee==="integer"?0:ee==="boolean"?!1:ee==="array"?[]:"",ie=[..._,oe];s(ie);const ue=ie.length-1;C(ue);const J=F(oe,ue);l?.(eh(r,i,J,ue,S))},H=()=>{if(w){if(!f){xe.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(p){p({append:W});return}xe.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}K()},q=ee=>{const oe=_[ee],ie=typeof structuredClone=="function"?structuredClone(oe):JSON.parse(JSON.stringify(oe??null)),ue=[..._.slice(0,ee+1),ie,..._.slice(ee+1)];s(ue),P(J=>gse(J,ee))},G=ee=>{const oe=_[ee],ie=[..._];ie[ee]=ou(oe)?Fw(oe):mb(oe),s(ie)},Q=ee=>{s(_.filter((oe,ie)=>ie!==ee)),P(oe=>xse(oe,ee))},se=(ee,oe)=>{const ie=[..._];if(ie[ee]=ou(_[ee])?mb(oe):oe,s(ie),ee===N&&V){const ue=F(_[ee],ee),J=F(ie[ee],ee);if(B.current={path:n,index:ee,label:J},ue!==J){const he=[...r];he[V.crumbIndex]=yb(r[V.crumbIndex],J,ee),l?.(he)}}},Z=Mg(Bc(o0,{activationConstraint:{distance:8}}),Bc(r0,{coordinateGetter:Kg})),te=T.map(ee=>ee.id),X=ee=>{R(String(ee.active.id))},Y=ee=>{R(null);const{active:oe,over:ie}=ee;if(!ie||oe.id===ie.id)return;const ue=te.indexOf(String(oe.id)),J=te.indexOf(String(ie.id));ue===-1||J===-1||(P(he=>ek(zc([...he],ue,J))),s(zc([..._],ue,J)),O.current=!0,requestAnimationFrame(()=>{O.current=!1}))},de=()=>{R(null)},re=E?T.find(ee=>ee.id===E):null,le=re!=null?_[re.index]:void 0,ne=re!=null&&le!==void 0?uf(_,L)[re.index]:null,me=re!=null&&le!==void 0?xb(wc(le),L):void 0;if(N!==null&&N<_.length){const ee=wc(_[N]),oe=Cse(ee,L,c,h,v),ie=()=>{if(!V)return eh(r,i,F(ee,N),N,S);const ue=r.slice(0,V.crumbIndex+1),J=B.current,he=J?.path===n&&J.index===N?J.label:F(ee,N);return ue[V.crumbIndex]=yb(ue[V.crumbIndex],he,N),ue};return o.jsx("div",{className:"min-w-0",children:oe?.type==="object"&&oe.properties?o.jsx(Oi,{schema:oe,value:ee,onChange:ue=>se(N,ue),basePath:`${n}.${N}`,breadcrumbPath:V?.innerPath??[],onBreadcrumbChange:ue=>{l?.([...ie(),...ue])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):oe?Bl({schema:oe,value:ee,onChange:ue=>se(N,ue),path:`${n}.${N}`,required:!0,label:oe.title&&!oe.title.includes("{{")?oe.title:F(ee,N),breadcrumbPath:V?.innerPath??[],onBreadcrumbChange:ue=>{l?.([...ie(),...ue])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):null})}return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(M3,{description:t.description,virtualMcpId:g?.virtualMcpId,children:o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i})}),_.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:_.length})]}),!y&&t.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),_.length>0&&o.jsx("div",{className:ae(E&&"cursor-grabbing"),children:o.jsxs(Bg,{sensors:Z,collisionDetection:M_,onDragStart:X,onDragEnd:Y,onDragCancel:de,children:[o.jsx(Ug,{items:te,strategy:Fg,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const ee=uf(_,L);return T.map(oe=>{const ie=_[oe.index];if(ie===void 0)return null;const ue=ee[oe.index]??F(ie,oe.index),J=xb(wc(ie),L);return o.jsx(Lse,{sortableId:oe.id,labelText:ue,imageSrc:J,hidden:ou(ie),onToggleHidden:k?()=>G(oe.index):void 0,onOpen:()=>z(oe.index),onDuplicate:()=>q(oe.index),onRemove:()=>Q(oe.index)},oe.id)})})()})}),qn.createPortal(o.jsx(zg,{dropAnimation:Bw,children:ne?o.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:o.jsx(_se,{labelText:ne,imageSrc:me})}):null}),document.body)]})}),o.jsxs("button",{type:"button",disabled:b,onClick:H,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30 disabled:pointer-events-none disabled:opacity-50",children:[o.jsx(Yt,{size:14}),x(w?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function Vse(t){const e=U.c(53),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==a?(b=a===void 0?[]:a,e[0]=a,e[1]=b):b=e[1];const y=b,[_,L]=A.useState(!1),v=V9(x?.virtualMcpId);let S;e[2]!==n?(S=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=S):S=e[3];const w=S;if(!s.properties)return null;let k;e[4]!==y||e[5]!==h||e[6]!==u||e[7]!==w||e[8]!==p||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==f||e[13]!==r||e[14]!==m||e[15]!==x||e[16]!==s?(k=o.jsx(Oi,{schema:s,value:w,onChange:i,basePath:r,breadcrumbPath:y,onBreadcrumbChange:c,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=y,e[5]=h,e[6]=u,e[7]=w,e[8]=p,e[9]=c,e[10]=i,e[11]=g,e[12]=f,e[13]=r,e[14]=m,e[15]=x,e[16]=s,e[17]=k):k=e[17];const j=k;if(d)return j;let C;e[18]!==r?(C=r.split(".").pop()??r,e[18]=r,e[19]=C):C=e[19];const V=C;let N;e[20]!==y||e[21]!==h||e[22]!==V||e[23]!==l||e[24]!==u||e[25]!==w||e[26]!==s?(N=use(V,l,s,w,y,h,u),e[20]=y,e[21]=h,e[22]=V,e[23]=l,e[24]=u,e[25]=w,e[26]=s,e[27]=N):N=e[27];const P=_||N,E=`${r}-fields`;let R;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=()=>L(Tse),e[28]=R):R=e[28];let M;e[29]!==P?(M=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:P?o.jsx(Ls,{size:16}):o.jsx(qs,{size:16})}),e[29]=P,e[30]=M):M=e[30];const I=x?.virtualMcpId;let D;e[31]!==l?(D=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[31]=l,e[32]=D):D=e[32];let $;e[33]!==s.description||e[34]!==D||e[35]!==I?($=o.jsx(M3,{description:s.description,virtualMcpId:I,children:D}),e[33]=s.description,e[34]=D,e[35]=I,e[36]=$):$=e[36];let O;e[37]!==E||e[38]!==P||e[39]!==$||e[40]!==M?(O=o.jsxs("button",{type:"button","aria-expanded":P,"aria-controls":E,onClick:R,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[M,$]}),e[37]=E,e[38]=P,e[39]=$,e[40]=M,e[41]=O):O=e[41];let B;e[42]!==s.description||e[43]!==v?(B=!v&&s.description&&o.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[42]=s.description,e[43]=v,e[44]=B):B=e[44];let F;e[45]!==E||e[46]!==j||e[47]!==P?(F=P&&o.jsx("div",{id:E,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=E,e[46]=j,e[47]=P,e[48]=F):F=e[48];let z;return e[49]!==O||e[50]!==B||e[51]!==F?(z=o.jsxs("div",{className:"min-w-0 space-y-2",children:[O,B,F]}),e[49]=O,e[50]=B,e[51]=F,e[52]=z):z=e[52],z}function Tse(t){return!t}function v2e(t,e,s,n,i){const r={...t[e]};if(i.length>1){const l=r.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),r.sections={...l,variants:a}}else r.sections=s;return r}function y2e(t){return structuredClone(t)}function _2e(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function tk(t){const e=t.replace(/[^A-Za-z0-9_ -]/g,"").replace(/\s+/g," ").trim();return/^[A-Za-z]/.test(e)?e:e?`Block ${e}`:""}function F3(t,e){const s=t.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_ -]*$/.test(s)?null:"Use letters, numbers, spaces, hyphens, or underscores. Must start with a letter.":"Block name is required."}function U3(t){const e=U.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:r,onSubmit:l}=t,a=i===void 0?"":i,c=r===void 0?!1:r,[d,u]=A.useState(a),[h,f]=A.useState(s);s!==h&&(f(s),s&&u(a));let m;e[0]!==c||e[1]!==n?(m=B=>{!B&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=m):m=e[2];const p=m;let g;e[3]!==d||e[4]!==c||e[5]!==l?(g=async B=>{B.preventDefault();const F=d.trim();!F||c||await l(F)},e[3]=d,e[4]=c,e[5]=l,e[6]=g):g=e[6];const x=g,b=ce();let y;e[7]!==b?(y=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsx(Gt,{children:y}),e[9]=y,e[10]=_):_=e[10];let L;e[11]!==b?(L=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=L):L=e[12];let v;e[13]!==L?(v=o.jsx(Tn,{children:L}),e[13]=L,e[14]=v):v=e[14];let S;e[15]!==_||e[16]!==v?(S=o.jsxs(ms,{children:[_,v]}),e[15]=_,e[16]=v,e[17]=S):S=e[17];let w;e[18]!==b?(w=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=w):w=e[19];let k;e[20]!==w?(k=o.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:w}),e[20]=w,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=B=>u(B.target.value),e[22]=j):j=e[22];let C;e[23]!==b?(C=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=C):C=e[24];let V;e[25]!==d||e[26]!==c||e[27]!==C?(V=o.jsx(kt,{id:"block-id",value:d,onChange:j,placeholder:C,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=C,e[28]=V):V=e[28];let N;e[29]!==k||e[30]!==V?(N=o.jsxs("div",{className:"py-4 space-y-2",children:[k,V]}),e[29]=k,e[30]=V,e[31]=N):N=e[31];let T;e[32]!==n?(T=()=>n(!1),e[32]=n,e[33]=T):T=e[33];let P;e[34]!==b?(P=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=P):P=e[35];let E;e[36]!==c||e[37]!==T||e[38]!==P?(E=o.jsx(fe,{type:"button",variant:"outline",onClick:T,disabled:c,children:P}),e[36]=c,e[37]=T,e[38]=P,e[39]=E):E=e[39];let R;e[40]!==d||e[41]!==c?(R=!d.trim()||c,e[40]=d,e[41]=c,e[42]=R):R=e[42];let M;e[43]!==c||e[44]!==b?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=M):M=e[45];let I;e[46]!==R||e[47]!==M?(I=o.jsx(fe,{type:"submit",disabled:R,children:M}),e[46]=R,e[47]=M,e[48]=I):I=e[48];let D;e[49]!==E||e[50]!==I?(D=o.jsxs(Yn,{children:[E,I]}),e[49]=E,e[50]=I,e[51]=D):D=e[51];let $;e[52]!==x||e[53]!==N||e[54]!==D||e[55]!==S?($=o.jsx(Ft,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:x,children:[S,N,D]})}),e[52]=x,e[53]=N,e[54]=D,e[55]=S,e[56]=$):$=e[56];let O;return e[57]!==p||e[58]!==s||e[59]!==$?(O=o.jsx(Ut,{open:s,onOpenChange:p,children:$}),e[57]=p,e[58]=s,e[59]=$,e[60]=O):O=e[60],O}function Ase(t){if(!t?.properties)return{};const e={};for(const[s,n]of Object.entries(t.properties))s.startsWith("__")||s==="@type"||(n.default!==void 0?e[s]=n.default:n.type==="boolean"?e[s]=!1:n.type==="string"?e[s]="":n.type==="number"||n.type==="integer"?e[s]=0:n.type==="object"&&(e[s]={}));return e}function Pse(t){const e=U.c(13),{blockKey:s}=t,n=ce();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(An,{size:11}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx(He,{asChild:!0,children:o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i,r]})}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s||e[6]!==n?(a=n("sectionsEditor.anyOfField.globalLoaderTooltip",{blockKey:s}),e[5]=s,e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(Ke,{side:"top",className:"max-w-[260px]",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function Ese(t){const e=U.c(36),{path:s,open:n,onOpenChange:i,title:r,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:u}=t,h=ce(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=ae("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?o.jsx(Ls,{size:16}):o.jsx(qs,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==r?(b=o.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:r}),e[7]=r,e[8]=b):b=e[8];let y;e[9]!==c?(y=c&&o.jsx(Pse,{blockKey:c}),e[9]=c,e[10]=y):y=e[10];let _;e[11]!==b||e[12]!==y?(_=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,y]}),e[11]=b,e[12]=y,e[13]=_):_=e[13];let L;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==_?(L=o.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":f,onClick:g,className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-3 py-2.5 text-left",children:[x,_]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=_,e[19]=L):L=e[19];let v;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(v=(d||u)&&o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":h("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:o.jsx(Ci,{size:16})})}),o.jsxs(Wt,{align:"end",className:"w-48",children:[c&&d&&o.jsxs(Ze,{onClick:d,children:[o.jsx(Mo,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.detach")]}),!c&&u&&o.jsxs(Ze,{onClick:u,children:[o.jsx(An,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=v):v=e[24];let S;e[25]!==L||e[26]!==v?(S=o.jsxs("div",{className:"group flex w-full min-w-0 items-center gap-1 rounded-lg pr-2 transition-colors hover:bg-accent/50",children:[L,v]}),e[25]=L,e[26]=v,e[27]=S):S=e[27];let w;e[28]!==f||e[29]!==l||e[30]!==n?(w=n&&o.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:o.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[28]=f,e[29]=l,e[30]=n,e[31]=w):w=e[31];let k;return e[32]!==S||e[33]!==w||e[34]!==p?(k=o.jsxs("div",{className:p,children:[S,w]}),e[32]=S,e[33]=w,e[34]=p,e[35]=k):k=e[35],k}function kb(t){const e=U.c(42),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=ce(),x=(s.anyOfRefs??[]).filter(Mse),b=u&&n?Xw(n,u):null,y=b?.data??n,_=b?null:Uw(y),L=_??y,v=$te(x,{savedBlockKey:b?.blockKey,editorValue:y}),S=v.length>0?Bte(y,v,b?.blockKey):v[0]?.resolveType??"",k=s.type==="block-ref"&&v.some(Dse);let j;e[0]!==l||e[1]!==r?(j=l??(r.includes(".")?r.split(".")[0]:r),e[0]=l,e[1]=r,e[2]=j):j=e[2];const C=j;let V;e[3]!==a?(V=a??[],e[3]=a,e[4]=V):V=e[4];const N=V,T=k&&N.length>0&&Nn(N[0])===C,P=T?N.slice(1):N,E=T?se=>{c?.([C,...se])}:c,[R,M]=A.useState(S),[I,D]=A.useState(S);I!==S&&(D(S),M(S));const[$,O]=A.useState(()=>Fte(y,b?.blockKey)),[B,F]=A.useState(!1);if(v.length>0){const se=R||S;let Z;e[5]!==se?(Z=Ne=>Ne.resolveType===se,e[5]=se,e[6]=Z):Z=e[6];const te=v.find(Z),X=pb(y,d,te?.schema),Y=zte(X??te?.schema??null,s.discriminatorKey),de=s.discriminatorKey,re=Ne=>{M(Ne);const ge=v.find(Ie=>Ie.resolveType===Ne),Te=pb(y,d,ge?.schema),Se=new Set(Object.keys((Te??ge?.schema)?.properties??{})),we=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Ye=Object.fromEntries(Object.entries(we).filter(Ie=>{const[Oe]=Ie;return Se.has(Oe)})),Ge={...Ase(ge?.schema),...Ye};if(de){const Ie=ge?.discriminatorValue??Ne;i({...Ge,[de]:Ie});return}if(ru(Ne)){i(Ge);return}i({...Ge,__resolveType:Ne})};let le;e[7]!==se||e[8]!==de||e[9]!==i?(le=Ne=>{if(de||!ru(se)||Ne===null||typeof Ne!="object"||Array.isArray(Ne)){i(Ne);return}const{__resolveType:ge,...Te}=Ne;i(Te)},e[7]=se,e[8]=de,e[9]=i,e[10]=le):le=e[10];const ne=le,me=Y?.properties?o.jsx(Oi,{schema:Y,value:L,onChange:Ne=>{if(b&&h){h(b.blockKey,Ne);return}if(_){i({...y,section:Ne});return}ne(Ne)},basePath:r,breadcrumbPath:P,onBreadcrumbChange:E,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(k&&me&&P.length>0){let Ne;return e[11]!==me?(Ne=o.jsx("div",{className:"min-w-0",children:me}),e[11]=me,e[12]=Ne):Ne=e[12],Ne}let ee;e[13]!==r?(ee=r.includes("."),e[13]=r,e[14]=ee):ee=e[14];const oe=ee,ie=b?()=>{const{name:Ne,...ge}=b.data;i(ge)}:void 0,ue=!b&&!_&&!!h&&k&&!ru(se)&&se.includes("/"),J=L&&typeof L=="object"&&!Array.isArray(L)?L:{},he=Ne=>{if(!h)return;const ge=Ne.trim(),Te=F3(ge,u??{});if(Te){xe.error(Te);return}h(ge,{...J,__resolveType:se,name:ge}),i({__resolveType:ge}),F(!1),xe.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:ge}))},ve=f?.virtualMcpId;let je;e[15]!==l||e[16]!==r||e[17]!==s.description||e[18]!==ve?(je=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:ve}),e[15]=l,e[16]=r,e[17]=s.description,e[18]=ve,e[19]=je):je=e[19];let Ce;e[20]!==g?(Ce=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=Ce):Ce=e[21];let Le;e[22]!==Ce?(Le=o.jsx(Ds,{placeholder:Ce}),e[22]=Ce,e[23]=Le):Le=e[23];let _e;return e[24]!==r||e[25]!==Le?(_e=o.jsx(js,{id:r,className:"w-full min-w-0",children:Le}),e[24]=r,e[25]=Le,e[26]=_e):_e=e[26],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[je,o.jsxs(ks,{value:se||void 0,onValueChange:re,children:[_e,o.jsx(Cs,{children:v.map(Rse)})]})]}),me&&(k?o.jsx(Ese,{path:r,open:$,onOpenChange:O,title:g(oe?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:me,nestedBlockRef:oe,globalBlockKey:b?.blockKey,onDetach:ie,onMakeGlobal:ue?()=>F(!0):void 0}):me),ue&&o.jsx(U3,{open:B,onOpenChange:F,defaultBlockId:tk(bs(se)),onSubmit:he})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const z=f?.virtualMcpId;let W;e[27]!==l||e[28]!==r||e[29]!==s.description||e[30]!==z?(W=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:z}),e[27]=l,e[28]=r,e[29]=s.description,e[30]=z,e[31]=W):W=e[31];const K=n!=null?String(n):"";let H;e[32]!==i?(H=se=>i(se.target.value),e[32]=i,e[33]=H):H=e[33];const q=s.description??"";let G;e[34]!==r||e[35]!==K||e[36]!==H||e[37]!==q?(G=o.jsx("input",{id:r,type:"text",value:K,onChange:H,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:q}),e[34]=r,e[35]=K,e[36]=H,e[37]=q,e[38]=G):G=e[38];let Q;return e[39]!==W||e[40]!==G?(Q=o.jsxs("div",{className:"space-y-1.5",children:[W,G]}),e[39]=W,e[40]=G,e[41]=Q):Q=e[41],Q}function Rse(t){const e=Ote(t);return o.jsx(Ot,{value:t.resolveType,children:e},t.resolveType)}function Dse(t){return t.resolveType.includes("/")&&!ru(t.resolveType)}function Mse(t){return t.resolveType!==""}const E1=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function Ise(t){const e={};if(typeof t!="string")return e;const s=/<symbol\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/symbol>/gi;for(const n of t.matchAll(s)){const i=n[1]??"",r=n[2]??"",l=E1(i,"id");if(!l)continue;const a=E1(i,"viewBox"),c=E1(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${r}</svg>`}return e}async function Ose(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return Ise(await e.text())}function $se(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)if(typeof s=="string")e.push({value:s,label:s});else if(s&&typeof s=="object"&&"value"in s){const n=s;e.push({value:String(n.value),label:typeof n.label=="string"?n.label:String(n.value),image:typeof n.image=="string"?n.image:void 0,icon:typeof n.icon=="string"?n.icon:void 0})}return e}function Bse(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)typeof s=="string"&&e.push({value:s,label:s});return e}function zse(t,e){return t.length>0?t:e}function Fse(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function Use({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:r}){return!!t&&!e&&s===0&&r&&n.length>0&&!i.includes(n)}function sk(t,e){const n=`<style>${e?`svg{color:${e}}`:""}.fill-current{fill:currentColor}.stroke-current{stroke:currentColor}.text-current{color:currentColor}</style>`,i=t.replace(/(<svg[^>]*>)/i,`$1${n}`);return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function Hse(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function Kse(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return sk(t.icon,e)}async function Wse(t,e,s){const n={};s&&(n.term=s);const r=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to fetch dynamic options: ${l.status}`);const a=await l.json();return $se(a)}function jb(t){const e=U.c(9),{option:s,className:n,fg:i}=t;let r;e[0]!==i||e[1]!==s?(r=Kse(s,i),e[0]=i,e[1]=s,e[2]=r):r=e[2];const l=r;if(!l)return null;const a=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==a?(c=ae("shrink-0",a,n),e[3]=n,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function qse(t){const e=U.c(53),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=ce(),d=s.options,u=a?.previewUrl,[h,f]=A.useState(!1),[m,p]=A.useState(""),[g,x]=A.useState(""),b=A.useRef(null);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=ne=>{p(ne),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(ne)},300)},e[0]=y):y=e[0];const _=y,L=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",v=typeof n=="string"?n:"",S=s.format==="icon-select";let w;e[1]!==g||e[2]!==d||e[3]!==L?(w=it.sandboxInvoke(L,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=L,e[4]=w):w=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==u?(k=()=>Wse(u,d,g||void 0),e[5]=g,e[6]=d,e[7]=u,e[8]=k):k=e[8];const j=!!u&&!!d&&(h||!!v);let C;e[9]!==w||e[10]!==k||e[11]!==j?(C={queryKey:w,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=w,e[10]=k,e[11]=j,e[12]=C):C=e[12];const V=Qt(C),N=V.data??[];let T;e[13]!==L?(T=it.sandboxSprite(L),e[13]=L,e[14]=T):T=e[14];let P;e[15]!==u||e[16]!==a?(P=()=>Ose(DS({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,threadId:a.threadId,previewUrl:u},"/sprites.svg")),e[15]=u,e[16]=a,e[17]=P):P=e[17];const E=S&&!!a&&(h||!!v)&&(!d||V.isFetched&&N.length===0);let R;e[18]!==T||e[19]!==P||e[20]!==E?(R={queryKey:T,queryFn:P,enabled:E,staleTime:3e5,retry:1},e[18]=T,e[19]=P,e[20]=E,e[21]=R):R=e[21];const M=Qt(R),I=Bse(s.enum),D=M.data??{},$=Hse(),O=Object.fromEntries(Object.entries(D).map(ne=>{const[me,ee]=ne;return[me,sk(ee,$)]})),B=S&&Object.keys(O).length>0?I.map(ne=>({...ne,previewSrc:O[ne.value]})):I,F=zse(N,B),z=Fse(F,m);let W;e[22]!==v?(W=ne=>ne.value===v,e[22]=v,e[23]=W):W=e[23];const K=F.find(W),H=m.trim(),q=V.isFetched&&!V.isFetching&&m===g,G=Use({loaderPath:d,isIconSelect:S,enumFallbackCount:I.length,trimmedSearch:H,optionValues:F.map(Gse),optionsSettled:q});if((!u||!d)&&I.length===0){const ne=a?.virtualMcpId;let me;e[24]!==l||e[25]!==r||e[26]!==s.description||e[27]!==ne?(me=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:ne}),e[24]=l,e[25]=r,e[26]=s.description,e[27]=ne,e[28]=me):me=e[28];let ee;e[29]!==i?(ee=ue=>i(ue.target.value),e[29]=i,e[30]=ee):ee=e[30];let oe;e[31]!==v||e[32]!==r||e[33]!==ee?(oe=o.jsx(kt,{id:r,type:"text",value:v,onChange:ee}),e[31]=v,e[32]=r,e[33]=ee,e[34]=oe):oe=e[34];let ie;return e[35]!==me||e[36]!==oe?(ie=o.jsxs("div",{className:"space-y-2",children:[me,oe]}),e[35]=me,e[36]=oe,e[37]=ie):ie=e[37],ie}const se=a?.virtualMcpId;let Z;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==se?(Z=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:se}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=se,e[42]=Z):Z=e[42];const te=K?o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(jb,{option:K,className:"h-6 w-6",fg:$}),o.jsx("span",{className:"truncate",children:K.label??K.value})]}):v?o.jsx("span",{className:"truncate",children:v}):o.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let X;e[43]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(s9,{className:"size-4 shrink-0 opacity-50"}),e[43]=X):X=e[43];let Y;e[44]!==h||e[45]!==te?(Y=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{variant:"outline",role:"combobox","aria-expanded":h,className:"h-10 w-full justify-between font-normal",children:[te,X]})}),e[44]=h,e[45]=te,e[46]=Y):Y=e[46];let de;e[47]===Symbol.for("react.memo_cache_sentinel")?(de={width:"var(--radix-popover-trigger-width)"},e[47]=de):de=e[47];let re;e[48]!==c?(re=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=re):re=e[49];let le;return e[50]!==m||e[51]!==re?(le=o.jsx(ui,{placeholder:re,className:"h-9",value:m,onValueChange:_}),e[50]=m,e[51]=re,e[52]=le):le=e[52],o.jsxs("div",{className:"space-y-2",children:[Z,o.jsxs(fs,{open:h,onOpenChange:f,children:[Y,o.jsx(hs,{className:"p-0",style:de,children:o.jsxs(Di,{shouldFilter:!1,children:[le,o.jsxs(hi,{children:[!G&&o.jsx(Bn,{children:V.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),o.jsx(Es,{children:z.map(ne=>o.jsxs(us,{value:ne.value,className:"cursor-pointer",onSelect:()=>{i(ne.value===v?"":ne.value),f(!1)},children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(jb,{option:ne,className:ae(ne.image?"h-9 w-9":"h-6 w-6"),fg:$}),o.jsx("span",{className:"truncate",children:ne.label??ne.value})]}),o.jsx(zt,{className:ae("ml-auto size-4 shrink-0",v===ne.value?"opacity-100":"opacity-0")})]},ne.value))}),G&&o.jsx(Es,{children:o.jsx(us,{value:H,className:"cursor-pointer",onSelect:()=>{i(H),p(""),x(""),f(!1)},children:o.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:H})})})})]})]})})]})]})}function Gse(t){return t.value}function nk(t){const e=U.c(17),{org:s}=Fe(),n=ys();let i,r,l,a;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(r=t.search?.trim()||void 0,i=t.imageOnly??!1,a=O8,l=it.filePickerObjects(s.id,t.configId,r,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=r,e[6]=l,e[7]=a):(i=e[4],r=e[5],l=e[6],a=e[7]);const c=t.enabled!==!1&&!!t.configId;let d;e[8]!==i||e[9]!==t.configId||e[10]!==r||e[11]!==n?(d=async h=>{const{pageParam:f}=h;return await n.call("FILE_OBJECTS_LIST",{configId:t.configId,cursor:f??void 0,search:r,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=r,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==c||e[15]!==d?(u={queryKey:l,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:Yse},e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],a(u)}function Yse(t){return t.nextCursor??void 0}function A9(){const t=U.c(2),{org:e}=Fe();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",r=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(n.configId)}/upload?filename=${encodeURIComponent(n.file.name)}`,{method:"POST",headers:{"Content-Type":i},body:n.file});if(!r.ok){const l=await r.text().catch(Jse);let a=`${r.status} ${r.statusText}`;try{const c=JSON.parse(l);c.message&&(a=c.message)}catch{l&&(a=l.slice(0,200))}throw new Error(`Upload failed: ${a}`)}return await r.json()}},t[0]=e,t[1]=s):s=t[1],Rs(s)}function Jse(){return""}function Xse(){const t=U.c(8),{org:e}=Fe(),s=ys(),n=Ms();let i;t[0]!==s?(i=a=>s.call("FILE_OBJECT_DELETE",a),t[0]=s,t[1]=i):i=t[1];let r;t[2]!==e||t[3]!==n?(r=(a,c)=>{n.invalidateQueries({queryKey:it.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=r):r=t[4];let l;return t[5]!==i||t[6]!==r?(l={mutationFn:i,onSuccess:r},t[5]=i,t[6]=r,t[7]=l):l=t[7],Rs(l)}function H3(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function ik(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function mf(t){const e=t.split("/");return e[e.length-1]??t}function rk(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const P9="file-picker:last-config-id";function ok(t){const e=U.c(31),s=ce(),n=t.open,i=t.onOpenChange;let r;e[0]!==t.mode||e[1]!==s?(r=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx(Gt,{children:r}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s?(a=s("filePicker.filePickerDialog.description"),e[5]=s,e[6]=a):a=e[6];let c;e[7]!==a?(c=o.jsx(Tn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=o.jsxs(ms,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==s?(u=b=>{const{error:y}=b;return o.jsx(Qse,{error:y??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=u):u=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(nn,{className:"h-64 w-full"}),e[14]=h):h=e[14];let f;e[15]!==t?(f=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=f):f=e[16];let m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(m=o.jsx(A.Suspense,{fallback:h,children:o.jsx(Zse,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==u?(p=o.jsx(rn,{fallback:u,children:m}),e[21]=m,e[22]=u,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=o.jsxs(Ft,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,p]}),e[24]=p,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=o.jsx(Ut,{open:n,onOpenChange:i,children:g}),e[27]=t.onOpenChange,e[28]=t.open,e[29]=g,e[30]=x):x=e[30],x}function Qse(t){const e=U.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(yn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=o.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,o.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function Zse(t){const e=U.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,r=I8();if(r.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(sne,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==r||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=r.find(x),e[1]=r,e[2]=n,e[3]=p}else p=e[3];const g=p;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=o.jsx(R1,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(r.length===1){const p=r[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=o.jsx(R1,{config:p,mode:s,onSelect:i}),e[10]=p,e[11]=s,e[12]=i,e[13]=g):g=e[13],g}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=typeof window<"u"?window.localStorage.getItem(P9):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==r?(c=r.find(p=>p.id===a)?.id??r[0].id,e[15]=r,e[16]=c):c=e[16];const d=c;let u;e[17]!==r?(u=r.map(ene),e[17]=r,e[18]=u):u=e[18];let h;e[19]!==u?(h=o.jsx(ed,{className:"self-start",children:u}),e[19]=u,e[20]=h):h=e[20];let f;if(e[21]!==r||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>o.jsx(wl,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(R1,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],f=r.map(p),e[21]=r,e[22]=s,e[23]=i,e[24]=f}else f=e[24];let m;return e[28]!==d||e[29]!==h||e[30]!==f?(m=o.jsxs(Xl,{defaultValue:d,onValueChange:tne,className:"min-h-0 flex-1 flex flex-col",children:[h,f]}),e[28]=d,e[29]=h,e[30]=f,e[31]=m):m=e[31],m}function ene(t){return o.jsx(ni,{value:t.id,children:t.name},t.id)}function tne(t){typeof window<"u"&&window.localStorage.setItem(P9,t)}function sne(){const t=U.c(12),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:o.jsx(Jn,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noBucketConfigured"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[s,o.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function R1({config:t,mode:e,onSelect:s}){const n=ce(),[i,r]=A.useState(""),l=r9(i,300),a=nk({configId:t.id,search:l,imageOnly:e==="image"}),c=A9(),[d,u]=A.useState(!1),h=A.useRef(null),f=e==="image"?"image/*":void 0;async function m(w){if(!w)return;const k=Array.from(w);if(k.length===0)return;let j=null;const C=[];for(const V of k)try{const N=await c.mutateAsync({configId:t.id,file:V});j??=N.publicUrl}catch(N){C.push(`${V.name} (${N instanceof Error?N.message:"upload failed"})`)}await a.refetch(),C.length>0&&xe.error(C.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:C.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:C.join("; ")})),j&&s(j)}function p(w){w.preventDefault(),u(!0)}function g(){u(!1)}function x(w){w.preventDefault(),w.stopPropagation(),u(!1),m(w.dataTransfer.files)}const y=(a.data?.pages??[]).flatMap(w=>w.items),_=y.filter(w=>e==="image"?H3(w.key):!0),L=l.trim(),v=y.length>0||i.trim().length>0,S=i!==l||a.isFetching&&!a.isFetchingNextPage;return o.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[o.jsxs("button",{type:"button",onClick:()=>h.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:ae("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",d&&"border-primary bg-primary/5",c.isPending&&"opacity-60 pointer-events-none"),children:[o.jsx(Jn,{size:18,className:"text-muted-foreground"}),o.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),o.jsx("input",{ref:h,type:"file",accept:f,multiple:!0,className:"hidden",onChange:w=>{const k=Array.from(w.target.files??[]);w.target.value="",m(k)}})]}),v?o.jsx(e9,{value:i,onChange:r,isSearching:S,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[_.length===0?L?o.jsx(rne,{query:L}):e==="image"&&y.length>0?o.jsx(ine,{}):o.jsx(nne,{}):e==="image"?o.jsx(one,{items:_,onSelect:s}):o.jsx(lne,{items:_,onSelect:s}),a.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function nne(){const t=U.c(12),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(li,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noFilesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function ine(){const t=U.c(12),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(li,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noImagesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function rne(t){const e=U.c(13),{query:s}=t,n=ce();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(li,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s||e[2]!==n?(r=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=r):r=e[3];let l;e[4]!==r?(l=o.jsx("p",{className:"text-sm font-medium",children:r}),e[4]=r,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function one(t){const e=U.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>o.jsx(lk,{item:a,variant:"image",onSelect:n},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let r;return e[5]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=r):r=e[6],r}function lne(t){const e=U.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>o.jsx("li",{children:o.jsx(lk,{item:a,variant:"row",onSelect:n})},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let r;return e[5]!==i?(r=o.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=r):r=e[6],r}function lk(t){const e=U.c(58),{item:s,variant:n,onSelect:i}=t;let r;e[0]!==s.key?(r=ik(s.key),e[0]=s.key,e[1]=r):r=e[1];const l=r;if(n==="image"){let _;e[2]!==s.publicUrl||e[3]!==i?(_=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=_):_=e[4];let L;e[5]!==s.key||e[6]!==s.publicUrl?(L=o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:ane}),e[5]=s.key,e[6]=s.publicUrl,e[7]=L):L=e[7];let v;e[8]!==s.key||e[9]!==_||e[10]!==L?(v=o.jsx("button",{type:"button",onClick:_,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:L}),e[8]=s.key,e[9]=_,e[10]=L,e[11]=v):v=e[11];let S;e[12]!==l?(S=o.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:l}),e[12]=l,e[13]=S):S=e[13];let w;e[14]!==s||e[15]!==i?(w=o.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(Cb,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=w):w=e[16];let k;e[17]!==s.key?(k=mf(s.key),e[17]=s.key,e[18]=k):k=e[18];let j;e[19]!==k?(j=o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx("p",{className:"truncate text-xs text-white",children:k})}),e[19]=k,e[20]=j):j=e[20];let C;return e[21]!==v||e[22]!==S||e[23]!==w||e[24]!==j?(C=o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[v,S,w,j]}),e[21]=v,e[22]=S,e[23]=w,e[24]=j,e[25]=C):C=e[25],C}let a;e[26]!==s.publicUrl||e[27]!==i?(a=()=>i(s.publicUrl),e[26]=s.publicUrl,e[27]=i,e[28]=a):a=e[28];let c;e[29]!==s.key?(c=o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:H3(s.key)?o.jsx(li,{size:16,className:"text-muted-foreground"}):o.jsx(Ai,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=mf(s.key),e[31]=s.key,e[32]=d):d=e[32];let u;e[33]!==d?(u=o.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=u):u=e[34];let h;e[35]!==s.key?(h=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=h):h=e[36];let f;e[37]!==u||e[38]!==h?(f=o.jsxs("div",{className:"min-w-0 flex-1",children:[u,h]}),e[37]=u,e[38]=h,e[39]=f):f=e[39];let m;e[40]!==l?(m=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:l}),e[40]=l,e[41]=m):m=e[41];let p;e[42]!==s.size?(p=rk(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==a||e[48]!==c||e[49]!==f||e[50]!==m?(x=o.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,m,g]}),e[46]=g,e[47]=a,e[48]=c,e[49]=f,e[50]=m,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=o.jsx(Cb,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let y;return e[55]!==x||e[56]!==b?(y=o.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[x,b]}),e[55]=x,e[56]=b,e[57]=y):y=e[57],y}function ane(t){t.target.style.display="none"}function Cb(t){const e=U.c(39),{item:s,onSelect:n}=t,i=ce(),[r,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(C){C.preventDefault(),C.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{xe.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(i9,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:une,"aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==s.publicUrl||e[9]!==n?(f=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(zt,{size:14}),e[11]=m):m=e[11];let p;e[12]!==i?(p=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=p):p=e[13];let g;e[14]!==f||e[15]!==p?(g=o.jsxs(Ze,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==r?(x=r?o.jsx(zt,{size:14}):o.jsx(vn,{size:14}),e[17]=r,e[18]=x):x=e[18];let b;e[19]!==r||e[20]!==i?(b=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=r,e[20]=i,e[21]=b):b=e[21];let y;e[22]!==c||e[23]!==b||e[24]!==x?(y=o.jsxs(Ze,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=y):y=e[25];const _=s.publicUrl;let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(mn,{size:14}),e[26]=L):L=e[26];let v;e[27]!==i?(v=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=v):v=e[28];let S;e[29]!==s.publicUrl||e[30]!==v?(S=o.jsx(Ze,{asChild:!0,children:o.jsxs("a",{href:_,target:"_blank",rel:"noreferrer",onClick:cne,children:[L,v]})}),e[29]=s.publicUrl,e[30]=v,e[31]=S):S=e[31];let w;e[32]!==y||e[33]!==S||e[34]!==g?(w=o.jsxs(Wt,{align:"end",onClick:dne,children:[g,y,S]}),e[32]=y,e[33]=S,e[34]=g,e[35]=w):w=e[35];let k;return e[36]!==w||e[37]!==h?(k=o.jsxs(Ht,{children:[h,w]}),e[36]=w,e[37]=h,e[38]=k):k=e[38],k}function cne(t){return t.stopPropagation()}function dne(t){return t.stopPropagation()}function une(t){return t.stopPropagation()}function ak(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:o.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[o.jsx(Jn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function ck(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function dk(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const hne=["low","medium","high","original"];function uk(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function hk(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=fne(t);for(const n of s){const i=n.indexOf("=");if((i>=0?n.slice(0,i):n)===e)return i>=0?n.slice(i+1):""}return null}}function fk(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",r=n>=0?t.slice(0,n):t,l=r.indexOf("?"),a=l>=0?r.slice(0,l):r,c=(l>=0?r.slice(l+1).split("&"):[]).filter(Boolean).filter(d=>{const u=d.indexOf("=");return(u>=0?d.slice(0,u):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${a}${c.length?`?${c.join("&")}`:""}${i}`}function fne(t){const e=t.indexOf("#"),s=e>=0?t.slice(0,e):t,n=s.indexOf("?");return n<0?[]:s.slice(n+1).split("&").filter(Boolean)}function mne(t){if(!t)return;const e=hk(t,"quality");return uk(e)?e:void 0}function pne(t,e){return fk(t,"quality",e)}function gne(t){return t?hk(t,"muted")!=="false":!0}function xne(t,e){return fk(t,"muted",e?void 0:"false")}function mk(t){const e=U.c(36),{value:s,onChange:n,showMuted:i}=t,r=i===void 0?!1:i,l=ce(),a=A.useId();let c;e[0]!==s?(c=mne(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==s?(u=gne(s),e[2]=s,e[3]=u):u=e[3];const h=u;let f;e[4]!==l?(f=l("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=l,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(i9,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=o.jsx(ds,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:m})}),e[7]=f,e[8]=p):p=e[8];let g;e[9]!==l?(g=l("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=l,e[10]=g):g=e[10];let x;e[11]!==g?(x=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let y;e[13]!==n||e[14]!==s?(y=j=>n(pne(s,uk(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=y):y=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=hne.map(bne),e[16]=_):_=e[16];let L;e[17]!==y||e[18]!==b?(L=o.jsx(Wf,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:y,children:_}),e[17]=y,e[18]=b,e[19]=L):L=e[19];let v;e[20]!==L||e[21]!==x?(v=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,L]}),e[20]=L,e[21]=x,e[22]=v):v=e[22];let S;e[23]!==h||e[24]!==a||e[25]!==n||e[26]!==r||e[27]!==l||e[28]!==s?(S=r&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Mt,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),o.jsx(ii,{id:a,checked:h,onCheckedChange:j=>n(xne(s,j))})]}),e[23]=h,e[24]=a,e[25]=n,e[26]=r,e[27]=l,e[28]=s,e[29]=S):S=e[29];let w;e[30]!==v||e[31]!==S?(w=o.jsx(hs,{align:"end",className:"w-auto min-w-52 p-3",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[v,S]})}),e[30]=v,e[31]=S,e[32]=w):w=e[32];let k;return e[33]!==w||e[34]!==p?(k=o.jsxs(fs,{children:[p,w]}),e[33]=w,e[34]=p,e[35]=k):k=e[35],k}function bne(t){return o.jsx(Ic,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function pk(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function Nb(t){const e=U.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function vne(t){const e=U.c(81),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=ce(),d=s.format==="video-uri",u=B3(n),[h,f]=A.useState(!1),[m,p]=A.useState(!1),g=u?ck(u):"",x=g?dk(g):"",b=dg(),y=A9();let _;e[0]!==b.data?.configs?(_=b.data?.configs??[],e[0]=b.data?.configs,e[1]=_):_=e[1];const L=a?.siteSlug;let v;e[2]!==_||e[3]!==L?(v=qf(_,L),e[2]=_,e[3]=L,e[4]=v):v=e[4];const S=v;let w;e[5]!==b.data?.configs||e[6]!==d||e[7]!==S?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==y?(w=async function(X){if(!X)return;let Y=Array.from(X);if(Y.length===0)return;if(d&&(Y=Y.filter(yne),Y.length===0)){xe.error(c("sectionsEditor.fileField.videoFileError"));return}const de=pk(b.data?.configs??[],S?.id,typeof window<"u"?window.localStorage.getItem(P9):null);if(!de){f(!0);return}try{const re=await y.mutateAsync({configId:de,file:Y[0]});i(re.publicUrl),Y.length>1&&xe.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:Y[0].name}))}catch(re){const le=re;xe.error(le instanceof Error?le.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=S?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=y,e[12]=w):w=e[12];const k=w;let j;e[13]!==p?(j=function(X){X.preventDefault(),X.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const C=j;let V;e[15]!==p?(V=function(X){X.currentTarget===X.target&&p(!1)},e[15]=p,e[16]=V):V=e[16];const N=V;let T;e[17]!==k||e[18]!==p?(T=function(X){X.preventDefault(),X.stopPropagation(),p(!1),k(X.dataTransfer.files)},e[17]=k,e[18]=p,e[19]=T):T=e[19];const P=T,E=a?.virtualMcpId;let R;e[20]!==l||e[21]!==r||e[22]!==s.description||e[23]!==E?(R=o.jsx("div",{className:"min-w-0",children:o.jsx(Hs,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:E})}),e[20]=l,e[21]=r,e[22]=s.description,e[23]=E,e[24]=R):R=e[24];const M=m&&"border-primary ring-2 ring-primary/30",I=y.isPending&&"pointer-events-none opacity-60";let D;e[25]!==M||e[26]!==I?(D=ae("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",M,I),e[25]=M,e[26]=I,e[27]=D):D=e[27];let $;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==u||e[33]!==c||e[34]!==y.isPending?($=u?d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceVideoLabel"),className:"relative block h-40 w-full cursor-pointer overflow-hidden bg-black",children:[o.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u),o.jsx(ak,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(Ax,{size:14,className:"shrink-0 text-muted-foreground"}),o.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),o.jsx(Nb,{ext:x})]})]}):o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceFileLabel"),className:"flex w-full cursor-pointer items-center gap-3 px-3 py-2.5 text-left hover:bg-muted/60",children:[o.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:o.jsx(Ai,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:g}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),o.jsx(Nb,{ext:x})]}):o.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?o.jsx(Ax,{size:20}):o.jsx(Ai,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:y.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=f,e[32]=u,e[33]=c,e[34]=y.isPending,e[35]=$):$=e[35];let O;e[36]!==m||e[37]!==c?(O=m&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=m,e[37]=c,e[38]=O):O=e[38];let B;e[39]!==N||e[40]!==C||e[41]!==P||e[42]!==D||e[43]!==$||e[44]!==O?(B=o.jsxs("div",{onDragOver:C,onDragLeave:N,onDrop:P,className:D,children:[$,O]}),e[39]=N,e[40]=C,e[41]=P,e[42]=D,e[43]=$,e[44]=O,e[45]=B):B=e[45];let F;e[46]!==i?(F=te=>i(te.target.value),e[46]=i,e[47]=F):F=e[47];let z;e[48]!==r||e[49]!==u||e[50]!==F?(z=o.jsx(kt,{id:r,type:"url",value:u,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=r,e[49]=u,e[50]=F,e[51]=z):z=e[51];let W;e[52]!==f||e[53]!==u||e[54]!==c?(W=!u&&o.jsxs(fe,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[o.jsx(Jn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=u,e[54]=c,e[55]=W):W=e[55];let K;e[56]!==d||e[57]!==i||e[58]!==u?(K=d&&u&&o.jsx(mk,{value:u,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=u,e[59]=K):K=e[59];let H;e[60]!==i||e[61]!==u||e[62]!==c?(H=u&&o.jsx(fe,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:o.jsx(on,{size:14})}),e[60]=i,e[61]=u,e[62]=c,e[63]=H):H=e[63];let q;e[64]!==z||e[65]!==W||e[66]!==K||e[67]!==H?(q=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[z,W,K,H]}),e[64]=z,e[65]=W,e[66]=K,e[67]=H,e[68]=q):q=e[68];let G;e[69]!==i?(G=te=>i(te),e[69]=i,e[70]=G):G=e[70];const Q=S?.id??null;let se;e[71]!==h||e[72]!==f||e[73]!==G||e[74]!==Q?(se=o.jsx(ok,{open:h,onOpenChange:f,mode:"any",onSelect:G,lockedConfigId:Q}),e[71]=h,e[72]=f,e[73]=G,e[74]=Q,e[75]=se):se=e[75];let Z;return e[76]!==B||e[77]!==q||e[78]!==se||e[79]!==R?(Z=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[R,B,q,se]}),e[76]=B,e[77]=q,e[78]=se,e[79]=R,e[80]=Z):Z=e[80],Z}function yne(t){return t.type.startsWith("video/")}const _ne=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Lne(t){const e=U.c(86),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=ce(),d=B3(n),[u,h]=A.useState(!1),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(!1),y=d?ck(d):"",_=y?dk(y):"",L=dg(),v=A9();let S;e[0]!==L.data?.configs?(S=L.data?.configs??[],e[0]=L.data?.configs,e[1]=S):S=e[1];const w=a?.siteSlug;let k;e[2]!==S||e[3]!==w?(k=qf(S,w),e[2]=S,e[3]=w,e[4]=k):k=e[4];const j=k;let C;e[5]!==i||e[6]!==b||e[7]!==g?(C=function(ne){g(!1),b(!1),i(ne)},e[5]=i,e[6]=b,e[7]=g,e[8]=C):C=e[8];const V=C;let N;e[9]!==L.data?.configs||e[10]!==j?.id||e[11]!==h||e[12]!==V||e[13]!==c||e[14]!==v?(N=async function(ne){if(!ne)return;const me=Array.from(ne).filter(Sne);if(me.length===0){xe.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const ee=pk(L.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(P9):null);if(!ee){h(!0);return}try{const oe=await v.mutateAsync({configId:ee,file:me[0]});V(oe.publicUrl),me.length>1&&xe.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:me[0].name}))}catch(oe){const ie=oe;xe.error(ie instanceof Error?ie.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=L.data?.configs,e[10]=j?.id,e[11]=h,e[12]=V,e[13]=c,e[14]=v,e[15]=N):N=e[15];const T=N;let P;e[16]!==m?(P=function(ne){ne.preventDefault(),ne.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=P):P=e[17];const E=P;let R;e[18]!==m?(R=function(ne){ne.currentTarget===ne.target&&m(!1)},e[18]=m,e[19]=R):R=e[19];const M=R;let I;e[20]!==T||e[21]!==m?(I=function(ne){ne.preventDefault(),ne.stopPropagation(),m(!1),T(ne.dataTransfer.files)},e[20]=T,e[21]=m,e[22]=I):I=e[22];const D=I,$=a?.virtualMcpId;let O;e[23]!==l||e[24]!==r||e[25]!==s.description||e[26]!==$?(O=o.jsx("div",{className:"min-w-0",children:o.jsx(Hs,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:$})}),e[23]=l,e[24]=r,e[25]=s.description,e[26]=$,e[27]=O):O=e[27];const B=f&&"border-primary ring-2 ring-primary/30",F=v.isPending&&"pointer-events-none opacity-60";let z;e[28]!==B||e[29]!==F?(z=ae("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",B,F),e[28]=B,e[29]=F,e[30]=z):z=e[30];let W;e[31]!==_||e[32]!==y||e[33]!==x||e[34]!==p||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==h||e[39]!==d||e[40]!==c||e[41]!==v.isPending?(W=d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>h(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&o.jsx("img",{src:d,alt:l,className:ae("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[o.jsx(li,{size:20}),o.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&o.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),o.jsx(ak,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:y}),_&&o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:_})]})]}):o.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[o.jsx(li,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=_,e[32]=y,e[33]=x,e[34]=p,e[35]=l,e[36]=b,e[37]=g,e[38]=h,e[39]=d,e[40]=c,e[41]=v.isPending,e[42]=W):W=e[42];let K;e[43]!==f||e[44]!==c?(K=f&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.imageField.dropToUpload")})}),e[43]=f,e[44]=c,e[45]=K):K=e[45];let H;e[46]!==M||e[47]!==E||e[48]!==D||e[49]!==z||e[50]!==W||e[51]!==K?(H=o.jsxs("div",{onDragOver:E,onDragLeave:M,onDrop:D,className:z,children:[W,K]}),e[46]=M,e[47]=E,e[48]=D,e[49]=z,e[50]=W,e[51]=K,e[52]=H):H=e[52];let q;e[53]!==V?(q=le=>V(le.target.value),e[53]=V,e[54]=q):q=e[54];let G;e[55]!==c?(G=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=G):G=e[56];let Q;e[57]!==r||e[58]!==d||e[59]!==q||e[60]!==G?(Q=o.jsx(kt,{id:r,type:"url",value:d,onChange:q,placeholder:G,className:"h-9 min-w-0 flex-1"}),e[57]=r,e[58]=d,e[59]=q,e[60]=G,e[61]=Q):Q=e[61];let se;e[62]!==h||e[63]!==d||e[64]!==c?(se=!d&&o.jsxs(fe,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[o.jsx(Jn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=h,e[63]=d,e[64]=c,e[65]=se):se=e[65];let Z;e[66]!==V||e[67]!==d||e[68]!==c?(Z=d&&o.jsxs(o.Fragment,{children:[o.jsx(mk,{value:d,onChange:V}),o.jsx(fe,{type:"button",variant:"ghost",size:"sm",onClick:()=>V(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:o.jsx(on,{size:14})})]}),e[66]=V,e[67]=d,e[68]=c,e[69]=Z):Z=e[69];let te;e[70]!==Q||e[71]!==se||e[72]!==Z?(te=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[Q,se,Z]}),e[70]=Q,e[71]=se,e[72]=Z,e[73]=te):te=e[73];let X;e[74]!==V?(X=le=>V(le),e[74]=V,e[75]=X):X=e[75];const Y=j?.id??null;let de;e[76]!==u||e[77]!==h||e[78]!==X||e[79]!==Y?(de=o.jsx(ok,{open:u,onOpenChange:h,mode:"image",onSelect:X,lockedConfigId:Y}),e[76]=u,e[77]=h,e[78]=X,e[79]=Y,e[80]=de):de=e[80];let re;return e[81]!==O||e[82]!==H||e[83]!==te||e[84]!==de?(re=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,H,te,de]}),e[81]=O,e[82]=H,e[83]=te,e[84]=de,e[85]=re):re=e[85],re}function Sne(t){return _ne.has(t.type||"")}const wne="0 0 1080 1080",kne="matrix(1 0 0 1 540 540)",K3=[{code:"AC",name:"Acre",gTransform:"matrix(1 0 0 1 -248.53 -95.16)",pathTransform:"translate(-57.47, -224.1)",d:"M 30.47 237.77 L 28.39 237.73 L 28.93 235.92 L 28.72 235.09 L 28.47 234.6 L 27.22 233.9 L 27.08 233.45 L 27.35 232.3 L 26.58 230.35 L 25.49 229.71 L 19.89 228.46 L 12.55 228.27 L 12.82 227.71 L 15.31 225.45 L 16.2 224.22 L 16.49 223.02 L 16.27 221.79 L 15.59 220.88 L 14.76 220.44 L 13.08 217.49 L 12.31 217.05 L 11.41 216.86 L 10.28 215.73 L 9.36 213.35 L 7.36 211.82 L 6.38 208.2 L 5.51 206.56 L 3.63 205.48 L 3.55 204.31 L 4.36 204.41 L 4.78 203.89 L 4.85 203.22 L 4.65 202.8 L 2.53 201.87 L 2.17 201.21 L 0 199.32 L 0.04 198.95 L 0.66 198.9 L 1.16 197.58 L 1.15 196.27 L 4.16 195.88 L 4.66 195.49 L 4.44 194.14 L 3.27 192.57 L 3.27 192.57 L 21.22 200.05 L 44.88 205.71 L 57.02 208.85 L 83.46 223.02 L 111.97 235.15 L 111.97 235.15 L 114.94 236.41 L 114.94 236.41 L 114.64 236.89 L 113.07 237.55 L 110.98 239.14 L 108.12 241.93 L 106.47 242.79 L 105.81 242.61 L 104.28 242.79 L 104.23 243.35 L 102.31 244.65 L 100.23 245.64 L 98.79 247.47 L 98.35 248.65 L 97.74 248.93 L 96.57 248.18 L 95.81 248.05 L 93.44 248.1 L 92.76 248.36 L 92.13 248.81 L 91.77 249.67 L 89.33 253.15 L 85.56 254.4 L 84.72 255.09 L 82.78 255.6 L 81.75 255.63 L 81.83 253.52 L 80.47 253.72 L 76.92 252.95 L 71.68 252.48 L 66.59 252.86 L 65.93 252.28 L 63.66 252.11 L 60.1 253.94 L 57.37 254.56 L 55.69 253.89 L 54.29 252.45 L 52.65 253.61 L 52.69 236.06 L 52.74 234.96 L 53.21 234.25 L 53.28 231.9 L 53.02 231.02 L 53.99 229.84 L 54.47 228.7 L 53.31 228.9 L 50.34 231.49 L 48.74 232.5 L 46.68 234.88 L 44.73 235.55 L 44.08 236.63 L 42.27 237.62 z"},{code:"AL",name:"Alagoas",gTransform:"matrix(1 0 0 1 276.36 -86.82)",pathTransform:"translate(-582.36, -232.44)",d:"M 561.91 230.3 L 561.71 229.57 L 560.29 228.79 L 559.84 228.88 L 558.82 228.59 L 558.28 227.19 L 558.28 227.19 L 559.6 226.12 L 560.24 225.03 L 562.41 224.27 L 564.79 220.98 L 564.88 220.29 L 565.7 219.69 L 566.7 220.91 L 568.37 221.21 L 569.45 221.09 L 572 223.11 L 573.9 225.23 L 575.68 226.28 L 577.59 226.76 L 580.09 226.11 L 583.23 226.4 L 584.4 226.29 L 586.26 225.23 L 587.42 225.28 L 589.23 224.17 L 591.41 221.88 L 591.53 221.43 L 593.08 220.19 L 595.08 219.95 L 597.32 220.8 L 599.88 219.51 L 601.35 219.32 L 603.27 220.13 L 606.17 220.4 L 606.44 220.61 L 606.44 220.61 L 603.66 225.57 L 599.11 230.7 L 595.53 234.28 L 592.49 238.86 L 589.16 241.74 L 588.16 243.77 L 586.84 245.56 L 586.84 245.56 L 586.24 244.25 L 582.65 242.02 L 582.19 241.99 L 580.53 241.2 L 578.77 239.75 L 577.47 237.3 L 572.05 234.23 L 568.37 233.28 z"},{code:"AM",name:"Amazonas",gTransform:"matrix(1 0 0 1 -166.8 -178.05)",pathTransform:"translate(-139.2, -141.22)",d:"M 165.82 47.29 L 166.54 48.07 L 167.29 48.41 L 167.9 48.42 L 169.03 48 L 169.66 48.11 L 169.72 49.07 L 170.93 50.24 L 171.9 50.61 L 172.78 50.4 L 174.14 50.51 L 176.09 51.46 L 176.58 52.12 L 175.67 55.44 L 174.96 56.94 L 177.69 60.68 L 179.35 65.44 L 179.54 67.7 L 180.41 68.82 L 180.46 69.27 L 178.84 70.73 L 179.2 72.32 L 179.86 73.9 L 179.09 76.94 L 178.52 77.9 L 178.81 82.88 L 179.69 85.05 L 180.91 85.89 L 181.49 86.79 L 182.62 91.12 L 182.56 91.7 L 181.42 93.02 L 179.58 92.69 L 179.44 93.83 L 184.45 98.25 L 184.97 98.29 L 186.93 99.6 L 188.41 101.25 L 189.45 103.29 L 189.98 103.36 L 191.32 102.94 L 193.68 103.98 L 193.24 101.87 L 193.99 99.58 L 194.24 97.85 L 193.87 96.05 L 194.69 93.08 L 195.71 91.82 L 196.99 91.13 L 199.08 90.42 L 199.63 89.53 L 201.23 89.47 L 204.06 90.4 L 205.93 92.44 L 206.85 94.95 L 208.67 95.18 L 209.92 94.72 L 211.33 93.31 L 213.36 92.76 L 213.78 92.37 L 213.8 91.84 L 212.66 90.43 L 212.43 89.7 L 212.54 89.04 L 213.69 86.4 L 213.76 85.27 L 215.42 82.24 L 217.75 78.98 L 217.72 78.3 L 236.21 78.37 L 236.21 78.37 L 236.61 83.23 L 236.18 84.68 L 236.36 86.95 L 236.6 87.63 L 238.3 88.48 L 238.48 88.89 L 238.13 89.58 L 238.08 91.69 L 239.91 93.68 L 240.27 93.87 L 240.97 93.69 L 242.81 94.92 L 243.36 96.75 L 243.4 97.68 L 243.7 98.13 L 248.34 101.9 L 252.92 104.44 L 253.55 105.34 L 254.9 106.43 L 256.78 107.1 L 259.15 108.41 L 261.41 109.06 L 262.77 109.21 L 264.09 110.03 L 264.17 110.64 L 265.44 111.98 L 268.14 113.42 L 269.24 115.59 L 271.11 116.38 L 271.96 115.77 L 273.34 115.42 L 273.53 115.9 L 273.4 116.68 L 275.21 118.35 L 245.31 182.59 L 244.53 183.9 L 243.08 185.03 L 242.5 186 L 242.47 187.13 L 243.29 189.46 L 243.67 190.03 L 244.74 190.61 L 246.32 192.17 L 246.96 193.43 L 247.11 195.39 L 247.68 195.96 L 247.68 195.96 L 246.5 197.16 L 246.3 197.77 L 246.24 198.53 L 246.58 199.37 L 246.31 200.38 L 245.11 202.2 L 244.25 202.84 L 243.83 203.69 L 243.93 204.54 L 244.59 205.91 L 245.05 207.85 L 243.67 212.07 L 242.49 217.29 L 241.28 218.02 L 193.43 218.34 L 193.43 218.34 L 193.47 217.64 L 193.11 217.26 L 191.72 216.98 L 189.8 218.06 L 189.26 219.8 L 188.58 219.99 L 185.34 218.51 L 184.66 215.63 L 184.04 215.43 L 183.06 215.56 L 182.6 215.35 L 181.35 212.08 L 178.81 211.1 L 177.48 209.83 L 176.68 207.92 L 176.23 207.43 L 174.08 206.3 L 163.29 206.36 L 161.91 208.92 L 160.19 209.42 L 160.28 210.59 L 160.02 210.81 L 157.54 211.34 L 156.35 212.93 L 156.3 213.6 L 157.2 214.3 L 157.37 214.75 L 157.01 215.77 L 156.2 216.92 L 154.14 218.13 L 154.03 219.94 L 154.27 221.4 L 150.4 220.94 L 148.27 221.32 L 147.07 222.39 L 145.28 222.29 L 144.44 221.74 L 143.98 221.72 L 142.23 222.98 L 141.7 223.82 L 141.96 225.57 L 139.42 228.73 L 138.74 228.81 L 138.06 228.28 L 137.42 226.02 L 137.04 225.93 L 135.2 226.95 L 133.9 228.16 L 132.53 228.55 L 131.76 228.42 L 130.68 228.92 L 130.27 229.45 L 130.14 230.17 L 128.92 230.96 L 128.55 230.98 L 126.24 228.65 L 125.52 228.28 L 122.65 228.61 L 118.69 228.35 L 118.85 229.64 L 118.7 230.2 L 117.15 232.01 L 115.23 232.59 L 111.97 235.15 L 111.97 235.15 L 83.46 223.02 L 57.02 208.85 L 44.88 205.71 L 21.22 200.05 L 3.27 192.57 L 3.27 192.57 L 3.2 191.92 L 3.9 189 L 5.12 187.6 L 10.04 184.13 L 12.3 183.89 L 12.77 183.59 L 13.75 182.03 L 13.83 181 L 12.09 176.51 L 12.47 175.32 L 13.65 173.13 L 14.93 171.81 L 15.85 170.56 L 16.27 169.58 L 16.57 167.84 L 16.28 166.52 L 16.95 164.48 L 17.26 162.17 L 17.99 161.42 L 21.65 159.79 L 23.84 158.56 L 24.99 157.52 L 25.43 156.12 L 26.21 155.75 L 27.62 155.64 L 29.27 154.71 L 32.81 151.98 L 35.23 151.55 L 36.74 151.84 L 40.93 150.62 L 42.43 149.85 L 44.25 149.49 L 47.58 149.87 L 48.88 148.28 L 49.51 146.83 L 50.6 146.22 L 52.74 146.42 L 53.38 146.96 L 54.7 146.72 L 55.8 145.98 L 57.51 146.1 L 57.82 146.63 L 57.8 147.81 L 59.41 149.1 L 62.24 149.18 L 62.82 148.78 L 63.28 148 L 63.17 147.61 L 64.34 142.69 L 71.04 105.52 L 72.2 102.6 L 71.21 97.64 L 71.33 97.38 L 70.03 96.33 L 68.55 93.58 L 68.51 93.09 L 69.16 91.7 L 68.64 89.92 L 68.27 89.52 L 66.57 88.93 L 63.54 86.58 L 61.6 84.3 L 61.8 72.79 L 65.69 72.53 L 67.44 71.36 L 70.94 70.44 L 73.62 72.2 L 74.84 72.31 L 76.11 71.88 L 75.62 70.19 L 75.92 68.47 L 74.55 66.37 L 73.98 65.83 L 72.83 65.23 L 71.32 65.76 L 68.53 65.15 L 64.96 65.24 L 64.9 55.34 L 65.86 55.38 L 67.18 54.8 L 69.46 54.2 L 72.3 55.07 L 91.33 55.13 L 90.87 54.47 L 90.08 54.33 L 89.7 53.13 L 90.65 51.2 L 92.08 51.6 L 92.69 53.12 L 93.56 54.44 L 94.22 54.79 L 95.05 54.8 L 96.66 54.19 L 98.6 52.1 L 98.92 51.26 L 100.18 50.02 L 102.73 48.63 L 104.02 49.09 L 105.19 51.67 L 106.81 53.66 L 107.55 54.96 L 108.21 56.74 L 108.44 58.29 L 107.95 61.92 L 108.15 63.68 L 111.35 62.93 L 119.66 69.99 L 120.45 70.27 L 122.95 70.48 L 125.25 69.48 L 126.95 67.78 L 129.06 66.62 L 131.25 66.51 L 131.81 66.8 L 132.58 67.88 L 132.56 68.85 L 131.45 70.55 L 131.82 71.53 L 132.4 71.8 L 133.73 71.08 L 134.29 70.17 L 134.52 68.88 L 135.52 67.72 L 135.99 67.49 L 136.99 67.67 L 137.54 67.49 L 137.95 66.83 L 138.41 64.52 L 138.92 64.15 L 140.43 63.79 L 143.36 62.02 L 144.33 62.57 L 145.26 62.28 L 146.86 61.24 L 147.88 59.63 L 149.99 58.42 L 152.02 58.97 L 154.38 57.32 L 154.93 56.5 L 155.37 53.84 L 155.34 52.55 L 156.11 51.63 L 157.14 51.21 L 158.88 51.19 L 160.22 50.8 L 162.28 49.2 L 163.24 48.83 L 165.52 48.53 z"},{code:"AP",name:"Amapá",gTransform:"matrix(1 0 0 1 32.29 -262.31)",pathTransform:"translate(-338.29, -56.97)",d:"M 344.98 99.7 L 344.04 99.64 L 343.27000000000004 99.98 L 341.97 100.10000000000001 L 339.18 99.42 L 337.73 98.39 L 337.3 96.89 L 335.43 95.5 L 335.32 94.2 L 335.53 93.51 L 335.21999999999997 91.93 L 334.89 91.46000000000001 L 333.94 91.27000000000001 L 333.53 90.33000000000001 L 333.60999999999996 87.9 L 330.67999999999995 84.62 L 329.9 84.98 L 329.08 84.79 L 327.58 81.31 L 327.71 79.73 L 327.12 77.92 L 326.5 77.36 L 325.83 75.85 L 325.64 73.74 L 326.07 70.6 L 325.9 70.27 L 323.33 69.53999999999999 L 321.31 67.27999999999999 L 320.55 64.44999999999999 L 320.74 63.72999999999999 L 321.42 63.49999999999999 L 320.93 62.31999999999999 L 320.25 62.349999999999994 L 317.41 59.69 L 316.47 59.83 L 316.09000000000003 60.25 L 314.76000000000005 60.39 L 313.9200000000001 60.12 L 313.12000000000006 59.14 L 311.9800000000001 58.3 L 310.7900000000001 58.18 L 310.30000000000007 56.9 L 309.63000000000005 56.1 L 307.70000000000005 55.050000000000004 L 306.41 54.56 L 303.02000000000004 54.190000000000005 L 301.94000000000005 54.480000000000004 L 300.77000000000004 54.46 L 300.46000000000004 53.92 L 300.22 52.480000000000004 L 300.47 47.940000000000005 L 301.09000000000003 46.64000000000001 L 300.72 44.34000000000001 L 300.1 43.77000000000001 L 300.1 43.77000000000001 L 300.45000000000005 43.56000000000001 L 301.44000000000005 43.86000000000001 L 301.43000000000006 44.67000000000001 L 301.14000000000004 44.85000000000001 L 301.48 45.82000000000001 L 302.95000000000005 45.760000000000005 L 303.77000000000004 45.99 L 304.12000000000006 46.89 L 304.96000000000004 47.6 L 307.21000000000004 48.38 L 310.50000000000006 49.13 L 313.26000000000005 47.35 L 313.61000000000007 46.59 L 315.3400000000001 45.42 L 316.1700000000001 45.13 L 316.86000000000007 46.07 L 319.57000000000005 47.01 L 320.65000000000003 46.89 L 322.37000000000006 45.88 L 322.49000000000007 45.46 L 322.81000000000006 45.49 L 324.27000000000004 46.79 L 324.07000000000005 47.66 L 326.44000000000005 47.489999999999995 L 326.95000000000005 47.989999999999995 L 327.90000000000003 48.16 L 328.52000000000004 48.15 L 329.43000000000006 47.67 L 331.1000000000001 46.17 L 332.88000000000005 45.07 L 334.63000000000005 42.77 L 335.00000000000006 41.77 L 334.80000000000007 41.230000000000004 L 337.93000000000006 34.730000000000004 L 338.0400000000001 32.910000000000004 L 339.1500000000001 31.610000000000003 L 339.8800000000001 31.42 L 343.48000000000013 25.630000000000003 L 343.71000000000015 24.480000000000004 L 344.5500000000001 23.280000000000005 L 346.34000000000015 21.730000000000004 L 346.97000000000014 20.070000000000004 L 349.08000000000015 18.930000000000003 L 349.5500000000002 18.01 L 350.5900000000002 17.430000000000003 L 351.1500000000002 18.890000000000004 L 352.0300000000002 20.250000000000004 L 350.3600000000002 15.450000000000003 L 350.2900000000002 14.160000000000004 L 350.4700000000002 13.830000000000004 L 353.8400000000002 16.250000000000004 L 354.9800000000002 17.460000000000004 L 355.8900000000002 18.680000000000003 L 356.4100000000002 19.870000000000005 L 356.44000000000017 21.450000000000003 L 356.88000000000017 21.76 L 357.20000000000016 21.28 L 357.58000000000015 21.18 L 357.79000000000013 21.58 L 358.0000000000001 29.47 L 358.66000000000014 33.339999999999996 L 361.3700000000001 39.38999999999999 L 364.03000000000014 48.32999999999999 L 367.35000000000014 53.32999999999999 L 368.3600000000001 53.67999999999999 L 371.6300000000001 53.599999999999994 L 374.4100000000001 54.53999999999999 L 375.7000000000001 55.38999999999999 L 376.4700000000001 58.03999999999999 L 376.31000000000006 61.36999999999999 L 375.02000000000004 62.32999999999999 L 373.29 62.75999999999999 L 372.91 63.08999999999999 L 374.70000000000005 62.93999999999999 L 375.74000000000007 62.51999999999999 L 376.02000000000004 62.749999999999986 L 376.14000000000004 63.33999999999999 L 375.97 64.07 L 370.94000000000005 68.13 L 369.77000000000004 70.22999999999999 L 367.62000000000006 71.63999999999999 L 365.68000000000006 75.35999999999999 L 362.77000000000004 78.85999999999999 L 362.07000000000005 79.31999999999998 L 361.13000000000005 79.22999999999998 L 359.68000000000006 79.74999999999997 L 357.6000000000001 82.72999999999998 L 357.6000000000001 82.72999999999998 L 356.2600000000001 82.79999999999997 L 355.5100000000001 83.69999999999997 L 355.5100000000001 83.69999999999997 L 354.0400000000001 85.37999999999998 L 353.07000000000005 87.59999999999998 L 351.95000000000005 89.46999999999998 L 351.11000000000007 90.11999999999999 L 348.1000000000001 93.57 L 347.74000000000007 95.97 L 347.9100000000001 97.77 L 345.9600000000001 99.58 L 344.98 99.7 z M 368.34 52.71 L 367.89 52.38 L 366.78999999999996 50.52 L 366.85999999999996 49.64 L 367.09 49.230000000000004 L 368.75 48.78 L 369.18 49.17 L 370.01 51.440000000000005 L 369.02 52.540000000000006 L 368.34 52.71 z M 370.83 70.32 L 370.43 70.07 L 370.35 69.36 L 371.46000000000004 68.26 L 372.34000000000003 68.11 L 373.59000000000003 68.35 L 374.05 68.24 L 374.49 67.6 L 374.54 68.19 L 373.57 69.63 L 372.58 70.13 L 370.83 70.32 z M 374.27 67.45 L 373.49 67.22 L 373.49 66.66 L 374.21000000000004 65.61999999999999 L 375.46000000000004 65.52 L 375.64000000000004 65.86999999999999 L 375.54 66.38 L 374.27 67.45 z M 367.08 49.03 L 366.32 48.53 L 366.58 47.7 L 367.46 47.53 L 368.32 47.85 L 368.33 48.58 L 367.08 49.03 z"},{code:"BA",name:"Bahia",gTransform:"matrix(1 0 0 1 193.52 -26.39)",pathTransform:"translate(-499.52, -292.87)",d:"M 527.5 365.33 L 527.14 364.5 L 527.8199999999999 363.15 L 527.81 362.62 L 527.28 361.58 L 523.15 358.53 L 523 358.02 L 523.22 356.51 L 522.65 355.28 L 522 355.52 L 521.8 355.96999999999997 L 521.4599999999999 356.15 L 521.2399999999999 355.9 L 521.7699999999999 351.5 L 522.5899999999999 348.2 L 523.41 347.32 L 525.88 347.56 L 526.9 346.85 L 526.9 346.43 L 526.34 345.41 L 526.5 342.76000000000005 L 531.46 338.54 L 532.9300000000001 335.46000000000004 L 532.5100000000001 334.29 L 531.7300000000001 333.27000000000004 L 530.8400000000001 333.21000000000004 L 530.1100000000001 332.83000000000004 L 527.2800000000001 330.36 L 525.1600000000001 330.38 L 522.97 329.78 L 520.7 328.7 L 517.97 328.14 L 515.99 328 L 514.67 328.99 L 513.1999999999999 329.49 L 510.5899999999999 329.04 L 510.0199999999999 329.25 L 509.5799999999999 325.29 L 503.05999999999995 319.09000000000003 L 502.67999999999995 318.91 L 498.28999999999996 320.14000000000004 L 496.76 318.90000000000003 L 496.25 319.11 L 495.32 318.89 L 492.78 317.66999999999996 L 490.60999999999996 316.04999999999995 L 489.62999999999994 316.22999999999996 L 485.2799999999999 312.59999999999997 L 484.1799999999999 312.05999999999995 L 481.4499999999999 311.30999999999995 L 479.6799999999999 311.55999999999995 L 477.7999999999999 312.4599999999999 L 476.9899999999999 313.5799999999999 L 476.3499999999999 313.75999999999993 L 471.0199999999999 312.2899999999999 L 470.4099999999999 311.7999999999999 L 470.1499999999999 310.2999999999999 L 470.2899999999999 309.4099999999999 L 471.5799999999999 306.6699999999999 L 470.7199999999999 306.2099999999999 L 468.43999999999994 305.68999999999994 L 466.25999999999993 305.6499999999999 L 465.05999999999995 305.1499999999999 L 463.2699999999999 305.06999999999994 L 459.43999999999994 306.6499999999999 L 455.17999999999995 309.6799999999999 L 454.53999999999996 310.7899999999999 L 451.16999999999996 312.6599999999999 L 449.15 313.0599999999999 L 448.2 314.2399999999999 L 446.39 315.7899999999999 L 444.96 316.3099999999999 L 443.96 316.1599999999999 L 442.10999999999996 318.7399999999999 L 441.06999999999994 319.5099999999999 L 438.93999999999994 319.1299999999999 L 438.2199999999999 319.2599999999999 L 437.5299999999999 320.2599999999999 L 436.18999999999994 321.1799999999999 L 435.78999999999996 320.9399999999999 L 437.21999999999997 317.5099999999999 L 436.71 315.09999999999985 L 436.71 315.09999999999985 L 438.19 313.1299999999998 L 438.44 312.35999999999984 L 438.21 311.08999999999986 L 437.53999999999996 309.36999999999983 L 437.64 308.6999999999998 L 438.34999999999997 307.2799999999998 L 438.29999999999995 306.8199999999998 L 435.09 304.1999999999998 L 433.4 300.73999999999984 L 432.78 297.21999999999986 L 432.83 295.66999999999985 L 434.03 291.83999999999986 L 435.61999999999995 290.8099999999999 L 435.84999999999997 290.4299999999999 L 435.90999999999997 289.4899999999999 L 434.28 288.6499999999999 L 434.16999999999996 288.31999999999994 L 434.65 285.79999999999995 L 436.08 284.73999999999995 L 436.06 284.36999999999995 L 433.34 281.90999999999997 L 433.34 281.90999999999997 L 433.29999999999995 280.97999999999996 L 434.65999999999997 278.59999999999997 L 434.61999999999995 277.53 L 434.44999999999993 277.10999999999996 L 432.98999999999995 276.61999999999995 L 432.04999999999995 275.96999999999997 L 431.69999999999993 274.71 L 431.75999999999993 271.78999999999996 L 431.94999999999993 270.93999999999994 L 433.8999999999999 269.2699999999999 L 435.0399999999999 268.8499999999999 L 435.9999999999999 268.1299999999999 L 435.70999999999987 267.4999999999999 L 435.1299999999999 266.9799999999999 L 434.20999999999987 266.6899999999999 L 433.1799999999999 266.8699999999999 L 432.82999999999987 266.5399999999999 L 432.7399999999999 266.0399999999999 L 433.1599999999999 265.0799999999999 L 435.19999999999993 264.25999999999993 L 435.75999999999993 263.80999999999995 L 435.7199999999999 263.04999999999995 L 433.8399999999999 262.06999999999994 L 430.25999999999993 261.3999999999999 L 428.3999999999999 259.43999999999994 L 428.1699999999999 258.5199999999999 L 428.6699999999999 257.3599999999999 L 429.6799999999999 256.6299999999999 L 431.1999999999999 253.1499999999999 L 432.09999999999985 252.53999999999988 L 433.10999999999984 252.26999999999987 L 433.45999999999987 251.88999999999987 L 432.16999999999985 250.08999999999986 L 432.35999999999984 249.71999999999986 L 435.5699999999998 247.09999999999985 L 439.3899999999998 245.07999999999984 L 439.9499999999998 244.60999999999984 L 440.16999999999985 243.62999999999985 L 440.85999999999984 242.97999999999985 L 440.85999999999984 242.97999999999985 L 443.1899999999998 242.95999999999984 L 444.6299999999998 244.29999999999984 L 445.28999999999985 245.33999999999983 L 445.8199999999998 247.54999999999984 L 447.5799999999998 250.03999999999985 L 451.7599999999998 251.89999999999986 L 453.55999999999983 251.37999999999985 L 455.66999999999985 251.55999999999986 L 455.99999999999983 251.34999999999985 L 456.74999999999983 249.89999999999986 L 457.8899999999998 249.52999999999986 L 458.55999999999983 248.65999999999985 L 459.72999999999985 247.76999999999987 L 461.9399999999998 247.01999999999987 L 463.2699999999998 247.18999999999986 L 464.74999999999983 247.71999999999986 L 466.09999999999985 247.29999999999987 L 469.0699999999999 244.87999999999988 L 472.01999999999987 239.82999999999987 L 472.7399999999999 238.96999999999986 L 472.9799999999999 238.04999999999987 L 473.2799999999999 235.48999999999987 L 473.1599999999999 234.32999999999987 L 470.9199999999999 229.89999999999986 L 470.9699999999999 228.96999999999986 L 474.2099999999999 227.31999999999985 L 476.1599999999999 227.29999999999984 L 477.6599999999999 227.75999999999985 L 478.06999999999994 228.68999999999986 L 478.38999999999993 228.86999999999986 L 480.50999999999993 228.43999999999986 L 481.8999999999999 227.89999999999986 L 483.2299999999999 228.27999999999986 L 484.9399999999999 229.26999999999987 L 484.8099999999999 229.91999999999987 L 484.9999999999999 230.20999999999987 L 485.8199999999999 230.48999999999987 L 488.8199999999999 230.37999999999985 L 490.2899999999999 229.73999999999987 L 491.9899999999999 229.63999999999987 L 492.8099999999999 228.41999999999987 L 494.3199999999999 227.07999999999987 L 497.0499999999999 226.73999999999987 L 497.8199999999999 226.37999999999985 L 498.6299999999999 225.39999999999986 L 500.7999999999999 225.40999999999985 L 501.4199999999999 226.03999999999985 L 501.7299999999999 226.08999999999986 L 503.5899999999999 224.27999999999986 L 503.4899999999999 221.87999999999985 L 505.4799999999999 221.49999999999986 L 506.2699999999999 221.67999999999986 L 507.31999999999994 221.01999999999987 L 508.81999999999994 218.70999999999987 L 509.2799999999999 217.55999999999986 L 509.2799999999999 217.55999999999986 L 510.1699999999999 217.95999999999987 L 511.3299999999999 217.68999999999986 L 513.53 217.97999999999985 L 516.35 219.36999999999983 L 516.7900000000001 219.87999999999982 L 516.7300000000001 222.60999999999981 L 517.4500000000002 224.5499999999998 L 519.6600000000002 225.4599999999998 L 519.9300000000002 227.4599999999998 L 519.0100000000002 229.13999999999982 L 520.8400000000003 229.75999999999982 L 521.8000000000003 229.53999999999982 L 522.6200000000003 228.61999999999983 L 525.4900000000004 227.73999999999984 L 526.2600000000003 224.15999999999983 L 526.7600000000003 223.28999999999982 L 527.5100000000003 223.12999999999982 L 528.2900000000003 223.65999999999983 L 528.9200000000003 223.70999999999984 L 531.3100000000003 222.68999999999983 L 532.4100000000003 221.44999999999982 L 532.5800000000003 220.85999999999981 L 532.3300000000003 219.4999999999998 L 532.6200000000002 219.2499999999998 L 534.8600000000002 218.7999999999998 L 535.6300000000002 216.7499999999998 L 537.2800000000002 216.3099999999998 L 539.8100000000002 214.8499999999998 L 540.4000000000002 214.7499999999998 L 541.8900000000002 215.3099999999998 L 542.7200000000003 216.7499999999998 L 544.0800000000003 217.5599999999998 L 546.4400000000003 218.3399999999998 L 549.4300000000003 218.7399999999998 L 551.0100000000003 219.88999999999982 L 551.5500000000003 221.53999999999982 L 551.9400000000003 221.80999999999983 L 552.3700000000002 221.65999999999983 L 552.6600000000002 219.90999999999983 L 553.0900000000001 219.46999999999983 L 554.0900000000001 219.45999999999984 L 554.5400000000002 219.77999999999983 L 554.5600000000002 220.40999999999983 L 553.9400000000002 221.28999999999982 L 554.3900000000002 222.11999999999983 L 554.8900000000002 222.48999999999984 L 556.9900000000002 223.34999999999985 L 557.0100000000002 224.28999999999985 L 558.2300000000002 227.33999999999986 L 558.2300000000002 227.33999999999986 L 558.7700000000002 228.73999999999987 L 559.7900000000002 229.02999999999986 L 560.2400000000002 228.93999999999986 L 561.6700000000002 229.72999999999985 L 561.8700000000002 230.44999999999985 L 561.8700000000002 230.44999999999985 L 561.2000000000003 231.60999999999984 L 561.4100000000003 233.74999999999983 L 562.6900000000003 236.24999999999983 L 564.6800000000003 238.19999999999982 L 565.4300000000003 239.34999999999982 L 565.3500000000003 242.46999999999983 L 564.6900000000003 244.08999999999983 L 564.6000000000003 244.96999999999983 L 565.3600000000002 247.71999999999983 L 565.0600000000003 248.29999999999984 L 564.3700000000002 248.84999999999985 L 561.8200000000003 249.84999999999985 L 560.6900000000003 249.09999999999985 L 558.9800000000002 249.08999999999986 L 558.6600000000002 249.38999999999987 L 558.0700000000002 250.96999999999989 L 558.0900000000001 251.7399999999999 L 559.0400000000002 253.3399999999999 L 560.1400000000002 253.9999999999999 L 560.6600000000002 255.4899999999999 L 562.0900000000001 256.9999999999999 L 562.2400000000001 257.3899999999999 L 562.1100000000001 258.8099999999999 L 561.7700000000001 259.1999999999999 L 561.8900000000001 259.6199999999999 L 562.4800000000001 260.1399999999999 L 564.4100000000001 261.0599999999999 L 564.8900000000001 261.76999999999987 L 565.4300000000001 262.10999999999984 L 566.98 262.74999999999983 L 569.87 261.86999999999983 L 569.87 261.86999999999983 L 570.51 261.84999999999985 L 570.87 262.2599999999999 L 566.79 271.08999999999986 L 562.9599999999999 276.27999999999986 L 561.93 278.60999999999984 L 556.9 284.34999999999985 L 554.4499999999999 285.60999999999984 L 553.5799999999999 285.59999999999985 L 553.8799999999999 284.16999999999985 L 554.2499999999999 284.01999999999987 L 554.3899999999999 282.91999999999985 L 553.9399999999998 280.98999999999984 L 552.0699999999998 280.73999999999984 L 551.6399999999999 279.4399999999998 L 550.9599999999999 278.6899999999998 L 550.5899999999999 279.28999999999985 L 550.1299999999999 281.61999999999983 L 549.6299999999999 282.48999999999984 L 549.0799999999999 282.86999999999983 L 548.52 282.5799999999998 L 548.03 280.8399999999998 L 548.14 280.5199999999998 L 548.4499999999999 280.3899999999998 L 548.42 279.99999999999983 L 547.55 281.28999999999985 L 548.4799999999999 282.97999999999985 L 548.9399999999999 283.20999999999987 L 549.31 283.0599999999999 L 550.4599999999999 283.3199999999999 L 549.9999999999999 285.1299999999999 L 548.7899999999998 286.27999999999986 L 548.5399999999998 288.09999999999985 L 547.2899999999998 289.0699999999999 L 546.9399999999998 289.7399999999999 L 546.7399999999998 290.57999999999987 L 546.9199999999997 291.4299999999999 L 545.5699999999997 291.0399999999999 L 545.3599999999997 291.4299999999999 L 544.9999999999997 293.9499999999999 L 545.3599999999997 293.22999999999985 L 546.1099999999997 293.4399999999998 L 546.3499999999997 293.97999999999985 L 546.1199999999997 294.3899999999999 L 546.1799999999996 295.0099999999999 L 546.4799999999996 295.3099999999999 L 546.8099999999996 296.3099999999999 L 545.7699999999996 298.8199999999999 L 546.3399999999997 302.2599999999999 L 545.7899999999997 302.7499999999999 L 545.2199999999997 302.52999999999986 L 545.0799999999997 303.65999999999985 L 545.6699999999997 304.11999999999983 L 546.8799999999998 302.3999999999998 L 546.4099999999997 300.1899999999998 L 547.2299999999998 299.5799999999998 L 547.4799999999998 300.11999999999983 L 547.4199999999998 301.8799999999998 L 546.4599999999998 304.48999999999984 L 545.7199999999998 309.91999999999985 L 545.2099999999998 311.72999999999985 L 545.4099999999999 314.1999999999999 L 546.1899999999998 317.0499999999999 L 546.3799999999999 321.5899999999999 L 547.2499999999999 327.99999999999994 L 548.2399999999999 331.41999999999996 L 546.0299999999999 338.08 L 544.6799999999998 344.72999999999996 L 544.2099999999998 345.73999999999995 L 544.0499999999998 348.59999999999997 L 542.9899999999999 352.32 L 542.8999999999999 354.65 L 543.2899999999998 359.07 L 544.1799999999998 360.78 L 541.9399999999998 363.76 L 540.1299999999999 364.43 L 539.1899999999998 365.07 L 536.4699999999998 368.96 L 535.9 371 L 535.9 371 L 527.81 365.86 L 527.5 365.33 z M 549.78 287.33 L 549.55 286.13 L 550.29 285.71999999999997 L 551.3499999999999 284.67999999999995 L 551.5099999999999 284.03999999999996 L 551.1399999999999 283.30999999999995 L 551.8999999999999 283.44999999999993 L 552.7199999999999 284.49999999999994 L 552.67 285.0299999999999 L 549.78 287.33 z M 547.25 294.18 L 546.62 294.15000000000003 L 546.63 293.48 L 546.89 293.12 L 546.09 292.9 L 545.6700000000001 292.5 L 545.8000000000001 291.43 L 547.6700000000001 291.28000000000003 L 547.83 291.48 L 547.94 292.61 L 547.25 294.18 z"},{code:"CE",name:"Ceará",gTransform:"matrix(1 0 0 1 235.04 -154.64)",pathTransform:"translate(-541.04, -164.62)",d:"M 573.79 156.85 L 568.9 158.44 L 566.29 160.45 L 562.99 167.14 L 562.15 168.26 L 561.28 168.83 L 560.63 170.5 L 560.78 171.24 L 559.38 173.68 L 557.92 175.19 L 557.35 176.29 L 556.32 176.55 L 555.54 176.04 L 555.03 176.11 L 554.19 176.99 L 552.78 179.24 L 552.44 181.21 L 553.08 181.38 L 553.74 181 L 553.74 181 L 553.66 181.54 L 552.82 182.69 L 551.79 185.69 L 552.31 187 L 551.65 188.31 L 550.56 188.94 L 550.39 189.32 L 550.27 190.25 L 550.51 190.66 L 551.09 190.95 L 551.44 191.67 L 551.42 193.33 L 552.66 194.22 L 553.35 194.3 L 553.69 195.49 L 552.08 198.98 L 550.89 200.1 L 551.06 200.35 L 551.06 200.35 L 549.47 200.84 L 548.4 201.67 L 546.86 203.96 L 545.21 204.01 L 544.58 202.37 L 543.8 201.8 L 542.44 201.32 L 541.43 200.25 L 540.97 199.26 L 539.14 198.43 L 536.29 196.53 L 533.21 196.11 L 531.92 196.21 L 529.78 197.01 L 528.15 197.2 L 527.26 196.96 L 522.33 196.76 L 522.33 196.76 L 522.39 195.44 L 521.71 194.76 L 521.63 193.79 L 522.77 190.68 L 524.27 188.43 L 524.28 187.74 L 523.51 186.58 L 520.95 186.11 L 519.64 185.46 L 518.63 182.79 L 517.58 177.59 L 516.82 175.02 L 517.06 174.57 L 516.12 166.41 L 516.01 166.03 L 515.09 165.34 L 515.89 164.76 L 516.48 163.18 L 515.88 160.19 L 514.88 158.18 L 515.36 156.58 L 514.57 152.71 L 515.31 151.35 L 515.33 150.59 L 513.97 149 L 513.53 147.27 L 510.38 140.85 L 508.58 136.13 L 508.29 134.84 L 508.47 133.38 L 510.05 131.41 L 511.14 129.56 L 511.25 128.76 L 511.25 128.76 L 511.44 128.62 L 511.4 128 L 511 127.34 L 511.65 126.53 L 518.39 126.31 L 521.28 125.88 L 523.35 125.22 L 530.75 126.01 L 532.87 127.13 L 534.81 128.63 L 538.93 130.81 L 540.39 131.33 L 545.21 134.33 L 546.42 134.53 L 548.64 136.82 L 551.63 138.93 L 554.2 139.65 L 556.64 142.56 L 557.86 143.17 L 560.82 146.98 L 564.98 150.06 L 566.44 152.06 L 567.48 153.05 L 568.98 153.87 L 570.13 153.9 L 572.5 154.82 L 573.29 155.49 z"},{code:"DF",name:"Distrito Federal",gTransform:"matrix(1 0 0 1 103.1 10.18)",pathTransform:"translate(-409.11, -329.45)",d:"M 416.71 333.87 L 402.02 333.85 L 401.5 330.59 L 402.42 328.76 L 402.8 325.03 L 414.75 325.04 L 416.58 327.02 L 416.64 329.23 L 416.05 330.42 L 415.84 332.86 z"},{code:"ES",name:"Espírito Santo",gTransform:"matrix(1 0 0 1 212.62 72.56)",pathTransform:"translate(-518.62, -391.82)",d:"M 501.63 411.37 L 501.34 411.23 L 501.78 408.89 L 502.35 407.59 L 501.76 404.47 L 501.92 404.05 L 503.64 401.99 L 508.79 402.02 L 509.34 401.7 L 510.31 398.46 L 511.42 397.19 L 512.3 394.9 L 512.54 393.18 L 512.8 392.74 L 514.04 391.88 L 515.75 389.79 L 516.29 386.82 L 516 384.39 L 514.73 381.58 L 513.63 380.31 L 513.11 380.22 L 512.66 380.51 L 511.9 380.23 L 511.41 379.52 L 511.84 378.97 L 513.32 378.88 L 514.12 379.23 L 515.09 379.26 L 516.04 379.02 L 516.36 378.6 L 516.19 376.88 L 514.88 376.53 L 514.67 376.12 L 514.97 374.58 L 515 372.66 L 514.48 372 L 513.15 371.33 L 512.85 370.63 L 514.02 368.7 L 516.19 367.39 L 516.5 367.37 L 517.55 368.11 L 518.68 368.22 L 518.7 367.41 L 517.03 365.14 L 518.37 365.27 L 520.55 364.98 L 521.39 364.37 L 522.47 364.05 L 524.05 363.97 L 526.59 364.78 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.8 365.86 L 535.9 371 L 535.9 371 L 534.97 374.35 L 534.66 377.21 L 534.78 380.8 L 535.5 386.95 L 535.19 389.42 L 533.7 392.6 L 530.95 393.99 L 530.4 394.59 L 528.73 397.92 L 527.75 401.72 L 526.98 403.19 L 526.15 402.51 L 525.27 402.38 L 524.98 403.66 L 526.33 404.18 L 524.39 408.42 L 520.94 412.26 L 520.7 411.99 L 518.84 412.65 L 518.04 413.88 L 517.98 415.27 L 517.56 416.52 L 515.97 418.54 L 515.68 419.67 L 515.68 419.67 L 514.06 418.61 L 511.07 418.98 L 506.73 417.97 L 504.23 416.84 L 503.56 412.13 z"},{code:"GO",name:"Goiás",gTransform:"matrix(1 0 0 1 75.37 14.13)",pathTransform:"translate(-381.37, -333.38)",d:"M 416.71 333.87 L 415.84 332.86 L 416.05 330.42 L 416.64 329.23 L 416.58 327.02 L 414.75 325.04 L 402.8 325.03 L 402.42 328.76 L 401.5 330.59 L 402.02 333.85 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.18 335.39 L 416.49 336.96 L 415.81 338.55 L 414.77 339.8 L 414.36 341.27 L 415.21 342.48 L 416.06 342.82 L 417.48 343.85 L 419.13 348.41 L 419.13 349.01 L 416.81 351.72 L 413.57 354.73 L 413.14 356.87 L 414.23 357.98 L 415.13 357.51 L 416.71 358.08 L 417.18 358.69 L 417.36 359.69 L 417.19 360.4 L 416.46 361.3 L 415.95 363.19 L 417.14 366.65 L 414.05 368.71 L 412.89 368.91 L 412.03 369.81 L 411.55 370.93 L 406.66 373.67 L 405.96 372.9 L 401.61 371.04 L 401.06 371.52 L 400.48 371.61 L 398.73 371.62 L 397.25 371.34 L 393.39 371.5 L 391.38 370.61 L 387.25 373.25 L 384.34 376.17 L 384.01 376.17 L 382.7 374.75 L 381.18 374.45 L 377.99 376.09 L 374.28 375.47 L 371.8 376.43 L 369.57 376.97 L 368.16 379.07 L 366.95 381.53 L 367.01 382.53 L 366.17 383.83 L 365.35 384.11 L 364.51 383.95 L 364.06 384.09 L 363.12 384.83 L 361.48 386.93 L 360.91 388.83 L 361.47 389.44 L 361.46 389.78 L 361.1 390.01 L 360.24 389.55 L 360.24 389.55 L 360 389.1 L 357.34 386.86 L 354.19 386.25 L 352.57 384.7 L 350.67 384.27 L 349.18 384.23 L 345.83 382.89 L 345.15 382.04 L 342.08 380.48 L 341.41 379.87 L 339.97 379.16 L 338.83 378.99 L 336.13 377.31 L 333.35 377.47 L 329.55 376.77 L 329.42 376.44 L 329.68 375.6 L 330.25 374.43 L 331.56 372.67 L 331.48 372.25 L 329.23 371.35 L 328.09 372.02 L 327.43 371.83 L 327.15 371.42 L 326.92 370.31 L 327.18 367.73 L 326.99 365.96 L 326.99 365.96 L 326.04 363.76 L 325.86 360.33 L 324.45 358.14 L 324.29 357.43 L 324.69 354.02 L 327.24 350.17 L 327.62 347.26 L 328.32 346.49 L 330.34 345.65 L 332.26 343.88 L 333.51 341.86 L 333.84 339.91 L 334.34 338.9 L 335.62 337.86 L 336.44 336.43 L 336.52 334.89 L 338.27 333.92 L 339.67 331.3 L 342.32 331.17 L 345.04 330.31 L 345.36 330.03 L 347.34 325.84 L 348.05 324.88 L 348.69 320.78 L 349.07 320.04 L 350.99 318.1 L 352.64 317.09 L 353.71 316.83 L 354.94 317.51 L 356.15 316.78 L 357.54 315.35 L 358.38 312.42 L 359.55 309.55 L 359.54 308.75 L 359.06 307.61 L 359.64 304.87 L 361.24 301.78 L 361.12 296.6 L 362.33 295.82 L 363.36 293.19 L 365.36 290.02 L 365.75 288.95 L 365.59 286.23 L 365.94 285.33 L 366.91 284.47 L 367.18 283.34 L 367.1 282.71 L 367.1 282.71 L 367.44 282.26 L 367.64 280.38 L 368.3 279.15 L 370.11 277.06 L 370.67 276.76 L 370.64 278.47 L 369.42 280.35 L 368.9 282.69 L 371.3 283.09 L 373.5 284.12 L 377.43 284.52 L 380.52 286.23 L 384.59 287.66 L 385.22 287.43 L 386.85 281.49 L 388.32 279.1 L 389.5 278.13 L 390.65 279.44 L 391.69 281.32 L 392.8 285.03 L 393.41 288.13 L 394.55 288.18 L 395.3 287.43 L 395.6 286.43 L 396.16 285.89 L 398.92 286.23 L 403.45 285.7 L 403.67 286.44 L 403.11 288 L 406.24 289.47 L 409.59 290.15 L 410.28 290.07 L 410.79 286.77 L 411.34 286.8 L 412.85 289.42 L 413.31 289.66 L 415.09 288.76 L 417.61 286.68 L 422.14 285.68 L 423.69 285.68 L 426.25 284.58 L 427.99 283.24 L 433.35 281.82 L 433.35 281.82 L 436.07 284.28 L 436.09 284.66 L 434.66 285.72 L 434.18 288.24 L 434.28 288.57 L 435.91 289.41 L 435.85 290.35 L 435.62 290.73 L 434.03 291.76 L 432.84 295.59 L 432.79 297.14 L 433.41 300.66 L 435.11 304.12 L 438.32 306.74 L 438.37 307.21 L 437.65 308.63 L 437.55 309.3 L 438.22 311.02 L 438.45 312.3 L 438.2 313.07 L 436.72 315.04 L 436.72 315.04 L 435.72 316.05 L 432.49 315.71 L 431.59 313.95 L 429.17 312.47 L 428 313.96 L 428.58 317.73 L 428.01 318.27 L 427.61 318.4 L 424.83 317.26 L 423.66 317.49 L 423.29 317.77 L 422.57 320.95 L 423.29 321.05 L 423.78 322.21 L 423.21 323.15 L 422.48 323.85 L 422.52 325.75 L 422.94 326.36 L 423.47 326.55 L 424.16 330.81 L 423.63 331.34 L 420.27 332.24 L 417.98 333.75 z"},{code:"MA",name:"Maranhão",gTransform:"matrix(1 0 0 1 142.22 -148.63)",pathTransform:"translate(-448.22, -170.64)",d:"M 458.57 128.92 L 458.53 129.25 L 456.48999999999995 131.4 L 456.05999999999995 131.57 L 456.0199999999999 133.01 L 457.98999999999995 131.31 L 458.66999999999996 130.1 L 460.78999999999996 128.51999999999998 L 461.67999999999995 127.37999999999998 L 462.7099999999999 121.04999999999998 L 463.8599999999999 120.34999999999998 L 464.9699999999999 120.22999999999998 L 466.63999999999993 119.30999999999997 L 467.2899999999999 119.17999999999998 L 467.7499999999999 119.29999999999998 L 467.82999999999987 120.92999999999998 L 467.6299999999999 121.37999999999998 L 466.20999999999987 123.24999999999999 L 462.9999999999999 124.99999999999999 L 462.9699999999999 125.71999999999998 L 463.69999999999993 125.83999999999999 L 464.1499999999999 125.02999999999999 L 465.2999999999999 124.71999999999998 L 465.5199999999999 125.54999999999998 L 464.92999999999995 126.05999999999999 L 465.17999999999995 126.35999999999999 L 469.38999999999993 121.38999999999999 L 470.24999999999994 121.71999999999998 L 472.8299999999999 120.78999999999998 L 476.86999999999995 121.21999999999998 L 476.40999999999997 118.80999999999999 L 477.02 118.57999999999998 L 479.44 118.65999999999998 L 481.21999999999997 119.03999999999998 L 483.84999999999997 120.08999999999997 L 484.89 120.19999999999997 L 487.03999999999996 121.57999999999997 L 488.43999999999994 121.60999999999997 L 489.69999999999993 122.90999999999997 L 491.5899999999999 124.22999999999996 L 494.0899999999999 124.80999999999996 L 495.24999999999994 124.61999999999996 L 495.80999999999995 125.37999999999997 L 496.1499999999999 125.42999999999996 L 497.7399999999999 125.33999999999996 L 500.1999999999999 125.99999999999996 L 500.45999999999987 125.09999999999995 L 499.78999999999985 124.62999999999995 L 501.45999999999987 124.24999999999996 L 502.02999999999986 124.35999999999996 L 501.9399999999999 124.77999999999996 L 501.9399999999999 124.77999999999996 L 501.4799999999999 126.20999999999997 L 501.7099999999999 126.92999999999996 L 502.3399999999999 127.46999999999997 L 501.9599999999999 128.99999999999997 L 500.1699999999999 131.26999999999998 L 496.0399999999999 135.23999999999998 L 492.7199999999999 135.7 L 491.9199999999999 135.54 L 488.9999999999999 138.94 L 489.0399999999999 140.74 L 488.1599999999999 142.57000000000002 L 486.2699999999999 144.42000000000002 L 485.44999999999993 146.4 L 484.80999999999995 146.57 L 484.03999999999996 147.62 L 484.4 149.54 L 485.63 150.37 L 486.01 151.65 L 485.73 153.11 L 484.59000000000003 155.98000000000002 L 486.17 158.79000000000002 L 486.72 161.77 L 486.61 164.20000000000002 L 486.40000000000003 164.75000000000003 L 482.3 169.17000000000002 L 482.13 171.65 L 482.25 173.76000000000002 L 482.76 176.06000000000003 L 484.53999999999996 178.10000000000002 L 486.15 179.01000000000002 L 486.32 179.51000000000002 L 486.45 180.35000000000002 L 486.06 182.55 L 485.77 182.99 L 485.65 184.20000000000002 L 485.15 185.66000000000003 L 483.94 186.97000000000003 L 481.65 187.26000000000002 L 481 186.98000000000002 L 480.17 187.02 L 477.74 187.88000000000002 L 476.22 187.99000000000004 L 473.72 186.17000000000004 L 472.71000000000004 185.96000000000004 L 471.25000000000006 186.15000000000003 L 470.24000000000007 186.75000000000003 L 469.12000000000006 187.01000000000002 L 468.89000000000004 186.71 L 468.05000000000007 186.95000000000002 L 467.55000000000007 187.17000000000002 L 465.6500000000001 189.08 L 465.6600000000001 189.54000000000002 L 465.0300000000001 190.41000000000003 L 463.0200000000001 192.41000000000003 L 460.6800000000001 193.32000000000002 L 457.8100000000001 195.88000000000002 L 456.48000000000013 196.41000000000003 L 455.4300000000001 196.45000000000002 L 453.73000000000013 197.98000000000002 L 452.65000000000015 198.34000000000003 L 450.04000000000013 198.66000000000003 L 447.3200000000001 199.42000000000002 L 445.1900000000001 201.37 L 444.2100000000001 204.34 L 443.8200000000001 207.31 L 443.1900000000001 209.63 L 441.7400000000001 212.37 L 441.4400000000001 212.59 L 441.10000000000014 213.41 L 440.97000000000014 214.93 L 439.77000000000015 217.41 L 438.07000000000016 218.81 L 437.34000000000015 220.81 L 438.0500000000001 222.75 L 438.52000000000015 225.93 L 440.25000000000017 228.99 L 440.21000000000015 229.51000000000002 L 439.45000000000016 230.91000000000003 L 439.32000000000016 237.27000000000004 L 438.1700000000002 239.72000000000003 L 437.9100000000002 240.78000000000003 L 437.8600000000002 242.70000000000002 L 437.8600000000002 242.70000000000002 L 436.5800000000002 242.04000000000002 L 435.9700000000002 241.22000000000003 L 435.1500000000002 240.77000000000004 L 434.1600000000002 240.48000000000005 L 432.3800000000002 240.68000000000004 L 431.67000000000024 240.50000000000003 L 430.3200000000002 238.50000000000003 L 429.3300000000002 235.64000000000001 L 427.2000000000002 234.02 L 427.06000000000023 232.37 L 428.7000000000002 230.56 L 428.62000000000023 230.03 L 424.74000000000024 228.08 L 424.12000000000023 227.03 L 424.06000000000023 225.37 L 423.31000000000023 223.78 L 422.37000000000023 223.09 L 420.29000000000025 222.81 L 420.09000000000026 222.39000000000001 L 420.35000000000025 221.68 L 422.98000000000025 219.14000000000001 L 422.61000000000024 217.83 L 423.34000000000026 215.15 L 424.03000000000026 213.72 L 424.60000000000025 213.17 L 425.9400000000002 212.63 L 429.3300000000002 212.28 L 428.9400000000002 210.93 L 429.5800000000002 207.68 L 429.5000000000002 205.92000000000002 L 427.7000000000002 204.71 L 423.43000000000023 205.65 L 421.28000000000026 206.99 L 419.0100000000003 203.97 L 418.10000000000025 203.12 L 415.10000000000025 198.97 L 414.22000000000025 199.04 L 413.3800000000003 197.6 L 413.9900000000003 196.41 L 413.8800000000003 195.53 L 413.6300000000003 195.19 L 412.2600000000003 194.95 L 411.84000000000026 195.22 L 409.91000000000025 193.89 L 410.09000000000026 193.17999999999998 L 411.85000000000025 192.51999999999998 L 413.60000000000025 190.48 L 413.85000000000025 188.89 L 413.5700000000003 187.89 L 413.8800000000003 185.52999999999997 L 415.65000000000026 179.36999999999998 L 415.66000000000025 178.93999999999997 L 414.98000000000025 177.79999999999998 L 414.7500000000002 176.71999999999997 L 414.9600000000002 172.99999999999997 L 414.3200000000002 171.49999999999997 L 413.8500000000002 168.00999999999996 L 413.0100000000002 166.97999999999996 L 409.61000000000024 165.53999999999996 L 408.3900000000002 165.51999999999995 L 408.11000000000024 165.19999999999996 L 408.03000000000026 164.16999999999996 L 407.4400000000003 163.47999999999996 L 405.7000000000003 163.18999999999997 L 404.7400000000003 163.70999999999998 L 403.3400000000003 163.61999999999998 L 400.56000000000034 162.10999999999999 L 399.70000000000033 162.04999999999998 L 397.74000000000035 162.57999999999998 L 395.12000000000035 164.42999999999998 L 394.5900000000004 165.06999999999996 L 394.5900000000004 165.06999999999996 L 394.10000000000036 164.98999999999995 L 408.81000000000034 153.15999999999994 L 411.16000000000037 153.38999999999993 L 412.3300000000004 152.46999999999994 L 413.8800000000004 150.29999999999995 L 414.3100000000004 149.14999999999995 L 415.8600000000004 147.97999999999996 L 416.4800000000004 145.09999999999997 L 417.6000000000004 144.63999999999996 L 420.0400000000004 142.31999999999996 L 420.51000000000045 141.10999999999996 L 420.80000000000047 139.20999999999995 L 422.4000000000005 134.51999999999995 L 424.36000000000047 132.97999999999996 L 425.8400000000005 131.21999999999997 L 426.67000000000047 129.76999999999998 L 427.13000000000045 128.48999999999998 L 426.95000000000044 126.66999999999999 L 427.74000000000046 125.85999999999999 L 426.70000000000044 124.27999999999999 L 430.38000000000045 121.18999999999998 L 430.25000000000045 119.54999999999998 L 430.75000000000045 117.16999999999999 L 432.49000000000046 115.6 L 432.8500000000005 114.89 L 433.75000000000045 111.87 L 433.83000000000044 110.26 L 433.40000000000043 109.73 L 432.4100000000004 109.89 L 432.14000000000044 109.4 L 432.19000000000045 108.78 L 433.33000000000044 108.63 L 433.90000000000043 107.89 L 434.6100000000004 103.5 L 434.4500000000004 102.12 L 434.9200000000004 101.09 L 435.6900000000004 100.64 L 435.6900000000004 100.64 L 436.3200000000004 100.64 L 436.5600000000004 100.4 L 436.5000000000004 99.86 L 436.8400000000004 99.11 L 437.42000000000036 98.58 L 438.76000000000033 99.56 L 439.2100000000003 101.4 L 440.4000000000003 101.52000000000001 L 441.1700000000003 100.16000000000001 L 441.7800000000003 103.09000000000002 L 442.7700000000003 103.13000000000002 L 443.06000000000034 102.64000000000003 L 443.13000000000034 101.70000000000003 L 443.98000000000036 101.66000000000003 L 445.67000000000036 102.19000000000003 L 446.17000000000036 102.88000000000002 L 444.74000000000035 104.58000000000003 L 445.41000000000037 105.28000000000003 L 445.43000000000035 105.83000000000003 L 446.6400000000003 103.79000000000002 L 447.13000000000034 102.25000000000001 L 447.5800000000003 102.25000000000001 L 447.9800000000003 103.27000000000001 L 447.9800000000003 103.85000000000001 L 447.1100000000003 104.77000000000001 L 446.8400000000003 105.76 L 446.9200000000003 108.47 L 447.1800000000003 108.8 L 447.6500000000003 108.92 L 448.2300000000003 108.78 L 449.1900000000003 107.85 L 448.72000000000025 106.85 L 448.86000000000024 106.25 L 450.18000000000023 104.82 L 451.23000000000025 104.57 L 453.36000000000024 105.16 L 454.86000000000024 104.05 L 454.91000000000025 104.97 L 454.55000000000024 105.17999999999999 L 453.42000000000024 106.71 L 454.0100000000002 107.28999999999999 L 454.11000000000024 106.91999999999999 L 455.36000000000024 106.32 L 455.9400000000002 107.11 L 455.80000000000024 108.32 L 457.43000000000023 110.07 L 458.29000000000025 109.63 L 459.87000000000023 110.3 L 460.6400000000002 112.7 L 460.5300000000002 113.65 L 458.3400000000002 116.38000000000001 L 457.9600000000002 117.27000000000001 L 458.06000000000023 117.93 L 458.66000000000025 116.9 L 460.41000000000025 115.22 L 461.24000000000024 115.19 L 462.11000000000024 116 L 462.6300000000002 117.89 L 462.36000000000024 119.12 L 461.3900000000002 119.31 L 460.36000000000024 120.22 L 459.2000000000002 121.71 L 459.2700000000002 122.47999999999999 L 458.1100000000002 124.82999999999998 L 457.4900000000002 128.35 L 457.70000000000016 128.69 L 458.57 128.92 z M 459.09 129.37 L 459.03 128.58 L 459.55999999999995 127.05000000000001 L 459.1499999999999 125.98000000000002 L 459.2799999999999 125.32000000000002 L 460.18999999999994 124.08000000000003 L 460.73999999999995 123.89000000000003 L 460.78999999999996 126.24000000000002 L 460.56999999999994 127.58000000000003 L 459.7699999999999 128.18000000000004 L 459.09 129.37 z M 452.79 103.61 L 452.35 103.15 L 452.27000000000004 102.55000000000001 L 453.07000000000005 101.43 L 453.91 101.4 L 454.59000000000003 101.82000000000001 L 454.69000000000005 102.16000000000001 L 454.50000000000006 102.52000000000001 L 452.79 103.61 z M 456.29 107.79 L 456 107.49000000000001 L 456.06 106.96000000000001 L 457.12 106.07000000000001 L 457.6 106.14 L 458.1 106.99 L 457.96000000000004 107.6 L 457.56000000000006 107.42999999999999 L 456.29 107.79 z M 442.13 102.98 L 441.92 102.93 L 442.87 99.35000000000001 L 443.17 99.44000000000001 L 443.2 99.67000000000002 L 442.78999999999996 102.73000000000002 L 442.13 102.98 z"},{code:"MG",name:"Minas Gerais",gTransform:"matrix(1 0 0 1 139.79 56.66)",pathTransform:"translate(-445.79, -375.93)",d:"M 527.5 365.33 L 526.59 364.78 L 524.05 363.97 L 522.47 364.05 L 521.39 364.37 L 520.55 364.98 L 518.37 365.27 L 517.03 365.14 L 518.7 367.41 L 518.68 368.22 L 517.55 368.11 L 516.5 367.37 L 516.19 367.39 L 514.02 368.7 L 512.85 370.63 L 513.15 371.33 L 514.48 372 L 515 372.66 L 514.97 374.58 L 514.67 376.12 L 514.88 376.53 L 516.19 376.88 L 516.36 378.6 L 516.04 379.02 L 515.09 379.26 L 514.12 379.23 L 513.32 378.88 L 511.84 378.97 L 511.41 379.52 L 511.9 380.23 L 512.66 380.51 L 513.11 380.22 L 513.63 380.31 L 514.73 381.58 L 516 384.39 L 516.29 386.82 L 515.75 389.79 L 514.04 391.88 L 512.8 392.74 L 512.54 393.18 L 512.3 394.9 L 511.42 397.19 L 510.31 398.46 L 509.34 401.7 L 508.79 402.02 L 503.64 401.99 L 501.92 404.05 L 501.76 404.47 L 502.35 407.59 L 501.78 408.89 L 501.34 411.23 L 501.63 411.37 L 501.63 411.37 L 499.1 413.72 L 497.86 413.99 L 497.3 414.49 L 498.04 415.19 L 495.68 421.24 L 493.78 424.95 L 493.69 425.7 L 495.13 425.83 L 495.42 426.44 L 495.21 426.96 L 492.68 427.94 L 483.17 432.47 L 481.8 432.67 L 481.82 432.21 L 481.33 432.04 L 478.8 431.77 L 478.23 431.83 L 476.61 432.77 L 475.36 432.93 L 472.16 433.01 L 471.8 432.69 L 471.29 432.77 L 467.19 434.55 L 466.14 435.32 L 464.43 436.09 L 463.93 435.81 L 461.34 435.98 L 458.43 437.32 L 456.01 438.06 L 455.33 438.55 L 455.33 438.55 L 454.08 439.28 L 451.88 439.5 L 449.95 440.52 L 448.72 441.76 L 446.93 442.43 L 444.55 442.68 L 442.21 442.6 L 442.2 442.11 L 442.55 441.62 L 442.46 441.27 L 441.27 441.6 L 441.09 443.9 L 441.33 444.13 L 441.28 444.97 L 440.53 445.95 L 439.23 446.27 L 438.66 445.84 L 435.05 446.84 L 434.86 446.31 L 432.85 446.55 L 431.73 446.3 L 429.7 442.99 L 430.92 442.28 L 430.4 440.57 L 428.6 439.74 L 426.81 438.51 L 426.1 436.9 L 426.63 435.34 L 426.82 431.89 L 426.56 428.95 L 428.42 426.23 L 429.12 424.05 L 429.17 422.78 L 428.94 422.41 L 425.24 421.09 L 424.24 421.14 L 423.96 421.5 L 423.18 421.81 L 421.57 421.86 L 421.6 421.01 L 420.77 419.02 L 419.47 417.23 L 419.1 415.02 L 418.79 414.4 L 418 413.66 L 418.19 411.72 L 419.71 409.69 L 419.77 409.13 L 419.37 407.58 L 417.49 406.37 L 416.91 405.76 L 417.2 403.39 L 417.77 402.38 L 417.57 401.34 L 414.3 397.99 L 413 398.28 L 412.15 398.92 L 410.5 398.14 L 408.12 398.25 L 407.81 398.86 L 408.01 399.32 L 407.57 400.31 L 404.79 400.99 L 403.68 400.56 L 402.17 399.11 L 401.16 400.36 L 392.98 401.04 L 392.52 401.52 L 392.04 402.71 L 392.31 405.25 L 391.9 405.69 L 390.71 405.17 L 390.7 402.39 L 390.45 401.43 L 390.09 401.04 L 389.53 400.99 L 389.27 401.18 L 388.86 402.31 L 388.19 403.25 L 387.65 403.57 L 387.03 403.55 L 385.82 401.45 L 385.49 400.03 L 385.63 399.12 L 383.95 398.33 L 381.77 396.91 L 379.78 397.5 L 378.16 397.28 L 376.49 397.63 L 372.2 396.67 L 369.65 396.59 L 367.92 395.04 L 367.17 394.9 L 365.67 395.51 L 364.24 397.2 L 362.32 397.57 L 360.17 398.68 L 358.95 399.81 L 358.95 399.81 L 359.26 397.19 L 358.67 393.98 L 359.66 389.8 L 360.24 389.55 L 360.24 389.55 L 361.1 390.01 L 361.46 389.78 L 361.47 389.44 L 360.91 388.83 L 361.48 386.93 L 363.12 384.83 L 364.06 384.09 L 364.51 383.95 L 365.35 384.11 L 366.17 383.83 L 367.01 382.53 L 366.95 381.53 L 368.16 379.07 L 369.57 376.97 L 371.8 376.43 L 374.28 375.47 L 377.99 376.09 L 381.18 374.45 L 382.7 374.75 L 384.01 376.17 L 384.34 376.17 L 387.25 373.25 L 391.38 370.61 L 393.39 371.5 L 397.25 371.34 L 398.73 371.62 L 400.48 371.61 L 401.06 371.52 L 401.61 371.04 L 405.96 372.9 L 406.66 373.67 L 411.55 370.93 L 412.03 369.81 L 412.89 368.91 L 414.05 368.71 L 417.14 366.65 L 415.95 363.19 L 416.46 361.3 L 417.19 360.4 L 417.36 359.69 L 417.18 358.69 L 416.71 358.08 L 415.13 357.51 L 414.23 357.98 L 413.14 356.87 L 413.57 354.73 L 416.81 351.72 L 419.13 349.01 L 419.13 348.41 L 417.48 343.85 L 416.06 342.82 L 415.21 342.48 L 414.36 341.27 L 414.77 339.8 L 415.81 338.55 L 416.49 336.96 L 416.18 335.39 L 416.71 333.87 L 417.98 333.75 L 420.27 332.24 L 423.63 331.34 L 424.16 330.81 L 423.47 326.55 L 422.94 326.36 L 422.52 325.75 L 422.48 323.85 L 423.21 323.15 L 423.78 322.21 L 423.29 321.05 L 422.57 320.95 L 423.29 317.77 L 423.66 317.49 L 424.83 317.26 L 427.61 318.4 L 428.01 318.27 L 428.58 317.73 L 428 313.96 L 429.17 312.47 L 431.59 313.95 L 432.49 315.71 L 435.72 316.05 L 436.72 315.04 L 436.72 315.04 L 437.23 317.45 L 435.8 320.89 L 436.2 321.12 L 437.54 320.21 L 438.24 319.21 L 438.96 319.08 L 441.09 319.46 L 442.13 318.69 L 443.98 316.12 L 444.97 316.27 L 446.4 315.74 L 448.21 314.19 L 449.16 313.02 L 451.18 312.61 L 454.55 310.75 L 455.19 309.64 L 459.46 306.61 L 463.28 305.03 L 465.08 305.12 L 466.28 305.62 L 468.46 305.65 L 470.74 306.18 L 471.59 306.64 L 470.3 309.38 L 470.15 310.27 L 470.41 311.76 L 471.02 312.26 L 476.35 313.72 L 476.99 313.55 L 477.8 312.43 L 479.68 311.54 L 481.45 311.28 L 484.18 312.03 L 485.28 312.57 L 489.63 316.21 L 490.61 316.03 L 492.78 317.65 L 495.31 318.87 L 496.24 319.09 L 496.75 318.88 L 498.28 320.12 L 502.67 318.89 L 503.05 319.07 L 509.57 325.27 L 510.01 329.23 L 510.58 329.02 L 513.19 329.47 L 514.66 328.97 L 515.98 327.98 L 517.97 328.13 L 520.7 328.69 L 522.96 329.77 L 525.15 330.38 L 527.27 330.35 L 530.1 332.82 L 530.83 333.2 L 531.72 333.27 L 532.5 334.29 L 532.92 335.46 L 531.45 338.54 L 526.49 342.76 L 526.34 345.41 L 526.9 346.43 L 526.9 346.85 L 525.88 347.56 L 523.4 347.32 L 522.58 348.2 L 521.76 351.5 L 521.23 355.9 L 521.45 356.15 L 521.8 355.96 L 522 355.51 L 522.64 355.27 L 523.22 356.5 L 523 358.01 L 523.15 358.52 L 527.29 361.58 L 527.82 362.62 L 527.83 363.15 L 527.15 364.5 z"},{code:"MS",name:"Mato Grosso do Sul",gTransform:"matrix(1 0 0 1 -2.22 90.13)",pathTransform:"translate(-303.77, -409.4)",d:"M 358.95 399.81 L 358.55 402.27 L 358.27 402.67 L 356.77 403.45 L 355.45 403.49 L 354.98 403.71 L 353.76 404.74 L 351.77 407.42 L 351.04 408.07 L 350.03 408.37 L 349.41 410.05 L 349.25 412.98 L 346.66 416.62 L 345.7 417.14 L 345.47 417.52 L 345.78 419.45 L 345.7 420.4 L 344.49 422.74 L 342.49 425 L 342.84 425.85 L 342.56 427.06 L 341.12 428.09 L 340.72 429.3 L 338.99 430.99 L 337.73 433.43 L 335.78 435.3 L 328.22 439.83 L 326.96 440.97 L 326.22 442.51 L 325.38 443.59 L 325.38 443.59 L 319.97 445.86 L 318.86 446.68 L 317.93 449.01 L 317.95 450.16 L 316.5 453.72 L 315.83 454.4 L 314.17 455.41 L 313.06 455.73 L 312.73 456.08 L 311.16 464 L 310.8 464.82 L 308.42 466.38 L 308.42 466.38 L 305.87 464.05 L 302.46 462.16 L 298.47 464.13 L 297.79 464.88 L 296.13 465.37 L 293.55 465.8 L 291.19 465.34 L 290.18 464.69 L 289.71 460.42 L 289.39 459.72 L 288.49 458.77 L 288.26 456.3 L 288.77 454.96 L 288.13 454.17 L 288.04 453.73 L 288.04 450.86 L 287.15 448.89 L 286.55 446.15 L 286.5 445.43 L 287.09 444.07 L 287.11 442.46 L 285.54 441.37 L 285.16 440.57 L 285 438.41 L 283.35 436.59 L 281.18 436.33 L 279.67 436.64 L 277.84 436.35 L 275.38 434.39 L 274.82 432.9 L 273.28 433.23 L 271.11 435.97 L 270.11 435.37 L 268.39 436.18 L 267.31 436.34 L 265.57 435.65 L 263.01 435.16 L 259.55 435.39 L 255.89 434.68 L 255.41 433.77 L 253.42 433.64 L 252.53 434.16 L 250.03 433.28 L 250.94 426.01 L 250.51 423.63 L 251.11 422.21 L 252.09 420.75 L 252.69 414.72 L 252.03 412.39 L 251.98 410.66 L 251.22 409.7 L 250.79 409.61 L 250.3 410.26 L 249.66 407 L 248.87 405.13 L 247.66 403.11 L 247.31 401.28 L 251.34 398.98 L 252.1 398.1 L 247.9 394.24 L 253.28 382.82 L 254.4 382.76 L 254.12 380.63 L 253.38 380.5 L 256.61 370.17 L 257.27 369.01 L 254.18 363.16 L 254.21 361.25 L 254.21 361.25 L 254.91 361.45 L 255.93 362.55 L 258.08 364.07 L 263.7 362.1 L 265.75 360.1 L 267.77 357.15 L 267.86 355.98 L 269.26 354.53 L 271.85 354.56 L 273.41 354.34 L 274.18 354.68 L 275.84 354.17 L 277.19 352.92 L 279.21 352.43 L 280.48 352.63 L 281.24 353.78 L 284.03 355.03 L 286.65 355.5 L 287.3 355.85 L 287.57 356.71 L 288.35 357.73 L 291.38 358.89 L 292.64 360 L 293.88 360.57 L 298.4 359.94 L 299.66 359.14 L 300.15 358.29 L 301.58 357.68 L 304.02 357.75 L 305.61 358.79 L 305.91 360.16 L 306.15 360.41 L 307.14 360.45 L 309.27 359.57 L 310.28 359.63 L 315.9 353.62 L 317.24 353.49 L 316.01 360.1 L 314.21 360.8 L 312.55 363.63 L 312.36 364.09 L 312.51 364.62 L 313.81 364.73 L 315.55 366 L 320.17 366.27 L 320.74 365.7 L 323.4 365.62 L 324.27 365.7 L 325.44 366.27 L 326.99 365.96 L 326.99 365.96 L 327.18 367.73 L 326.92 370.31 L 327.15 371.42 L 327.43 371.83 L 328.09 372.02 L 329.23 371.35 L 331.48 372.25 L 331.56 372.67 L 330.25 374.43 L 329.68 375.6 L 329.42 376.44 L 329.55 376.77 L 333.35 377.47 L 336.13 377.31 L 338.83 378.99 L 339.97 379.16 L 341.41 379.87 L 342.08 380.48 L 345.15 382.04 L 345.83 382.89 L 349.18 384.23 L 350.67 384.27 L 352.57 384.7 L 354.19 386.25 L 357.34 386.86 L 360 389.1 L 360.24 389.55 L 360.24 389.55 L 359.66 389.8 L 358.67 393.98 L 359.26 397.19 z"},{code:"MT",name:"Mato Grosso",gTransform:"matrix(1 0 0 1 -23.8 -38.15)",pathTransform:"translate(-282.2, -281.12)",d:"M 206.96 296.05 L 208.43 294.62 L 212.54 292.05 L 213.06 289.6 L 214.49 285.82 L 215.42 284.74 L 217.06 284.21 L 217.49 283.8 L 218.07 282.96 L 218.59 280.71 L 220.25 278.7 L 220.81 276.46 L 220.88 274.75 L 220.3 273.26 L 220.34 271.21 L 218.81 267.87 L 217.91 267.9 L 217.33 267.39 L 216.9 264.14 L 217.04 262.82 L 218.4 261.74 L 219.8 259.99 L 219.97 259.24 L 218.56 255.65 L 217.49 255.22 L 216.38 255.11 L 212.88 255.2 L 211.66 254.09 L 211.9 253.53 L 194.74 253.48 L 195.64 244.48 L 194.14 241.73 L 193.87 239.97 L 193.9 239.17 L 194.9 235.65 L 194.52 233.72 L 195.46 232.05 L 194.63 229.78 L 194.48 228.39 L 194.22 227.78 L 193.44 227.31 L 193.38 226.96 L 194.67 221.97 L 195.43 220.55 L 194.83 219.31 L 193.43 218.34 L 193.43 218.34 L 241.28 218.02 L 242.49 217.29 L 243.67 212.07 L 245.05 207.85 L 244.59 205.91 L 243.93 204.54 L 243.83 203.69 L 244.25 202.84 L 245.11 202.2 L 246.31 200.38 L 246.58 199.37 L 246.24 198.53 L 246.3 197.77 L 246.5 197.16 L 247.68 195.96 L 247.68 195.96 L 248.85 197.04 L 251.3 201.1 L 251.7 202.86 L 253.07 206.82 L 254.39 208.75 L 255.16 210.37 L 254.93 212.81 L 255.41 215.21 L 256.14 217.41 L 257.67 218.52 L 260.67 221.27 L 264.05 222.97 L 264.28 223.91 L 264.24 225.01 L 264.47 225.5 L 265.42 225.9 L 266.24 225.73 L 267.87 226.18 L 268.41 226.9 L 268.61 227.98 L 268.96 228.3 L 270.33 227.85 L 274.02 229.34 L 308.06 231.76 L 371.03 235.24 L 371.03 235.24 L 370.38 236.26 L 369.82 238.15 L 368.72 239.4 L 368.28 242.54 L 367.85 243.39 L 367.48 243.66 L 365.54 248.95 L 365 251.92 L 364.96 254.87 L 363.08 260.86 L 363.14 261.72 L 364.53 263.06 L 364.37 263.93 L 363.55 264.82 L 363.5 265.32 L 364.6 267.57 L 364.13 270.88 L 364.14 272.45 L 364.66 273.03 L 365.1 276.08 L 364.36 278.84 L 365.34 282.18 L 366.3 282.69 L 367.1 282.71 L 367.1 282.71 L 367.18 283.34 L 366.91 284.47 L 365.94 285.33 L 365.59 286.23 L 365.75 288.95 L 365.36 290.02 L 363.36 293.19 L 362.33 295.82 L 361.12 296.6 L 361.24 301.78 L 359.64 304.87 L 359.06 307.61 L 359.54 308.75 L 359.55 309.55 L 358.38 312.42 L 357.54 315.35 L 356.15 316.78 L 354.94 317.51 L 353.71 316.83 L 352.64 317.09 L 350.99 318.1 L 349.07 320.04 L 348.69 320.78 L 348.05 324.88 L 347.34 325.84 L 345.36 330.03 L 345.04 330.31 L 342.32 331.17 L 339.67 331.3 L 338.27 333.92 L 336.52 334.89 L 336.44 336.43 L 335.62 337.86 L 334.34 338.9 L 333.84 339.91 L 333.51 341.86 L 332.26 343.88 L 330.34 345.65 L 328.32 346.49 L 327.62 347.26 L 327.24 350.17 L 324.69 354.02 L 324.29 357.43 L 324.45 358.14 L 325.86 360.33 L 326.04 363.76 L 326.99 365.96 L 326.99 365.96 L 325.44 366.27 L 324.27 365.7 L 323.4 365.62 L 320.74 365.7 L 320.17 366.27 L 315.55 366 L 313.81 364.73 L 312.51 364.62 L 312.36 364.09 L 312.55 363.63 L 314.21 360.8 L 316.01 360.1 L 317.24 353.49 L 315.9 353.62 L 310.28 359.63 L 309.27 359.57 L 307.14 360.45 L 306.15 360.41 L 305.91 360.16 L 305.61 358.79 L 304.02 357.75 L 301.58 357.68 L 300.15 358.29 L 299.66 359.14 L 298.4 359.94 L 293.88 360.57 L 292.64 360 L 291.38 358.89 L 288.35 357.73 L 287.57 356.71 L 287.3 355.85 L 286.65 355.5 L 284.03 355.03 L 281.24 353.78 L 280.48 352.63 L 279.21 352.43 L 277.19 352.92 L 275.84 354.17 L 274.18 354.68 L 273.41 354.34 L 271.85 354.56 L 269.26 354.53 L 267.86 355.98 L 267.77 357.15 L 265.75 360.1 L 263.7 362.1 L 258.08 364.07 L 255.93 362.55 L 254.91 361.45 L 254.21 361.25 L 254.21 361.25 L 253.55 360.58 L 253.23 359.78 L 253.77 359.07 L 251.33 356.92 L 250.05 357.55 L 249.53 357.5 L 248.36 356.82 L 247.91 356.12 L 245.89 354.71 L 244 353.95 L 243.7 353.63 L 243.4 352.51 L 243.17 349.58 L 242.56 347.81 L 242.37 344.15 L 243.25 342.51 L 244.39 341.42 L 244.73 339.64 L 244.68 337.75 L 243.72 337.81 L 243.32 338.41 L 242.94 338.57 L 216.08 337.49 L 215.03 324.84 L 209.66 318.71 L 214.54 318.65 L 214.19 311.1 L 211.55 305.78 L 211.06 303.81 L 211.32 302.75 L 211.93 302.2 L 212.58 300.92 L 211.14 297.99 L 208.03 296.95 z"},{code:"PA",name:"Pará",gTransform:"matrix(1 0 0 1 29.16 -180.48)",pathTransform:"translate(-335.15, -138.78)",d:"M 371.03 235.24 L 308.05999999999995 231.76000000000002 L 274.0199999999999 229.34000000000003 L 270.3299999999999 227.85000000000002 L 268.9599999999999 228.3 L 268.6099999999999 227.99 L 268.4099999999999 226.9 L 267.8599999999999 226.18 L 266.2299999999999 225.73000000000002 L 265.4099999999999 225.9 L 264.4599999999999 225.51000000000002 L 264.2299999999999 225.01000000000002 L 264.2699999999999 223.91000000000003 L 264.0399999999999 222.97000000000003 L 260.6599999999999 221.27000000000004 L 257.6599999999999 218.51000000000005 L 256.1199999999999 217.40000000000003 L 255.3999999999999 215.20000000000005 L 254.9199999999999 212.81000000000006 L 255.1499999999999 210.37000000000006 L 254.37999999999988 208.74000000000007 L 253.04999999999987 206.81000000000006 L 251.67999999999986 202.86000000000007 L 251.28999999999988 201.10000000000008 L 248.8399999999999 197.04000000000008 L 247.65999999999988 195.96000000000006 L 247.65999999999988 195.96000000000006 L 247.0899999999999 195.40000000000006 L 246.93999999999988 193.44000000000005 L 246.2999999999999 192.18000000000006 L 244.7099999999999 190.62000000000006 L 243.6399999999999 190.04000000000005 L 243.2699999999999 189.47000000000006 L 242.43999999999988 187.13000000000005 L 242.46999999999989 186.00000000000006 L 243.0499999999999 185.03000000000006 L 244.4999999999999 183.90000000000006 L 245.2799999999999 182.59000000000006 L 275.1799999999999 118.35000000000007 L 273.3699999999999 116.68000000000006 L 273.4999999999999 115.90000000000006 L 273.3099999999999 115.42000000000006 L 271.9199999999999 115.77000000000005 L 271.0699999999999 116.38000000000005 L 269.1999999999999 115.60000000000005 L 268.09999999999985 113.43000000000005 L 265.40999999999985 111.98000000000005 L 264.1399999999999 110.64000000000004 L 264.0599999999999 110.04000000000005 L 262.7399999999999 109.22000000000006 L 261.3699999999999 109.07000000000005 L 259.1199999999999 108.42000000000004 L 256.7399999999999 107.11000000000004 L 254.8599999999999 106.44000000000004 L 253.5099999999999 105.35000000000004 L 252.8799999999999 104.45000000000003 L 248.2999999999999 101.91000000000003 L 243.6599999999999 98.14000000000003 L 243.3599999999999 97.70000000000003 L 243.3199999999999 96.77000000000002 L 242.7699999999999 94.94000000000003 L 240.9299999999999 93.71000000000002 L 240.2299999999999 93.90000000000002 L 239.8699999999999 93.70000000000002 L 238.03999999999988 91.72000000000001 L 238.0899999999999 89.61000000000001 L 238.43999999999988 88.92000000000002 L 238.25999999999988 88.51000000000002 L 236.56999999999988 87.66000000000003 L 236.32999999999987 86.98000000000002 L 236.14999999999986 84.71000000000002 L 236.57999999999987 83.26000000000002 L 236.17999999999986 78.40000000000002 L 236.17999999999986 78.40000000000002 L 234.58999999999986 61.43000000000002 L 234.58999999999986 61.43000000000002 L 235.33999999999986 61.75000000000002 L 235.76999999999987 62.33000000000002 L 235.74999999999986 62.81000000000002 L 236.19999999999985 63.210000000000015 L 237.11999999999983 63.490000000000016 L 238.48999999999984 62.780000000000015 L 238.95999999999984 61.97000000000001 L 241.66999999999985 62.20000000000001 L 242.47999999999985 61.15000000000001 L 241.93999999999986 59.34000000000001 L 243.72999999999985 58.98000000000001 L 245.13999999999984 57.35000000000001 L 247.77999999999983 58.36000000000001 L 249.65999999999983 58.39000000000001 L 250.19999999999982 56.870000000000005 L 253.52999999999983 55.25000000000001 L 255.49999999999983 55.64000000000001 L 256.65999999999985 55.53000000000001 L 257.14999999999986 55.28000000000001 L 258.34999999999985 53.80000000000001 L 258.74999999999983 52.40000000000001 L 260.2099999999998 51.30000000000001 L 261.0699999999998 51.19000000000001 L 261.7199999999998 51.65000000000001 L 263.8299999999998 50.52000000000001 L 264.23999999999984 50.63000000000001 L 264.60999999999984 51.62000000000001 L 265.33999999999986 52.070000000000014 L 267.36999999999983 52.55000000000001 L 268.97999999999985 52.80000000000001 L 269.53999999999985 52.20000000000001 L 271.20999999999987 51.81000000000001 L 271.98999999999984 52.09000000000001 L 272.80999999999983 52.08000000000001 L 273.66999999999985 51.74000000000001 L 275.90999999999985 52.040000000000006 L 280.57999999999987 53.42000000000001 L 281.53999999999985 53.28000000000001 L 282.53999999999985 52.41000000000001 L 282.5099999999999 50.13000000000001 L 280.4399999999999 47.63000000000001 L 279.1999999999999 47.00000000000001 L 279.6899999999999 45.32000000000001 L 280.9999999999999 43.870000000000005 L 281.27999999999986 42.760000000000005 L 281.58999999999986 42.59 L 282.29999999999984 42.78 L 283.1299999999998 43.54 L 285.47999999999985 44.65 L 297.09999999999985 42.32 L 298.66999999999985 44.01 L 299.6899999999998 44.07 L 300.1299999999998 43.78 L 300.1299999999998 43.78 L 300.74999999999983 44.35 L 301.11999999999983 46.65 L 300.49999999999983 47.949999999999996 L 300.24999999999983 52.489999999999995 L 300.48999999999984 53.92999999999999 L 300.79999999999984 54.46999999999999 L 301.96999999999986 54.489999999999995 L 303.04999999999984 54.199999999999996 L 306.4399999999998 54.56999999999999 L 307.72999999999985 55.059999999999995 L 309.65999999999985 56.10999999999999 L 310.32999999999987 56.90999999999999 L 310.8199999999999 58.18999999999999 L 312.0099999999999 58.30999999999999 L 313.14999999999986 59.14999999999999 L 313.9499999999999 60.12999999999999 L 314.78999999999985 60.39999999999999 L 316.11999999999983 60.25999999999999 L 316.49999999999983 59.83999999999999 L 317.4399999999998 59.69999999999999 L 320.2799999999998 62.359999999999985 L 320.9599999999998 62.329999999999984 L 321.4499999999998 63.509999999999984 L 320.7699999999998 63.73999999999998 L 320.5799999999998 64.45999999999998 L 321.3399999999998 67.28999999999998 L 323.3599999999998 69.54999999999998 L 325.9299999999998 70.27999999999999 L 326.0999999999998 70.60999999999999 L 325.6699999999998 73.74999999999999 L 325.8599999999998 75.85999999999999 L 326.5299999999998 77.36999999999999 L 327.1499999999998 77.92999999999999 L 327.7399999999998 79.74 L 327.6099999999998 81.32 L 329.1099999999998 84.8 L 329.9299999999998 84.99 L 330.70999999999975 84.63 L 333.63999999999976 87.91 L 333.5599999999998 90.34 L 333.9699999999998 91.28 L 334.9199999999998 91.47 L 335.2499999999998 91.94 L 335.5599999999998 93.52 L 335.3499999999998 94.21 L 335.4599999999998 95.50999999999999 L 337.3299999999998 96.89999999999999 L 337.7599999999998 98.39999999999999 L 339.2099999999998 99.42999999999999 L 341.99999999999983 100.11 L 343.29999999999984 99.99 L 344.0699999999998 99.64999999999999 L 345.0099999999998 99.71 L 345.0099999999998 99.71 L 344.47999999999985 100.44999999999999 L 344.76999999999987 102.03999999999999 L 344.59999999999985 102.57 L 343.30999999999983 103.67999999999999 L 341.91999999999985 103.85 L 341.41999999999985 103.66999999999999 L 340.57999999999987 102.87999999999998 L 339.91999999999985 102.72999999999998 L 336.53999999999985 104.30999999999997 L 336.16999999999985 104.84999999999998 L 334.5699999999998 105.56999999999998 L 333.9399999999998 105.54999999999998 L 332.3899999999998 106.13999999999999 L 332.42999999999984 106.71999999999998 L 338.8899999999998 105.65999999999998 L 339.7699999999998 106.31999999999998 L 339.8999999999998 106.77999999999997 L 339.8999999999998 107.43999999999997 L 339.2799999999998 107.93999999999997 L 339.5799999999998 108.29999999999997 L 340.2099999999998 108.09999999999997 L 341.0699999999998 107.09999999999997 L 342.0899999999998 107.08999999999996 L 342.6199999999998 106.81999999999996 L 343.2199999999998 106.93999999999997 L 344.2899999999998 106.51999999999997 L 345.4299999999998 105.94999999999997 L 348.70999999999975 103.60999999999997 L 350.20999999999975 103.25999999999998 L 352.0499999999997 102.44999999999997 L 355.20999999999975 100.60999999999997 L 355.7499999999998 99.60999999999997 L 356.4199999999998 99.08999999999997 L 358.50999999999976 98.07999999999997 L 359.1699999999998 97.35999999999997 L 358.9199999999998 96.68999999999997 L 359.12999999999977 96.27999999999997 L 360.25999999999976 95.99999999999997 L 361.34999999999974 96.05999999999997 L 361.75999999999976 96.26999999999997 L 362.13999999999976 100.06999999999996 L 361.6199999999998 102.64999999999996 L 361.94999999999976 104.26999999999997 L 362.75999999999976 105.86999999999996 L 364.06999999999977 107.21999999999996 L 364.3699999999998 108.85999999999996 L 364.2499999999998 109.32999999999996 L 362.4099999999998 111.16999999999996 L 361.93999999999977 111.29999999999995 L 361.06999999999977 110.77999999999996 L 359.2499999999998 110.25999999999996 L 357.9899999999998 109.94999999999996 L 357.0599999999998 110.08999999999996 L 354.9299999999998 109.04999999999995 L 354.6699999999998 107.92999999999995 L 353.7899999999998 107.39999999999995 L 351.5099999999998 111.21999999999994 L 350.8999999999998 113.58999999999995 L 351.5799999999998 116.55999999999995 L 352.05999999999983 117.19999999999995 L 352.97999999999985 117.81999999999995 L 351.96999999999986 116.67999999999995 L 351.53999999999985 113.98999999999995 L 351.65999999999985 113.46999999999996 L 354.22999999999985 109.24999999999996 L 356.53999999999985 110.42999999999996 L 356.64999999999986 110.87999999999997 L 359.17999999999984 113.32999999999997 L 358.92999999999984 115.34999999999997 L 358.1899999999998 115.89999999999996 L 358.5899999999998 118.22999999999996 L 359.1099999999998 119.35999999999996 L 360.2299999999998 120.10999999999996 L 360.9699999999998 120.25999999999996 L 361.4899999999998 120.74999999999996 L 361.1499999999998 120.10999999999996 L 360.3799999999998 119.86999999999996 L 359.17999999999984 118.82999999999996 L 358.9599999999998 118.14999999999995 L 359.2999999999998 113.94999999999995 L 360.1199999999998 112.75999999999995 L 361.5499999999998 113.48999999999995 L 362.37999999999977 114.68999999999996 L 362.2899999999998 115.47999999999996 L 363.4899999999998 116.33999999999996 L 363.7399999999998 116.04999999999995 L 362.7399999999998 114.78999999999995 L 361.81999999999977 112.68999999999996 L 361.81999999999977 112.24999999999996 L 364.07999999999976 109.92999999999996 L 365.69999999999976 110.01999999999997 L 367.62999999999977 110.65999999999997 L 367.96999999999974 111.21999999999997 L 367.35999999999973 111.80999999999997 L 367.6799999999997 112.08999999999997 L 368.15999999999974 112.11999999999998 L 369.1899999999997 111.94999999999997 L 370.5199999999997 111.04999999999997 L 374.6099999999997 110.08999999999997 L 375.37999999999965 110.28999999999998 L 377.11999999999966 111.34999999999998 L 380.2899999999997 110.92999999999998 L 381.3599999999997 110.51999999999998 L 382.37999999999965 109.50999999999998 L 383.3599999999997 108.91999999999997 L 385.0999999999997 108.40999999999997 L 385.86999999999966 108.47999999999996 L 385.92999999999967 109.22999999999996 L 383.88999999999965 113.24999999999996 L 383.64999999999964 114.74999999999996 L 383.18999999999966 115.81999999999995 L 382.3599999999997 116.84999999999995 L 382.3499999999997 117.72999999999995 L 382.92999999999967 119.14999999999995 L 382.6099999999997 121.61999999999995 L 383.48999999999967 120.42999999999995 L 383.49999999999966 119.02999999999994 L 385.0399999999997 116.02999999999994 L 386.1699999999997 112.83999999999995 L 387.2899999999997 111.27999999999994 L 387.55999999999966 111.00999999999995 L 388.31999999999965 110.95999999999995 L 388.89999999999964 110.60999999999996 L 390.71999999999963 110.37999999999995 L 391.5999999999996 109.02999999999996 L 393.1099999999996 107.33999999999996 L 394.46999999999963 105.07999999999996 L 394.9899999999996 104.61999999999996 L 395.77999999999963 105.10999999999996 L 396.39999999999964 104.64999999999996 L 398.01999999999964 106.98999999999997 L 399.20999999999964 107.57999999999997 L 399.1599999999996 106.83999999999997 L 398.8099999999996 106.08999999999997 L 399.4299999999996 105.07999999999997 L 402.9399999999996 104.56999999999996 L 401.9099999999996 104.24999999999997 L 398.39999999999964 104.70999999999997 L 398.08999999999963 104.49999999999997 L 398.37999999999965 102.06999999999996 L 398.88999999999965 101.77999999999996 L 399.55999999999966 102.15999999999995 L 400.57999999999964 102.26999999999995 L 401.64999999999964 99.16999999999996 L 400.96999999999963 97.77999999999996 L 400.9999999999996 97.09999999999995 L 402.1699999999996 95.28999999999995 L 405.0099999999996 92.80999999999995 L 405.3699999999996 92.72999999999995 L 406.4799999999996 93.86999999999995 L 409.4099999999996 91.77999999999994 L 409.8699999999996 91.70999999999995 L 410.2699999999996 92.15999999999995 L 410.3699999999996 92.72999999999995 L 410.0499999999996 93.39999999999995 L 411.1199999999996 93.23999999999995 L 411.9299999999996 92.65999999999995 L 412.2899999999996 91.87999999999995 L 412.9199999999996 91.68999999999996 L 413.1999999999996 91.83999999999996 L 413.9399999999996 93.22999999999996 L 415.2699999999996 94.42999999999996 L 415.4699999999996 93.86999999999996 L 415.35999999999956 93.48999999999997 L 414.4 93 L 414.26 92.71 L 414.13 91.50999999999999 L 414.3 91.08999999999999 L 414.74 90.89999999999999 L 417.02 91.16 L 418.2 91.81 L 418.82 92.83 L 420.45 93.53999999999999 L 422.09999999999997 92.75999999999999 L 422.62999999999994 94.89999999999999 L 422.12999999999994 95.21 L 422.09999999999997 95.8 L 423.02 95.28 L 424.18 92.93 L 424.56 93.16000000000001 L 424.33 94.49000000000001 L 424.74 94.93 L 427.25 94.67 L 427.7 95.32000000000001 L 428.15999999999997 97.00000000000001 L 427.55999999999995 97.95000000000002 L 428.40999999999997 97.45000000000002 L 428.66999999999996 97.82000000000002 L 430.55999999999995 97.96000000000002 L 434.0899999999999 96.72000000000003 L 433.7799999999999 98.30000000000003 L 433.0299999999999 100.13000000000002 L 434.49999999999994 99.64000000000003 L 435.0899999999999 99.02000000000002 L 435.7199999999999 100.64000000000003 L 435.7199999999999 100.64000000000003 L 434.94999999999993 101.09000000000003 L 434.4799999999999 102.12000000000003 L 434.63999999999993 103.50000000000003 L 433.92999999999995 107.89000000000003 L 433.35999999999996 108.63000000000002 L 432.21999999999997 108.78000000000003 L 432.16999999999996 109.40000000000003 L 432.43999999999994 109.89000000000003 L 433.42999999999995 109.73000000000003 L 433.85999999999996 110.26000000000003 L 433.78 111.87000000000003 L 432.88 114.89000000000003 L 432.52 115.60000000000002 L 430.78 117.17000000000002 L 430.28 119.55000000000001 L 430.40999999999997 121.19000000000001 L 426.72999999999996 124.28000000000002 L 427.77 125.86000000000001 L 426.97999999999996 126.67000000000002 L 427.15999999999997 128.49 L 426.7 129.77 L 425.87 131.22 L 424.39 132.98 L 422.43 134.51999999999998 L 420.83 139.20999999999998 L 420.53999999999996 141.10999999999999 L 420.06999999999994 142.32 L 417.62999999999994 144.64 L 416.50999999999993 145.1 L 415.88999999999993 147.98 L 414.3399999999999 149.14999999999998 L 413.9099999999999 150.29999999999998 L 412.3599999999999 152.46999999999997 L 411.1899999999999 153.38999999999996 L 408.83999999999986 153.15999999999997 L 394.1299999999999 164.98999999999998 L 394.6199999999999 165.07 L 394.6199999999999 165.07 L 396.9099999999999 165.88 L 398.7799999999999 165.64 L 400.06999999999994 165.76 L 401.0899999999999 167.42 L 401.4799999999999 167.73 L 402.3499999999999 167.86999999999998 L 403.6099999999999 169.03999999999996 L 403.5699999999999 169.66999999999996 L 403.1999999999999 170.33999999999995 L 402.47999999999985 170.70999999999995 L 401.5099999999998 170.77999999999994 L 401.2199999999998 171.05999999999995 L 401.3099999999998 172.46999999999994 L 402.31999999999977 173.80999999999995 L 401.39999999999975 176.55999999999995 L 400.75999999999976 177.03999999999994 L 399.2999999999998 177.49999999999994 L 399.0499999999998 177.95999999999995 L 399.3399999999998 179.15999999999994 L 399.1499999999998 180.49999999999994 L 397.8499999999998 180.64999999999995 L 396.3399999999998 181.98999999999995 L 395.4899999999998 183.25999999999996 L 395.63999999999976 184.76999999999995 L 395.39999999999975 185.26999999999995 L 392.89999999999975 186.46999999999994 L 389.4899999999997 187.60999999999993 L 387.0199999999997 189.38999999999993 L 386.8299999999997 189.73999999999992 L 387.2599999999997 191.92999999999992 L 387.3199999999997 194.5999999999999 L 386.03999999999974 196.6999999999999 L 384.6299999999997 198.3799999999999 L 384.47999999999973 198.9499999999999 L 384.64999999999975 199.8299999999999 L 385.2399999999997 200.7899999999999 L 386.90999999999974 202.52999999999992 L 387.65999999999974 202.8499999999999 L 387.8099999999997 203.14999999999992 L 387.1499999999997 207.1899999999999 L 385.3899999999997 212.33999999999992 L 384.3099999999997 213.14999999999992 L 382.60999999999973 216.38999999999993 L 382.4299999999997 217.37999999999994 L 381.4899999999997 218.91999999999993 L 380.7499999999997 219.76999999999992 L 379.6999999999997 219.92999999999992 L 378.3299999999997 220.8499999999999 L 377.2999999999997 222.7699999999999 L 376.08999999999975 224.4499999999999 L 374.90999999999974 225.5399999999999 L 373.75999999999976 227.11999999999992 L 372.62999999999977 231.57999999999993 L 371.03 235.24 z M 392.19 104.93 L 387.67 106.89 L 384.28000000000003 107.41 L 382.26000000000005 107.1 L 381.61000000000007 108.22999999999999 L 379.7700000000001 109.41999999999999 L 379.05000000000007 108.80999999999999 L 378.44000000000005 107.27999999999999 L 378.21000000000004 107.55999999999999 L 378.63000000000005 108.78999999999999 L 378.2900000000001 109.6 L 377.5800000000001 110.00999999999999 L 373.8100000000001 108.36999999999999 L 373.0100000000001 109.08999999999999 L 368.8200000000001 110.35 L 365.6200000000001 109.78 L 364.8100000000001 109.17 L 364.5700000000001 107.32000000000001 L 364.3400000000001 106.91000000000001 L 363.2300000000001 105.89000000000001 L 362.1700000000001 104.29000000000002 L 361.9600000000001 102.51000000000002 L 362.4800000000001 99.76000000000002 L 363.1000000000001 99.38000000000002 L 364.86000000000007 99.74000000000002 L 365.7900000000001 98.99000000000002 L 365.87000000000006 98.43000000000002 L 364.57000000000005 98.86000000000003 L 363.35 98.73000000000003 L 362.41 98.02000000000004 L 362.23 96.97000000000004 L 362.57 91.89000000000004 L 363.3 91.13000000000004 L 363.65000000000003 91.88000000000004 L 365.41 92.48000000000003 L 365.96000000000004 92.42000000000003 L 365.50000000000006 92.00000000000003 L 364.2300000000001 91.78000000000003 L 363.3300000000001 89.62000000000003 L 363.6900000000001 87.94000000000003 L 364.5800000000001 85.97000000000003 L 365.9100000000001 84.64000000000003 L 366.87000000000006 84.07000000000004 L 368.21000000000004 83.58000000000004 L 369.53000000000003 83.45000000000005 L 372.99 83.97000000000004 L 380.2 85.74000000000004 L 383.9 85.28000000000004 L 384.01 84.98000000000005 L 385.15 84.36000000000004 L 387.31 83.99000000000004 L 390.2 84.28000000000004 L 393 85.10000000000004 L 399.48 85.95000000000003 L 400.11 86.42000000000003 L 400.06 87.65000000000003 L 399.36 88.39000000000003 L 398.68 89.89000000000003 L 398.32 92.54000000000003 L 397.46 95.84000000000003 L 396.16999999999996 96.52000000000004 L 395.81999999999994 97.21000000000004 L 396.04999999999995 98.40000000000003 L 394.06999999999994 100.98000000000003 L 392.67999999999995 104.48000000000003 L 392.19 104.93 z M 344.98 104.76 L 344.23 104.25 L 345.33000000000004 102 L 345.24000000000007 100.21 L 345.49000000000007 100 L 347.82000000000005 99.52 L 348.72 98.66 L 348.87 98.16 L 348.67 95.82 L 349.53000000000003 93.24 L 350.79 91.75 L 353.08000000000004 90.28 L 355.95000000000005 90.08 L 356.6700000000001 92.44 L 355.57000000000005 94.63 L 354.72 97.67 L 353.62 98.34 L 352.28000000000003 100.37 L 351.50000000000006 101.09 L 346.56000000000006 104.4 L 344.98 104.76 z M 373.46 81.86 L 372.43 81.61 L 369.98 81.69 L 369.19 81.53 L 368.9 81.27 L 368.52 80.17999999999999 L 368.53 78.94 L 370.03999999999996 78.52 L 371.92999999999995 78.56 L 374.11999999999995 77.27 L 378.92999999999995 76.67 L 379.69999999999993 76.93 L 380.37999999999994 77.61000000000001 L 380.19999999999993 78.63000000000001 L 377.63999999999993 80.02000000000001 L 375.85999999999996 82.50000000000001 L 374.76 83 L 373.46 81.86 z M 378.25 81.86 L 380.11 80.66 L 382.09000000000003 80.69 L 383.74 81.31 L 384.27 82.3 L 384.32 82.92 L 383.44 83.69 L 380.59 83.97 L 379.41999999999996 84.28999999999999 L 377.15999999999997 83.39999999999999 L 376.96 82.86999999999999 L 378.25 81.86 z M 361.27 86.25 L 360.77 85.99 L 360.15999999999997 86.03 L 358.61999999999995 85.34 L 358.8299999999999 84.18 L 359.4699999999999 83.26 L 361.38999999999993 82.86 L 363.74999999999994 81.96 L 365.06999999999994 82.03999999999999 L 365.86999999999995 82.72 L 365.9599999999999 82.85 L 364.0299999999999 84.46 L 362.9599999999999 84.8 L 361.27 86.25 z M 370.69 76.56 L 369.87 76.26 L 369.7 74.60000000000001 L 369.84999999999997 74.00000000000001 L 371.02 72.69000000000001 L 373.46999999999997 71.77000000000001 L 373.71999999999997 71.89000000000001 L 374.24999999999994 72.57000000000002 L 374.28999999999996 73.46000000000002 L 372.34 75.45000000000002 L 370.69 76.56 z M 356.86 96.78 L 356.72 96.37 L 356.91 95.44 L 357.95000000000005 92.63 L 360.54 90.94 L 361.26000000000005 90.66 L 361.95000000000005 90.8 L 361.79 92.59 L 360.23 93.03 L 358.61 95.22 L 356.86 96.78 z M 367.77 79.21 L 366.58 78.89999999999999 L 366.28 78.41999999999999 L 367.15999999999997 77.46 L 367.86999999999995 73.50999999999999 L 368.75999999999993 72.27999999999999 L 369.04999999999995 72.40999999999998 L 369.11999999999995 72.72999999999998 L 369.09999999999997 75.20999999999998 L 369.7 77.07999999999998 L 369.38 77.95999999999998 L 368.35 78.35999999999999 L 367.77 79.21 z M 352.96 89.4 L 352.69 89.21000000000001 L 352.81 88.60000000000001 L 353.36 88.24000000000001 L 354.55 86.53000000000002 L 355.31 84.99000000000001 L 356.04 84.33000000000001 L 357.49 83.79 L 357.29 85.28 L 356.89000000000004 86.28 L 355.17 87.94 L 352.96 89.4 z M 366.83 82.37 L 366.22999999999996 82.22 L 365.39 81.51 L 364.43 79.87 L 364.38 79.49000000000001 L 364.61 79.2 L 365.42 78.62 L 367.27000000000004 79.46000000000001 L 367.56000000000006 79.89000000000001 L 367.80000000000007 81.98000000000002 L 366.83 82.37 z M 361.45 112.93 L 360.8 112.82000000000001 L 359.92 112.30000000000001 L 359.23 112.76 L 358.48 112.48 L 356.8 110.74000000000001 L 356.8 110.13000000000001 L 358.08 110.12 L 361.14 111.44 L 361.45 112.93 z M 340.3 107.39 L 340.34000000000003 106.36 L 340.14000000000004 106.06 L 340.74000000000007 105.07000000000001 L 343.1000000000001 104.19000000000001 L 343.88000000000005 104.57000000000001 L 344.75000000000006 105.43 L 344.46000000000004 105.78 L 343.43000000000006 106.25 L 340.89000000000004 106.66 L 340.3 107.39 z M 353 100.7 L 352.82 100.67 L 352.83 100.32000000000001 L 353.37 99.38000000000001 L 355.16 97.76 L 355.58000000000004 96.52000000000001 L 355.63000000000005 95.22000000000001 L 355.87000000000006 94.92000000000002 L 356.19000000000005 95.36000000000001 L 356.19000000000005 96.87000000000002 L 355.30000000000007 99.60000000000002 L 354.68000000000006 100.25000000000003 L 353 100.7 z M 359.3 90.8 L 360.95 87.84 L 361.83 87.63000000000001 L 362.53999999999996 87.82000000000001 L 362.80999999999995 88.69000000000001 L 362.22999999999996 89.4 L 359.3 90.8 z M 390.72 109.77 L 389.88000000000005 109.42 L 389.5400000000001 108.36 L 390.5800000000001 106.64 L 391.6500000000001 106.31 L 391.8400000000001 106.41 L 391.8200000000001 107.14999999999999 L 391.0800000000001 109.38999999999999 L 390.72 109.77 z M 357.24 90.3 L 356.7 90.1 L 357.02 88.05999999999999 L 358.34999999999997 86.24999999999999 L 358.58 86.28999999999999 L 359.87 87.16999999999999 L 359.86 87.41999999999999 L 358.31 88.05999999999999 L 357.24 90.3 z M 359.47 95.33 L 360.19000000000005 95.36 L 359.7900000000001 95.81 L 358.8500000000001 96.12 L 358.74000000000007 97.24000000000001 L 357.95000000000005 97.95 L 356.26000000000005 98.79 L 356.1 98.61 L 356.37 97.78 L 356.84000000000003 97.15 L 358.57000000000005 95.48 L 359.47 95.33 z M 336.91 105.54 L 336.36 105.35000000000001 L 336.29 105.00000000000001 L 336.72 104.60000000000001 L 340.28000000000003 103.00000000000001 L 340.82000000000005 103.70000000000002 L 340.81000000000006 103.90000000000002 L 339.4100000000001 104.63000000000002 L 336.91 105.54 z M 400.44 100.76 L 399.41 100.57000000000001 L 398.59000000000003 99.78 L 399.46000000000004 98.53 L 400.8 98.52 L 400.99 99.71 L 400.89 100.3 L 400.44 100.76 z M 363.19 81.86 L 360.83 82.56 L 360.24 82.57000000000001 L 360.06 82.36000000000001 L 361.09 81.32000000000001 L 362.13 80.81 L 363.17 80.98 L 363.61 81.32000000000001 L 363.76 81.55000000000001 L 363.61 81.76 L 363.19 81.86 z M 357.92 90.45 L 357.84000000000003 89.69 L 358.09000000000003 89.19 L 360.57000000000005 87.73 L 359.6700000000001 89.73 L 358.86000000000007 90.36 L 357.92 90.45 z M 360.06 94.98 L 359.61 94.86 L 359.54 94.63 L 360.32 93.13 L 361.51 93.14999999999999 L 361.39 94.49999999999999 L 360.06 94.98 z M 388.1 110.81 L 387.82000000000005 110.58 L 388.72 108.98 L 389.40000000000003 108.58 L 389.63000000000005 109.33 L 390.14000000000004 109.7 L 389.88000000000005 110.22 L 389.45000000000005 110.56 L 388.82000000000005 110.38 L 388.1 110.81 z M 361.44 87.49 L 360.55 87.42 L 360.57 87.23 L 362.93 85.39 L 362.97 86.35 L 362.74 86.97999999999999 L 362.49 87.32 L 361.44 87.49 z M 428.9 97.71 L 428.52 97.17999999999999 L 428.71 96.41999999999999 L 429.72999999999996 95.50999999999999 L 429.97999999999996 95.66 L 430.21 97.41 L 428.9 97.71 z"},{code:"PB",name:"Paraíba",gTransform:"matrix(1 0 0 1 275.13 -126.21)",pathTransform:"translate(-581.13, -193.05)",d:"M 610.43 199.15 L 607.93 197.09 L 607.11 196.83 L 604.46 196.62 L 602.15 197.69 L 600.67 198.97 L 600.22 200.77 L 598.32 201.8 L 596.31 202.25 L 595.17 202.23 L 595.17 202.83 L 594.37 203.36 L 592.19 203.65 L 588.31 203.39 L 586.7 204.27 L 586.15 204.91 L 584.33 205.01 L 583.44 205.7 L 582.9 206.46 L 583.29 207.19 L 583.3 207.73 L 582.9 208.21 L 581.12 209.74 L 579.78 209.9 L 578.13 210.74 L 576.53 209.95 L 575.58 209.01 L 575.23 206.77 L 575.47 206.28 L 575.29 205.98 L 574.15 205.66 L 573.71 205.95 L 572.2 206.2 L 572.24 205.75 L 574.77 203.11 L 574.94 202.68 L 574.22 200.81 L 574.18 200.34 L 574.55 199.56 L 577.55 198.49 L 577.66 198.19 L 577.16 196.8 L 573.66 194.88 L 572.18 195.29 L 569.96 196.55 L 569.03 198.06 L 567.55 198.93 L 566.5 199.24 L 563.8 201.12 L 562.28 202.76 L 560.65 202.99 L 558.02 203.96 L 557.25 203.63 L 557.3 202.95 L 556.67 201.71 L 556.29 201.63 L 555.36 202.36 L 553.85 202.68 L 552.86 202.35 L 551.46 200.44 L 551.06 200.35 L 551.06 200.35 L 550.89 200.1 L 552.08 198.98 L 553.69 195.49 L 553.35 194.3 L 552.66 194.22 L 551.42 193.33 L 551.44 191.67 L 551.09 190.95 L 550.51 190.66 L 550.27 190.25 L 550.39 189.32 L 550.56 188.94 L 551.65 188.31 L 552.31 187 L 551.79 185.69 L 552.82 182.69 L 553.66 181.54 L 553.74 181 L 553.74 181 L 554.31 180.54 L 556.24 182.18 L 557.14 182.6 L 560.02 183.21 L 561.18 182.08 L 564.41 180.42 L 565.23 179.71 L 565.33 178.67 L 565.74 177.72 L 568.92 176.51 L 570.35 176.39 L 573.61 175.35 L 574.25 175.43 L 574.78 175.87 L 574.79 177.06 L 571.8 180.27 L 571.36 181.23 L 570.98 182.97 L 570.57 183.35 L 569.72 183.6 L 569.51 183.91 L 569.43 185.63 L 572.96 186.15 L 573.28 186.38 L 573.59 187.76 L 573.88 187.99 L 577.03 186.73 L 578.8 186.65 L 580.75 186.95 L 581.64 188.12 L 581.12 189.66 L 581.95 190.4 L 584.3 189.47 L 584.8 188.73 L 585.35 187.52 L 584.88 186.58 L 584.72 185.16 L 585.2 184.57 L 586.21 184.89 L 585.68 183.36 L 584.96 182.58 L 585.27 181.1 L 587.09 179.75 L 588.47 179.7 L 588.89 180.09 L 588.79 181.09 L 589.41 181.58 L 592.83 181.98 L 593.36 182.33 L 599.19 181.94 L 601.36 182.24 L 603.82 183.34 L 604.86 182.94 L 608.36 183.15 L 609.29 182.91 L 609.29 182.91 L 609.38 185.31 L 610.83 189.7 L 610.89 190.34 L 610.71 191.28 L 610.34 191.73 L 610.31 192.61 L 610.89 191.87 L 611.4 190.37 L 611.41 192.35 L 612 193.36 L 611.73 198.54 L 611.37 199.14 z"},{code:"PE",name:"Pernambuco",gTransform:"matrix(1 0 0 1 254.6 -106.99)",pathTransform:"translate(-560.6, -212.26)",d:"M 558.28 227.19 L 557.06 224.15 L 557.05 223.21 L 554.94 222.35 L 554.44 221.98 L 553.99 221.15 L 554.6 220.26 L 554.58 219.64 L 554.13 219.32 L 553.13 219.33 L 552.7 219.77 L 552.41 221.51 L 551.98 221.66 L 551.59 221.4 L 551.05 219.75 L 549.47 218.6 L 546.48 218.2 L 544.12 217.43 L 542.77 216.62 L 541.94 215.18 L 540.45 214.62 L 539.86 214.73 L 537.33 216.19 L 535.68 216.63 L 534.91 218.68 L 532.68 219.13 L 532.39 219.38 L 532.64 220.74 L 532.47 221.33 L 531.37 222.57 L 528.98 223.6 L 528.34 223.54 L 527.57 223.01 L 526.81 223.18 L 526.31 224.05 L 525.54 227.62 L 522.67 228.5 L 521.85 229.42 L 520.89 229.65 L 519.05 229.03 L 519.97 227.35 L 519.71 225.35 L 517.5 224.44 L 516.78 222.5 L 516.84 219.77 L 516.4 219.26 L 513.59 217.88 L 511.39 217.59 L 510.23 217.85 L 509.33 217.45 L 509.33 217.45 L 511.95 216.18 L 513.92 214.47 L 514.46 213.6 L 516.75 212.27 L 517.72 211.99 L 521.61 208.12 L 522.35 206.36 L 522.41 204.09 L 522.12 203.55 L 520.5 201.97 L 520.57 199.78 L 519.97 198.65 L 519.91 197.7 L 520.02 197.25 L 520.54 196.92 L 522.33 196.76 L 522.33 196.76 L 527.26 196.96 L 528.15 197.2 L 529.78 197.01 L 531.92 196.21 L 533.21 196.11 L 536.29 196.53 L 539.14 198.43 L 540.97 199.26 L 541.43 200.25 L 542.44 201.32 L 543.8 201.8 L 544.58 202.37 L 545.21 204.01 L 546.86 203.96 L 548.4 201.67 L 549.47 200.84 L 551.06 200.35 L 551.06 200.35 L 551.46 200.44 L 552.86 202.35 L 553.85 202.68 L 555.36 202.36 L 556.29 201.63 L 556.67 201.71 L 557.3 202.95 L 557.25 203.63 L 558.02 203.96 L 560.65 202.99 L 562.28 202.76 L 563.8 201.12 L 566.5 199.24 L 567.55 198.93 L 569.03 198.06 L 569.96 196.55 L 572.18 195.29 L 573.66 194.88 L 577.16 196.8 L 577.66 198.19 L 577.55 198.49 L 574.55 199.56 L 574.18 200.34 L 574.22 200.81 L 574.94 202.68 L 574.77 203.11 L 572.24 205.75 L 572.2 206.2 L 573.71 205.95 L 574.15 205.66 L 575.29 205.98 L 575.47 206.28 L 575.23 206.77 L 575.58 209.01 L 576.53 209.95 L 578.13 210.74 L 579.78 209.9 L 581.12 209.74 L 582.9 208.21 L 583.3 207.73 L 583.29 207.19 L 582.9 206.46 L 583.44 205.7 L 584.33 205.01 L 586.15 204.91 L 586.7 204.27 L 588.31 203.39 L 592.19 203.65 L 594.37 203.36 L 595.17 202.83 L 595.17 202.23 L 596.31 202.25 L 598.32 201.8 L 600.22 200.77 L 600.67 198.97 L 602.15 197.69 L 604.46 196.62 L 607.11 196.83 L 607.93 197.09 L 610.43 199.15 L 610.43 199.15 L 611.31 199.38 L 611.86 200.6 L 610.59 202.32 L 610.48 202.87 L 610.49 203.35 L 611.19 203.72 L 611.46 204.22 L 611.65 205.28 L 609.69 211.66 L 606.44 220.61 L 606.44 220.61 L 606.17 220.4 L 603.27 220.13 L 601.35 219.32 L 599.88 219.51 L 597.32 220.8 L 595.08 219.95 L 593.08 220.19 L 591.53 221.43 L 591.41 221.88 L 589.23 224.17 L 587.42 225.28 L 586.26 225.23 L 584.4 226.29 L 583.23 226.4 L 580.09 226.11 L 577.59 226.76 L 575.68 226.28 L 573.9 225.23 L 572 223.11 L 569.45 221.09 L 568.37 221.21 L 566.7 220.91 L 565.7 219.69 L 564.88 220.29 L 564.79 220.98 L 562.41 224.27 L 560.24 225.03 L 559.6 226.12 z"},{code:"PI",name:"Piauí",gTransform:"matrix(1 0 0 1 174.84 -130.97)",pathTransform:"translate(-480.85, -188.29)",d:"M 505.7 126.91 L 507.01 127.03 L 507.7 126.8 L 509.94 127.31 L 510.93 128.16 L 511.25 128.76 L 511.25 128.76 L 511.14 129.56 L 510.05 131.41 L 508.47 133.38 L 508.29 134.84 L 508.58 136.13 L 510.38 140.85 L 513.53 147.27 L 513.97 149 L 515.33 150.59 L 515.31 151.35 L 514.57 152.71 L 515.36 156.58 L 514.88 158.18 L 515.88 160.19 L 516.48 163.18 L 515.89 164.76 L 515.09 165.34 L 516.01 166.03 L 516.12 166.41 L 517.06 174.57 L 516.82 175.02 L 517.58 177.59 L 518.63 182.79 L 519.64 185.46 L 520.95 186.11 L 523.51 186.58 L 524.28 187.74 L 524.27 188.43 L 522.77 190.68 L 521.63 193.79 L 521.71 194.76 L 522.39 195.44 L 522.33 196.76 L 522.33 196.76 L 520.54 196.92 L 520.02 197.25 L 519.91 197.7 L 519.97 198.65 L 520.57 199.78 L 520.5 201.97 L 522.12 203.55 L 522.41 204.09 L 522.35 206.36 L 521.61 208.12 L 517.72 211.99 L 516.75 212.27 L 514.46 213.6 L 513.92 214.47 L 511.95 216.18 L 509.33 217.45 L 509.33 217.45 L 508.88 218.61 L 507.38 220.91 L 506.33 221.58 L 505.54 221.4 L 503.54 221.78 L 503.65 224.18 L 501.79 225.98 L 501.47 225.93 L 500.85 225.31 L 498.69 225.3 L 497.87 226.28 L 497.1 226.64 L 494.37 226.98 L 492.86 228.32 L 492.04 229.54 L 490.34 229.64 L 488.86 230.28 L 485.86 230.39 L 485.04 230.11 L 484.85 229.83 L 484.98 229.17 L 483.27 228.19 L 481.94 227.8 L 480.55 228.35 L 478.42 228.78 L 478.1 228.6 L 477.69 227.67 L 476.19 227.21 L 474.24 227.23 L 471 228.88 L 470.94 229.81 L 473.18 234.25 L 473.3 235.4 L 473.01 237.97 L 472.76 238.88 L 472.04 239.74 L 469.09 244.79 L 466.12 247.21 L 464.77 247.63 L 463.29 247.1 L 461.95 246.93 L 459.75 247.68 L 458.58 248.57 L 457.91 249.44 L 456.77 249.82 L 456.02 251.27 L 455.69 251.48 L 453.58 251.3 L 451.78 251.82 L 447.6 249.97 L 445.83 247.48 L 445.3 245.27 L 444.64 244.23 L 443.2 242.89 L 440.87 242.91 L 440.87 242.91 L 437.93 242.7 L 437.93 242.7 L 437.98 240.78 L 438.24 239.72 L 439.39 237.27 L 439.52 230.91 L 440.28 229.51 L 440.31 229 L 438.58 225.94 L 438.11 222.75 L 437.41 220.81 L 438.14 218.81 L 439.84 217.41 L 441.04 214.93 L 441.17 213.42 L 441.51 212.59 L 441.81 212.38 L 443.25 209.64 L 443.88 207.32 L 444.27 204.35 L 445.25 201.37 L 447.38 199.42 L 450.1 198.66 L 452.71 198.35 L 453.78 197.98 L 455.48 196.45 L 456.53 196.41 L 457.87 195.89 L 460.73 193.32 L 463.07 192.41 L 465.08 190.41 L 465.71 189.54 L 465.71 189.08 L 467.61 187.16 L 468.11 186.94 L 468.95 186.7 L 469.18 187 L 470.3 186.74 L 471.3 186.14 L 472.76 185.95 L 473.77 186.16 L 476.28 187.98 L 477.79 187.88 L 480.23 187.02 L 481.06 186.98 L 481.71 187.26 L 483.99 186.97 L 485.2 185.66 L 485.7 184.2 L 485.82 182.99 L 486.11 182.55 L 486.5 180.35 L 486.37 179.5 L 486.2 179 L 484.59 178.09 L 482.81 176.06 L 482.3 173.76 L 482.19 171.65 L 482.36 169.17 L 486.46 164.74 L 486.67 164.19 L 486.77 161.76 L 486.22 158.78 L 484.64 155.98 L 485.78 153.11 L 486.06 151.64 L 485.68 150.37 L 484.45 149.53 L 484.1 147.61 L 484.87 146.56 L 485.51 146.39 L 486.33 144.41 L 488.22 142.56 L 489.1 140.73 L 489.06 138.94 L 491.98 135.53 L 492.79 135.69 L 496.1 135.23 L 500.23 131.26 L 502.02 128.99 L 502.41 127.46 L 501.77 126.93 L 501.55 126.21 L 502.01 124.77 L 502.01 124.77 L 502.74 124.89 L 504.21 125.76 L 504.72 126.27 L 504.59 126.58 z"},{code:"PR",name:"Paraná",gTransform:"matrix(1 0 0 1 47.59 157)",pathTransform:"translate(-353.59, -476.27)",d:"M 396.75 499.4 L 391.51 499.37 L 391.18 499.81 L 389.44 500.05 L 388.68 499.98 L 388.57 499.59 L 387 500.16 L 385.65 501.59 L 382.3 503.72 L 380.86 503.56 L 379.63 502.94 L 376.5 500.34 L 375.47 499.95 L 374.71 499.94 L 371.87 500.67 L 369.54 500.84 L 368.73 500.81 L 367.31 500.05 L 366.2 500.19 L 364.67 500.84 L 364.08 502.31 L 363.35 503.18 L 361.48 504.16 L 357.91 503.75 L 355.91 504.9 L 355.19 505.67 L 354.5 507.26 L 355.35 510.25 L 354.48 511.11 L 353.56 511.13 L 352.81 511.51 L 352.64 512 L 351.31 510.11 L 347.06 510.24 L 343.3 509.81 L 341.72 508.63 L 341.56 508.22 L 340.53 507.59 L 336.27 507.23 L 330.98 505.55 L 328.64 506.12 L 325.95 506.09 L 323.93 504.68 L 323.61 504.17 L 322.55 503.93 L 322.02 503.92 L 321.31 504.29 L 317.68 504.27 L 317.68 504.27 L 317.46 503.06 L 314.93 498.88 L 314.95 496.29 L 313.96 493.41 L 310.54 491.04 L 309.45 492.17 L 307.33 492.06 L 306.23 492.49 L 305.16 493.39 L 303.7 492.31 L 302.88 492.37 L 302.6 490.17 L 303.26 488.6 L 304.33 487.33 L 305.55 485.15 L 305.61 484.81 L 305.12 484.06 L 305.14 482.82 L 306.04 479.18 L 307.3 476.16 L 307.05 473.86 L 308.33 471.48 L 308.12 470.46 L 307.28 469.58 L 306.97 467.98 L 307.63 466.92 L 308.42 466.38 L 308.42 466.38 L 310.8 464.82 L 311.16 464 L 312.73 456.08 L 313.06 455.73 L 314.17 455.41 L 315.83 454.4 L 316.5 453.72 L 317.95 450.16 L 317.93 449.01 L 318.86 446.68 L 319.97 445.86 L 325.38 443.59 L 325.38 443.59 L 328.64 441.3 L 332.47 441.95 L 336.48 441.84 L 339.75 442.13 L 340.96 441.51 L 341.31 440.91 L 342.04 440.54 L 343.21 440.83 L 344.69 441.61 L 347.21 442.07 L 349.85 443.16 L 351.16 443.29 L 352.23 442.75 L 354.81 442.74 L 355.59 443.74 L 357.34 444.58 L 360.85 445.38 L 361.48 445.89 L 362.19 447.21 L 363.92 447.28 L 364.34 446.94 L 365.99 447.09 L 366.65 447.63 L 371.96 447.76 L 374.93 446.91 L 376.06 448.46 L 379.65 451.29 L 380.54 453.05 L 380.55 455.79 L 380.16 456.37 L 380 457.18 L 380.38 459.02 L 381.68 460.53 L 381.6 462.29 L 381.24 462.85 L 382.73 465.85 L 383.94 467 L 384.61 467.28 L 385.11 467.96 L 385.06 468.85 L 385.98 470.82 L 386.58 471.11 L 386.83 471.55 L 386.58 472.6 L 385.31 474.73 L 385.63 476.77 L 386.23 477.15 L 387.24 477.36 L 389.62 477.24 L 393.04 476.71 L 393.54 477.1 L 395.12 476.91 L 396.71 477.04 L 398.32 478.3 L 398.18 478.71 L 397.29 479.36 L 396.6 482.66 L 396.95 483.44 L 398.02 483.97 L 398.67 483.12 L 399.77 480.36 L 400.53 480.19 L 402.67 480.77 L 402.27 482.72 L 403 486.02 L 404.42 486.6 L 404.58 487.92 L 404.58 487.92 L 403.23 488.94 L 402.62 490.42 L 402.07 490.3 L 402.34 488.36 L 403.78 487.41 L 402.37 487.69 L 401.48 488.18 L 400.61 488.16 L 400.27 487.77 L 399.7 487.6 L 399.16 487.97 L 398.88 488.9 L 399.4 489.7 L 398.67 490.66 L 398.37 490.76 L 395.89 490.23 L 395.1 489.69 L 394.65 489.81 L 394.47 490.71 L 394.81 491.08 L 396.42 491.64 L 397.82 491.39 L 399.95 491.99 L 400.22 492.47 L 399.25 493.15 L 397.71 495.93 L 396.47 496.7 L 394.05 497.27 L 393.85 497.72 L 396.8 497.52 L 396.95 498.71 z"},{code:"RJ",name:"Rio de Janeiro",gTransform:"matrix(1 0 0 1 179.27 113.69)",pathTransform:"translate(-485.28, -432.95)",d:"M 468.35 450.28 L 468.28000000000003 449.5 L 468.66 449.23 L 471.85 449.45000000000005 L 474.44 448.86000000000007 L 471.91 447.31000000000006 L 470.51000000000005 446.81000000000006 L 467.70000000000005 447.49000000000007 L 466.34000000000003 449.0900000000001 L 465.31000000000006 449.4100000000001 L 464.61000000000007 449.36000000000007 L 463.26000000000005 447.2100000000001 L 462.78000000000003 447.2100000000001 L 461.88000000000005 447.6300000000001 L 460.9200000000001 448.6900000000001 L 457.7700000000001 449.4900000000001 L 457.4300000000001 450.40000000000015 L 457.2400000000001 452.3000000000001 L 459.4300000000001 452.4300000000001 L 460.5000000000001 453.4400000000001 L 459.35000000000014 454.5200000000001 L 458.41000000000014 454.3500000000001 L 456.9900000000001 454.5200000000001 L 456.9900000000001 454.5200000000001 L 456.5100000000001 454.2600000000001 L 454.8800000000001 452.5300000000001 L 454.8300000000001 452.12000000000006 L 455.9200000000001 448.62000000000006 L 457.01000000000005 447.4700000000001 L 459.36000000000007 446.4600000000001 L 459.86000000000007 446.61000000000007 L 462.63000000000005 446.25000000000006 L 464.13000000000005 445.5400000000001 L 465.78000000000003 443.3900000000001 L 465.03000000000003 441.7500000000001 L 463.33000000000004 441.7400000000001 L 460.18000000000006 442.2700000000001 L 458.4100000000001 441.8800000000001 L 457.18000000000006 440.29000000000013 L 456.62000000000006 439.1200000000001 L 455.3500000000001 438.5800000000001 L 455.3500000000001 438.5800000000001 L 456.0300000000001 438.0900000000001 L 458.4500000000001 437.3500000000001 L 461.3600000000001 436.0100000000001 L 463.9400000000001 435.8400000000001 L 464.4400000000001 436.11000000000007 L 466.16000000000014 435.3400000000001 L 467.21000000000015 434.5700000000001 L 471.3000000000001 432.7800000000001 L 471.8200000000001 432.7100000000001 L 472.1800000000001 433.0200000000001 L 475.3800000000001 432.9500000000001 L 476.6300000000001 432.7800000000001 L 478.2600000000001 431.8400000000001 L 478.8300000000001 431.7800000000001 L 481.36000000000007 432.05000000000007 L 481.8500000000001 432.2200000000001 L 481.8300000000001 432.6900000000001 L 483.2100000000001 432.4900000000001 L 492.7200000000001 427.96000000000015 L 495.25000000000006 426.97000000000014 L 495.46000000000004 426.45000000000016 L 495.18000000000006 425.84000000000015 L 493.74000000000007 425.71000000000015 L 493.83000000000004 424.96000000000015 L 495.72 421.25000000000017 L 498.08000000000004 415.21000000000015 L 497.35 414.50000000000017 L 497.91 414.01000000000016 L 499.15000000000003 413.7400000000002 L 501.68 411.38000000000017 L 501.68 411.38000000000017 L 503.61 412.14000000000016 L 504.28000000000003 416.85000000000014 L 506.78000000000003 417.98000000000013 L 511.11 418.9900000000001 L 514.1 418.6200000000001 L 515.72 419.6800000000001 L 515.72 419.6800000000001 L 515.64 420.9500000000001 L 514.6999999999999 422.5600000000001 L 514.4799999999999 424.6900000000001 L 515.6199999999999 431.4700000000001 L 515.1199999999999 432.1500000000001 L 512.0399999999998 433.9000000000001 L 506.0699999999998 435.8400000000001 L 503.23999999999984 437.5600000000001 L 499.73999999999984 441.2500000000001 L 499.6299999999998 442.91000000000014 L 499.9399999999998 444.10000000000014 L 499.74999999999983 445.72000000000014 L 499.0199999999998 447.20000000000016 L 497.1999999999998 447.71000000000015 L 490.6499999999998 447.54000000000013 L 484.8599999999998 448.2400000000001 L 482.4699999999998 447.78000000000014 L 481.9799999999998 447.40000000000015 L 481.9199999999998 446.72000000000014 L 482.94999999999976 445.2400000000001 L 483.6199999999998 443.79000000000013 L 483.5299999999998 443.17000000000013 L 482.74999999999983 442.9900000000001 L 479.9599999999998 444.1400000000001 L 479.6999999999998 444.8300000000001 L 480.0099999999998 445.6200000000001 L 481.3899999999998 446.79000000000013 L 481.6399999999998 447.76000000000016 L 481.04999999999984 448.28000000000014 L 479.41999999999985 448.79000000000013 L 477.84999999999985 448.76000000000016 L 469.80999999999983 449.83000000000015 L 468.35 450.28 z M 463.24 452.27 L 462.57 451.29999999999995 L 464.68 449.74999999999994 L 466.54 450.68999999999994 L 466.97 451.38999999999993 L 464.51000000000005 451.88999999999993 L 464.1 451.5399999999999 L 463.63 451.5399999999999 L 463.24 452.27 z"},{code:"RN",name:"Rio Grande do Norte",gTransform:"matrix(1 0 0 1 274.86 -145.63)",pathTransform:"translate(-580.87, -173.63)",d:"M 609.29 182.91 L 608.36 183.15 L 604.86 182.94 L 603.82 183.34 L 601.36 182.24 L 599.19 181.94 L 593.36 182.33 L 592.83 181.98 L 589.41 181.58 L 588.79 181.09 L 588.89 180.09 L 588.47 179.7 L 587.09 179.75 L 585.27 181.1 L 584.96 182.58 L 585.68 183.36 L 586.21 184.89 L 585.2 184.57 L 584.72 185.16 L 584.88 186.58 L 585.35 187.52 L 584.8 188.73 L 584.3 189.47 L 581.95 190.4 L 581.12 189.66 L 581.64 188.12 L 580.75 186.95 L 578.8 186.65 L 577.03 186.73 L 573.88 187.99 L 573.59 187.76 L 573.28 186.38 L 572.96 186.15 L 569.43 185.63 L 569.51 183.91 L 569.72 183.6 L 570.57 183.35 L 570.98 182.97 L 571.36 181.23 L 571.8 180.27 L 574.79 177.06 L 574.78 175.87 L 574.25 175.43 L 573.61 175.35 L 570.35 176.39 L 568.92 176.51 L 565.74 177.72 L 565.33 178.67 L 565.23 179.71 L 564.41 180.42 L 561.18 182.08 L 560.02 183.21 L 557.14 182.6 L 556.24 182.18 L 554.31 180.54 L 553.74 181 L 553.74 181 L 553.08 181.38 L 552.44 181.21 L 552.78 179.24 L 554.19 176.99 L 555.03 176.11 L 555.54 176.04 L 556.32 176.55 L 557.35 176.29 L 557.92 175.19 L 559.38 173.68 L 560.78 171.24 L 560.63 170.5 L 561.28 168.83 L 562.15 168.26 L 562.99 167.14 L 566.29 160.45 L 568.9 158.44 L 573.79 156.85 L 573.79 156.85 L 574.26 157.61 L 575.12 158.36 L 578.25 158.35 L 579.47 158.76 L 581.16 160.51 L 582.48 161.01 L 585.81 160.69 L 588.69 161.21 L 591.23 160.97 L 593.56 160.24 L 598.06 161.16 L 599.33 161.2 L 601.28 162.06 L 602.3 162.88 L 602.94 163.82 L 605.25 168.56 L 605.75 170.35 L 605.71 171.1 L 607.19 176.48 L 607.4 178.16 L 608.12 178.7 L 609.08 181.39 z"},{code:"RO",name:"Rondônia",gTransform:"matrix(1 0 0 1 -139.57 -68.08)",pathTransform:"translate(-166.43, -251.18)",d:"M 187.32 290.95 L 186.03 289.5 L 185.59 287.62 L 184.03 287.1 L 183.17 287.42 L 181.36 287.5 L 177.29 285.69 L 177.28 285.29 L 176.62 284.68 L 175.35 285.27 L 173.37 283.59 L 171.85 282.62 L 170.99 281.16 L 170.71 279.77 L 169.67 279.38 L 167.9 280.5 L 166.68 280.47 L 165.27 279.67 L 164.4 278.34 L 161.27 276.76 L 159.31 276.59 L 158.17 277.13 L 157.27 277.98 L 155.84 277.81 L 155.53 277.51 L 153.39 277 L 150.33 276.72 L 149.57 276.29 L 148.39 275.1 L 148.09 273.13 L 146.51 272.64 L 144.62 271.67 L 143.8 269.95 L 143.51 269.75 L 140.79 269.47 L 140.41 269.12 L 139.57 265.41 L 138.69 264.52 L 138.21 265.68 L 137.55 265.36 L 137.28 264.72 L 137.9 263.19 L 137.06 261.67 L 135.7 261.28 L 134.44 257.81 L 134.27 256.15 L 135.82 253.24 L 135.61 251.58 L 134.45 249.61 L 133.7 247.45 L 133.64 245.16 L 134.26 244.66 L 134.64 243.29 L 135.68 242.24 L 136.04 240.77 L 135.8 239.28 L 135.38 238.39 L 135.29 236.86 L 135.83 235.21 L 134.66 233.03 L 133.64 232.65 L 132.55 233.63 L 132.49 234.14 L 131.65 235.1 L 131.08 235.1 L 128.9 234.08 L 123.72 234.16 L 118.11 235.94 L 116.42 235.93 L 114.94 236.41 L 114.94 236.41 L 111.97 235.15 L 111.97 235.15 L 115.23 232.59 L 117.15 232.01 L 118.7 230.2 L 118.85 229.64 L 118.69 228.35 L 122.65 228.61 L 125.52 228.28 L 126.24 228.65 L 128.55 230.98 L 128.92 230.96 L 130.14 230.17 L 130.27 229.45 L 130.68 228.92 L 131.76 228.42 L 132.53 228.55 L 133.9 228.16 L 135.2 226.95 L 137.04 225.93 L 137.42 226.02 L 138.06 228.28 L 138.74 228.81 L 139.42 228.73 L 141.96 225.57 L 141.7 223.82 L 142.23 222.98 L 143.98 221.72 L 144.44 221.74 L 145.28 222.29 L 147.07 222.39 L 148.27 221.32 L 150.4 220.94 L 154.27 221.4 L 154.03 219.94 L 154.14 218.13 L 156.2 216.92 L 157.01 215.77 L 157.37 214.75 L 157.2 214.3 L 156.3 213.6 L 156.35 212.93 L 157.54 211.34 L 160.02 210.81 L 160.28 210.59 L 160.19 209.42 L 161.91 208.92 L 163.29 206.36 L 174.08 206.3 L 176.23 207.43 L 176.68 207.92 L 177.48 209.83 L 178.81 211.1 L 181.35 212.08 L 182.6 215.35 L 183.06 215.56 L 184.04 215.43 L 184.66 215.63 L 185.34 218.51 L 188.58 219.99 L 189.26 219.8 L 189.8 218.06 L 191.72 216.98 L 193.11 217.26 L 193.47 217.64 L 193.43 218.34 L 193.43 218.34 L 194.83 219.31 L 195.43 220.55 L 194.67 221.97 L 193.38 226.96 L 193.44 227.31 L 194.22 227.78 L 194.48 228.39 L 194.63 229.78 L 195.46 232.05 L 194.52 233.72 L 194.9 235.65 L 193.9 239.17 L 193.87 239.97 L 194.14 241.73 L 195.64 244.48 L 194.74 253.48 L 211.9 253.53 L 211.66 254.09 L 212.88 255.2 L 216.38 255.11 L 217.49 255.22 L 218.56 255.65 L 219.97 259.24 L 219.8 259.99 L 218.4 261.74 L 217.04 262.82 L 216.9 264.14 L 217.33 267.39 L 217.91 267.9 L 218.81 267.87 L 220.34 271.21 L 220.3 273.26 L 220.88 274.75 L 220.81 276.46 L 220.25 278.7 L 218.59 280.71 L 218.07 282.96 L 217.49 283.8 L 217.06 284.21 L 215.42 284.74 L 214.49 285.82 L 213.06 289.6 L 212.54 292.05 L 208.43 294.62 L 206.96 296.05 L 206.96 296.05 L 206.22 296.01 L 203.63 294.46 L 202.36 293.03 L 195.28 293.99 L 193.96 293.56 L 193.71 293.26 L 190.33 293.92 L 189.85 293.76 L 189.33 292.41 z"},{code:"RR",name:"Roraima",gTransform:"matrix(1 0 0 1 -116.08 -267.27)",pathTransform:"translate(-189.92, -51.99)",d:"M 234.61 61.4 L 236.21 78.37 L 236.21 78.37 L 217.72 78.3 L 217.75 78.98 L 215.42 82.24 L 213.76 85.27 L 213.69 86.4 L 212.54 89.04 L 212.43 89.7 L 212.66 90.43 L 213.8 91.84 L 213.78 92.37 L 213.36 92.76 L 211.33 93.31 L 209.92 94.72 L 208.67 95.18 L 206.85 94.95 L 205.93 92.44 L 204.06 90.4 L 201.23 89.47 L 199.63 89.53 L 199.08 90.42 L 196.99 91.13 L 195.71 91.82 L 194.69 93.08 L 193.87 96.05 L 194.24 97.85 L 193.99 99.58 L 193.24 101.87 L 193.68 103.98 L 191.32 102.94 L 189.98 103.36 L 189.45 103.29 L 188.41 101.25 L 186.93 99.6 L 184.97 98.29 L 184.45 98.25 L 179.44 93.83 L 179.58 92.69 L 181.42 93.02 L 182.56 91.7 L 182.62 91.12 L 181.49 86.79 L 180.91 85.89 L 179.69 85.05 L 178.81 82.88 L 178.52 77.9 L 179.09 76.94 L 179.86 73.9 L 179.2 72.32 L 178.84 70.73 L 180.46 69.27 L 180.41 68.82 L 179.54 67.7 L 179.35 65.44 L 177.69 60.68 L 174.96 56.94 L 175.67 55.44 L 176.58 52.12 L 176.09 51.46 L 174.14 50.51 L 172.78 50.4 L 171.9 50.61 L 170.93 50.24 L 169.72 49.07 L 169.66 48.11 L 169.03 48 L 167.9 48.42 L 167.29 48.41 L 166.54 48.07 L 165.82 47.29 L 165.82 47.29 L 166.12 46.83 L 166.35 44.55 L 166.05 44.33 L 162.68 44.1 L 158.93 44.24 L 155.62 43.54 L 155.42 42.94 L 156.22 41.18 L 156.34 39.7 L 155.61 37.93 L 153.67 34.39 L 152.94 32.33 L 152.47 28.61 L 153.26 27.13 L 153.18 26.17 L 151.34 24.17 L 149.18 23.11 L 146.37 20.33 L 145.31 18.52 L 145.02 17.56 L 143.88 16.91 L 143.63 16.52 L 143.66 15.68 L 143.95 15.35 L 144.85 15.42 L 145.97 16.08 L 146.91 17.81 L 147.52 17.9 L 150.91 17.4 L 152.26 17.5 L 154.17 18.09 L 154.78 19.29 L 155.33 21.22 L 155.87 21.57 L 156.83 21.49 L 157.57 20.84 L 158.52 20.44 L 161.7 20.6 L 162.17 20.65 L 163.48 21.86 L 164.08 22.01 L 164.6 21.87 L 165.21 20.31 L 166.52 20.45 L 167.97 21.38 L 171.9 25.95 L 172.95 26.52 L 173.66 26.63 L 175.17 25.95 L 175.91 24.82 L 176.01 23.98 L 175.18 21.22 L 175.54 19.48 L 176 19.2 L 177.93 19.15 L 178.94 18.05 L 180.49 16.96 L 181.24 17.01 L 185.14 18.35 L 185.73 18.18 L 186.53 17.46 L 187.56 17.16 L 188.69 17.51 L 189.72 17.3 L 191.06 16.02 L 192.06 15.77 L 193.21 16 L 194.32 15.93 L 195 15.08 L 195.05 13.73 L 198.08 11.92 L 200.41 12.11 L 203.17 11.72 L 204.06 10.59 L 204.15 9.88 L 204.74 8.76 L 205.49 8.63 L 207.34 7.73 L 208.44 6.69 L 209.55 4.98 L 208.35 1.42 L 207.18 1.06 L 207.82 0.88 L 209.25 0.95 L 210.05 1.27 L 213.62 1.17 L 214.68 0.22 L 215.42 0 L 216.79 0.42 L 217.32 1.73 L 218.36 2.53 L 218.84 3.9 L 218.17 8.8 L 217.45 10.18 L 216.2 10.88 L 216.26 11.71 L 217.87 12.12 L 219.49 11.9 L 221.84 12.71 L 223.66 13.81 L 222.78 15.24 L 222.77 16.39 L 225.11 19.81 L 225.31 21.36 L 223.8 24.28 L 221.92 25.69 L 221.2 27.19 L 221.47 27.58 L 221.53 29.75 L 220.06 32.16 L 219.16 34.93 L 218.85 37.5 L 218.76 40.17 L 219.74 42.04 L 220.25 43.8 L 220.24 45.2 L 221.81 46.23 L 222.71 46.43 L 222.84 47.11 L 222.38 52.26 L 222.5 53 L 224.31 53.29 L 223.65 54.46 L 224.11 54.96 L 226.26 55.7 L 227.72 57.62 L 230.38 60.36 z"},{code:"RS",name:"Rio Grande do Sul",gTransform:"matrix(1 0 0 1 11.62 259.25)",pathTransform:"translate(-317.63, -578.5)",d:"M 321.99 638.52 L 321.63 638.53 L 319.69 637.42 L 319.49 636.96 L 320.01 632.69 L 319.55 628.44 L 319.7 627.37 L 320.33 626.13 L 323.17 623.75 L 324 622.19 L 326.3 619.63 L 324.84 617.98 L 323.77 617.36 L 321.52 616.76 L 319.2 614.51 L 317.99 612.89 L 317.89 611.3 L 317.46 610.12 L 316.23 608.09 L 314.17 605.85 L 313.5 605.26 L 311.11 604.05 L 309.66 604.26 L 307.76 602.75 L 306.24 601.12 L 304.99 600.34 L 304.85 598.64 L 302.95 596.48 L 299.63 596.02 L 298.71 595.55 L 296.98 593.89 L 295.22 594.02 L 293.05 592.64 L 291.14 588.93 L 290.03 587.44 L 287.5 585.32 L 286.8 585.4 L 286.13 587.19 L 283.54 589.43 L 280.87 589.55 L 280.97 586.69 L 281.37 585.41 L 280.98 584.41 L 277.33 580.12 L 274.96 578.35 L 272.78 576.29 L 271.03 574.18 L 268.34 571.97 L 266.44 571.83 L 264.29 572.04 L 263.15 573.4 L 263.09 574.36 L 262.06 575.33 L 260.95 575.35 L 260.37 574.87 L 257.21 575.01 L 256.56 574.53 L 256.4 573.62 L 255.91 573.4 L 256.76 573.18 L 257.8 572.46 L 260.32 569.69 L 260.43 567.85 L 261.03 566.6 L 261.85 566.15 L 263.14 566.08 L 263.78 565.82 L 264.7 564.82 L 270.15 558.34 L 270.78 556.92 L 270.95 555.81 L 271.77 554.74 L 272.97 553.89 L 274.34 553.48 L 276.3 549.26 L 276.4 548.65 L 276.71 548.28 L 278.35 547.42 L 279.98 545.62 L 280.83 544.47 L 281.34 543.18 L 282.68 541.08 L 283.61 540.79 L 285.18 540.97 L 285.73 541.76 L 286.2 540.48 L 285.99 539.9 L 284.64 539.08 L 284.59 538.72 L 284.94 538.39 L 286.02 538.01 L 286.84 537.05 L 289.63 536.1 L 290.68 535.03 L 290.78 534.11 L 291.6 533.2 L 293.81 532.05 L 296.28 531.65 L 298.05 529.84 L 298.2 528.78 L 299.52 526.42 L 299.85 526.38 L 299.9 526.74 L 300.19 526.94 L 301.52 526.77 L 303.96 525.64 L 306.64 525.05 L 307.85 524.48 L 309.95 522.13 L 310.45 522.14 L 311.12 521.75 L 312.13 520.4 L 314.44 519.67 L 314.74 520.05 L 314.74 520.05 L 318.26 520.44 L 321.52 519.29 L 322.08 518.48 L 323.43 519.06 L 323.28 519.98 L 326.36 519.95 L 327.99 520.94 L 330.55 520.57 L 332.47 521.72 L 335.05 521.31 L 336.59 521.49 L 339.39 521.33 L 341.65 522.25 L 344.13 523.65 L 345.13 526.09 L 346.72 526.28 L 346.81 525.8 L 348.62 525.45 L 354.18 528.99 L 355.55 530.54 L 356.26 530.51 L 357.82 531.49 L 360.85 534.98 L 362.49 537.19 L 362.97 538.67 L 365.14 541.33 L 366.31 541.88 L 373 542.94 L 375.11 542.54 L 378.46 542.88 L 379.34 545.22 L 377.26 546.8 L 375.99 547.21 L 375.26 549.07 L 375.48 551.26 L 375.1 552.82 L 374.58 554.12 L 373.4 554.32 L 372.11 556.01 L 372.08 557.42 L 373.88 558.59 L 374.15 558.39 L 373.87 557.42 L 373.88 556.46 L 375.37 555.64 L 376.95 556.28 L 377.68 557.19 L 378.85 558.04 L 379.3 558.01 L 379.3 558.01 L 377.9 559.74 L 374 566.78 L 369.79 578.38 L 363.49 588.86 L 358.05 595.52 L 351.54 601.48 L 345.45 605.16 L 342.35 609.47 L 342.17 609.04 L 342.82 607.46 L 343.16 605.28 L 341.98 603.57 L 342.08 603.15 L 343.01 602.98 L 344.02 603.38 L 344.58 603.96 L 345.6 604 L 348.18 602.59 L 349 601.91 L 351.85 598.2 L 352.6 597.51 L 353.05 597.7 L 354.07 597.51 L 355.12 596.67 L 356.05 595.4 L 356.42 593.92 L 356.6 592.99 L 356.37 590.89 L 356.57 589.52 L 358.14 589.45 L 358.88 589.75 L 359.15 590.58 L 359.5 590.32 L 359.21 588.92 L 359.72 586.85 L 360.2 586.28 L 362.94 584.69 L 363.67 583.61 L 364.14 580.86 L 363.93 578.58 L 364.49 577.9 L 364.99 578.7 L 365.36 578.73 L 365.79 578.31 L 366.26 575.23 L 366.16 574.79 L 365.21 573.57 L 364.54 573.54 L 364.28 574.23 L 364.45 574.62 L 364.31 575.19 L 363.96 575.39 L 362.45 575.37 L 360.44 575.77 L 360.1 577.38 L 359.57 577.43 L 358.76 576.99 L 358.86 575.28 L 358.04 574.39 L 357 574.72 L 356.4 574.24 L 355.67 572.98 L 355.27 571.53 L 355.39 570.96 L 354.75 570.27 L 354.14 572.98 L 354.58 575.23 L 355.83 577.34 L 355.26 578.15 L 354.52 580.69 L 354.9 583.72 L 354.72 584.49 L 354.24 584.12 L 354.5 583.88 L 354.47 583.17 L 354 581.89 L 353.55 581.5 L 353.02 582.16 L 352.99 583.53 L 351.58 586.8 L 351.53 588.69 L 351.75 589.21 L 351.03 589.91 L 349.42 590.55 L 348.81 592.13 L 344.72 593.7 L 344 594.23 L 343.47 595.82 L 343.37 598.09 L 342.4 600.36 L 340.04 601.66 L 339.93 603.42 L 340.41 604.25 L 340.66 605.27 L 339.71 605.83 L 339.46 607.34 L 339.89 607.94 L 340.57 607.8 L 341.87 608.43 L 342.02 609.34 L 339.89 610.99 L 337.57 615.51 L 335.64 622.39 L 333.63 626.88 L 331.95 629.4 L 324.16 636.93 z"},{code:"SC",name:"Santa Catarina",gTransform:"matrix(1 0 0 1 51.41 209.71)",pathTransform:"translate(-357.4, -528.97)",d:"M 379.3 558.01 L 378.85 558.04 L 377.68 557.1899999999999 L 376.95 556.27 L 375.36 555.64 L 373.88 556.46 L 373.87 557.4200000000001 L 374.15 558.3900000000001 L 373.88 558.5900000000001 L 372.08 557.4200000000002 L 372.12 556.0100000000002 L 373.4 554.3200000000002 L 374.58 554.1200000000001 L 375.10999999999996 552.8100000000002 L 375.47999999999996 551.2600000000002 L 375.25999999999993 549.0700000000002 L 375.98999999999995 547.2100000000002 L 377.25999999999993 546.7900000000002 L 379.3399999999999 545.2100000000002 L 378.4599999999999 542.8700000000001 L 375.1099999999999 542.5300000000001 L 372.9999999999999 542.9300000000001 L 366.3099999999999 541.8700000000001 L 365.14999999999986 541.3300000000002 L 362.97999999999985 538.6700000000002 L 362.48999999999984 537.1900000000002 L 360.85999999999984 534.9800000000001 L 357.82999999999987 531.4900000000001 L 356.2599999999999 530.5000000000001 L 355.5499999999999 530.5300000000001 L 354.1799999999999 528.9800000000001 L 348.6199999999999 525.4400000000002 L 346.8099999999999 525.7800000000002 L 346.7199999999999 526.2600000000002 L 345.1199999999999 526.0700000000002 L 344.1199999999999 523.6300000000001 L 341.64999999999986 522.2400000000001 L 339.3799999999999 521.3100000000002 L 336.58999999999986 521.4700000000001 L 335.04999999999984 521.2900000000002 L 332.45999999999987 521.7000000000002 L 330.54999999999984 520.5500000000002 L 327.97999999999985 520.9100000000002 L 326.34999999999985 519.9300000000002 L 323.26999999999987 519.9600000000002 L 323.41999999999985 519.0300000000002 L 322.0699999999998 518.4500000000002 L 321.5099999999998 519.2600000000001 L 318.24999999999983 520.4200000000001 L 314.72999999999985 520.0300000000001 L 314.72999999999985 520.0300000000001 L 316.17999999999984 517.1000000000001 L 316.90999999999985 515.0100000000001 L 316.32999999999987 511.7600000000001 L 316.7399999999999 508.5500000000001 L 316.6999999999999 506.0000000000001 L 317.65999999999985 504.2500000000001 L 317.65999999999985 504.2500000000001 L 321.28999999999985 504.2700000000001 L 321.99999999999983 503.8900000000001 L 322.5299999999998 503.9000000000001 L 323.5899999999998 504.1400000000001 L 323.8999999999998 504.6500000000001 L 325.9299999999998 506.0600000000001 L 328.6099999999998 506.0900000000001 L 330.94999999999976 505.5100000000001 L 336.2399999999998 507.1900000000001 L 340.4999999999998 507.5500000000001 L 341.51999999999975 508.1800000000001 L 341.68999999999977 508.59000000000015 L 343.25999999999976 509.77000000000015 L 347.02999999999975 510.19000000000017 L 351.27999999999975 510.0600000000002 L 352.60999999999973 511.96000000000015 L 352.78999999999974 511.46000000000015 L 353.52999999999975 511.08000000000015 L 354.44999999999976 511.0600000000002 L 355.31999999999977 510.20000000000016 L 354.46999999999974 507.21000000000015 L 355.15999999999974 505.63000000000017 L 355.87999999999977 504.8500000000002 L 357.87999999999977 503.7100000000002 L 361.44999999999976 504.1100000000002 L 363.31999999999977 503.14000000000016 L 364.0499999999998 502.27000000000015 L 364.63999999999976 500.79000000000013 L 366.16999999999973 500.14000000000016 L 367.27999999999975 500.00000000000017 L 368.69999999999976 500.76000000000016 L 369.50999999999976 500.79000000000013 L 371.83999999999975 500.6200000000001 L 374.6799999999997 499.8900000000001 L 375.4299999999997 499.9000000000001 L 376.46999999999974 500.30000000000007 L 379.58999999999975 502.9000000000001 L 380.81999999999977 503.5200000000001 L 382.25999999999976 503.6800000000001 L 385.6099999999998 501.5500000000001 L 386.9599999999998 500.1200000000001 L 388.5199999999998 499.5500000000001 L 388.6399999999998 499.9400000000001 L 389.3999999999998 500.0100000000001 L 391.1399999999998 499.7800000000001 L 391.4699999999998 499.3400000000001 L 396.7099999999998 499.37000000000006 L 396.7099999999998 499.37000000000006 L 396.3199999999998 500.69000000000005 L 396.8299999999998 502.34000000000003 L 396.7599999999998 502.73 L 395.2599999999998 503.87 L 394.2799999999998 503.39 L 393.4599999999998 500.86 L 393.4399999999998 501.98 L 394.0299999999998 504.70000000000005 L 395.7399999999998 506.36000000000007 L 396.2999999999998 507.31000000000006 L 395.2899999999998 509.6000000000001 L 395.12999999999977 511.9200000000001 L 395.2299999999998 512.35 L 395.9899999999998 513.08 L 396.2499999999998 518.94 L 396.5599999999998 519.49 L 396.9899999999998 519.69 L 397.75999999999976 519.1800000000001 L 398.1099999999998 519.9000000000001 L 398.2099999999998 520.7700000000001 L 397.7399999999998 520.83 L 397.3099999999998 520.5500000000001 L 396.1199999999998 521.1800000000001 L 395.7799999999998 525.0200000000001 L 396.3499999999998 527.6100000000001 L 395.7799999999998 528.3600000000001 L 396.0899999999998 530.2900000000001 L 396.99999999999983 532.1700000000001 L 396.1399999999998 534.5100000000001 L 395.61999999999983 538.5200000000001 L 393.90999999999985 543.2 L 393.5699999999999 543.1 L 393.20999999999987 542.34 L 393.41999999999985 541.37 L 392.49999999999983 540.19 L 392.23999999999984 540.5200000000001 L 392.41999999999985 542.95 L 393.57999999999987 543.7800000000001 L 392.65999999999985 545.44 L 391.01999999999987 546.09 L 386.8899999999999 549.13 L 384.08999999999986 551.6899999999999 L 380.33999999999986 556.13 L 379.3 558.01 z M 397.18 531.46 L 397.03000000000003 530.99 L 397.28000000000003 529.24 L 398.04 526.84 L 397.64000000000004 525.6600000000001 L 397.80000000000007 524.6400000000001 L 399.20000000000005 523.8800000000001 L 399.4200000000001 523.94 L 400.0800000000001 524.8800000000001 L 399.5400000000001 527.44 L 398.7200000000001 528.3000000000001 L 398.1300000000001 529.5200000000001 L 398.3300000000001 530.69 L 397.18 531.46 z M 396.73 507.09 L 394.86 505.07 L 397.41 502.63 L 397.66 502.67 L 398.31 503.72 L 397.45 505.04 L 396.73 507.09 z"},{code:"SE",name:"Sergipe",gTransform:"matrix(1 0 0 1 266.49 -72.82)",pathTransform:"translate(-572.49, -246.44)",d:"M 569.94 261.69 L 567.04 262.58 L 565.49 261.94 L 564.95 261.6 L 564.47 260.88 L 562.55 259.96 L 561.95 259.44 L 561.83 259.03 L 562.17 258.64 L 562.3 257.22 L 562.15 256.83 L 560.72 255.32 L 560.2 253.83 L 559.11 253.16 L 558.15 251.56 L 558.13 250.79 L 558.72 249.21 L 559.04 248.91 L 560.74 248.92 L 561.87 249.67 L 564.42 248.68 L 565.11 248.13 L 565.41 247.55 L 564.65 244.8 L 564.73 243.92 L 565.39 242.3 L 565.47 239.19 L 564.72 238.04 L 562.73 236.09 L 561.46 233.59 L 561.24 231.45 L 561.91 230.3 L 561.91 230.3 L 568.37 233.28 L 572.05 234.23 L 577.47 237.3 L 578.77 239.75 L 580.53 241.2 L 582.19 241.99 L 582.65 242.02 L 586.24 244.25 L 586.84 245.56 L 586.84 245.56 L 584.46 246.32 L 579.89 249.26 L 578.92 250.15 L 577.37 252.36 L 577.05 252.34 L 577.16 251.24 L 576.11 249.42 L 575.12 249.58 L 575.46 250.74 L 576.7 250.74 L 576.93 250.98 L 576.41 252.95 L 575.14 255.04 L 574.61 254.69 L 574.24 254.02 L 573.25 253.86 L 573.45 254.54 L 574.58 255.16 L 574.32 256.93 L 573.46 258.08 L 572.53 260.11 L 571.75 260.26 L 571.45 259.8 L 571.93 258.4 L 572.34 258.27 L 572.65 257.84 L 573.02 256.8 L 572.21 256.43 L 572.31 257.11 L 571.86 258.24 L 571.38 258.74 L 571.12 259.83 L 571.4 260.55 L 571.14 261.07 z"},{code:"SP",name:"São Paulo",gTransform:"matrix(1 0 0 1 89.6 122.15)",pathTransform:"translate(-395.6, -441.42)",d:"M 404.58 487.92 L 404.41999999999996 486.59000000000003 L 402.99999999999994 486.02000000000004 L 402.2699999999999 482.72 L 402.6699999999999 480.77000000000004 L 400.5299999999999 480.19000000000005 L 399.7699999999999 480.36000000000007 L 398.6699999999999 483.13000000000005 L 398.0099999999999 483.9800000000001 L 396.9499999999999 483.4500000000001 L 396.59999999999985 482.67000000000013 L 397.28999999999985 479.3700000000001 L 398.17999999999984 478.7100000000001 L 398.3199999999998 478.3100000000001 L 396.7099999999998 477.04000000000013 L 395.11999999999983 476.91000000000014 L 393.53999999999985 477.10000000000014 L 393.03999999999985 476.72000000000014 L 389.6299999999998 477.2500000000001 L 387.24999999999983 477.3700000000001 L 386.23999999999984 477.16000000000014 L 385.6399999999998 476.77000000000015 L 385.30999999999983 474.73000000000013 L 386.5899999999998 472.6100000000001 L 386.8399999999998 471.5600000000001 L 386.5899999999998 471.1200000000001 L 385.9899999999998 470.8200000000001 L 385.06999999999977 468.8500000000001 L 385.12999999999977 467.9600000000001 L 384.62999999999977 467.2800000000001 L 383.95999999999975 466.99000000000007 L 382.7499999999998 465.8500000000001 L 381.25999999999976 462.8400000000001 L 381.6199999999998 462.2900000000001 L 381.69999999999976 460.5300000000001 L 380.39999999999975 459.0100000000001 L 380.01999999999975 457.17000000000013 L 380.18999999999977 456.3600000000001 L 380.57999999999976 455.78000000000014 L 380.5599999999998 453.04000000000013 L 379.6699999999998 451.28000000000014 L 376.0799999999998 448.45000000000016 L 374.9499999999998 446.90000000000015 L 371.9799999999998 447.76000000000016 L 366.6699999999998 447.63000000000017 L 366.00999999999976 447.09000000000015 L 364.3599999999998 446.95000000000016 L 363.93999999999977 447.29000000000013 L 362.21999999999974 447.22000000000014 L 361.4999999999997 445.90000000000015 L 360.8699999999997 445.39000000000016 L 357.35999999999973 444.59000000000015 L 355.60999999999973 443.75000000000017 L 354.82999999999976 442.75000000000017 L 352.2499999999998 442.76000000000016 L 351.1799999999998 443.3000000000002 L 349.8599999999998 443.1700000000002 L 347.2199999999998 442.0800000000002 L 344.6899999999998 441.62000000000023 L 343.2099999999998 440.8300000000002 L 342.0399999999998 440.5400000000002 L 341.3099999999998 440.9100000000002 L 340.9699999999998 441.5100000000002 L 339.7599999999998 442.1300000000002 L 336.47999999999985 441.8400000000002 L 332.46999999999986 441.9500000000002 L 328.6399999999999 441.30000000000024 L 325.3899999999999 443.59000000000026 L 325.3899999999999 443.59000000000026 L 326.22999999999985 442.5100000000003 L 326.95999999999987 440.97000000000025 L 328.21999999999986 439.83000000000027 L 335.77999999999986 435.29000000000025 L 337.72999999999985 433.42000000000024 L 338.98999999999984 430.99000000000024 L 340.71999999999986 429.30000000000024 L 341.11999999999983 428.09000000000026 L 342.55999999999983 427.0600000000003 L 342.8399999999998 425.84000000000026 L 342.4899999999998 425.0000000000003 L 344.4899999999998 422.7400000000003 L 345.69999999999976 420.4000000000003 L 345.76999999999975 419.4600000000003 L 345.45999999999975 417.5300000000003 L 345.68999999999977 417.1400000000003 L 346.64999999999975 416.62000000000035 L 349.2499999999998 412.98000000000036 L 349.4099999999998 410.05000000000035 L 350.0299999999998 408.37000000000035 L 351.0399999999998 408.07000000000033 L 351.7699999999998 407.43000000000035 L 353.7599999999998 404.75000000000034 L 354.97999999999985 403.73000000000036 L 355.4499999999999 403.50000000000034 L 356.7599999999999 403.4600000000003 L 358.2599999999999 402.68000000000035 L 358.53999999999985 402.28000000000037 L 358.9399999999998 399.8200000000004 L 358.9399999999998 399.8200000000004 L 360.15999999999985 398.6900000000004 L 362.30999999999983 397.5800000000004 L 364.22999999999985 397.2100000000004 L 365.65999999999985 395.5200000000004 L 367.15999999999985 394.91000000000037 L 367.90999999999985 395.05000000000035 L 369.6399999999999 396.60000000000036 L 372.1899999999999 396.68000000000035 L 376.4799999999999 397.6400000000003 L 378.1499999999999 397.2800000000003 L 379.7699999999999 397.50000000000034 L 381.7699999999999 396.91000000000037 L 383.94999999999993 398.3300000000004 L 385.61999999999995 399.1200000000004 L 385.48999999999995 400.0400000000004 L 385.81999999999994 401.46000000000043 L 387.0299999999999 403.5500000000004 L 387.6599999999999 403.5800000000004 L 388.19999999999993 403.2600000000004 L 388.86999999999995 402.3200000000004 L 389.28 401.1900000000004 L 389.53999999999996 401.0000000000004 L 390.09 401.0500000000004 L 390.45 401.4400000000004 L 390.7 402.4000000000004 L 390.71 405.18000000000035 L 391.90999999999997 405.7100000000003 L 392.32 405.26000000000033 L 392.05 402.7200000000003 L 392.54 401.5300000000003 L 392.99 401.0500000000003 L 401.17 400.3800000000003 L 402.18 399.1300000000003 L 403.68 400.59000000000026 L 404.8 401.02000000000027 L 407.58 400.33000000000027 L 408.02 399.34000000000026 L 407.82 398.8800000000003 L 408.13 398.27000000000027 L 410.51 398.16000000000025 L 412.17 398.9400000000002 L 413.02000000000004 398.30000000000024 L 414.33000000000004 398.0100000000002 L 417.59000000000003 401.36000000000024 L 417.79 402.40000000000026 L 417.22 403.41000000000025 L 416.93 405.78000000000026 L 417.51 406.39000000000027 L 419.4 407.60000000000025 L 419.79999999999995 409.15000000000026 L 419.73999999999995 409.71000000000026 L 418.21999999999997 411.74000000000024 L 418.03999999999996 413.68000000000023 L 418.83 414.42000000000024 L 419.14 415.03000000000026 L 419.51 417.24000000000024 L 420.81 419.04000000000025 L 421.64 421.03000000000026 L 421.61 421.8800000000003 L 423.22 421.83000000000027 L 424 421.52000000000027 L 424.28 421.16000000000025 L 425.28 421.11000000000024 L 428.97999999999996 422.43000000000023 L 429.21 422.80000000000024 L 429.15999999999997 424.0700000000002 L 428.46 426.2500000000002 L 426.59999999999997 428.97000000000025 L 426.85999999999996 431.91000000000025 L 426.66999999999996 435.36000000000024 L 426.14 436.92000000000024 L 426.86 438.52000000000027 L 428.64 439.7600000000003 L 430.45 440.59000000000026 L 430.96 442.3100000000003 L 429.75 443.0100000000003 L 431.77 446.3200000000003 L 432.9 446.5700000000003 L 434.90999999999997 446.33000000000027 L 435.09 446.86000000000024 L 438.71 445.86000000000024 L 439.27 446.28000000000026 L 440.58 445.96000000000026 L 441.33 444.98000000000025 L 441.38 444.14000000000027 L 441.14 443.90000000000026 L 441.31 441.60000000000025 L 442.5 441.27000000000027 L 442.59 441.6200000000003 L 442.23999999999995 442.1100000000003 L 442.24999999999994 442.5900000000003 L 444.5899999999999 442.6700000000003 L 446.9799999999999 442.4200000000003 L 448.7699999999999 441.7500000000003 L 449.99999999999994 440.5100000000003 L 451.92999999999995 439.4900000000003 L 454.13999999999993 439.27000000000027 L 455.37999999999994 438.54000000000025 L 455.37999999999994 438.54000000000025 L 456.6499999999999 439.08000000000027 L 457.2099999999999 440.2500000000003 L 458.43999999999994 441.84000000000026 L 460.2099999999999 442.23000000000025 L 463.3599999999999 441.7000000000003 L 465.0599999999999 441.71000000000026 L 465.8099999999999 443.35000000000025 L 464.1599999999999 445.5000000000002 L 462.6599999999999 446.2100000000002 L 459.88999999999993 446.5700000000002 L 459.38999999999993 446.42000000000024 L 457.0399999999999 447.43000000000023 L 455.94999999999993 448.5800000000002 L 454.85999999999996 452.0800000000002 L 454.90999999999997 452.49000000000024 L 456.53999999999996 454.22000000000025 L 457.02 454.48000000000025 L 457.02 454.48000000000025 L 456.96 454.68000000000023 L 455.27 455.10000000000025 L 454.21 454.28000000000026 L 452.72999999999996 455.39000000000027 L 452.29999999999995 456.04000000000025 L 452.56999999999994 456.2600000000003 L 451.80999999999995 456.90000000000026 L 448.5899999999999 458.4500000000003 L 446.3399999999999 459.15000000000026 L 446.05999999999995 459.59000000000026 L 446.09999999999997 460.55000000000024 L 446.59999999999997 462.10000000000025 L 446.28 462.52000000000027 L 444.88 462.78000000000026 L 444.18 462.14000000000027 L 442.84000000000003 461.85000000000025 L 439.72 461.35000000000025 L 438.86 461.5000000000002 L 437.54 461.8400000000002 L 435.81 462.6600000000002 L 435.31 463.1700000000002 L 434.1 465.32000000000016 L 432.79 465.89000000000016 L 432.29 465.77000000000015 L 432.87 465.3000000000001 L 432.39 464.0800000000001 L 431.21999999999997 463.2300000000001 L 430.39 464.4600000000001 L 430.65 465.2100000000001 L 430.34999999999997 465.8200000000001 L 422.72999999999996 470.0600000000001 L 421.78 470.8800000000001 L 421.46999999999997 472.04000000000013 L 418.2 475.04000000000013 L 414.95 476.9900000000001 L 413.03 477.5200000000001 L 408.53 480.7300000000001 L 406.2 482.69000000000005 L 405.53 482.77000000000004 L 405.09 483.39000000000004 L 405.98999999999995 483.82000000000005 L 406.65 483.88000000000005 L 407.58 483.52000000000004 L 407.58 484.28000000000003 L 406.96 485.59000000000003 L 405.64 486.44000000000005 L 404.58 487.92 z M 448.89 464.91 L 447.34999999999997 464.26000000000005 L 446.18999999999994 464.44000000000005 L 445.69999999999993 464.06000000000006 L 445.79999999999995 463.2800000000001 L 446.74999999999994 462.6300000000001 L 447.8399999999999 460.7800000000001 L 448.55999999999995 461.0300000000001 L 449.21999999999997 461.68000000000006 L 449.34999999999997 464.5900000000001 L 448.89 464.91 z"},{code:"TO",name:"Tocantins",gTransform:"matrix(1 0 0 1 95.98 -93.17)",pathTransform:"translate(-401.98, -226.09)",d:"M 433.35 281.82 L 427.99 283.24 L 426.25 284.58 L 423.69 285.68 L 422.14 285.68 L 417.61 286.68 L 415.09 288.76 L 413.31 289.66 L 412.85 289.42 L 411.34 286.8 L 410.79 286.77 L 410.28 290.07 L 409.59 290.15 L 406.24 289.47 L 403.11 288 L 403.67 286.44 L 403.45 285.7 L 398.92 286.23 L 396.16 285.89 L 395.6 286.43 L 395.3 287.43 L 394.55 288.18 L 393.41 288.13 L 392.8 285.03 L 391.69 281.32 L 390.65 279.44 L 389.5 278.13 L 388.32 279.1 L 386.85 281.49 L 385.22 287.43 L 384.59 287.66 L 380.52 286.23 L 377.43 284.52 L 373.5 284.12 L 371.3 283.09 L 368.9 282.69 L 369.42 280.35 L 370.64 278.47 L 370.67 276.76 L 370.11 277.06 L 368.3 279.15 L 367.64 280.38 L 367.44 282.26 L 367.1 282.71 L 367.1 282.71 L 366.3 282.69 L 365.34 282.18 L 364.36 278.84 L 365.1 276.08 L 364.66 273.03 L 364.14 272.45 L 364.13 270.88 L 364.6 267.57 L 363.5 265.32 L 363.55 264.82 L 364.37 263.93 L 364.53 263.06 L 363.14 261.72 L 363.08 260.86 L 364.96 254.87 L 365 251.92 L 365.54 248.95 L 367.48 243.66 L 367.85 243.39 L 368.28 242.54 L 368.72 239.4 L 369.82 238.15 L 370.38 236.26 L 371.03 235.24 L 371.03 235.24 L 372.65 231.55 L 373.78 227.1 L 374.93 225.52 L 376.12 224.42 L 377.33 222.74 L 378.36 220.82 L 379.73 219.9 L 380.78 219.74 L 381.51 218.89 L 382.45 217.35 L 382.63 216.36 L 384.33 213.12 L 385.42 212.32 L 387.18 207.17 L 387.84 203.13 L 387.69 202.83 L 386.95 202.51 L 385.28 200.77 L 384.68 199.82 L 384.52 198.94 L 384.66 198.37 L 386.07 196.68 L 387.36 194.58 L 387.3 191.91 L 386.87 189.73 L 387.06 189.38 L 389.53 187.6 L 392.94 186.46 L 395.44 185.25 L 395.68 184.75 L 395.53 183.24 L 396.39 181.97 L 397.9 180.63 L 399.19 180.48 L 399.38 179.14 L 399.09 177.94 L 399.34 177.48 L 400.8 177.02 L 401.44 176.54 L 402.37 173.79 L 401.35 172.45 L 401.26 171.05 L 401.55 170.77 L 402.52 170.69 L 403.24 170.32 L 403.61 169.66 L 403.64 169.02 L 402.38 167.85 L 401.51 167.71 L 401.12 167.4 L 400.1 165.74 L 398.81 165.62 L 396.94 165.87 L 394.65 165.06 L 394.65 165.06 L 395.18 164.42 L 397.8 162.57 L 399.76 162.04 L 400.63 162.09 L 403.41 163.61 L 404.81 163.69 L 405.76 163.17 L 407.5 163.46 L 408.09 164.15 L 408.17 165.18 L 408.45 165.5 L 409.67 165.53 L 413.07 166.96 L 413.91 167.99 L 414.38 171.49 L 415.02 172.99 L 414.81 176.71 L 415.04 177.79 L 415.71 178.92 L 415.7 179.36 L 413.93 185.51 L 413.62 187.88 L 413.9 188.88 L 413.65 190.47 L 411.9 192.51 L 410.14 193.18 L 409.96 193.89 L 411.9 195.21 L 412.32 194.94 L 413.69 195.18 L 413.94 195.53 L 414.05 196.41 L 413.43 197.6 L 414.28 199.04 L 415.16 198.97 L 418.16 203.13 L 419.07 203.98 L 421.35 207 L 423.49 205.66 L 427.76 204.72 L 429.56 205.94 L 429.64 207.69 L 429 210.94 L 429.39 212.29 L 426 212.64 L 424.66 213.18 L 424.09 213.73 L 423.41 215.16 L 422.68 217.84 L 423.05 219.14 L 420.42 221.69 L 420.16 222.39 L 420.36 222.81 L 422.44 223.1 L 423.38 223.79 L 424.12 225.38 L 424.18 227.04 L 424.8 228.08 L 428.68 230.03 L 428.77 230.56 L 427.13 232.37 L 427.26 234.02 L 429.4 235.64 L 430.39 238.51 L 431.73 240.51 L 432.44 240.69 L 434.22 240.48 L 435.22 240.78 L 436.04 241.22 L 436.65 242.04 L 437.93 242.7 L 437.93 242.7 L 440.87 242.91 L 440.87 242.91 L 440.18 243.56 L 439.96 244.54 L 439.4 245.01 L 435.58 247.03 L 432.37 249.65 L 432.18 250.02 L 433.47 251.82 L 433.11 252.21 L 432.1 252.48 L 431.2 253.09 L 429.68 256.58 L 428.67 257.3 L 428.17 258.46 L 428.4 259.38 L 430.26 261.33 L 433.85 262 L 435.72 262.99 L 435.77 263.75 L 435.21 264.2 L 433.17 265.01 L 432.74 265.97 L 432.83 266.47 L 433.18 266.8 L 434.21 266.62 L 435.13 266.91 L 435.71 267.42 L 436 268.06 L 435.04 268.77 L 433.89 269.19 L 431.94 270.86 L 431.75 271.71 L 431.7 274.63 L 432.05 275.88 L 432.99 276.54 L 434.04 276.78 L 434.45 277.03 L 434.62 277.45 L 434.67 278.51 L 433.31 280.89 z"}];function jne({selected:t,onSelect:e}){const s=ce(),[n,i]=A.useState(wne),r=l=>{if(l)try{const a=l.getBBox();if(!a.width||!a.height)return;const c=Math.max(a.width,a.height)*.04,d=`${a.x-c} ${a.y-c} ${a.width+c*2} ${a.height+c*2}`;i(u=>u===d?u:d)}catch{}};return o.jsx("svg",{ref:r,viewBox:n,role:"group","aria-label":s("sectionsEditor.brazilMap.ariaLabel"),className:"h-72 w-full rounded-md border border-border/60 bg-muted/20",children:o.jsx("g",{transform:kne,children:K3.map(l=>{const a=l.code===t;return o.jsx("g",{transform:l.gTransform,children:o.jsx("path",{d:l.d,transform:l.pathTransform,role:"button",tabIndex:0,"aria-label":l.name,"aria-pressed":a,onClick:()=>e(l.code),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),e(l.code))},className:ae("cursor-pointer stroke-background outline-none transition-colors [stroke-width:1] [vector-effect:non-scaling-stroke]","hover:fill-primary/50 focus-visible:fill-primary/50",a?"fill-primary":"fill-muted-foreground/40")})},l.code)})})})}const Cne=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Åland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua & Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia & Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"VG",name:"British Virgin Islands"},{code:"BN",name:"Brunei"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"BQ",name:"Caribbean Netherlands"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"IO",name:"Chagos Archipelago"},{code:"CL",name:"Chile"},{code:"CN",name:"China mainland"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo - Brazzaville"},{code:"CD",name:"Congo - Kinshasa"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Côte d’Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CW",name:"Curaçao"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"SZ",name:"Eswatini"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard & McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia"},{code:"MD",name:"Moldova"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar (Burma)"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"KP",name:"North Korea"},{code:"MK",name:"North Macedonia"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PS",name:"Palestinian Territories"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn Islands"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"São Tomé & Príncipe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"GS",name:"So. Georgia & So. Sandwich Isl."},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"KR",name:"South Korea"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"BL",name:"St. Barthélemy"},{code:"SH",name:"St. Helena"},{code:"KN",name:"St. Kitts & Nevis"},{code:"LC",name:"St. Lucia"},{code:"MF",name:"St. Martin"},{code:"PM",name:"St. Pierre & Miquelon"},{code:"VC",name:"St. Vincent & Grenadines"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard & Jan Mayen"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"T1",name:"Tor network (Cloudflare)"},{code:"TT",name:"Trinidad & Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Türkiye"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks & Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UM",name:"U.S. Outlying Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"XX",name:"Unknown (Cloudflare could not determine)"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VA",name:"Vatican City"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"WF",name:"Wallis & Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],Nne="BR";function Vne(t){if(!t)return!1;const e=Object.keys(t).sort();return e.length===3&&e[0]==="city"&&e[1]==="country"&&e[2]==="regionCode"}function Tne(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return{city:typeof e.city=="string"?e.city:"",regionCode:typeof e.regionCode=="string"?e.regionCode:"",country:typeof e.country=="string"?e.country:""}}function Ane(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function Vb(t){const e=U.c(37),{id:s,options:n,value:i,placeholder:r,emptyMessage:l,onChange:a}=t,[c,d]=A.useState(!1);let u;if(e[0]!==n||e[1]!==i){let w;e[3]!==i?(w=k=>k.value===i,e[3]=i,e[4]=w):w=e[4],u=n.find(w),e[0]=n,e[1]=i,e[2]=u}else u=e[2];const h=u;let f;e[5]!==r||e[6]!==h?(f=h?o.jsx("span",{className:"truncate",children:h.label}):o.jsx("span",{className:"text-muted-foreground",children:r}),e[5]=r,e[6]=h,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(s9,{className:"size-4 shrink-0 opacity-50"}),e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==c||e[11]!==f?(p=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,m]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==r?(x=o.jsx(ui,{placeholder:r,className:"h-9"}),e[14]=r,e[15]=x):x=e[15];let b;e[16]!==l?(b=o.jsx(Bn,{children:l}),e[16]=l,e[17]=b):b=e[17];let y;if(e[18]!==a||e[19]!==n||e[20]!==i){let w;e[22]!==a||e[23]!==i?(w=k=>o.jsxs(us,{value:`${k.label} ${k.value}`,onSelect:()=>{a(k.value===i?"":k.value),d(!1)},children:[o.jsx("span",{className:"truncate",children:k.label}),o.jsx(zt,{className:ae("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=a,e[23]=i,e[24]=w):w=e[24],y=n.map(w),e[18]=a,e[19]=n,e[20]=i,e[21]=y}else y=e[21];let _;e[25]!==y?(_=o.jsx(Es,{children:y}),e[25]=y,e[26]=_):_=e[26];let L;e[27]!==b||e[28]!==_?(L=o.jsxs(hi,{children:[b,_]}),e[27]=b,e[28]=_,e[29]=L):L=e[29];let v;e[30]!==L||e[31]!==x?(v=o.jsx(hs,{className:"p-0",style:g,children:o.jsxs(Di,{children:[x,L]})}),e[30]=L,e[31]=x,e[32]=v):v=e[32];let S;return e[33]!==c||e[34]!==v||e[35]!==p?(S=o.jsxs(fs,{open:c,onOpenChange:d,children:[p,v]}),e[33]=c,e[34]=v,e[35]=p,e[36]=S):S=e[36],S}const Pne=Cne.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),Ene=K3.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function gk(t){const e=U.c(66),{schema:s,value:n,onChange:i,path:r,sandbox:l}=t,a=ce();let c;e[0]!==n?(c=Tne(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:u,regionCode:h,country:f}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==a?(g=p.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==a?(b=p.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const y=b;let _;e[10]!==p.city?.title||e[11]!==a?(_=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=_):_=e[12];const L=_;let v;e[13]!==d||e[14]!==i?(v=j=>{i(Ane(d,j))},e[13]=d,e[14]=i,e[15]=v):v=e[15];const S=v,w=f===Nne;let k;if(e[16]!==u||e[17]!==L||e[18]!==f||e[19]!==x||e[20]!==S||e[21]!==w||e[22]!==r||e[23]!==h||e[24]!==y||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==h?(j=z=>z.code===h,e[30]=h,e[31]=j):j=e[31];const C=K3.find(j),V=`${r}.country`;let N;e[32]!==s.title||e[33]!==a?(N=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=N):N=e[34];const T=l?.virtualMcpId;let P;e[35]!==s.description||e[36]!==N||e[37]!==T||e[38]!==V?(P=o.jsx(Hs,{htmlFor:V,label:N,description:s.description,virtualMcpId:T}),e[35]=s.description,e[36]=N,e[37]=T,e[38]=V,e[39]=P):P=e[39];const E=`${r}.country`;let R;e[40]!==x||e[41]!==E?(R=o.jsx(Mt,{htmlFor:E,className:"text-xs",children:x}),e[40]=x,e[41]=E,e[42]=R):R=e[42];const M=`${r}.country`;let I;e[43]!==a?(I=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=I):I=e[44];let D;e[45]!==a?(D=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=D):D=e[46];let $;e[47]!==S?($=z=>S({country:z,regionCode:"",city:""}),e[47]=S,e[48]=$):$=e[48];let O;e[49]!==f||e[50]!==M||e[51]!==I||e[52]!==D||e[53]!==$?(O=o.jsx(Vb,{id:M,options:Pne,value:f,placeholder:I,emptyMessage:D,onChange:$}),e[49]=f,e[50]=M,e[51]=I,e[52]=D,e[53]=$,e[54]=O):O=e[54];let B;e[55]!==R||e[56]!==O?(B=o.jsxs("div",{className:"space-y-1.5",children:[R,O]}),e[55]=R,e[56]=O,e[57]=B):B=e[57];let F;e[58]!==f||e[59]!==S||e[60]!==w||e[61]!==r||e[62]!==h||e[63]!==y||e[64]!==a?(F=f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Mt,{htmlFor:`${r}.regionCode`,className:"text-xs",children:y}),w?o.jsxs("div",{className:"space-y-2",children:[o.jsx(jne,{selected:h,onSelect:z=>S({regionCode:z===h?"":z,city:""})}),o.jsx(Vb,{id:`${r}.regionCode`,options:Ene,value:h,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:z=>S({regionCode:z,city:""})})]}):o.jsxs(o.Fragment,{children:[o.jsx(kt,{id:`${r}.regionCode`,type:"text",value:h,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:z=>S({regionCode:z.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=S,e[60]=w,e[61]=r,e[62]=h,e[63]=y,e[64]=a,e[65]=F):F=e[65],k=o.jsxs("div",{className:"space-y-4",children:[P,B,F,f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Mt,{htmlFor:`${r}.city`,className:"text-xs",children:L}),o.jsx(kt,{id:`${r}.city`,type:"text",value:u,placeholder:w&&C?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:C.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:z=>S({city:z.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=u,e[17]=L,e[18]=f,e[19]=x,e[20]=S,e[21]=w,e[22]=r,e[23]=h,e[24]=y,e[25]=l?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=a,e[29]=k}else k=e[29];return k}function Rne(t){const e=t.schema;if(!e?.properties)return null;const s=new Set(Object.keys(t.discriminators??{}));if(s.size===0)return e;const n={};for(const[i,r]of Object.entries(e.properties))s.has(i)||(n[i]=r);return Object.keys(n).length===0?null:{...e,properties:n}}function Dne(t){const e=U.c(52),s=ce(),{schema:n,value:i,onChange:r,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=Kw(i,c.map(Mne)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const u=d,[h,f]=A.useState(u),[m,p]=A.useState(u);m!==u&&(p(u),f(u));const g=Math.min(h,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==r?(b=I=>{const D=Number(I);f(D),r({...c[D]?.discriminators??{}})},e[4]=c,e[5]=r,e[6]=b):b=e[6];const y=b;if(c.length===0)return null;let _;e[7]!==x?(_=x?Rne(x):null,e[7]=x,e[8]=_):_=e[8];const L=_;let v;if(e[9]!==x?.schema?.properties||e[10]!==i){let I;e[12]!==x?.schema?.properties?(I=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=I):I=e[13],v=Wte(i,Object.keys(I)),e[9]=x?.schema?.properties,e[10]=i,e[11]=v}else v=e[11];const S=v;let w;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(w=a&&o.jsx(Hs,{htmlFor:l,label:a,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=a,e[15]=l,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=w):w=e[18];const k=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let C;e[21]!==j?(C=o.jsx(Ds,{placeholder:j}),e[21]=j,e[22]=C):C=e[22];let V;e[23]!==l||e[24]!==C?(V=o.jsx(js,{id:l,className:"w-full min-w-0",children:C}),e[23]=l,e[24]=C,e[25]=V):V=e[25];let N;if(e[26]!==c||e[27]!==s){let I;e[29]!==s?(I=(D,$)=>o.jsx(Ot,{value:String($),children:Xte(D.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:$+1})},D.title),e[29]=s,e[30]=I):I=e[30],N=c.map(I),e[26]=c,e[27]=s,e[28]=N}else N=e[28];let T;e[31]!==N?(T=o.jsx(Cs,{children:N}),e[31]=N,e[32]=T):T=e[32];let P;e[33]!==y||e[34]!==T||e[35]!==k||e[36]!==V?(P=o.jsxs(ks,{value:k,onValueChange:y,children:[V,T]}),e[33]=y,e[34]=T,e[35]=k,e[36]=V,e[37]=P):P=e[37];let E;e[38]!==P||e[39]!==w?(E=o.jsxs("div",{className:"space-y-1.5",children:[w,P]}),e[38]=P,e[39]=w,e[40]=E):E=e[40];let R;e[41]!==x||e[42]!==L||e[43]!==r||e[44]!==l||e[45]!==S||e[46]!==t||e[47]!==i?(R=x&&(Vne(x.schema?.properties)?o.jsx(gk,{...t,schema:x.schema,onChange:I=>r({...S,...I,...x.discriminators??{}})}):L?o.jsx(Oi,{schema:L,value:i,onChange:I=>r({...I,...x.discriminators??{}}),basePath:l,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection}):null),e[41]=x,e[42]=L,e[43]=r,e[44]=l,e[45]=S,e[46]=t,e[47]=i,e[48]=R):R=e[48];let M;return e[49]!==E||e[50]!==R?(M=o.jsxs("div",{className:"space-y-3",children:[E,R]}),e[49]=E,e[50]=R,e[51]=M):M=e[51],M}function Mne(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const Ine={lat:-21.9,lng:-41.42},fp=1e5;let sh=null;function One(t){return sh||(sh=new Promise((e,s)=>{if(typeof window>"u"){s(new Error("Google Maps requires a browser environment"));return}const n=window;if(n.google?.maps){e(n.google.maps);return}const i=()=>{const a=window.google?.maps;a?e(a):s(new Error("Google Maps script loaded without google.maps"))},r=document.querySelector("script[data-google-maps-loader]");if(r){r.addEventListener("load",i),r.addEventListener("error",()=>s(new Error("Failed to load Google Maps")));return}const l=document.createElement("script");l.src=`https://maps.googleapis.com/maps/api/js?key=${t}&v=weekly&libraries=maps`,l.async=!0,l.defer=!0,l.dataset.googleMapsLoader="true",l.addEventListener("load",i),l.addEventListener("error",()=>s(new Error("Failed to load Google Maps"))),document.head.appendChild(l)}),sh)}function $ne(t){if(typeof t!="string"||!t)return null;const e=t.split(",").map(Number),[s,n,i]=e;return!Number.isFinite(s)||!Number.isFinite(n)?null:{lat:s,lng:n,radius:Number.isFinite(i)?i:fp}}function Bne({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r}){const l=mm().googleMapsApiKey,a=A.useRef(s);a.current=s;const c=A.useRef($ne(e)),[d,u]=A.useState(null),h=A.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return One(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:Ine,y=x?.radius??fp,_=new g.Map(m,{center:b,zoom:y?Math.round(Math.log2(768e4/y))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),L=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:_,center:b,radius:y});p.circle=L;const v=()=>{const w=L.getCenter(),k=L.getRadius();w&&a.current(`${w.lat()},${w.lng()},${k}`)},S=w=>{w&&p.listeners.push(w)};S(_.addListener("click",w=>{w.latLng&&(L.setCenter({lat:w.latLng.lat(),lng:w.latLng.lng()}),L.getRadius()||L.setRadius(fp),v())})),S(L.addListener("radius_changed",v)),S(L.addListener("dragend",v))},g=>{p.disposed||u(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return h.current||(h.current=f),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Hs,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),l?d?o.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):o.jsx("div",{ref:h.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):o.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["The map picker is unavailable — set"," ",o.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const zne="oklch(0.65 0.15 160)",Fne="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",xk="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",L2e="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function Tb(t){return t.map(e=>e.label).join(`
|
|
620
|
-
`)}function Ab(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Une(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function Hne(t){return t.map((e,s)=>({...e,index:s}))}function bk(t){const e=U.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=ce(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=ae("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=o.jsx(zf,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Mo,{className:"h-4 w-4 shrink-0",style:{color:zne}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(p=!i&&o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:Wne,onPointerDown:Kne,children:o.jsx(Ci,{size:14})})}),o.jsxs(Wt,{align:"end",children:[r&&o.jsxs(Ze,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(z6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Ze,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(vn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Ze,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(on,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=r,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function Kne(t){return t.stopPropagation()}function Wne(t){return t.stopPropagation()}function qne(t){const e=U.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:Gne},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=Hg(d);let g;e[2]!==m?(g=ur.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const y=b;let _;e[7]!==r?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=_):_=e[8];const L=p?"cursor-grabbing":"cursor-grab",v=n?xk:Fne;let S;e[9]!==L||e[10]!==v?(S=ae("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,v),e[9]=L,e[10]=v,e[11]=S):S=e[11];let w;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(w=o.jsx(bk,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=w):w=e[17];let k;return e[18]!==u||e[19]!==h||e[20]!==r||e[21]!==f||e[22]!==y||e[23]!==_||e[24]!==S||e[25]!==w?(k=o.jsx("div",{ref:f,style:y,...u,...h,onClick:r,onKeyDown:_,className:S,children:w}),e[18]=u,e[19]=h,e[20]=r,e[21]=f,e[22]=y,e[23]=_,e[24]=S,e[25]=w,e[26]=k):k=e[26],k}function Gne(){return!1}function Yne(t){const e=U.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=ce(),m=n.length>1;let p;e[0]!==n?(p=()=>Ab(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=A.useState(p),[b,y]=A.useState(null),[_,L]=A.useState(s),[v,S]=A.useState(n.length);let w;e[2]!==n?(w=()=>Tb(n),e[2]=n,e[3]=w):w=e[3];const[k,j]=A.useState(w),C=A.useRef(!1),V=Tb(n);_!==s?(L(s),S(n.length),j(V),x(Ab(n))):(v!==n.length||k!==V)&&(S(n.length),j(V),x(oe=>Une(oe,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:Kg},e[5]=T):T=e[5];const P=Mg(Bc(o0,N),Bc(r0,T));let E;e[6]!==g?(E=g.map(Jne),e[6]=g,e[7]=E):E=e[7];const R=E;let M;e[8]!==g?(M=oe=>{const ie=String(oe.active.id);y(g.find(ue=>ue.id===ie)??null)},e[8]=g,e[9]=M):M=e[9];const I=M;let D;e[10]!==R||e[11]!==u?(D=oe=>{y(null);const{active:ie,over:ue}=oe;if(!ue||ie.id===ue.id)return;const J=R.indexOf(String(ie.id)),he=R.indexOf(String(ue.id));J===-1||he===-1||(x(ve=>Hne(zc([...ve],J,he))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),u(J,he))},e[10]=R,e[11]=u,e[12]=D):D=e[12];const $=D;let O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{y(null)},e[13]=O):O=e[13];const B=O;let F,z,W,K,H,q,G,Q,se,Z,te,X,Y;if(e[14]!==m||e[15]!==g||e[16]!==R||e[17]!==$||e[18]!==I||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==P||e[27]!==f){const oe=Ge=>{C.current||r(Ge)};te="space-y-1 border-b p-2";let ie;e[41]!==f?(ie=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ie):ie=e[42];let ue;e[43]!==ie?(ue=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ie}),e[43]=ie,e[44]=ue):ue=e[44];let J;e[45]!==f?(J=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=J):J=e[46];let he;e[47]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Yt,{size:14}),e[47]=he):he=e[47];let ve;e[48]!==h||e[49]!==J?(ve=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":J,className:"size-6",onClick:h,children:he})}),e[48]=h,e[49]=J,e[50]=ve):ve=e[50];let je;e[51]!==f?(je=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=je):je=e[52];let Ce;e[53]!==je?(Ce=o.jsx(Ke,{children:je}),e[53]=je,e[54]=Ce):Ce=e[54];let Le;e[55]!==ve||e[56]!==Ce?(Le=o.jsxs(We,{children:[ve,Ce]}),e[55]=ve,e[56]=Ce,e[57]=Le):Le=e[57];let _e;e[58]!==f?(_e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=_e):_e=e[59];let Ne;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ne=o.jsx(on,{size:14}),e[60]=Ne):Ne=e[60];let ge;e[61]!==d||e[62]!==_e?(ge=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":_e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ne})}),e[61]=d,e[62]=_e,e[63]=ge):ge=e[63];let Te;e[64]!==f?(Te=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Te):Te=e[65];let Se;e[66]!==Te?(Se=o.jsx(Ke,{children:Te}),e[66]=Te,e[67]=Se):Se=e[67];let we;e[68]!==ge||e[69]!==Se?(we=o.jsxs(We,{children:[ge,Se]}),e[68]=ge,e[69]=Se,e[70]=we):we=e[70];let Ye;e[71]!==Le||e[72]!==we?(Ye=o.jsxs("div",{className:"flex items-center gap-0.5",children:[Le,we]}),e[71]=Le,e[72]=we,e[73]=Ye):Ye=e[73],e[74]!==ue||e[75]!==Ye?(X=o.jsxs("div",{className:"flex items-center justify-between",children:[ue,Ye]}),e[74]=ue,e[75]=Ye,e[76]=X):X=e[76],z=Bg,q=P,G=M_,Q=I,se=$,Z=B,F=Ug,K=R,H=Fg,Y="space-y-0.5",W=g.map(Ge=>o.jsx(qne,{entry:Ge,selected:Ge.index===i,canDelete:m,onSelect:()=>oe(Ge.index),onRename:l?()=>l(Ge.index):void 0,onDuplicate:()=>a(Ge.index),onDelete:()=>c(Ge.index)},Ge.id)),e[14]=m,e[15]=g,e[16]=R,e[17]=$,e[18]=I,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=P,e[27]=f,e[28]=F,e[29]=z,e[30]=W,e[31]=K,e[32]=H,e[33]=q,e[34]=G,e[35]=Q,e[36]=se,e[37]=Z,e[38]=te,e[39]=X,e[40]=Y}else F=e[28],z=e[29],W=e[30],K=e[31],H=e[32],q=e[33],G=e[34],Q=e[35],se=e[36],Z=e[37],te=e[38],X=e[39],Y=e[40];let de;e[77]!==W||e[78]!==Y?(de=o.jsx("div",{className:Y,children:W}),e[77]=W,e[78]=Y,e[79]=de):de=e[79];let re;e[80]!==F||e[81]!==K||e[82]!==H||e[83]!==de?(re=o.jsx(F,{items:K,strategy:H,children:de}),e[80]=F,e[81]=K,e[82]=H,e[83]=de,e[84]=re):re=e[84];let le;e[85]!==b||e[86]!==m?(le=b?o.jsx("div",{className:ae("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",xk),children:o.jsx(bk,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ne;e[88]!==le?(ne=qn.createPortal(o.jsx(zg,{dropAnimation:Bw,children:le}),document.body),e[88]=le,e[89]=ne):ne=e[89];let me;e[90]!==z||e[91]!==q||e[92]!==G||e[93]!==Q||e[94]!==se||e[95]!==Z||e[96]!==re||e[97]!==ne?(me=o.jsxs(z,{sensors:q,collisionDetection:G,onDragStart:Q,onDragEnd:se,onDragCancel:Z,children:[re,ne]}),e[90]=z,e[91]=q,e[92]=G,e[93]=Q,e[94]=se,e[95]=Z,e[96]=re,e[97]=ne,e[98]=me):me=e[98];let ee;return e[99]!==te||e[100]!==X||e[101]!==me?(ee=o.jsxs("div",{className:te,children:[X,me]}),e[99]=te,e[100]=X,e[101]=me,e[102]=ee):ee=e[102],ee}function Jne(t){return t.id}const Xne=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Qne={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function D1(t){return Jl(t)!==void 0}function W3(t,e){if(e){if(D1(e))return e;const s=Qne[e];if(s&&D1(s))return s}for(const[s,n]of Xne)if(s.test(t)&&D1(n))return n;return"FilterLines"}function Zne(t){return Jl(t)??U2}function M1(t){const e=U.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=Zne(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=ae("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=o.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function S2e(t,e){return UQ(t,e).map(s=>{const n=e[s.blockKey]??{},i=tw(WQ(s.blockKey),e,t);return{blockKey:s.blockKey,title:Il(s.blockKey,n),description:Hc(i),iconName:W3(s.matcherResolveType)}})}const vk="Users03";function eie(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function tie(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,r]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(r)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=rl(l,t);s.push({resolveType:l,title:a.title??bs(l),description:a.description,iconName:W3(l,a.icon)})}return s}function sie(t,e){if(!t)return vk;const s=e.find(n=>n.resolveType===t);return s?s.iconName:W3(t)}function nie(t){const e=U.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=A.useState(!1),f=ce(),p=(i?d.find(X=>X.blockKey===i):void 0)?.iconName??sie(s,r),g=Jl(p);let x;e[0]!==a||e[1]!==h?(x=X=>{a(X),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let y;e[3]!==c||e[4]!==h?(y=X=>{c?.(X),h(!1)},e[3]=c,e[4]=h,e[5]=y):y=e[5];const _=y;let L;e[6]!==h?(L=()=>h(!0),e[6]=h,e[7]=L):L=e[7];let v;e[8]!==g?(v=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=v):v=e[9];let S;e[10]!==n?(S=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Ls,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=w):w=e[12];let k;e[13]!==L||e[14]!==v||e[15]!==S?(k=o.jsxs("button",{type:"button",onClick:L,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[v,S,w]}),e[13]=L,e[14]=v,e[15]=S,e[16]=k):k=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let C;e[19]!==f?(C=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=C):C=e[20];let V;e[21]!==f?(V=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=V):V=e[22];let N;e[23]!==V?(N=o.jsx(ui,{placeholder:V}),e[23]=V,e[24]=N):N=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let P;e[27]!==T?(P=o.jsx(Bn,{children:T}),e[27]=T,e[28]=P):P=e[28];let E;e[29]!==f?(E=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=E):E=e[30];let R;e[31]!==f?(R=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=R):R=e[32];const M=`${E} ${R}`;let I;e[33]!==b?(I=()=>b(""),e[33]=b,e[34]=I):I=e[34];const D=!s&&!i&&"bg-accent/60";let $;e[35]!==D?($=ae("gap-2.5",D),e[35]=D,e[36]=$):$=e[36];let O;e[37]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(M1,{iconName:vk,size:"sm"}),e[37]=O):O=e[37];let B;e[38]!==f?(B=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=B):B=e[39];let F;e[40]!==B?(F=o.jsx("span",{className:"text-sm",children:B}),e[40]=B,e[41]=F):F=e[41];let z;e[42]!==f?(z=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=z):z=e[43];let W;e[44]!==z?(W=o.jsx("span",{className:"text-xs text-muted-foreground",children:z}),e[44]=z,e[45]=W):W=e[45];let K;e[46]!==F||e[47]!==W?(K=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,W]}),e[46]=F,e[47]=W,e[48]=K):K=e[48];let H;e[49]!==M||e[50]!==I||e[51]!==$||e[52]!==K?(H=o.jsxs(us,{value:M,onSelect:I,className:$,children:[O,K]}),e[49]=M,e[50]=I,e[51]=$,e[52]=K,e[53]=H):H=e[53];let q;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let X;e[59]!==i||e[60]!==s||e[61]!==b?(X=Y=>o.jsxs(us,{value:`${Y.title} ${Y.resolveType} ${Y.description??""}`,onSelect:()=>b(Y.resolveType),className:ae("gap-2.5",!i&&s===Y.resolveType&&"bg-accent/60"),children:[o.jsx(M1,{iconName:Y.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:Y.title}),Y.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Y.description})]})]},Y.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=X):X=e[62],q=r.map(X),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=q}else q=e[58];let G;e[63]!==H||e[64]!==q?(G=o.jsxs(Es,{children:[H,q]}),e[63]=H,e[64]=q,e[65]=G):G=e[65];let Q;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(Q=d.length>0&&o.jsx(Es,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(X=>o.jsxs(us,{value:`${X.title} ${X.blockKey} ${X.description??""}`,onSelect:()=>_(X.blockKey),className:ae("gap-2.5",i===X.blockKey&&"bg-accent/60"),children:[o.jsx(M1,{iconName:X.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:X.title}),X.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:X.description})]})]},X.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=Q):Q=e[70];let se;e[71]!==P||e[72]!==G||e[73]!==Q?(se=o.jsxs(hi,{children:[P,G,Q]}),e[71]=P,e[72]=G,e[73]=Q,e[74]=se):se=e[74];let Z;e[75]!==u||e[76]!==h||e[77]!==C||e[78]!==N||e[79]!==se||e[80]!==j?(Z=o.jsxs(YP,{open:u,onOpenChange:h,title:j,description:C,className:"sm:max-w-lg",filter:eie,children:[N,se]}),e[75]=u,e[76]=h,e[77]=C,e[78]=N,e[79]=se,e[80]=j,e[81]=Z):Z=e[81];let te;return e[82]!==Z||e[83]!==k?(te=o.jsxs(o.Fragment,{children:[k,Z]}),e[82]=Z,e[83]=k,e[84]=te):te=e[84],te}const iie="website/sections/Rendering/Lazy.tsx";function pf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function q3(t){if(!pf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Ns(e)}function rie(t){return t!=null}function mp(t){if(t==null)return t;if(q3(t)){const e=t.section;return e==null?null:pf(e)?e:{}}return pf(t)?t:void 0}function oie(t,e){return t===null?null:q3(e)?{...e,section:t}:t}function w2e(t){return{__resolveType:t}}function k2e(t,e){if(!rie(e))return null;if(t){const s=mp(e)??{};return{__resolveType:iie,section:s}}return q3(e)?mp(e)??null:pf(e)?e:null}const lie="General";function Kc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function yk(t,e){return t===Jo?lie:e}function _k(t){const e=nf(t),s=new Set,n=[];for(const i of e)Kc(i.resolveType)&&(ri(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:yk(i.resolveType,i.title),description:i.description})));return n}function G3(t){const e=sf(t),s=zn(e,t),n=_k(s?.properties?.seo);return n.length>0?n:aie(t)}function aie(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const r of Object.keys(i)){if(!Kc(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:yk(r,l)})}return s}function Lk(t){const e=G3(t),s=e.find(n=>n.resolveType===Jo);return s?s.resolveType:e[0]?.resolveType??Jo}function Sk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=zn(s,t),i=_k(n?.properties?.seo);if(i.length>0)return i}return G3(t)}function cie(t,e){const s=Sk(t,e),n=s.find(i=>i.resolveType===Jo);return n?n.resolveType:s[0]?.resolveType??Lk(t)}function die(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Lk(t)}function uie(t,e,s){const n=s.__resolveType;return typeof n=="string"&&Kc(n)?n:cie(t,e)}const hie=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),Jo="website/sections/Seo/SeoV2.tsx",fie=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function au(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function mie(t){return typeof t.__resolveType=="string"&&Kc(t.__resolveType)?!0:fie.some(e=>e in t)}function pie(t,e){for(const[s,n]of Object.entries(t)){if(!au(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&hie.has(r))continue;const l=i.seo;if(au(l)){const a=l;if(mie(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?uie(e,i,a):typeof a.__resolveType=="string"&&Kc(a.__resolveType)?a.__resolveType:Jo}}}for(const[s,n]of Object.entries(t)){if(!au(n))continue;const i=n;if(typeof i.__resolveType=="string"&&Kc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function gie(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function j2e(t,e,s){if(e.kind==="site"){const c=pie(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Sk(s,c.blockData):void 0,build:d=>gie(c,d)}:null}const n=t[e.pageKey];if(!au(n))return null;const i=n,r=i.seo,l=mp(r),a=l&&au(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?die(s,a):typeof a?.__resolveType=="string"?a.__resolveType:Jo,seoTypeOptions:s?G3(s):void 0,build:c=>({...i,seo:c===null?null:oie(c,r)})}}const Y3=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],xie=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],bie=["jsonLD","title","description","noIndexing","configJsonLD"];function wk(t){return t===Jo||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function vie(t){switch(t){case"general":return Y3;case"pdp":return xie;case"plp":return bie;default:return null}}function kk(t,e){const s=vie(wk(e));if(!s||!t.properties)return t;const n={};for(const i of s){const r=t.properties[i];r&&(n[i]=r)}return{...t,properties:n}}function yie(){return Y3.filter(t=>t!=="type")}function _ie(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Lie(t,e){return t[e]===void 0}function Sie(t){const e=U.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=ce(),d=kk(s,Jo).properties??{},u=yie();let h;e[0]!==r?(h=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=h):h=e[1];const f=h,[m,p]=A.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=A.useState(g);m!==l&&(p(l),b({}));let y;e[3]!==x||e[4]!==n?(y=j=>x[j]!==void 0?x[j]:Lie(n,j),e[3]=x,e[4]=n,e[5]=y):y=e[5];const _=y;let L;e[6]!==i||e[7]!==r||e[8]!==n?(L=(j,C)=>{b(N=>({...N,[j]:C}));const V={...n};if(C)delete V[j];else{const N=r?.[j];V[j]=N??(j==="type"?"website":"")}i(V)},e[6]=i,e[7]=r,e[8]=n,e[9]=L):L=e[9];const v=L,S="min-w-0 space-y-6",w=Y3.map(j=>{const C=d[j];if(!C)return null;const V=f&&u.includes(j),N=V&&_(j),T=N?r?.[j]??n[j]:n[j],P=C.title??_ie(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:ae(N&&"pointer-events-none opacity-60"),children:Bl({schema:C,value:T,onChange:E=>{N||i({...n,[j]:E})},path:j,label:P,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:wie})}),V&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ii,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:E=>v(j,E)}),o.jsx(Mt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==l||e[11]!==w?(k=o.jsx("div",{className:S,children:w},l),e[10]=l,e[11]=w,e[12]=k):k=e[12],k}function wie(){}function kie(t){const e=U.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(wk(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=o.jsx(Sie,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let u;e[8]!==n||e[9]!==s?(u=kk(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??jie;let p;return e[12]!==h||e[13]!==r||e[14]!==l||e[15]!==m||e[16]!==i?(p=o.jsx(Oi,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},r),e[12]=h,e[13]=r,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function jie(){}function Cie(t){const e=U.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=ce();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(Mh,{className:"size-3.5"})}),h.map((x,b)=>{const y=b===h.length-1,_=Nn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:_,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",y?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx(Oi,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function C2e(t){const e=U.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let y;e[0]!==a?(y=a===void 0?[]:a,e[0]=a,e[1]=y):y=e[1];const _=y;let L;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(L=s&&n?u?o.jsx(kie,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:h}):o.jsx(Oi,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=r,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=L):L=e[16];const v=L;let S;e[17]!==c||e[18]!==v?(S=v??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=v,e[19]=S):S=e[19];let w;return e[20]!==d||e[21]!==S?(w=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,S]})}),e[20]=d,e[21]=S,e[22]=w):w=e[22],w}const N2e="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 V2e(t,e){return SZ(t,e,Hc)}function T2e(t){const e=U.c(71),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=ce(),a=N9(),[c,d]=A.useState(n),[u,h]=A.useState(i),[f,m]=A.useState(s),[p,g]=A.useState(null),x=A.useRef(!1),[b,y]=A.useState(null);f!==s&&(m(s),d(n),h(i),g(null),y(null));let _;e[0]!==i||e[1]!==u?(_=()=>{if(x.current){x.current=!1;return}const X=u.trim();if(X===i.trim()){h(i),y(null);return}const Y=w9(X);if(Y){y(Y),h(i);return}y(null),g(X)},e[0]=i,e[1]=u,e[2]=_):_=e[2];const L=_;let v;e[3]!==r||e[4]!==p?(v=()=>{p!==null&&(h(p),r("path",p),g(null))},e[3]=r,e[4]=p,e[5]=v):v=e[5];const S=v;let w;e[6]!==i?(w=()=>{h(i),g(null)},e[6]=i,e[7]=w):w=e[7];const k=w;let j;e[8]!==r?(j=X=>{d(X.target.value),r("name",X.target.value)},e[8]=r,e[9]=j):j=e[9];let C;e[10]!==l?(C=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=C):C=e[11];let V;e[12]!==c||e[13]!==a||e[14]!==j||e[15]!==C?(V=o.jsx("input",{type:"text",value:c,readOnly:a,onChange:j,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:C}),e[12]=c,e[13]=a,e[14]=j,e[15]=C,e[16]=V):V=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=X=>{h(X.target.value),y(null)},e[17]=N):N=e[17];let T;e[18]!==i?(T=X=>{X.key==="Enter"?(X.preventDefault(),X.currentTarget.blur()):X.key==="Escape"&&(X.preventDefault(),x.current=!0,h(i),y(null),X.currentTarget.blur())},e[18]=i,e[19]=T):T=e[19];let P;e[20]!==l?(P=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[20]=l,e[21]=P):P=e[21];let E;e[22]!==L||e[23]!==u||e[24]!==a||e[25]!==T||e[26]!==P?(E=o.jsx("input",{type:"text",value:u,readOnly:a,onChange:N,onBlur:L,onKeyDown:T,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:P}),e[22]=L,e[23]=u,e[24]=a,e[25]=T,e[26]=P,e[27]=E):E=e[27];let R;e[28]!==b?(R=b&&o.jsx("p",{className:"text-xs text-destructive",children:b}),e[28]=b,e[29]=R):R=e[29];const M=p!==null;let I;e[30]!==k?(I=X=>{X||k()},e[30]=k,e[31]=I):I=e[31];let D;e[32]!==l?(D=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[32]=l,e[33]=D):D=e[33];let $;e[34]!==D?($=o.jsx(Gr,{children:D}),e[34]=D,e[35]=$):$=e[35];const O=p??"";let B;e[36]!==i||e[37]!==l||e[38]!==O?(B=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:O}),e[36]=i,e[37]=l,e[38]=O,e[39]=B):B=e[39];let F;e[40]!==B?(F=o.jsx(Yr,{children:B}),e[40]=B,e[41]=F):F=e[41];let z;e[42]!==$||e[43]!==F?(z=o.jsxs(qr,{children:[$,F]}),e[42]=$,e[43]=F,e[44]=z):z=e[44];let W;e[45]!==l?(W=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[45]=l,e[46]=W):W=e[46];let K;e[47]!==W?(K=o.jsx(Xr,{children:W}),e[47]=W,e[48]=K):K=e[48];let H;e[49]!==S?(H=X=>{X.preventDefault(),S()},e[49]=S,e[50]=H):H=e[50];let q;e[51]!==l?(q=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[51]=l,e[52]=q):q=e[52];let G;e[53]!==H||e[54]!==q?(G=o.jsx(Qr,{onClick:H,children:q}),e[53]=H,e[54]=q,e[55]=G):G=e[55];let Q;e[56]!==K||e[57]!==G?(Q=o.jsxs(Jr,{children:[K,G]}),e[56]=K,e[57]=G,e[58]=Q):Q=e[58];let se;e[59]!==z||e[60]!==Q?(se=o.jsxs(Wr,{children:[z,Q]}),e[59]=z,e[60]=Q,e[61]=se):se=e[61];let Z;e[62]!==M||e[63]!==I||e[64]!==se?(Z=o.jsx(Kr,{open:M,onOpenChange:I,children:se}),e[62]=M,e[63]=I,e[64]=se,e[65]=Z):Z=e[65];let te;return e[66]!==E||e[67]!==R||e[68]!==Z||e[69]!==V?(te=o.jsxs("div",{className:"space-y-1",children:[V,E,R,Z]}),e[66]=E,e[67]=R,e[68]=Z,e[69]=V,e[70]=te):te=e[70],te}function A2e(t){const e=U.c(13),{onClick:s}=t,n=ce();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ng,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(Ke,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const Pb=new WeakMap;function Nie(t,e){let s=Pb.get(e);s||(s=new Map,Pb.set(e,s));let n=s.get(t);return n===void 0&&(n=zn(t,e),s.set(t,n)),n}function Vie(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function Tie(t,e){return{__resolveType:e,variants:[{rule:Fc(),value:structuredClone(t)},{rule:Fc(),value:structuredClone(t)}]}}function Aie(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>N3(n.rule));return s?s.value:e[e.length-1]?.value}function Pie(t){const e=[...t.variants],s=e[e.length-1],n={rule:Fc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function Eie(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Rie(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Die(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Mie(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function Iie(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function Eb(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const Rb=new WeakMap;function Oie(t){let e=Rb.get(t);return e||(e=tie(t),Rb.set(t,e)),e}function jk(t){const e=U.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=ce(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=A.useState(0);if(!Vie(l)){let $;e[0]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=$):$=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(ng,{size:14}),e[2]=O):O=e[2];let B;e[3]!==r?(B=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=B):B=e[4];let F;return e[5]!==B?(F=o.jsx(Ke,{children:B}),e[5]=B,e[6]=F):F=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":$,onClick:()=>{a(Tie(l,s)),h(0)},children:O})}),F]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==r?(g=($,O)=>({index:O,label:Hc($.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(O+1)})}),e[7]=r,e[8]=g):g=e[8];const x=m.map(g),b=m[p],y=b?.rule??{},_=y.__resolveType??"",L=b?.value,v=c?Oie(c):[],S=_&&c?Nie(_,c):null,{__resolveType:w,...k}=y,j=()=>{a(Aie(f)),h(0)},C=()=>{const $=Pie(f);a($),h($.variants.length-1)},V=$=>{const O=Eie(f,$);O&&(a(O),h(Die(p,$,O.variants.length)))},N=$=>{const O=Rie(f,$);a(O),h($+1)},T=($,O)=>{const B=Mie(f,$,O);a(B),p===$&&h(O)},P=$=>{const O=$?qQ($,c):{__resolveType:v3};a(Eb(f,p,O))},E=$=>{const O=$,B=_?{...O,__resolveType:_}:{...O};a(Eb(f,p,B))},R=$=>{a(Iie(f,p,$))},M=`${d}-${f.__resolveType}`;let I;e[9]!==r?(I=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=I):I=e[10];let D;return e[11]!==I?(D=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:I}),e[11]=I,e[12]=D):D=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(Yne,{listKey:M,variants:x,selectedIndex:p,onSelect:h,onDuplicate:N,onDelete:V,onRemoveAll:j,onReorder:T,onAdd:C}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[D,o.jsx(nie,{currentRt:_,currentLabel:Hc(y),matchers:v,onSelect:P}),S&&o.jsx("div",{className:"pt-1",children:o.jsx(Cie,{schema:S,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${_}`)})]}),n({...i,value:L,onChange:R})]})]})}const $ie="website/loaders/secret.ts";function cu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Bie(){return{__resolveType:$ie,name:"",encrypted:""}}function zie(t){const{value:e,...s}=t;return s}function I1(t){const e=U.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=ce();if(typeof n=="string"||n==null&&!cu(n)){const C=typeof n=="string"?n:"",V=a?.virtualMcpId;let N;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==V?(N=o.jsx(Hs,{htmlFor:l,label:r,description:s.description,virtualMcpId:V}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=V,e[4]=N):N=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let P;e[7]!==i?(P=M=>i(M.target.value),e[7]=i,e[8]=P):P=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==T||e[12]!==P?(E=o.jsx(kt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:P,className:"h-10"}),e[9]=l,e[10]=C,e[11]=T,e[12]=P,e[13]=E):E=e[13];let R;return e[14]!==N||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[N,E]}),e[14]=N,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=cu(n)?n:Bie(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(Hs,{htmlFor:m,label:r,description:s.description,virtualMcpId:p}),e[19]=r,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let y;e[26]!==u||e[27]!==i?(y=C=>i({...u,name:C.target.value}),e[26]=u,e[27]=i,e[28]=y):y=e[28];let _;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==y?(_=o.jsx(kt,{id:x,value:h,placeholder:b,onChange:y,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=y,e[33]=_):_=e[33];const L=`${l}-value`;let v;e[34]!==f||e[35]!==c?(v=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=v):v=e[36];let S;e[37]!==u||e[38]!==f||e[39]!==i?(S=C=>{const V=C.target.value;if(!V){i(f?zie(u):u);return}i({...u,value:V})},e[37]=u,e[38]=f,e[39]=i,e[40]=S):S=e[40];let w;e[41]!==v||e[42]!==S||e[43]!==L?(w=o.jsx(kt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:v,onChange:S,className:"h-10"}),e[41]=v,e[42]=S,e[43]=L,e[44]=w):w=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==w||e[49]!==k||e[50]!==g||e[51]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,w,k]}),e[48]=w,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function Fie(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],r=[],l=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let a,c=-1;for(const d of r){const u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function Uie(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const Hie=new Set(["__resolveType","@type"]);function Kie(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function Wie(t){if(j9(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function Db(t){if(t.type==="array"&&t.items)return t;const e=t.items??Wie(t);return e?{...t,type:"array",items:e}:null}function qie(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function Ck(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=zn(n,s);return i?o.jsx(Oi,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Bl(t){const{schema:e,value:s}=t,n=a=>t.readOnly?o.jsx(Yee,{children:a},t.path):a;if(cf(s)){const a=yZ(s),c=Db(e);if(a!==null&&c)return o.jsx(th,{...t,schema:c,value:a,onChange:d=>t.onChange(_Z(s,d))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&j9(e)){const a=Db(e);if(a)return o.jsx(th,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!cf(s)&&e.type==="block-ref"){const a=Fie(e,s)??Uie(s);if(a){const c={...e,type:"array",items:a};return o.jsx(th,{...t,schema:c,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(Kie(e)){const a=e.anyOfRefs[0],c=a.schema?.properties?.variants?.items?.properties?.value,d=c&&c.type!=="block-ref"?c:e.plainSchema??c?.plainSchema??{type:"string"},u=h=>Bl({...h,schema:d});return o.jsx(jk,{...t,multivariateResolveType:a.resolveType,renderInnerField:u},t.path)}return e.anyOfRefs?o.jsx(kb,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Dne,{...t},t.path);if(e.format==="image-uri")return n(o.jsx(Lne,{...t},t.path));if(e.format==="file-uri"||e.format==="video-uri")return n(o.jsx(vne,{...t},t.path));if(e.format==="map")return n(o.jsx(Bne,{...t},t.path));if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return n(o.jsx(qse,{...t},t.path));if(e.format==="location")return n(o.jsx(gk,{...t},t.path));if(e.enum&&e.enum.length>0)return n(o.jsx(Ete,{...t},t.path));if(e.type==="anyOf")return o.jsx(kb,{...t},t.path);if(cu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(I1,{...t},t.path);if(!e.format&&!e.enum){const a=Ck(t);if(a)return a}const i=s??qie(e.type,e.default);if(i==null)return cu(s)?n(o.jsx(I1,{...t},t.path)):null;if(cu(i))return n(o.jsx(I1,{...t,value:i},t.path));const r={...t,value:i},l=s==null?e.type??typeof i:Array.isArray(i)?"array":typeof i;if(l==="array"||Array.isArray(i))return o.jsx(th,{...r},t.path);switch(l){case"boolean":return n(o.jsx(Nte,{...r},t.path));case"number":case"integer":return n(o.jsx(Cte,{...r},t.path));case"string":{const a=e.format;return n(a==="color-input"||a==="color"?o.jsx(Z0,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(Z0,{...r},t.path):o.jsx(Z0,{...r},t.path))}case"object":return i!==null&&typeof i=="object"&&!Array.isArray(i)?o.jsx(Vse,{...r},t.path):null;default:return n(o.jsx(Z0,{...r},t.path))}}function Gie(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Bl({...t,schema:e});const s=Ck(t);return s||Bl(e?{...t,schema:e}:t)}function Oi({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=ce(),p=N9(),g=t.properties;if(!g)return t.type==="inline-union"?Bl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,readOnly:p}):null;if(vZ(e)&&g.variants){const T=g.variants.items?.properties?.value;return o.jsx(jk,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:P=>Gie(P,T)},n)}const x=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},b=Object.keys(g).filter(T=>!Hie.has(T)&&g[T]?.hidden!==!0),y=new Set(t.required??[]);if(b.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const _=(T,P)=>{if(P===void 0){const{[T]:E,...R}=x;s(R);return}s({...x,[T]:P})},L=typeof x.__resolveType=="string"?x.__resolveType:void 0,v=b.filter(T=>{const P=g[T];return P!=null&&Ec(P,x[T])}).length>1,S=ase(b,g,x),w=i.length>0?dse(b,g,x,i,a,l):null,k=w?g[w]:null,j=w&&k?[w]:b,C=w&&k?lse(w,k,i,Eu(w,b,g)):i,V=ose(i,C),N=V.length>0&&r?T=>r([...V,...T]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:j.map(T=>{const P=g[T];if(!P)return null;const E=n?`${n}.${T}`:T,R=Eu(T,b,g),M=$l(T,P),$=(V.length===0&&b.some(O=>{const B=g[O];return O!==T&&B!=null&&$l(O,B)===M})||V.length===0&&S.has(T))&&N?P.type==="block-ref"?O=>N(ise(T,O)):O=>N(nse(R,O)):N;return Bl({schema:P,value:x[T],onChange:O=>_(T,O),path:E,label:R,readOnly:p,required:y.has(T),breadcrumbPath:C,onBreadcrumbChange:$,hasSiblingDrillDownFields:v,focused:w===T,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function Yie(t){const e=U.c(3),{isPending:s,isError:n}=t;if(n){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(yn,{size:13}),"Couldn't save"]}),e[0]=r):r=e[0],r}if(s){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(st,{className:"size-[13px]"}),"Saving…"]}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx(zt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const Mb=3e4;function Jie(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function Xie(t,{resolveType:e,props:s}){let n;try{n=await fetch(ES(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Mb)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${Mb/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let r=null,l=!1;try{r=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?r:i}function Qie(t){const e=U.c(2);let s;return e[0]!==t?(s={mutationFn:n=>Xie(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function Nk({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=_s()?.taskId??null,g=ce(),x=ro(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,y=zn(a.resolveType,i),_=!y&&wQ(a.resolveType,i),L=_?kQ(c):null,v=y??L,[S,w]=A.useState(c),[k,j]=A.useState([]),[C,V]=A.useState(0),[N,T]=A.useState(!1),[P,E]=A.useState(null),[R,M]=A.useState(!1),[I,D]=A.useState(!1),[$,O]=A.useState(!1),B=P!==null,{save:F,flush:z,isPending:W}=E3({orgSlug:t,virtualMcpId:e,branch:s}),K=Qie({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});A.useEffect(()=>()=>{z()},[]);const H=ww(l),q=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,G={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},Q=le=>{w(le),a.mode==="saved"&&F(a.blockKey,{__resolveType:a.resolveType,...le})},se=()=>{B?(E(null),T(!1),V(le=>le+1)):E(JSON.stringify(S,null,2))},Z=le=>{const ne=le??"";try{const me=JSON.parse(ne);if(me&&typeof me=="object"&&!Array.isArray(me)){T(!1),Q(me);return}T(!0)}catch{T(!0)}},te=async le=>{const ne=F3(le,r);if(ne){xe.error(ne);return}await u(le,{__resolveType:a.resolveType,...S}),M(!1)},X=()=>{D(!0),K.mutate({resolveType:a.resolveType,props:S})},Y=()=>{n&&window.open(Jie(n,a.resolveType,S,Date.now()),"_blank","noopener")},de=[a.title,...k],re=le=>{j(k.slice(0,le)),V(ne=>ne+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(Kf,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:de.map((le,ne)=>{const me=ne===de.length-1,ee=Nn(le);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ne>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>re(ne),title:ee,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",me?"font-medium text-foreground":"text-muted-foreground"),children:ee})]},`${ee}-${ne}`)})}),a.mode==="saved"&&o.jsx(Yie,{isPending:W,isError:!1}),m&&o.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:X,disabled:K.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:H}),children:[K.isPending?o.jsx(st,{className:"size-3.5"}):o.jsx(Tl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>M(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:H}),children:o.jsx(R2,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:H})})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:B?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:se,"aria-label":g(B?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":B,children:B?o.jsx(Ws,{size:14}):o.jsx(Qc,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g(B?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:H}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:q,singular:H})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:ae("relative min-h-0 flex-1",I&&$&&"hidden"),children:[o.jsx(Ql,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[L&&v===L&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:H})}),v?o.jsx(Oi,{schema:v,value:S,onChange:le=>Q(le),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:h,sandbox:G},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:H}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:H})})]})})}),P!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ld,{language:"json",height:"100%",code:P,onChange:Z,onSave:le=>{Z(le),z()}})})]})]}),I&&o.jsx(Zie,{singular:H,result:{isPending:K.isPending,error:K.error,data:K.data,hasRun:K.status!=="idle"},expanded:$,onToggleExpand:()=>O(le=>!le),onOpenInNewTab:n?Y:void 0,onClose:()=>{D(!1),O(!1)}})]}),o.jsx(U3,{open:R,onOpenChange:M,defaultBlockId:"",isPending:d,onSubmit:te})]})}function Zie(t){const e=U.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=ce();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=ae("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(mn,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?o.jsx(PT,{size:14}):o.jsx(M6,{size:14}),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(y=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=y):y=e[21];let _;e[22]!==i||e[23]!==c?(_=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=_):_=e[24];let L;e[25]!==_?(L=o.jsx(Ke,{side:"bottom",children:_}),e[25]=_,e[26]=L):L=e[26];let v;e[27]!==L||e[28]!==y?(v=o.jsxs(We,{children:[y,L]}),e[27]=L,e[28]=y,e[29]=v):v=e[29];let S;e[30]!==c?(S=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=S):S=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Ws,{size:14}),e[32]=w):w=e[32];let k;e[33]!==a||e[34]!==S?(k=o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":S,children:w}),e[33]=a,e[34]=S,e[35]=k):k=e[35];let j;e[36]!==v||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,v,k]}),e[36]=v,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=C):C=e[42];let V;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(V=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(st,{className:"size-4"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(ld,{language:"json",height:"100%",code:u,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=u,e[47]=s,e[48]=c,e[49]=V):V=e[49];let N;return e[50]!==C||e[51]!==V||e[52]!==f?(N=o.jsxs("div",{className:f,children:[C,V]}),e[50]=C,e[51]=V,e[52]=f,e[53]=N):N=e[53],N}function ere(t){const e=U.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=ce();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=m0(u);let f;e[4]!==h?(f=D3((v,S)=>h.mutate({blockKey:v,data:S})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=Vw(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let v;e[9]!==d?(v=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=v):v=e[10];let S;return e[11]!==v?(S=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:v}),e[11]=v,e[12]=S):S=e[12],S}const y=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let L;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==y||e[26]!==_||e[27]!==n?(L=o.jsx(Nk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:h.isPending,onCreate:tre,onSaveReferencedBlock:m,showRun:!1},y),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=h.isPending,e[24]=m,e[25]=y,e[26]=_,e[27]=n,e[28]=L):L=e[28],L}async function tre(){}function sre(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function Ib(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:sre(t.error)}}function nre(t){switch(t){case"clone-failed":case"install-failed":case"start-failed":return"terminal-error";case"idle":case"cloning":return"booting";case"checking-out":case"installing":case"starting":case"running":case"crashed":return"snapshot-readable"}}function ire(t){if(t.fastPreviewActive)return t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData?{kind:"error",source:"data"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"};const e=nre(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const s=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return s&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(i=>i.status==="error"&&!i.hasData&&i.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:s?t.lifecyclePhase==="running"||t.lifecyclePhase==="crashed"?{kind:"error",source:"data"}:{kind:"loading"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"}}const rre="https://github.com/decocms/blocks";function ore(){const t=U.c(14),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(ET,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=r):r=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(mn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(fe,{size:"sm",asChild:!0,children:o.jsxs("a",{href:rre,target:"_blank",rel:"noreferrer",children:[r,l]})}),t[8]=r,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=o.jsx(Vi,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function lre(t){const e=U.c(15),{source:s,onRetry:n}=t,i=ce();let r;e[0]!==s||e[1]!==i?(r=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=r):r=e[2];const l=r;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(yn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let u;e[8]!==n||e[9]!==d?(u=o.jsx(fe,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=o.jsx(Vi,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}const are=A.lazy(()=>Ys(()=>import("./sections-editor-CWq03Vnp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157])).then(t=>({default:t.SectionsEditor})));function Ob(t){const e=U.c(60),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=Fe(),{currentBranch:a,taskId:c}=an(),d=Vs(s),u=j2(d,a);let h;e[0]!==u||e[1]!==d?(h=Yl(d)&&u,e[0]=u,e[1]=d,e[2]=h):h=e[2];const f=h,m=fi(),p=nl(),g=Aw(),x=m.lifecycle.phase==="running",b=p.previewUrl;let y;e[3]!==a||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==s?(y=a?{orgSlug:l.slug,virtualMcpId:s,branch:a,threadId:c??null,previewUrl:b}:null,e[3]=a,e[4]=l,e[5]=b,e[6]=c,e[7]=s,e[8]=y):y=e[8];const _=y;let L;e[9]!==x?(L={fetchEnabled:x},e[9]=x,e[10]=L):L=e[10];const v=L9(_,L);let S;e[11]!==x?(S={fetchEnabled:x},e[11]=x,e[12]=S):S=e[12];const w=j3(_,S),k=ire({lifecyclePhase:m.lifecycle.phase,decofile:Ib(v),meta:Ib(w),hasEditableContent:QS(v.data,w.data),fastPreviewActive:Sn(s).runtime==="cms"}),j=cre;if(k.kind==="loading"){let K;return e[13]===Symbol.for("react.memo_cache_sentinel")?(K=j(o.jsx(Sl,{})),e[13]=K):K=e[13],K}if(k.kind==="empty"){let K;return e[14]===Symbol.for("react.memo_cache_sentinel")?(K=j(o.jsx(ore,{})),e[14]=K):K=e[14],K}if(k.kind==="error"){let K;e[15]!==v||e[16]!==p||e[17]!==w||e[18]!==k.source?(K=()=>{if(k.source==="sandbox"){p.retry();return}Promise.all([v.refetch(),w.refetch()])},e[15]=v,e[16]=p,e[17]=w,e[18]=k.source,e[19]=K):K=e[19];const H=K;let q;return e[20]!==H||e[21]!==k.source?(q=j(o.jsx(lre,{source:k.source,onRetry:H})),e[20]=H,e[21]=k.source,e[22]=q):q=e[22],q}let C;e[23]!==f||e[24]!==s?(C=K=>j(o.jsx(Rw,{readOnly:f,virtualMcpId:s,className:"h-full min-h-0",children:K})),e[23]=f,e[24]=s,e[25]=C):C=e[25];const V=C,N=g.state.target;if(N?.kind==="loader"&&v.data&&w.data){const K=a??"",H=b??null;let q;e[26]!==v.data||e[27]!==w.data||e[28]!==l.slug||e[29]!==K||e[30]!==H||e[31]!==N.key||e[32]!==s?(q=o.jsx(ere,{orgSlug:l.slug,virtualMcpId:s,branch:K,previewUrl:H,meta:w.data,decofile:v.data,blockKey:N.key}),e[26]=v.data,e[27]=w.data,e[28]=l.slug,e[29]=K,e[30]=H,e[31]=N.key,e[32]=s,e[33]=q):q=e[33];let G;return e[34]!==V||e[35]!==q?(G=V(q),e[34]=V,e[35]=q,e[36]=G):G=e[36],G}let T;e[37]!==a||e[38]!==l.slug||e[39]!==N||e[40]!==s?(T=N||!a?null:T3(V3(l.slug,s,a)),e[37]=a,e[38]=l.slug,e[39]=N,e[40]=s,e[41]=T):T=e[41];const P=T;let E="/",R=null,M=null;N?.kind==="page"?(E=N.path,R=N.key):N?.kind==="section"?M=N.key:P&&(E=P.path,R=P.pageKey);const I=R?`page:${R}`:M?`section:${M}`:`path:${E}`;let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}),e[42]=D):D=e[42];const $=a??"",O=b??void 0,B=M?null:r,F=!!R&&g.state.editSeoPageKey===R;let z;e[43]!==M||e[44]!==R||e[45]!==E||e[46]!==I||e[47]!==i||e[48]!==l.slug||e[49]!==O||e[50]!==B||e[51]!==F||e[52]!==$||e[53]!==s||e[54]!==g.consumeEditSeo||e[55]!==g.setVariantOverride?(z=o.jsx(A.Suspense,{fallback:D,children:o.jsx(are,{orgSlug:l.slug,virtualMcpId:s,branch:$,previewReady:!0,previewUrl:O,currentPath:E,activePageBlockKey:R,activeGlobalBlockKey:M,externalSelection:B,initialEditSeo:F,onExitSeo:g.consumeEditSeo,onVariantPreviewOverride:g.setVariantOverride,onViewJsonFile:i},I)}),e[43]=M,e[44]=R,e[45]=E,e[46]=I,e[47]=i,e[48]=l.slug,e[49]=O,e[50]=B,e[51]=F,e[52]=$,e[53]=s,e[54]=g.consumeEditSeo,e[55]=g.setVariantOverride,e[56]=z):z=e[56];let W;return e[57]!==V||e[58]!==z?(W=V(z),e[57]=V,e[58]=z,e[59]=W):W=e[59],W}function cre(t){return o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function $b(t){const e=U.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=ce(),{org:a}=Fe(),{currentBranch:c,taskId:d}=an(),h=nl().previewUrl;let f;e[0]!==c||e[1]!==a.slug||e[2]!==h||e[3]!==d||e[4]!==s?(f=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:h}:null,e[0]=c,e[1]=a.slug,e[2]=h,e[3]=d,e[4]=s,e[5]=f):f=e[5];const p=L9(f),g=c??"";let x;e[6]!==a.slug||e[7]!==g||e[8]!==s?(x={orgSlug:a.slug,virtualMcpId:s,branch:g},e[6]=a.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:y}=E3(x),_=p.data?.[n],L=p.data===void 0&&p.isLoading,v=p.data!==void 0&&_===void 0,S=!c||v||L;let w;e[10]!==_?(w=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=w):w=e[11];const k=w;let j;e[12]!==n||e[13]!==S||e[14]!==b?(j=$=>{if(S)return;let O;try{O=JSON.parse($)}catch{return}O===null||typeof O!="object"||Array.isArray(O)||b(n,O)},e[12]=n,e[13]=S,e[14]=b,e[15]=j):j=e[15];const C=j;let V;e[16]!==y?(V=()=>({flush:y}),e[16]=y,e[17]=V):V=e[17],A.useImperativeHandle(r,V);let N;e[18]!==l?(N=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=N):N=e[19];let T;e[20]!==N?(T=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=T):T=e[21];let P;e[22]!==l?(P=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=P):P=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ws,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==P?(R=o.jsx(fe,{variant:"ghost",size:"icon",onClick:i,"aria-label":P,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=P,e[27]=R):R=e[27];let M;e[28]!==R||e[29]!==T?(M=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[T,R]}),e[28]=R,e[29]=T,e[30]=M):M=e[30];let I;e[31]!==p.data||e[32]!==y||e[33]!==k||e[34]!==L||e[35]!==v||e[36]!==n||e[37]!==S||e[38]!==C||e[39]!==l?(I=L?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}):v?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",l("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ld,{code:k,language:"json",readOnly:S,height:"100%",onChange:$=>C($??""),onSave:$=>{C($),y()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=y,e[33]=k,e[34]=L,e[35]=v,e[36]=n,e[37]=S,e[38]=C,e[39]=l,e[40]=I):I=e[40];let D;return e[41]!==M||e[42]!==I?(D=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[M,I]}),e[41]=M,e[42]=I,e[43]=D):D=e[43],D}function Vk(t){return t.contentEditingEnabled&&!t.isMobile}function dre(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function ure(t){return Vk({contentEditingEnabled:x6(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function hre(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const fre=500,mre={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Bb=1,O1=["desktop","mobile","tablet"],zb={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Fb(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function pre(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function nh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function $1(t,e){try{return new URL(t,e).href}catch{return null}}function gre(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return r.at(-1)===s?a=Math.max(a,95):r.includes(s)&&(a=Math.max(a,90)),a}function xre(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function bre({virtualMcpId:t}){const e=ce(),s=sd(),n=Hl(),i=lQ(),{currentBranch:r,taskId:l}=an(),a=Aw(),c=ro(),d=Sn(t),u=e0(c?.entity?.id===t?c.entity.metadata?.ui?.layout??null:null),h=x6(u),f=Vk({contentEditingEnabled:h,isMobile:n}),[m,p]=A.useState(()=>ure({cmsMode:u,isMobile:n})),[g,x]=A.useState("desktop"),[b,y]=A.useState(null),[_,L]=A.useState(null),v=A.useRef(null),S=A.useRef(null),[w,k]=A.useState(!1),j=A.useRef(null),C=()=>{j.current?.flush(),k(!1)},V=()=>k(be=>(be&&j.current?.flush(),!be)),[N,T]=A.useState({width:0,height:0}),[P,E]=A.useState(null),[R,M]=A.useState(!1),[I,D]=A.useState(""),$=A.useRef(null),[O,B]=A.useState(!1),[F,z]=A.useState(),[W,K]=A.useState(null),[H,q]=A.useState(null),[G,Q]=A.useState(null),[se,Z]=A.useState("/"),[te,X]=A.useState(null),[Y,de]=A.useState({}),[re,le]=A.useState(!1),ne=A.useRef(null),me=()=>{le(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>le(!1),15e3)},ee=()=>{ne.current&&(clearTimeout(ne.current),ne.current=null),le(!1)},{org:oe}=Fe(),ie=fi(),ue=nl(),J=ue.vmEntry,he=ue.previewUrl,ve=ie.lifecycle.phase,je=ve==="running",Ce=c?.entity?.id===t?m2(c.entity.metadata):null,Le=c?.entity?.id===t&&d.runtime==="cms",_e=d.projectDefault==="cms",Ne=nZ({sandboxUrl:he,previewServerUrl:Ce,fastPreviewActive:Le}),ge=t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r,threadId:l??null,previewUrl:he}:null,Te=L9(ge,{fetchEnabled:je}),Se=j3(ge,{fetchEnabled:je}),we=Te.data,Ye=Se.data,Ge=we?of(we).sort((be,De)=>be.name.localeCompare(De.name)):[],Ie=t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r}:null,Oe=Pee(Ie),pt=we&&Ye?k3(we,Ye):[],nt=we&&Ye?Nw(Ye,we,"loaders"):[],lt=I?(()=>{const be=I.toLowerCase();return Ge.map(De=>({page:De,score:gre(De.name,De.path,be)})).filter(({score:De})=>De>0).sort((De,yt)=>yt.score-De.score||De.page.path.length-yt.page.path.length).map(({page:De})=>De)})():Ge,gt=pt.filter(be=>{if(!I)return!0;const De=I.toLowerCase();return be.name.toLowerCase().includes(De)||be.key.toLowerCase().includes(De)||be.resolveType.toLowerCase().includes(De)}),bt=f?nt:[],rt=bt.filter(be=>{if(!I)return!0;const De=I.toLowerCase();return be.title.toLowerCase().includes(De)||be.key.toLowerCase().includes(De)||be.resolveType.toLowerCase().includes(De)}),ct=H?nt.find(be=>be.key===H)??null:null,Qe=$o,dt=W||H?null:op(Ge,se,te),ye=W?W.name:ct?.title??dt?.name,ke=dt?.key??null,et=dt?.path??null,tt=(ke?Y[ke]:void 0)??{},ut=Rr(se,tt),jt={};if(je&&he&&Ye&&we){const be=Iee(Ye,"loaders"),De=ke?we[ke]:void 0,yt=tee(De,we,os=>be.has(os)),Nt=JZ(yt);for(const os of tf(se)){if(os.type!=="param")continue;const pn=qZ(se,os.name,yt),Xs=ZZ(pn,be,Nt);Xs.length>0&&(jt[os.name]=Xs)}}const mt=t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r,threadId:l??null}:null,ft=we&&ke?uw(we,ke,0):[],at=we?ow(ft,we):[],vt=at.map(be=>be.isSavedBlock?be.label:""),wt=at.map(be=>be.isSavedBlock?"global":be.isMultivariate?"variant":"normal"),Me=ft.map(be=>ap(be,we??{})),ht=A.useRef(null),St=A.useRef(null),xt=ie.status.state==="paused",$t=ie.phase,pe=pw({claimPhase:$t,lifecycle:ie.lifecycle}),Pe=ue.previewState,Ue=ue.userStopped,Ae=C3(oe.slug,t??"",r??""),{url:Je}=rw(Le&&t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r,previewServerUrl:Ce??null,path:ut}:null),_t=_e&&d.runtime==="sandbox",ot=ZX({previewState:Pe,progressStatus:pe.status,previewServerUrl:Ce,fastPreviewActive:Le,fastPreviewReady:!!Je,codingSession:_t}),ts=ot.mode!=="none",Ve=ot.mode==="production"&&ot.iframeBase?nh(ot.iframeBase):null,Be=!s,Vt=ot.mode==="production"?Ve:nh(he),Ct=c?.entity?.id===t&&c.entity.metadata?.fastPreviewInPlace===!0,As=ot.mode==="production"&&Le&&Ct&&f&&m==="blocks",wn=A.useRef(null);As||(wn.current=Je);const oo=wn.current,lo=As?oo??Je:Je,Js=pre(ot.mode==="sandbox"?q0(Fb(G??$1(ut,ot.iframeBase)??ot.iframeBase,g),a.state.variantOverride??[]):ot.mode==="production"&&Be?q0(Fb(iw(G??lo??$1(ut,ot.iframeBase)??ot.iframeBase,ot.showWakingPill?tZ:null),g),a.state.variantOverride??[]):null);A.useEffect(()=>{},[s,Ve,P]);const mi="sandbox.preview.openInNewTab",br=Je??(ot.iframeBase?$1(ut,ot.iframeBase):null),ao=ot.mode==="production"?br?q0(br,a.state.variantOverride??[]):null:Js??ot.iframeBase,co=async()=>{const be=ao;if(be){window.open(be,"_blank","noopener");return}},pi=t&&r?V3(oe.slug,t,r):null,gi=be=>{pi&&HZ(pi,be)},is=a.state.target;A.useEffect(()=>{if(!(!is||!Ne||!Ye))if(is.kind==="page"){const be=Y[is.key]??{};St.current=Rr(is.path,be),K(null),q(null),Q(null),X(is.key),Z(is.path),gi({path:is.path,pageKey:is.key,params:be})}else if(is.kind==="loader")St.current=null,K(null),q(is.key),Q(null);else{const be=pt.find(De=>De.key===is.key);if(be){St.current=null;const De=sf(Ye);q(null),K(be),Q(nb(Ne,De,be.key))}}},[is,Ne,Ye,Y]),A.useEffect(()=>{!ke||et===null||is?.kind==="page"&&is.key===ke&&is.path===et||a.selectTarget({kind:"page",key:ke,path:et})},[ke,et,is]);const[vr,$i]=A.useState(null);if(Pe.kind==="iframe"&&vr!==Pe.previewUrl){const be=vr!==null;$i(Pe.previewUrl);const De=pi?T3(pi):null;if(De){if(St.current=Rr(De.path,De.params),Z(De.path),X(De.pageKey),Q(null),K(null),q(null),De.pageKey&&Object.keys(De.params).length>0){const yt=De.pageKey;de(Nt=>({...Nt,[yt]:De.params}))}}else be&&(St.current=null,Z("/"),Q(null),X(null),K(null),q(null))}ht.current=Js;const yr=nQ({iframeRef:v,src:ot.mode==="sandbox"?Js:null,active:ot.mode==="sandbox"}),_r=A.useRef(null);A.useEffect(()=>{if(!Je||!Js||_r.current===Je)return;_r.current=Je;const be=v.current;be&&be.getAttribute("src")!==Js&&(me(),be.src=Js)},[Je,Js]);const Lr=()=>{const be=v.current?.contentWindow,De=Vt;if(!be||!De||!we||!ke)return;const yt=we[ke];if(!yt||typeof yt!="object")return;const Nt=sZ({previewBaseUrl:De,pageBlock:yt,decofile:we,path:ut,pathTemplate:se});if(!Nt)return;const os=q0(Nt.src,a.state.variantOverride??[]);be.postMessage({type:"cms-editor::render",src:os,body:Nt.body},De)},uo=A.useRef(null);A.useEffect(()=>{if(!As||W||H||!ke||!we){uo.current=null;return}const be=JSON.stringify({page:ke,path:ut,pathTemplate:se,decofile:we});if(uo.current===be)return;const De=uo.current===null;uo.current=be,!De&&Lr()},[we,As,W,H,ke,ut,se]);const Bi=A.useRef(null);A.useEffect(()=>{if(!As||W||H||!ke||!we){Bi.current=null;return}const be=JSON.stringify(a.state.variantOverride??null),De=Bi.current;Bi.current={page:ke,sig:be},!(!De||De.page!==ke||De.sig===be)&&Lr()},[a.state.variantOverride,As,W,H,ke]);const ho=!!t&&!!r&&!ie.notFound&&!Ue&&!xt&&($t?.kind==="ready"||ve!=="idle"),Bs=hre({editingMode:m,sandboxDisplay:ot.mode==="sandbox",blocksEditingEnabled:f});A.useEffect(()=>{const be=Vt;if(!be)return;const De=yt=>{if(yt.origin===be)if(yt.data?.type==="visual-editor::element-clicked"){const Nt=aZ.safeParse(yt.data.payload);Nt.success&&y(Nt.data)}else if(yt.data?.type==="cms-editor::section-clicked"){const Nt=uZ.safeParse(yt.data.payload);Nt.success&&L({index:Nt.data.sectionIndex,seq:Nt.data.clickSeq})}else yt.data?.type==="cms-editor::render-start"?me():yt.data?.type==="cms-editor::render-end"?(ee(),v.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:vt,kinds:wt,keys:Me},be)):yt.data?.type==="cms-editor::render-error"&&ee()};return window.addEventListener("message",De),()=>window.removeEventListener("message",De)},[Vt,vt,wt,Me]);const Sr=()=>{const be=v.current?.contentWindow,De=nh(he);!be||!De||be.postMessage({type:"visual-editor::activate",script:cZ},De)},fo=()=>{const be=v.current?.contentWindow,De=nh(he);!be||!De||be.postMessage({type:"visual-editor::deactivate"},De)},ol=()=>{const be=v.current?.contentWindow,De=Vt;!be||!De||(be.postMessage(ot.mode==="production"?{type:"editor::inject",args:{script:rb}}:{type:"visual-editor::activate",script:rb},De),be.postMessage({type:"cms-editor::set-labels",labels:vt,kinds:wt,keys:Me},De))},mo=()=>{const be=v.current?.contentWindow,De=Vt;!be||!De||be.postMessage({type:"cms-editor::deactivate"},De)},zi=be=>{if(be==="blocks"&&!f)return;const De=m;!n&&be!==De&&(be==="blocks"?S.current?.resize("30%"):S.current?.collapse()),be!=="blocks"&&C(),p(be),y(null),L(null),be!=="blocks"&&q(null),De==="visual"&&fo(),be==="visual"&&Sr(),De==="blocks"&&be!=="blocks"&&mo(),be==="blocks"&&ol()},po=()=>{zi(dre(m,f))},go=()=>{if(!v.current||!Js)return;me();const be=v.current;be.src=Js};q$(()=>{const be=v.current;if(!be)return;me();const De=document.activeElement,yt=be.tabIndex;be.tabIndex=-1,be.style.pointerEvents="none",be.blur(),xre(be,ht.current);let Nt;const os=()=>{clearTimeout(Nt),be.tabIndex=yt,be.style.pointerEvents="";const pn=document.activeElement;(!pn||pn===document.body||pn===be)&&De?.focus(),be.removeEventListener("load",os)};be.addEventListener("load",os),Nt=setTimeout(os,3e3)});const xo=()=>{const be=O1.indexOf(g);x(O1[(be+1)%O1.length])},Fi=(be,De)=>{if(!ke)return;const yt=ke,Nt={...tt,[be]:De};St.current=Rr(se,Nt),de(os=>({...os,[yt]:Nt})),gi({path:se,pageKey:yt,params:Nt})},wr=Vee({iframeBase:ot.iframeBase,resolvedPath:ut,activeGlobalSectionName:W?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Ui=be=>{const De=Y[be.key]??{},yt=Rr(be.path,De);(W||Qe(yt)!==Qe(ut))&&me(),St.current=yt,K(null),q(null),Q(null),L(null),X(be.key),Z(be.path),gi({path:be.path,pageKey:be.key,params:De}),a.selectTarget({kind:"page",key:be.key,path:be.path})},B9=be=>{if(!Ne||!Ye){xe.error(e("sandbox.preview.previewMetadataNotReady"));return}me(),St.current=null;const De=sf(Ye),yt=nb(Ne,De,be.key);K(be),q(null),Q(yt),L(null),a.selectTarget({kind:"section",key:be.key})},bo=be=>{f&&(K(null),q(be.key),Q(null),zi("blocks"),a.selectTarget({kind:"loader",key:be.key}))},vo=async({name:be,path:De,templateKey:yt})=>{if(!t||!r)return;const Nt=w9(De);if(Nt){z(Nt);return}const os=De.trim().startsWith("/")?De.trim():`/${De.trim()}`;if(Ge.some(Xs=>Qe(Xs.path)===Qe(os))){z(e("sandbox.preview.pageAlreadyExists",{path:os}));return}let pn;if(yt&&(pn=we?.[yt],!pn)){z(e("sandbox.preview.templateNoLongerExists"));return}z(void 0);try{const Xs=await Oe.mutateAsync({name:be,path:os,template:pn});B(!1),xe.success(e("sandbox.preview.pageCreated",{name:be})),await rd(fre),Ui({key:Xs.key,name:Xs.name,path:Xs.path}),zi("blocks")}catch(Xs){z(Xs instanceof Error?Xs.message:e("sandbox.preview.failedToCreatePage"))}},kr=ts&&(ho||ot.mode==="production"),yo=Tee({showPreviewToolbar:kr,contentEditingEnabled:h}),xi=kr?o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{onClick:go,"aria-label":e("sandbox.preview.refresh"),children:o.jsx($n,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),yo?o.jsxs("div",{ref:$,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>M(be=>!be),children:[W&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Hr,{size:11}),"Global"]}),ct&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Vl,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:ae("text-[13px] font-medium text-foreground",ye==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ye??wr}),!W&&!H&&ye!=null&&se&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:tf(se).map((be,De)=>{if(be.type==="text")return o.jsx("span",{className:ae(De===0?"min-w-0 truncate":"shrink-0"),children:be.text},`text-${De}`);const yt=jt[be.name];return yt&&mt?o.jsx(gee,{sources:yt,template:se,paramName:be.name,value:tt[be.name]??"",sandboxRef:mt,onCommit:Nt=>Fi(be.name,Nt)},`${ke}:${be.name}`):o.jsx(Cee,{name:be.name,value:tt[be.name]??"",onCommit:Nt=>Fi(be.name,Nt)},`${ke}:${be.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>M(be=>!be),"aria-label":e("sandbox.preview.choosePage"),"aria-expanded":R,children:o.jsx(Ls,{size:12,className:ae("shrink-0 text-muted-foreground transition-transform",R&&"rotate-180")})})]}),R&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:I,onChange:be=>D(be.target.value),onKeyDown:be=>{if(be.key!=="Enter")return;const De=I.trim();if(!De)return;const yt=lt.find(Nt=>Qe(Nt.path)===Qe(De));yt&&(be.preventDefault(),M(!1),D(""),Ui(yt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:be=>{be.preventDefault(),M(!1),D(""),z(void 0),B(!0)},children:[o.jsx(Yt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),lt.length===0&>.length===0&&rt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Ge.length===0&&pt.length===0&&bt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[lt.length>0&&o.jsx("div",{className:"p-1.5",children:lt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),M(!1),D(""),Ui(be)},children:[o.jsx(Mo,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.path})]},be.key))}),gt.length>0&&o.jsxs("div",{className:ae("p-1.5",lt.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),gt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),M(!1),D(""),B9(be)},children:[o.jsx(Hr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]}),rt.length>0&&o.jsxs("div",{className:ae("p-1.5",(lt.length>0||gt.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),rt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),M(!1),D(""),bo(be)},children:[o.jsx(Vl,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:wr}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{"aria-label":e(mi),onClick:()=>{co()},children:o.jsx(mn,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e(mi)})]})]}):null,jr=xi?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:xi}):null,_o=ot.mode==="sandbox",bi=mre[g],vi=g==="desktop"&&(N.width===0||N.width>=bi.width+2*Bb),Cr=vi?1:Math.min(N.width>0?N.width/(bi.width+2*Bb):1,1),bd=vi?{width:"100%",height:"100%"}:{width:`${bi.width}px`,height:N.height>0?`${N.height/Cr}px`:`${bi.height}px`,transform:`scale(${Cr})`,transformOrigin:"top center"},Lo=ts?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[_o&&o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{onClick:po,"aria-pressed":Bs==="visual","aria-label":e("sandbox.preview.visualEditor"),active:Bs==="visual",className:"rounded-full",children:o.jsx(Px,{size:16})})}),o.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{onClick:xo,"aria-label":e(zb[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(RT,{size:16}),g==="tablet"&&o.jsx(DT,{size:16}),g==="desktop"&&o.jsx(MT,{size:16})]},g)})}),o.jsx(Ke,{side:"top",children:e(zb[g])})]})]})}):null,vd=!!H&&Bs==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[mt&&Object.entries(jt).map(([be,De])=>(tt[be]??"")===""?o.jsx(kee,{sources:De,template:se,paramName:be,sandboxRef:mt,onFill:yt=>Fi(be,yt)},`${ke}:${be}`):null),i?jr&&o.jsx(oQ,{children:jr}):xi&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex-1"}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:xi}),o.jsx("div",{className:"flex-1"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:vd?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(Ob,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V}),w&&ke&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx($b,{ref:j,virtualMcpId:t,pageKey:ke,onClose:C})})]}):o.jsxs(Im,{orientation:"horizontal",disabled:Bs!=="blocks",children:[o.jsx(Lc,{ref:S,id:"preview-blocks-editor",defaultSize:Bs==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Bs==="blocks"&&o.jsx(Ob,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V})}),Bs==="blocks"&&o.jsx(Om,{withHandle:!0}),o.jsx(Lc,{id:"preview-canvas",defaultSize:Bs==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(Im,{orientation:"horizontal",disabled:!(w&&ke),children:[w&&ke&&o.jsxs(o.Fragment,{children:[o.jsx(Lc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx($b,{ref:j,virtualMcpId:t,pageKey:ke,onClose:C})}),o.jsx(Om,{withHandle:!0})]}),o.jsx(Lc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:be=>{if(!be)return;const De=()=>T(Nt=>Nt.width===be.clientWidth&&Nt.height===be.clientHeight?Nt:{width:be.clientWidth,height:be.clientHeight});De();const yt=new ResizeObserver(De);return yt.observe(be),()=>yt.disconnect()},className:ae("h-full relative overflow-clip flex justify-center",ts&&!vi&&"bg-muted/30"),children:[(re||Ae)&&ts&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),ot.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Pc,{kind:"starting",progress:pe,claimPhase:$t})}),Pe.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Pc,{kind:"suspended",onResume:ue.resume})}),Pe.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Pc,{kind:"errored",error:Pe.error,onRetry:ue.retry,connectionsHref:`/${oe.slug}/settings/connections`})}),ot.showWakingPill&&o.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(st,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Bs==="visual"&&!b&&o.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(Px,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Bs==="visual"&&b&&o.jsx(NZ,{element:b,onDismiss:()=>y(null)}),Lo,ts&&Js&&o.jsx("div",{className:ae("shrink-0",!vi&&"border-x border-border bg-background shadow-sm"),style:bd,children:o.jsx("iframe",{ref:v,src:Js,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:yr.handleError,onLoad:()=>{if(yr.handleLoad(),ee(),ot.mode!=="sandbox"){ot.mode==="production"&&!ot.showWakingPill&&Bs==="blocks"&&ol();return}if(qe("vm_preview_loaded",{view_mode:Bs,vm_id:J?.sandboxHandle??null}),!W)try{const be=v.current?.contentWindow?.location?.pathname;if(!be)return;const De=St.current;if(De!==null&&(St.current=null,Qe(be)!==Qe(De))||Qe(be)===Qe(ut))return;Z(be),gi({path:be,pageKey:te,params:tt})}catch{}Bs==="visual"&&Sr(),Bs==="blocks"&&ol()}},ot.iframeBase)})]})})]})})]})}),o.jsx(Ree,{open:O,onOpenChange:B,isPending:Oe.isPending,error:F,templates:Ge,onSubmit:vo})]})}function vre(t){const e=U.c(22),{virtualMcpId:s}=t,n=ce(),i=Vs(s),{activeTask:r,taskId:l,currentBranch:a}=an(),c=g_(l),[d,u]=A.useState(!1);if(x_({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:bn(i?.metadata),threadHasRepo:bn(c)||bn(r?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(_n,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>u(!0),b=o.jsx(_n,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let y;e[7]!==n?(y=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsxs(fe,{onClick:x,children:[b,y]}),e[9]=y,e[10]=_):_=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==_?(L=o.jsx(Vi,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=L):L=e[14];let v;e[15]!==d?(v=o.jsx(Ju,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=v):v=e[16];let S;return e[17]!==L||e[18]!==v?(S=o.jsxs(o.Fragment,{children:[L,v]}),e[17]=L,e[18]=v,e[19]=S):S=e[19],S}let f;return e[20]!==s?(f=o.jsx(bre,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}function yre(t){const e=U.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,enabled:l}=t,a=l===void 0?!0:l;let c;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c=it.sandboxRepoDir(s,n,i,r),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==r||e[8]!==n?(d=async()=>{const f=eo({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==a||e[11]!==c||e[12]!==d?(u={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=u):u=e[13],Qt(u).data??null}const _re=A.lazy(()=>Ys(()=>import("./file-explorer-BVlXTJHP.js"),__vite__mapDeps([158,1,2,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,94,96,88,97,69,98,99,100,101,102,103,104,70,144,142,92,138,109,78,79,80,81,82,83,84,85,86,87,89,90,91,93,95,105,106,107,108,75,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,139,140,141,143,145,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.FileExplorer})));function Lre(t){const e=U.c(26),{openPath:s}=t,n=ce(),i=ro(),{org:r}=Fe(),{currentBranch:l,taskId:a}=an(),c=i?.entity?.id??null,d=sd(),u=nl(),h=fi();u.vmEntry,h.lifecycle.phase;const f=d,m=c??"",p=l??"",g=a??null,x=f;let b;e[0]!==r.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=r.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],yre(b);const y=null;if(!c||!l){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;e[8]!==n?(j=n("mainPanelTabs.codeTab.noSandboxToBrowseDescription"),e[8]=n,e[9]=j):j=e[9];let C;return e[10]!==k||e[11]!==j?(C=o.jsx(Vi,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=C):C=e[12],C}let _;e[13]!==y||e[14]!==n?(_=y,e[13]=y,e[14]=n,e[15]=_):_=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}),e[16]=L):L=e[16];const v=a??null;let S;e[17]!==l||e[18]!==s||e[19]!==r.slug||e[20]!==v||e[21]!==c?(S=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(A.Suspense,{fallback:L,children:o.jsx(_re,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:v,openPath:s})})}),e[17]=l,e[18]=s,e[19]=r.slug,e[20]=v,e[21]=c,e[22]=S):S=e[22];let w;return e[23]!==_||e[24]!==S?(w=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,S]}),e[23]=_,e[24]=S,e[25]=w):w=e[25],w}function Sre(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function wre(t,e,s){return typeof t!="string"?null:Sre(zn(t,e),s)}function Tk(t,e,s){if(!e||typeof t!="string")return!1;const n=wre(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function kre({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ms(),i=_s()?.taskId??null,r=f0(e),l=Sn(e).runtime==="cms";return Rs({mutationKey:yg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await $7({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return Lg(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:u0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=h0(r,p8(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():l9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=it.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:it.liveMeta(t,e,s)})}})}function mc(t){const e=U.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let r;e[0]!==i||e[1]!==n||e[2]!==s?(r=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==r?(l=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5],l}function E9(t,e){return`${t}-${e}`}function Ak(t,e){return`site/apps/${t}/${e}.ts`}function Pk(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function jre(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Cre(t){return t==="local"?"Custom":"Installed"}function Ek(t,e,s){const n=new Set([E9(t,e),e].map(r=>r.toLowerCase())),i=Ak(t,e);for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(r.toLowerCase())||a.__resolveType===i)return r}return null}function Nre(t,e){const s=t.vendor.alias,n=t.name,i=Ek(s,n,e);return{id:E9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Ak(s,n),blockKey:i,installed:i!==null}}function Vre(t,e,s){if(t===w3)return null;const n=Pk(t);if(!n)return null;const{vendor:i,app:r}=n,l=Ek(i,r,s),a=rl(t,e);return{id:E9(i,r),app:r,vendor:i,title:a.title??r,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function Tre(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Uc(t,e)||!$S(n))return null;const i=Pk(n)??jre(t);if(!i)return null;const r=rl(n,s),{vendor:l,app:a}=i;return{id:E9(l,a),app:a,vendor:l,title:r.title??lf(t,e,s),description:r.description??"",category:Cre(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function Are(t,e,s){const n=new Map;for(const r of t){const l=Nre(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=Vre(r,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=Tre(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Pre)}function Pre(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Ere(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function Rre(t,e,s){const n=U.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=it.decoApps(),n[0]=r):r=n[0];let l;n[1]!==i?(l={queryKey:r,queryFn:Ere,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Qt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Are(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function Dre(t){const e=U.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=ce();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const u=s==="pages";let h;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==u?(h=o.jsx(Fn,{id:"pages",icon:Mo,label:d,count:n.pages,active:u,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==r||e[15]!==f||e[16]!==m?(p=o.jsx(Fn,{id:"sections",icon:Hr,label:f,count:n.sections,active:m,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==r||e[22]!==x||e[23]!==g?(b=o.jsx(Fn,{id:"apps",icon:Z6,label:g,count:n.apps,active:x,onSelect:r}),e[20]=n.apps,e[21]=r,e[22]=x,e[23]=g,e[24]=b):b=e[24];let y;e[25]!==l?(y=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=y):y=e[26];const _=s==="redirects";let L;e[27]!==n.redirects||e[28]!==r||e[29]!==y||e[30]!==_?(L=o.jsx(Fn,{id:"redirects",icon:F6,label:y,count:n.redirects,active:_,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=y,e[30]=_,e[31]=L):L=e[31];let v;e[32]!==l?(v=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=v):v=e[33];const S=s==="loaders";let w;e[34]!==n.loaders||e[35]!==r||e[36]!==v||e[37]!==S?(w=o.jsx(Fn,{id:"loaders",icon:Vl,label:v,count:n.loaders,active:S,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=v,e[37]=S,e[38]=w):w=e[38];let k;e[39]!==l?(k=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=k):k=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==r||e[43]!==k||e[44]!==j?(C=o.jsx(Fn,{id:"actions",icon:dr,label:k,count:n.actions,active:j,onSelect:r}),e[41]=n.actions,e[42]=r,e[43]=k,e[44]=j,e[45]=C):C=e[45];let V;e[46]!==l?(V=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=V):V=e[47];const N=s==="site";let T;e[48]!==r||e[49]!==V||e[50]!==N?(T=o.jsx(Fn,{id:"site",icon:C6,label:V,active:N,onSelect:r}),e[48]=r,e[49]=V,e[50]=N,e[51]=T):T=e[51];let P;e[52]!==l?(P=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=P):P=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==P||e[56]!==E?(R=o.jsx(Fn,{id:"seo",icon:U6,label:P,active:E,onSelect:r}),e[54]=r,e[55]=P,e[56]=E,e[57]=R):R=e[57];let M;e[58]!==l?(M=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=M):M=e[59];const I=s==="calendar";let D;e[60]!==r||e[61]!==M||e[62]!==I?(D=o.jsx(Fn,{id:"calendar",icon:Zc,label:M,active:I,onSelect:r}),e[60]=r,e[61]=M,e[62]=I,e[63]=D):D=e[63];let $;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?($=i&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Mc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Fn,{id:"posts",icon:Ai,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Fn,{id:"authors",icon:t9,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Fn,{id:"categories",icon:M2,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Fn,{id:"post-schedule",icon:IT,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=r,e[69]=i,e[70]=l,e[71]=$):$=e[71];let O;e[72]!==b||e[73]!==L||e[74]!==w||e[75]!==C||e[76]!==T||e[77]!==R||e[78]!==D||e[79]!==$||e[80]!==h||e[81]!==p?(O=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,L,w,C,T,R,D,$]}),e[72]=b,e[73]=L,e[74]=w,e[75]=C,e[76]=T,e[77]=R,e[78]=D,e[79]=$,e[80]=h,e[81]=p,e[82]=O):O=e[82];let B;return e[83]!==c||e[84]!==O?(B=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,O]}),e[83]=c,e[84]=O,e[85]=B):B=e[85],B}function Fn(t){const e=U.c(18),{id:s,icon:n,label:i,count:r,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let u;e[3]!==d?(u=ae("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=o.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==r?(m=r!==void 0&&o.jsx("span",{className:ae("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[9]=l,e[10]=r,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function Mre(t){const e=U.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=pw({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=o.jsx(Pc,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==r?(a=o.jsx(Pc,{kind:"suspended",onResume:r}),e[6]=r,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==r||e[10]!==s.error?(a=o.jsx(Pc,{kind:"errored",error:s.error,onRetry:r,connectionsHref:l}),e[8]=l,e[9]=r,e[10]=s.error,e[11]=a):a=e[11],a}}}const Ire=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Ore(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Ire.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Ub(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const r=`${s} (copy ${i})`;if(!t.has(r))return r}return`${s} (copy ${Date.now()})`}function $re(t,e){const s=$o,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const l=`${n}-copy-${r}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function Bre(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const r=`${s}_copy_${i}`;if(!Object.hasOwn(t,r))return r}return`${s}_copy_${Date.now()}`}function zre(t){const e=P3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Fre(t,e){return _w(t,e)}const Ure=1e3;function Hre(t,e){for(let s=0;s<Ure;s++){const n=P3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Kre={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Wre={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},qre={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Gre(t){const e=U.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=ce(),[p,g]=A.useState(i),[x,b]=A.useState(r),[y,_]=A.useState(Bo),[L,v]=A.useState(null),[S,w]=A.useState(s);s!==S&&(w(s),s&&(g(i),b(r),_(Bo),v(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=ee=>{!ee&&!f&&(v(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const C=j;let V;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==k||e[8]!==y||e[9]!==d?(V=async ee=>{ee.preventDefault();const oe=p.trim(),ie=x.trim();if(!oe||!ie||f)return;const ue=w9(ie);if(ue){v(ue);return}const J=d?.({name:oe,path:ie});if(J){v(J);return}v(null),await u({name:oe,path:ie,templateKey:k&&y!==Bo?y:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=k,e[8]=y,e[9]=d,e[10]=V):V=e[10];const N=V,T=L??a,P=Kre[n];let E;e[11]!==m||e[12]!==P?(E=m(P),e[11]=m,e[12]=P,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(ms,{children:o.jsx(Gt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let M;e[16]!==f||e[17]!==k||e[18]!==m||e[19]!==y||e[20]!==c?(M=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(Lw,{id:"page-form-template",value:y,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=y,e[20]=c,e[21]=M):M=e[21];let I;e[22]!==m?(I=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=I):I=e[23];let D;e[24]!==I?(D=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:I}),e[24]=I,e[25]=D):D=e[25];let $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=ee=>g(ee.target.value),e[26]=$):$=e[26];let O;e[27]!==m?(O=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=O):O=e[28];let B;e[29]!==f||e[30]!==p||e[31]!==O?(B=o.jsx(kt,{id:"page-form-name",value:p,onChange:$,placeholder:O,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=O,e[32]=B):B=e[32];let F;e[33]!==B||e[34]!==D?(F=o.jsxs("div",{className:"space-y-1.5",children:[D,B]}),e[33]=B,e[34]=D,e[35]=F):F=e[35];let z;e[36]!==m?(z=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=z):z=e[37];let W;e[38]!==z?(W=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:z}),e[38]=z,e[39]=W):W=e[39];let K;e[40]===Symbol.for("react.memo_cache_sentinel")?(K=ee=>b(ee.target.value),e[40]=K):K=e[40];let H;e[41]!==m?(H=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=H):H=e[42];let q;e[43]!==f||e[44]!==x||e[45]!==H?(q=o.jsx(kt,{id:"page-form-path",value:x,onChange:K,placeholder:H,disabled:f}),e[43]=f,e[44]=x,e[45]=H,e[46]=q):q=e[46];let G;e[47]!==W||e[48]!==q?(G=o.jsxs("div",{className:"space-y-1.5",children:[W,q]}),e[47]=W,e[48]=q,e[49]=G):G=e[49];let Q;e[50]!==T?(Q=T&&o.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=Q):Q=e[51];let se;e[52]!==F||e[53]!==G||e[54]!==Q||e[55]!==M?(se=o.jsxs("div",{className:"space-y-4 py-4",children:[M,F,G,Q]}),e[52]=F,e[53]=G,e[54]=Q,e[55]=M,e[56]=se):se=e[56];let Z;e[57]!==h?(Z=()=>h(!1),e[57]=h,e[58]=Z):Z=e[58];let te;e[59]!==m?(te=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=te):te=e[60];let X;e[61]!==f||e[62]!==Z||e[63]!==te?(X=o.jsx(fe,{type:"button",variant:"outline",onClick:Z,disabled:f,children:te}),e[61]=f,e[62]=Z,e[63]=te,e[64]=X):X=e[64];let Y;e[65]!==f||e[66]!==p||e[67]!==x?(Y=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=Y):Y=e[68];let de;e[69]!==f||e[70]!==n||e[71]!==m?(de=f?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),m(qre[n])]}):m(Wre[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=de):de=e[72];let re;e[73]!==Y||e[74]!==de?(re=o.jsx(fe,{type:"submit",disabled:Y,children:de}),e[73]=Y,e[74]=de,e[75]=re):re=e[75];let le;e[76]!==X||e[77]!==re?(le=o.jsxs(Yn,{children:[X,re]}),e[76]=X,e[77]=re,e[78]=le):le=e[78];let ne;e[79]!==N||e[80]!==se||e[81]!==le||e[82]!==R?(ne=o.jsx(Ft,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[R,se,le]})}),e[79]=N,e[80]=se,e[81]=le,e[82]=R,e[83]=ne):ne=e[83];let me;return e[84]!==C||e[85]!==s||e[86]!==ne?(me=o.jsx(Ut,{open:s,onOpenChange:C,children:ne}),e[84]=C,e[85]=s,e[86]=ne,e[87]=me):me=e[87],me}function Yre(t){const e=U.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=ce(),[u,h]=A.useState(i),[f,m]=A.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=K=>{!K&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==u||e[5]!==l?(x=async K=>{K.preventDefault();const H=u.trim();!H||c||await l(H)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let y;e[7]!==d?(y=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsx(Gt,{children:y}),e[9]=y,e[10]=_):_=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let v;e[13]!==L?(v=o.jsx(Tn,{children:L}),e[13]=L,e[14]=v):v=e[14];let S;e[15]!==_||e[16]!==v?(S=o.jsxs(ms,{children:[_,v]}),e[15]=_,e[16]=v,e[17]=S):S=e[17];let w;e[18]!==d?(w=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=w):w=e[19];let k;e[20]!==w?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:w}),e[20]=w,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=K=>h(K.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==u?(C=o.jsx(kt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=C):C=e[25];let V;e[26]!==k||e[27]!==C?(V=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=V):V=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let T;e[31]!==N?(T=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=T):T=e[32];let P;e[33]!==n?(P=o.jsx(kt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=P):P=e[34];let E;e[35]!==T||e[36]!==P?(E=o.jsxs("div",{className:"space-y-1.5",children:[T,P]}),e[35]=T,e[36]=P,e[37]=E):E=e[37];let R;e[38]!==V||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[V,E]}),e[38]=V,e[39]=E,e[40]=R):R=e[40];let M;e[41]!==a?(M=()=>a(!1),e[41]=a,e[42]=M):M=e[42];let I;e[43]!==d?(I=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=I):I=e[44];let D;e[45]!==c||e[46]!==M||e[47]!==I?(D=o.jsx(fe,{type:"button",variant:"outline",onClick:M,disabled:c,children:I}),e[45]=c,e[46]=M,e[47]=I,e[48]=D):D=e[48];let $;e[49]!==c||e[50]!==u?($=!u.trim()||c,e[49]=c,e[50]=u,e[51]=$):$=e[51];let O;e[52]!==c||e[53]!==d?(O=c?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=O):O=e[54];let B;e[55]!==$||e[56]!==O?(B=o.jsx(fe,{type:"submit",disabled:$,children:O}),e[55]=$,e[56]=O,e[57]=B):B=e[57];let F;e[58]!==D||e[59]!==B?(F=o.jsxs(Yn,{children:[D,B]}),e[58]=D,e[59]=B,e[60]=F):F=e[60];let z;e[61]!==b||e[62]!==R||e[63]!==F||e[64]!==S?(z=o.jsx(Ft,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[S,R,F]})}),e[61]=b,e[62]=R,e[63]=F,e[64]=S,e[65]=z):z=e[65];let W;return e[66]!==g||e[67]!==s||e[68]!==z?(W=o.jsx(Ut,{open:s,onOpenChange:g,children:z}),e[66]=g,e[67]=s,e[68]=z,e[69]=W):W=e[69],W}function Jre(t){const e=U.c(7),{type:s}=t,n=EQ[s];let i;e[0]!==n?(i=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const r=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==r?(l=o.jsx(Ke,{side:"left",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs(We,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const B1={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},J3=["posts","authors","categories"],du={posts:"post",authors:"author",categories:"category"};function uu(t){return J3.includes(t)}const X3={posts:"post",authors:"author",categories:"category"},Rk={posts:B1.post,authors:B1.author,categories:B1.category},Xre=Object.fromEntries(Object.entries(Rk).map(([t,e])=>[e,t]));function Qre(t){return typeof t=="string"?Xre[t]??null:null}function Xo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function cs(t){return typeof t=="string"?t:""}function Zre(t,e){switch(t){case"posts":return{label:cs(e.title)||"Untitled post",subtitle:cs(e.slug)};case"authors":return{label:cs(e.name)||"Unnamed author",subtitle:cs(e.email)};case"categories":return{label:cs(e.name)||"Unnamed category",subtitle:cs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Dk(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Xo(n);if(!i)continue;const r=Qre(i.__resolveType);if(!r)continue;const l=Xo(i[X3[r]])??{},{label:a,subtitle:c}=Zre(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of J3)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function eoe(t,e){return Dk(t)[e]}function Ru(t,e){return eoe(t,e).map(s=>({key:s.key,payload:Kd(Xo(t[s.key])??void 0,e)}))}const Hb=Object.freeze({});function Kd(t,e){return t?Xo(t[X3[e]])??Hb:Hb}function pc(t,e,s){return{name:t,__resolveType:Rk[e],[X3[e]]:s}}function P2e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:cs(Xo(f)?.[s]),l=f=>typeof f=="string"?f:cs(Xo(f)?.name),a=f=>{const m=r(f),p=m?t.find(({payload:x})=>cs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>cs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:cs(m.name)||cs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||r(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function zl(t){return Array.isArray(t)?t:[]}function Fr(t){if(typeof t=="string")return t;const e=Xo(t);return e?cs(e.slug):""}function toe(t){if(typeof t=="string")return t;const e=Xo(t);return e?cs(e.email):""}function Mk(t){const e=[];return cs(t.title).trim()||e.push("Title"),cs(t.slug).trim()||e.push("Slug"),zl(t.categories).map(Fr).filter(Boolean).length===0&&e.push("Category"),cs(t.excerpt).trim()||e.push("Excerpt"),cs(t.image).trim()||e.push("Cover image"),e}const Ik=8;function Ok(t){const e=cs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function E2e(t,e){return e!=="published"||Ok(t)==="published"?!1:Mk(t).length>0}function soe(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Ik).toISOString()}function R2e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=cs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?soe(s):n}}function $k(t){return Ru(t,"posts").map(({key:e,payload:s})=>({key:e,title:cs(s.title)||"Untitled post",slug:cs(s.slug),date:cs(s.date),scheduledDatetime:cs(s.scheduledDatetime),categorySlugs:zl(s.categories).map(Fr).filter(Boolean),authorEmails:zl(s.authors).map(toe).filter(Boolean),missing:Mk(s),status:Ok(s)}))}function noe(t,e){const s=zl(t.categories);return s.some(n=>Fr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function ioe(t,e){const s=zl(t.categories);return s.length===1&&Fr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function D2e(t,e,s){const n=zl(t.categories);if(!n.some(a=>Fr(a)===e))return t;const i=n.map(a=>{const c=Fr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=Fr(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function roe(t,e){const s=zl(t.categories);return s.some(n=>Fr(n)===e)?{...t,categories:s.filter(n=>Fr(n)!==e)}:t}function Kb(t){return{...t,dateModified:new Date().toISOString()}}function pp(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function z1(t,e){const s=`collections/blog/${e}/${pp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Bk(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${pp(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${pp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const ooe={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Wb="Box";function loe(t){return t.startsWith("site/")?"site":"app"}function aoe(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Vd(...t){for(const e of t)if(e!==void 0)return e}function M2e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!uoe(r)||e.has(r))continue;e.add(r);const l=rl(r,t),a=coe(r),c=ooe[a],d=loe(r),u=(d==="site"?Vd(l.title,c?.title):Vd(c?.title,l.title))??a,h=d==="site"?Vd(l.description,c?.description):Vd(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&aoe(f)?f:void 0,p=m!==void 0?c?.iconName??Wb:Vd(f,c?.iconName)??Wb;s.push({resolveType:r,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function coe(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const doe=["blog/sections/blocks/","site/sections/Blog/Post/"];function uoe(t){return doe.some(e=>t.startsWith(e))}const I2e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],O2e=["January","February","March","April","May","June","July","August","September","October","November","December"],zk=1440*60*1e3;function jl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function $2e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function B2e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function gf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function gp(t,e){return Math.round((jl(t).getTime()-jl(e).getTime())/zk)}function hoe(t){const e=(t.getTime()-jl(t).getTime())/zk;return Math.min(Math.max(e,0),1)}function qb(t,e){return gp(t,e)+hoe(t)}function z2e(t){const e=gf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(gf(e,n*7+r));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function F2e(t,e){const s=jl(t[0]),n=gf(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const u=jl(d.start),h=jl(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?gf(n,-1):h,p=gp(f,s),g=gp(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),y=qb(new Date(x),s),_=Math.max(qb(new Date(b),s)-y,0);_<=0||l.push({variant:d,startCol:p,span:g,leftUnits:y,widthUnits:_})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function xf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const Fk=/^(\d{4})-(\d{2})-(\d{2})$/;function bf(t){const e=t.trim();if(!e)return null;const s=Fk.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,l=Number(s[3]),a=new Date(i,r,l);return a.getMonth()===r&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:jl(n)}function foe(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Ik);return{...Bk("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:xf(t)}}function moe(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(Fk.test(e))return bf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function poe(t,e){const s=moe(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===xf(s)&&(i.date=xf(n)),i}function goe(t){return bf(t.scheduledDatetime)??bf(t.date)}function U2e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:bf(i.scheduledDatetime)!==null},l=goe(i);if(!l){s.push(r);continue}const a=xf(l),c=e.get(a);c?c.push(r):e.set(a,[r])}const n=(i,r)=>Number(r.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(r.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const xoe="0.161.0",boe="0.162.0",H2e="deno task update";function Gb(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Yb(t,e){const s=Gb(t),n=Gb(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const r=s[i]-n[i];if(r!==0)return r}return 0}const Uk=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function voe(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Uk.exec(s)?.[1];if(n)return n}return null}function yoe(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Uk.exec(n)?.[1];if(i)return i}return null}function _oe(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=voe(t.denoJson)??yoe(t.meta);return!e||Yb(e,xoe)<0?{kind:"outdated",version:e}:Yb(e,boe)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function K2e(t){return t.kind==="publish-only"||t.kind==="full"}function W2e(t){return t.kind==="full"}function Loe(t){const e=U.c(16),s=Vs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=f0(t.virtualMcpId),i=_s()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=it.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await p3({...t,threadId:i},h0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==r||e[9]!==l||e[10]!==a?(c={queryKey:r,queryFn:l,enabled:a,staleTime:3e5},e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Qt(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=_oe({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Soe({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=ce(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=A.useState(!1),[h,f]=A.useState(c),[m,p]=A.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},y=async _=>{if(!i||m)return;let L;try{L=JSON.parse(_)}catch{xe.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(L),xe.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(v){xe.error(r("sectionsEditor.pageJsonDialog.saveError",{error:v instanceof Error?v.message:String(v)}))}finally{p(!1)}};return o.jsx(Ut,{open:t,onOpenChange:e,children:o.jsxs(Ft,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ms,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Gt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(fe,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(gr,{size:12}):o.jsx(vn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(fe,{size:"sm",onClick:()=>y(h),disabled:!x||m,className:"h-7 text-xs",children:r(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",r("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(ld,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{y(_)}})})]})})}function _i(t){const e=U.c(46),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,y=ce(),_=a==="global";let L;e[0]!==s||e[1]!==l||e[2]!==_||e[3]!==n||e[4]!==c?(L=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(Ke,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:ae("flex size-8 shrink-0 items-center justify-center rounded-lg",_?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:ae("shrink-0",!_&&(l?"text-accent-foreground":"text-muted-foreground")),style:_?{color:b3}:void 0})}),e[0]=s,e[1]=l,e[2]=_,e[3]=n,e[4]=c,e[5]=L):L=e[5];const v=L,S=l?_?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":_?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==S?(w=ae("group relative flex min-w-0 items-center rounded-md transition-colors",S),e[6]=S,e[7]=w):w=e[7];let k;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==y||e[13]!==i?(k=u&&o.jsx("span",{className:ae("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:woe,children:o.jsx(id,{checked:f,onCheckedChange:()=>g?.(),"aria-label":y("sandbox.itemRow.selectItem",{title:i})})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=y,e[13]=i,e[14]=k):k=e[14];const j=m&&!l&&"text-destructive";let C;e[15]!==j?(C=ae("block truncate text-sm font-medium",j),e[15]=j,e[16]=C):C=e[16];let V;e[17]!==C||e[18]!==i?(V=o.jsx("span",{className:C,children:i}),e[17]=C,e[18]=i,e[19]=V):V=e[19];const N=l?"text-accent-foreground/70":"text-muted-foreground";let T;e[20]!==N?(T=ae("block truncate text-xs",N),e[20]=N,e[21]=T):T=e[21];let P;e[22]!==r||e[23]!==T?(P=o.jsx("span",{className:T,children:r}),e[22]=r,e[23]=T,e[24]=P):P=e[24];let E;e[25]!==P||e[26]!==V?(E=o.jsxs("span",{className:"min-w-0 flex-1",children:[V,P]}),e[25]=P,e[26]=V,e[27]=E):E=e[27];let R;e[28]!==l||e[29]!==m||e[30]!==p?(R=m&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx("span",{className:ae("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(yn,{size:14})})}),p&&o.jsx(Ke,{side:"bottom",children:p})]}),e[28]=l,e[29]=m,e[30]=p,e[31]=R):R=e[31];let M;e[32]!==x||e[33]!==v||e[34]!==E||e[35]!==R||e[36]!==d?(M=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[v,E,R,d]}),e[32]=x,e[33]=v,e[34]=E,e[35]=R,e[36]=d,e[37]=M):M=e[37];let I;e[38]!==l||e[39]!==b?(I=b&&o.jsx("div",{className:ae("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[38]=l,e[39]=b,e[40]=I):I=e[40];let D;return e[41]!==M||e[42]!==I||e[43]!==w||e[44]!==k?(D=o.jsxs("div",{className:w,children:[k,M,I]}),e[41]=M,e[42]=I,e[43]=w,e[44]=k,e[45]=D):D=e[45],D}function woe(t){return t.stopPropagation()}function Ro(t){const e=U.c(10),{icon:s,title:n,description:i}=t;let r;e[0]!==s?(r=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=r):r=e[1];let l;e[2]!==n?(l=o.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[r,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const koe={loaders:Vl,actions:dr},joe={loaders:"Loaders",actions:"Actions"},Coe={analytics:dP,blog:Mc,commerce:cP,site:OT,website:An};function Noe(t,e){return e===0?Coe[t.toLowerCase()]??Ho:Ho}function ih(t,e){return e===0?Bee(t):t}function Voe(t){const e=U.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=ce();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u),[m,p]=A.useState(null),[g,x]=A.useState(""),[b,y]=A.useState(Ioe),[_,L]=A.useState(c);_!==c&&(L(c),f([]),p(null),x(""),y(new Set));let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=z=>{y(W=>{const K=new Set(W);return K.has(z)?K.delete(z):K.add(z),K})},e[1]=v):v=e[1];const S=v;let w;e[2]!==i||e[3]!==s||e[4]!==n?(w={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=w):w=e[5];const k=m0(w);let j;e[6]!==k?(j=D3((z,W)=>k.mutate({blockKey:z,data:W})),e[6]=k,e[7]=j):j=e[7];const C=j;let V;e[8]!==c?(V=ww(c),e[8]=c,e[9]=V):V=e[9];const N=V,T=koe[c];let P,E,R,M,I,D,$;if(e[10]!==T||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==N||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const z=[...Nw(l,a,c).map(Moe),...jw(l,c).map(Doe)],W=g.trim().toLowerCase(),K=W.length>0,H=K?z.filter(ge=>ge.title.toLowerCase().includes(W)||ge.resolveType.toLowerCase().includes(W)):[],q=new Map,G=[],Q=new Map;if(!K){for(const ge of z){const Te=ge.folderPath;if(!(Te.length<h.length)&&h.every((Se,we)=>Te[we]===Se))if(Te.length===h.length)if(ge.savedKey!==void 0){const Se=Q.get(ge.resolveType);Se?Se.push(ge):Q.set(ge.resolveType,[ge])}else G.push(ge);else{const Se=Te[h.length],we=q.get(Se)??{count:0,savedCount:0};ge.savedKey!==void 0?we.savedCount=we.savedCount+1:we.count=we.count+1,q.set(Se,we)}}G.sort(Roe);for(const ge of Q.values())ge.sort(Eoe)}const se=[...Q.entries()].filter(ge=>{const[Te]=ge;return!G.some(Se=>Se.resolveType===Te)}).flatMap(Poe).sort(Aoe);let Z;e[33]!==h?(Z=(ge,Te)=>ih(ge.name,h.length).localeCompare(ih(Te.name,h.length)),e[33]=h,e[34]=Z):Z=e[34];const te=[...q.entries()].map(Toe).sort(Z);let X;e[35]===Symbol.for("react.memo_cache_sentinel")?(X=ge=>{p(ge.savedKey!==void 0?{mode:"saved",key:ge.savedKey}:{mode:"available",resolveType:ge.resolveType,title:ge.title})},e[35]=X):X=e[35];const Y=X;let de;e[36]!==k||e[37]!==N||e[38]!==d?(de=async(ge,Te)=>{await k.mutateAsync({blockKey:ge,data:Te}),xe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:ge})),p({mode:"saved",key:ge})},e[36]=k,e[37]=N,e[38]=d,e[39]=de):de=e[39];const re=de;let le;e[40]!==a||e[41]!==m?(le=Ooe(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ne=le;if(ne){const ge=`${ne.mode}:${ne.mode==="saved"?ne.blockKey:ne.resolveType}`;let Te;e[43]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>p(null),e[43]=Te):Te=e[43];let Se;e[44]!==i||e[45]!==a||e[46]!==re||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==ge||e[54]!==ne.editorTarget||e[55]!==ne.initialValue||e[56]!==n?(Se=o.jsx(Nk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:ne.editorTarget,initialValue:ne.initialValue,isCreating:k.isPending,onCreate:re,onSaveReferencedBlock:C,onBack:Te},ge),e[44]=i,e[45]=a,e[46]=re,e[47]=c,e[48]=l,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=ge,e[54]=ne.editorTarget,e[55]=ne.initialValue,e[56]=n,e[57]=Se):Se=e[57],R=Se;break e}$="flex h-full w-full min-w-0 flex-col";let me;e[58]!==d?(me=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=me):me=e[59];let ee;e[60]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>f([]),e[60]=ee):ee=e[60];const oe=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ie;e[61]!==oe?(ie=ae("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",oe),e[61]=oe,e[62]=ie):ie=e[62];const ue=joe[c];let J;e[63]!==ie||e[64]!==ue?(J=o.jsx("button",{type:"button",onClick:ee,className:ie,children:ue}),e[63]=ie,e[64]=ue,e[65]=J):J=e[65];let he;e[66]!==h?(he=h.map((ge,Te)=>{const Se=Te===h.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Te+1)),className:ae("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Se?"font-medium text-foreground":"text-muted-foreground"),children:ih(ge,Te)})]},`${ge}-${Te}`)}),e[66]=h,e[67]=he):he=e[67];let ve;e[68]!==me||e[69]!==J||e[70]!==he?(ve=o.jsxs("nav",{"aria-label":me,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[J,he]}),e[68]=me,e[69]=J,e[70]=he,e[71]=ve):ve=e[71];let je;e[72]===Symbol.for("react.memo_cache_sentinel")?(je=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=je):je=e[72];let Ce;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ce=ge=>x(ge.target.value),e[73]=Ce):Ce=e[73];let Le;e[74]!==c||e[75]!==d?(Le=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Le):Le=e[76];let _e;e[77]!==c||e[78]!==d?(_e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=_e):_e=e[79];let Ne;e[80]!==g||e[81]!==Le||e[82]!==_e?(Ne=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[je,o.jsx("input",{type:"text",value:g,onChange:Ce,placeholder:Le,"aria-label":_e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Le,e[82]=_e,e[83]=Ne):Ne=e[83],e[84]!==ve||e[85]!==Ne?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ve,Ne]}),e[84]=ve,e[85]=Ne,e[86]=E):E=e[86],P=Ql,D="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",M="mx-auto w-full max-w-4xl px-6 py-5",I=K?H.length===0?o.jsx(Ro,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:H.map(ge=>o.jsx(_i,{icon:T,accent:ge.savedKey!==void 0?"global":void 0,title:ge.title,subtitle:ge.resolveType,active:!1,onClick:()=>Y(ge)},ge.savedKey??ge.resolveType))}):te.length===0&&G.length===0&&se.length===0?o.jsx(Ro,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[te.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:te.map(ge=>{const Te=Noe(ge.name,h.length);return o.jsxs("button",{type:"button",onClick:()=>f([...h,ge.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(Te,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:ih(ge.name,h.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[ge.count," ",ge.count===1?N:c,ge.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:ge.savedCount})]})]})]})]},ge.name)})}),(G.length>0||se.length>0)&&o.jsxs("div",{className:ae("flex flex-col gap-1",te.length>0&&"mt-4"),children:[G.map(ge=>{const Te=Q.get(ge.resolveType)??[],Se=b.has(ge.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(_i,{icon:T,title:ge.title,subtitle:ge.resolveType,active:!1,onClick:()=>Y(ge)}),Te.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>S(ge.resolveType),"aria-expanded":Se,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:b3},children:[Se?o.jsx(Ls,{size:12,className:"shrink-0"}):o.jsx(qs,{size:12,className:"shrink-0"}),d(Se?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Te.length,")"]}),Se&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Te.map(we=>o.jsx(_i,{icon:T,accent:"global",title:we.title,subtitle:we.resolveType,active:!1,onClick:()=>Y(we)},we.savedKey))})]})]},ge.resolveType)}),se.map(ge=>o.jsx(_i,{icon:T,accent:"global",title:ge.title,subtitle:ge.resolveType,active:!1,onClick:()=>Y(ge)},ge.savedKey))]})]})}e[10]=T,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=m,e[23]=N,e[24]=d,e[25]=n,e[26]=P,e[27]=E,e[28]=R,e[29]=M,e[30]=I,e[31]=D,e[32]=$}else P=e[26],E=e[27],R=e[28],M=e[29],I=e[30],D=e[31],$=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let O;e[87]!==M||e[88]!==I?(O=o.jsx("div",{className:M,children:I}),e[87]=M,e[88]=I,e[89]=O):O=e[89];let B;e[90]!==P||e[91]!==O||e[92]!==D?(B=o.jsx(P,{className:D,children:O}),e[90]=P,e[91]=O,e[92]=D,e[93]=B):B=e[93];let F;return e[94]!==E||e[95]!==B||e[96]!==$?(F=o.jsxs("div",{className:$,children:[E,B]}),e[94]=E,e[95]=B,e[96]=$,e[97]=F):F=e[97],F}function Toe(t){const[e,s]=t;return{name:e,...s}}function Aoe(t,e){return t.title.localeCompare(e.title)}function Poe(t){const[,e]=t;return e}function Eoe(t,e){return t.title.localeCompare(e.title)}function Roe(t,e){return t.title.localeCompare(e.title)}function Doe(t){return{resolveType:t.resolveType,title:t.title,folderPath:Cw(t.resolveType)}}function Moe(t){return{resolveType:t.resolveType,title:t.title,folderPath:Cw(t.resolveType),savedKey:t.key}}function Ioe(){return new Set}function Ooe(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=Vw(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function $oe(t){const e=U.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=ce(),g=ro(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[y,_]=A.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[v,S]=A.useState(L),[w,k]=A.useState(0),[j,C]=A.useState(!1);let V;e[2]!==l||e[3]!==c?(V=zn(c,l),e[2]=l,e[3]=c,e[4]=V):V=e[4];const N=V,T=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,P=_s()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==P||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:P,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=P,e[10]=n,e[11]=R):R=e[11];const M=R;let I,D,$,O,B,F,z,W;if(e[12]!==a||e[13]!==v||e[14]!==y||e[15]!==f||e[16]!==p||e[17]!==d){const ie=[d,...v],ue=he=>{S(v.slice(0,he)),k(Boe)};let J;e[26]!==a||e[27]!==y||e[28]!==f?(J=async he=>{const ve=F3(he,a);if(ve){xe.error(ve);return}await f(he,y),C(!1)},e[26]=a,e[27]=y,e[28]=f,e[29]=J):J=e[29],I=J,O="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",D="shrink-0 border-b px-3 py-2.5",W="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(B=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=B):B=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",z=ie.map((he,ve)=>{const je=ve===ie.length-1,Ce=Nn(he);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ve>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ue(ve),title:Ce,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",je?"font-medium text-foreground":"text-muted-foreground"),children:Ce})]},`${Ce}-${ve}`)}),e[12]=a,e[13]=v,e[14]=y,e[15]=f,e[16]=p,e[17]=d,e[18]=I,e[19]=D,e[20]=$,e[21]=O,e[22]=B,e[23]=F,e[24]=z,e[25]=W}else I=e[18],D=e[19],$=e[20],O=e[21],B=e[22],F=e[23],z=e[24],W=e[25];let K;e[32]!==B||e[33]!==F||e[34]!==z?(K=o.jsx("nav",{"aria-label":B,className:F,children:z}),e[32]=B,e[33]=F,e[34]=z,e[35]=K):K=e[35];let H;e[36]===Symbol.for("react.memo_cache_sentinel")?(H=()=>C(!0),e[36]=H):H=e[36];let q;e[37]!==p?(q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=q):q=e[38];let G;e[39]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(R2,{size:14}),e[39]=G):G=e[39];let Q;e[40]!==h||e[41]!==q?(Q=o.jsx(He,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:H,"aria-label":q,children:G})}),e[40]=h,e[41]=q,e[42]=Q):Q=e[42];let se;e[43]!==p?(se=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=se):se=e[44];let Z;e[45]!==se?(Z=o.jsx(Ke,{side:"bottom",children:se}),e[45]=se,e[46]=Z):Z=e[46];let te;e[47]!==Q||e[48]!==Z?(te=o.jsxs(We,{children:[Q,Z]}),e[47]=Q,e[48]=Z,e[49]=te):te=e[49];let X;e[50]!==K||e[51]!==te||e[52]!==W?(X=o.jsxs("div",{className:W,children:[K,te]}),e[50]=K,e[51]=te,e[52]=W,e[53]=X):X=e[53];const Y="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",de=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:T});let re;e[54]!==de?(re=o.jsx("p",{className:Y,children:de}),e[54]=de,e[55]=re):re=e[55];let le;e[56]!==D||e[57]!==X||e[58]!==re?(le=o.jsxs("div",{className:D,children:[X,re]}),e[56]=D,e[57]=X,e[58]=re,e[59]=le):le=e[59];let ne;e[60]!==a||e[61]!==v||e[62]!==w||e[63]!==y||e[64]!==l||e[65]!==m||e[66]!==M||e[67]!==N||e[68]!==p?(ne=o.jsx(Ql,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:N?o.jsx(Oi,{schema:N,value:y,onChange:ie=>_(ie),basePath:"",breadcrumbPath:v,onBreadcrumbChange:S,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:M},w):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=v,e[62]=w,e[63]=y,e[64]=l,e[65]=m,e[66]=M,e[67]=N,e[68]=p,e[69]=ne):ne=e[69];let me;e[70]!==$||e[71]!==le||e[72]!==ne?(me=o.jsxs("div",{className:$,children:[le,ne]}),e[70]=$,e[71]=le,e[72]=ne,e[73]=me):me=e[73];let ee;e[74]!==u||e[75]!==I||e[76]!==h||e[77]!==j?(ee=o.jsx(U3,{open:j,onOpenChange:C,defaultBlockId:u,isPending:h,onSubmit:I}),e[74]=u,e[75]=I,e[76]=h,e[77]=j,e[78]=ee):ee=e[78];let oe;return e[79]!==O||e[80]!==me||e[81]!==ee?(oe=o.jsxs("div",{className:O,children:[me,ee]}),e[79]=O,e[80]=me,e[81]=ee,e[82]=oe):oe=e[82],oe}function Boe(t){return t+1}var zoe=Object.prototype.toString,pd=Array.isArray||function(e){return zoe.call(e)==="[object Array]"};function Q3(t){return typeof t=="function"}function Foe(t){return pd(t)?"array":typeof t}function F1(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Jb(t,e){return t!=null&&typeof t=="object"&&e in t}function Uoe(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Hoe=RegExp.prototype.test;function Koe(t,e){return Hoe.call(t,e)}var Woe=/\S/;function qoe(t){return!Koe(Woe,t)}var Goe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Yoe(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return Goe[s]})}var Joe=/\s*/,Xoe=/\s+/,Xb=/\s*=/,Qoe=/\s*\}/,Zoe=/#|\^|\/|>|\{|&|=|!/;function ele(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var h,f,m;function p(k){if(typeof k=="string"&&(k=k.split(Xoe,2)),!pd(k)||k.length!==2)throw new Error("Invalid tags: "+k);h=new RegExp(F1(k[0])+"\\s*"),f=new RegExp("\\s*"+F1(k[1])),m=new RegExp("\\s*"+F1("}"+k[1]))}p(e||Ri.tags);for(var g=new p0(t),x,b,y,_,L,v;!g.eos();){if(x=g.pos,y=g.scanUntil(h),y)for(var S=0,w=y.length;S<w;++S)_=y.charAt(S),qoe(_)?(r.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
|
|
620
|
+
`)}function Ab(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Une(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function Hne(t){return t.map((e,s)=>({...e,index:s}))}function bk(t){const e=U.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=ce(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=ae("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=o.jsx(zf,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Mo,{className:"h-4 w-4 shrink-0",style:{color:zne}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(p=!i&&o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:Wne,onPointerDown:Kne,children:o.jsx(Ci,{size:14})})}),o.jsxs(Wt,{align:"end",children:[r&&o.jsxs(Ze,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(z6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Ze,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(vn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Ze,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(on,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=r,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function Kne(t){return t.stopPropagation()}function Wne(t){return t.stopPropagation()}function qne(t){const e=U.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:Gne},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=Hg(d);let g;e[2]!==m?(g=ur.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const y=b;let _;e[7]!==r?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=_):_=e[8];const L=p?"cursor-grabbing":"cursor-grab",v=n?xk:Fne;let S;e[9]!==L||e[10]!==v?(S=ae("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,v),e[9]=L,e[10]=v,e[11]=S):S=e[11];let w;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(w=o.jsx(bk,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=w):w=e[17];let k;return e[18]!==u||e[19]!==h||e[20]!==r||e[21]!==f||e[22]!==y||e[23]!==_||e[24]!==S||e[25]!==w?(k=o.jsx("div",{ref:f,style:y,...u,...h,onClick:r,onKeyDown:_,className:S,children:w}),e[18]=u,e[19]=h,e[20]=r,e[21]=f,e[22]=y,e[23]=_,e[24]=S,e[25]=w,e[26]=k):k=e[26],k}function Gne(){return!1}function Yne(t){const e=U.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=ce(),m=n.length>1;let p;e[0]!==n?(p=()=>Ab(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=A.useState(p),[b,y]=A.useState(null),[_,L]=A.useState(s),[v,S]=A.useState(n.length);let w;e[2]!==n?(w=()=>Tb(n),e[2]=n,e[3]=w):w=e[3];const[k,j]=A.useState(w),C=A.useRef(!1),V=Tb(n);_!==s?(L(s),S(n.length),j(V),x(Ab(n))):(v!==n.length||k!==V)&&(S(n.length),j(V),x(oe=>Une(oe,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:Kg},e[5]=T):T=e[5];const P=Mg(Bc(o0,N),Bc(r0,T));let E;e[6]!==g?(E=g.map(Jne),e[6]=g,e[7]=E):E=e[7];const R=E;let M;e[8]!==g?(M=oe=>{const ie=String(oe.active.id);y(g.find(ue=>ue.id===ie)??null)},e[8]=g,e[9]=M):M=e[9];const I=M;let D;e[10]!==R||e[11]!==u?(D=oe=>{y(null);const{active:ie,over:ue}=oe;if(!ue||ie.id===ue.id)return;const J=R.indexOf(String(ie.id)),he=R.indexOf(String(ue.id));J===-1||he===-1||(x(ve=>Hne(zc([...ve],J,he))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),u(J,he))},e[10]=R,e[11]=u,e[12]=D):D=e[12];const $=D;let O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{y(null)},e[13]=O):O=e[13];const B=O;let F,z,W,K,H,q,G,Q,se,Z,te,X,Y;if(e[14]!==m||e[15]!==g||e[16]!==R||e[17]!==$||e[18]!==I||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==P||e[27]!==f){const oe=Ge=>{C.current||r(Ge)};te="space-y-1 border-b p-2";let ie;e[41]!==f?(ie=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ie):ie=e[42];let ue;e[43]!==ie?(ue=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ie}),e[43]=ie,e[44]=ue):ue=e[44];let J;e[45]!==f?(J=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=J):J=e[46];let he;e[47]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Yt,{size:14}),e[47]=he):he=e[47];let ve;e[48]!==h||e[49]!==J?(ve=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":J,className:"size-6",onClick:h,children:he})}),e[48]=h,e[49]=J,e[50]=ve):ve=e[50];let je;e[51]!==f?(je=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=je):je=e[52];let Ce;e[53]!==je?(Ce=o.jsx(Ke,{children:je}),e[53]=je,e[54]=Ce):Ce=e[54];let Le;e[55]!==ve||e[56]!==Ce?(Le=o.jsxs(We,{children:[ve,Ce]}),e[55]=ve,e[56]=Ce,e[57]=Le):Le=e[57];let _e;e[58]!==f?(_e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=_e):_e=e[59];let Ne;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ne=o.jsx(on,{size:14}),e[60]=Ne):Ne=e[60];let ge;e[61]!==d||e[62]!==_e?(ge=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":_e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ne})}),e[61]=d,e[62]=_e,e[63]=ge):ge=e[63];let Te;e[64]!==f?(Te=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Te):Te=e[65];let Se;e[66]!==Te?(Se=o.jsx(Ke,{children:Te}),e[66]=Te,e[67]=Se):Se=e[67];let we;e[68]!==ge||e[69]!==Se?(we=o.jsxs(We,{children:[ge,Se]}),e[68]=ge,e[69]=Se,e[70]=we):we=e[70];let Ye;e[71]!==Le||e[72]!==we?(Ye=o.jsxs("div",{className:"flex items-center gap-0.5",children:[Le,we]}),e[71]=Le,e[72]=we,e[73]=Ye):Ye=e[73],e[74]!==ue||e[75]!==Ye?(X=o.jsxs("div",{className:"flex items-center justify-between",children:[ue,Ye]}),e[74]=ue,e[75]=Ye,e[76]=X):X=e[76],z=Bg,q=P,G=M_,Q=I,se=$,Z=B,F=Ug,K=R,H=Fg,Y="space-y-0.5",W=g.map(Ge=>o.jsx(qne,{entry:Ge,selected:Ge.index===i,canDelete:m,onSelect:()=>oe(Ge.index),onRename:l?()=>l(Ge.index):void 0,onDuplicate:()=>a(Ge.index),onDelete:()=>c(Ge.index)},Ge.id)),e[14]=m,e[15]=g,e[16]=R,e[17]=$,e[18]=I,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=P,e[27]=f,e[28]=F,e[29]=z,e[30]=W,e[31]=K,e[32]=H,e[33]=q,e[34]=G,e[35]=Q,e[36]=se,e[37]=Z,e[38]=te,e[39]=X,e[40]=Y}else F=e[28],z=e[29],W=e[30],K=e[31],H=e[32],q=e[33],G=e[34],Q=e[35],se=e[36],Z=e[37],te=e[38],X=e[39],Y=e[40];let de;e[77]!==W||e[78]!==Y?(de=o.jsx("div",{className:Y,children:W}),e[77]=W,e[78]=Y,e[79]=de):de=e[79];let re;e[80]!==F||e[81]!==K||e[82]!==H||e[83]!==de?(re=o.jsx(F,{items:K,strategy:H,children:de}),e[80]=F,e[81]=K,e[82]=H,e[83]=de,e[84]=re):re=e[84];let le;e[85]!==b||e[86]!==m?(le=b?o.jsx("div",{className:ae("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",xk),children:o.jsx(bk,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ne;e[88]!==le?(ne=qn.createPortal(o.jsx(zg,{dropAnimation:Bw,children:le}),document.body),e[88]=le,e[89]=ne):ne=e[89];let me;e[90]!==z||e[91]!==q||e[92]!==G||e[93]!==Q||e[94]!==se||e[95]!==Z||e[96]!==re||e[97]!==ne?(me=o.jsxs(z,{sensors:q,collisionDetection:G,onDragStart:Q,onDragEnd:se,onDragCancel:Z,children:[re,ne]}),e[90]=z,e[91]=q,e[92]=G,e[93]=Q,e[94]=se,e[95]=Z,e[96]=re,e[97]=ne,e[98]=me):me=e[98];let ee;return e[99]!==te||e[100]!==X||e[101]!==me?(ee=o.jsxs("div",{className:te,children:[X,me]}),e[99]=te,e[100]=X,e[101]=me,e[102]=ee):ee=e[102],ee}function Jne(t){return t.id}const Xne=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Qne={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function D1(t){return Jl(t)!==void 0}function W3(t,e){if(e){if(D1(e))return e;const s=Qne[e];if(s&&D1(s))return s}for(const[s,n]of Xne)if(s.test(t)&&D1(n))return n;return"FilterLines"}function Zne(t){return Jl(t)??U2}function M1(t){const e=U.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=Zne(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=ae("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=o.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function S2e(t,e){return UQ(t,e).map(s=>{const n=e[s.blockKey]??{},i=tw(WQ(s.blockKey),e,t);return{blockKey:s.blockKey,title:Il(s.blockKey,n),description:Hc(i),iconName:W3(s.matcherResolveType)}})}const vk="Users03";function eie(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function tie(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,r]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(r)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=rl(l,t);s.push({resolveType:l,title:a.title??bs(l),description:a.description,iconName:W3(l,a.icon)})}return s}function sie(t,e){if(!t)return vk;const s=e.find(n=>n.resolveType===t);return s?s.iconName:W3(t)}function nie(t){const e=U.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=A.useState(!1),f=ce(),p=(i?d.find(X=>X.blockKey===i):void 0)?.iconName??sie(s,r),g=Jl(p);let x;e[0]!==a||e[1]!==h?(x=X=>{a(X),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let y;e[3]!==c||e[4]!==h?(y=X=>{c?.(X),h(!1)},e[3]=c,e[4]=h,e[5]=y):y=e[5];const _=y;let L;e[6]!==h?(L=()=>h(!0),e[6]=h,e[7]=L):L=e[7];let v;e[8]!==g?(v=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=v):v=e[9];let S;e[10]!==n?(S=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Ls,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=w):w=e[12];let k;e[13]!==L||e[14]!==v||e[15]!==S?(k=o.jsxs("button",{type:"button",onClick:L,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[v,S,w]}),e[13]=L,e[14]=v,e[15]=S,e[16]=k):k=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let C;e[19]!==f?(C=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=C):C=e[20];let V;e[21]!==f?(V=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=V):V=e[22];let N;e[23]!==V?(N=o.jsx(ui,{placeholder:V}),e[23]=V,e[24]=N):N=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let P;e[27]!==T?(P=o.jsx(Bn,{children:T}),e[27]=T,e[28]=P):P=e[28];let E;e[29]!==f?(E=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=E):E=e[30];let R;e[31]!==f?(R=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=R):R=e[32];const M=`${E} ${R}`;let I;e[33]!==b?(I=()=>b(""),e[33]=b,e[34]=I):I=e[34];const D=!s&&!i&&"bg-accent/60";let $;e[35]!==D?($=ae("gap-2.5",D),e[35]=D,e[36]=$):$=e[36];let O;e[37]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(M1,{iconName:vk,size:"sm"}),e[37]=O):O=e[37];let B;e[38]!==f?(B=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=B):B=e[39];let F;e[40]!==B?(F=o.jsx("span",{className:"text-sm",children:B}),e[40]=B,e[41]=F):F=e[41];let z;e[42]!==f?(z=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=z):z=e[43];let W;e[44]!==z?(W=o.jsx("span",{className:"text-xs text-muted-foreground",children:z}),e[44]=z,e[45]=W):W=e[45];let K;e[46]!==F||e[47]!==W?(K=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,W]}),e[46]=F,e[47]=W,e[48]=K):K=e[48];let H;e[49]!==M||e[50]!==I||e[51]!==$||e[52]!==K?(H=o.jsxs(us,{value:M,onSelect:I,className:$,children:[O,K]}),e[49]=M,e[50]=I,e[51]=$,e[52]=K,e[53]=H):H=e[53];let q;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let X;e[59]!==i||e[60]!==s||e[61]!==b?(X=Y=>o.jsxs(us,{value:`${Y.title} ${Y.resolveType} ${Y.description??""}`,onSelect:()=>b(Y.resolveType),className:ae("gap-2.5",!i&&s===Y.resolveType&&"bg-accent/60"),children:[o.jsx(M1,{iconName:Y.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:Y.title}),Y.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Y.description})]})]},Y.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=X):X=e[62],q=r.map(X),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=q}else q=e[58];let G;e[63]!==H||e[64]!==q?(G=o.jsxs(Es,{children:[H,q]}),e[63]=H,e[64]=q,e[65]=G):G=e[65];let Q;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(Q=d.length>0&&o.jsx(Es,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(X=>o.jsxs(us,{value:`${X.title} ${X.blockKey} ${X.description??""}`,onSelect:()=>_(X.blockKey),className:ae("gap-2.5",i===X.blockKey&&"bg-accent/60"),children:[o.jsx(M1,{iconName:X.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:X.title}),X.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:X.description})]})]},X.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=Q):Q=e[70];let se;e[71]!==P||e[72]!==G||e[73]!==Q?(se=o.jsxs(hi,{children:[P,G,Q]}),e[71]=P,e[72]=G,e[73]=Q,e[74]=se):se=e[74];let Z;e[75]!==u||e[76]!==h||e[77]!==C||e[78]!==N||e[79]!==se||e[80]!==j?(Z=o.jsxs(YP,{open:u,onOpenChange:h,title:j,description:C,className:"sm:max-w-lg",filter:eie,children:[N,se]}),e[75]=u,e[76]=h,e[77]=C,e[78]=N,e[79]=se,e[80]=j,e[81]=Z):Z=e[81];let te;return e[82]!==Z||e[83]!==k?(te=o.jsxs(o.Fragment,{children:[k,Z]}),e[82]=Z,e[83]=k,e[84]=te):te=e[84],te}const iie="website/sections/Rendering/Lazy.tsx";function pf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function q3(t){if(!pf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Ns(e)}function rie(t){return t!=null}function mp(t){if(t==null)return t;if(q3(t)){const e=t.section;return e==null?null:pf(e)?e:{}}return pf(t)?t:void 0}function oie(t,e){return t===null?null:q3(e)?{...e,section:t}:t}function w2e(t){return{__resolveType:t}}function k2e(t,e){if(!rie(e))return null;if(t){const s=mp(e)??{};return{__resolveType:iie,section:s}}return q3(e)?mp(e)??null:pf(e)?e:null}const lie="General";function Kc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function yk(t,e){return t===Jo?lie:e}function _k(t){const e=nf(t),s=new Set,n=[];for(const i of e)Kc(i.resolveType)&&(ri(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:yk(i.resolveType,i.title),description:i.description})));return n}function G3(t){const e=sf(t),s=zn(e,t),n=_k(s?.properties?.seo);return n.length>0?n:aie(t)}function aie(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const r of Object.keys(i)){if(!Kc(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:yk(r,l)})}return s}function Lk(t){const e=G3(t),s=e.find(n=>n.resolveType===Jo);return s?s.resolveType:e[0]?.resolveType??Jo}function Sk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=zn(s,t),i=_k(n?.properties?.seo);if(i.length>0)return i}return G3(t)}function cie(t,e){const s=Sk(t,e),n=s.find(i=>i.resolveType===Jo);return n?n.resolveType:s[0]?.resolveType??Lk(t)}function die(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Lk(t)}function uie(t,e,s){const n=s.__resolveType;return typeof n=="string"&&Kc(n)?n:cie(t,e)}const hie=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),Jo="website/sections/Seo/SeoV2.tsx",fie=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function au(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function mie(t){return typeof t.__resolveType=="string"&&Kc(t.__resolveType)?!0:fie.some(e=>e in t)}function pie(t,e){for(const[s,n]of Object.entries(t)){if(!au(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&hie.has(r))continue;const l=i.seo;if(au(l)){const a=l;if(mie(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?uie(e,i,a):typeof a.__resolveType=="string"&&Kc(a.__resolveType)?a.__resolveType:Jo}}}for(const[s,n]of Object.entries(t)){if(!au(n))continue;const i=n;if(typeof i.__resolveType=="string"&&Kc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function gie(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function j2e(t,e,s){if(e.kind==="site"){const c=pie(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Sk(s,c.blockData):void 0,build:d=>gie(c,d)}:null}const n=t[e.pageKey];if(!au(n))return null;const i=n,r=i.seo,l=mp(r),a=l&&au(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?die(s,a):typeof a?.__resolveType=="string"?a.__resolveType:Jo,seoTypeOptions:s?G3(s):void 0,build:c=>({...i,seo:c===null?null:oie(c,r)})}}const Y3=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],xie=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],bie=["jsonLD","title","description","noIndexing","configJsonLD"];function wk(t){return t===Jo||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function vie(t){switch(t){case"general":return Y3;case"pdp":return xie;case"plp":return bie;default:return null}}function kk(t,e){const s=vie(wk(e));if(!s||!t.properties)return t;const n={};for(const i of s){const r=t.properties[i];r&&(n[i]=r)}return{...t,properties:n}}function yie(){return Y3.filter(t=>t!=="type")}function _ie(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Lie(t,e){return t[e]===void 0}function Sie(t){const e=U.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=ce(),d=kk(s,Jo).properties??{},u=yie();let h;e[0]!==r?(h=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=h):h=e[1];const f=h,[m,p]=A.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=A.useState(g);m!==l&&(p(l),b({}));let y;e[3]!==x||e[4]!==n?(y=j=>x[j]!==void 0?x[j]:Lie(n,j),e[3]=x,e[4]=n,e[5]=y):y=e[5];const _=y;let L;e[6]!==i||e[7]!==r||e[8]!==n?(L=(j,C)=>{b(N=>({...N,[j]:C}));const V={...n};if(C)delete V[j];else{const N=r?.[j];V[j]=N??(j==="type"?"website":"")}i(V)},e[6]=i,e[7]=r,e[8]=n,e[9]=L):L=e[9];const v=L,S="min-w-0 space-y-6",w=Y3.map(j=>{const C=d[j];if(!C)return null;const V=f&&u.includes(j),N=V&&_(j),T=N?r?.[j]??n[j]:n[j],P=C.title??_ie(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:ae(N&&"pointer-events-none opacity-60"),children:Bl({schema:C,value:T,onChange:E=>{N||i({...n,[j]:E})},path:j,label:P,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:wie})}),V&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ii,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:E=>v(j,E)}),o.jsx(Mt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==l||e[11]!==w?(k=o.jsx("div",{className:S,children:w},l),e[10]=l,e[11]=w,e[12]=k):k=e[12],k}function wie(){}function kie(t){const e=U.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(wk(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=o.jsx(Sie,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let u;e[8]!==n||e[9]!==s?(u=kk(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??jie;let p;return e[12]!==h||e[13]!==r||e[14]!==l||e[15]!==m||e[16]!==i?(p=o.jsx(Oi,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},r),e[12]=h,e[13]=r,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function jie(){}function Cie(t){const e=U.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=ce();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(Mh,{className:"size-3.5"})}),h.map((x,b)=>{const y=b===h.length-1,_=Nn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:_,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",y?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx(Oi,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function C2e(t){const e=U.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let y;e[0]!==a?(y=a===void 0?[]:a,e[0]=a,e[1]=y):y=e[1];const _=y;let L;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(L=s&&n?u?o.jsx(kie,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:h}):o.jsx(Oi,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=r,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=L):L=e[16];const v=L;let S;e[17]!==c||e[18]!==v?(S=v??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=v,e[19]=S):S=e[19];let w;return e[20]!==d||e[21]!==S?(w=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,S]})}),e[20]=d,e[21]=S,e[22]=w):w=e[22],w}const N2e="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 V2e(t,e){return SZ(t,e,Hc)}function T2e(t){const e=U.c(71),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=ce(),a=N9(),[c,d]=A.useState(n),[u,h]=A.useState(i),[f,m]=A.useState(s),[p,g]=A.useState(null),x=A.useRef(!1),[b,y]=A.useState(null);f!==s&&(m(s),d(n),h(i),g(null),y(null));let _;e[0]!==i||e[1]!==u?(_=()=>{if(x.current){x.current=!1;return}const X=u.trim();if(X===i.trim()){h(i),y(null);return}const Y=w9(X);if(Y){y(Y),h(i);return}y(null),g(X)},e[0]=i,e[1]=u,e[2]=_):_=e[2];const L=_;let v;e[3]!==r||e[4]!==p?(v=()=>{p!==null&&(h(p),r("path",p),g(null))},e[3]=r,e[4]=p,e[5]=v):v=e[5];const S=v;let w;e[6]!==i?(w=()=>{h(i),g(null)},e[6]=i,e[7]=w):w=e[7];const k=w;let j;e[8]!==r?(j=X=>{d(X.target.value),r("name",X.target.value)},e[8]=r,e[9]=j):j=e[9];let C;e[10]!==l?(C=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=C):C=e[11];let V;e[12]!==c||e[13]!==a||e[14]!==j||e[15]!==C?(V=o.jsx("input",{type:"text",value:c,readOnly:a,onChange:j,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:C}),e[12]=c,e[13]=a,e[14]=j,e[15]=C,e[16]=V):V=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=X=>{h(X.target.value),y(null)},e[17]=N):N=e[17];let T;e[18]!==i?(T=X=>{X.key==="Enter"?(X.preventDefault(),X.currentTarget.blur()):X.key==="Escape"&&(X.preventDefault(),x.current=!0,h(i),y(null),X.currentTarget.blur())},e[18]=i,e[19]=T):T=e[19];let P;e[20]!==l?(P=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[20]=l,e[21]=P):P=e[21];let E;e[22]!==L||e[23]!==u||e[24]!==a||e[25]!==T||e[26]!==P?(E=o.jsx("input",{type:"text",value:u,readOnly:a,onChange:N,onBlur:L,onKeyDown:T,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:P}),e[22]=L,e[23]=u,e[24]=a,e[25]=T,e[26]=P,e[27]=E):E=e[27];let R;e[28]!==b?(R=b&&o.jsx("p",{className:"text-xs text-destructive",children:b}),e[28]=b,e[29]=R):R=e[29];const M=p!==null;let I;e[30]!==k?(I=X=>{X||k()},e[30]=k,e[31]=I):I=e[31];let D;e[32]!==l?(D=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[32]=l,e[33]=D):D=e[33];let $;e[34]!==D?($=o.jsx(Gr,{children:D}),e[34]=D,e[35]=$):$=e[35];const O=p??"";let B;e[36]!==i||e[37]!==l||e[38]!==O?(B=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:O}),e[36]=i,e[37]=l,e[38]=O,e[39]=B):B=e[39];let F;e[40]!==B?(F=o.jsx(Yr,{children:B}),e[40]=B,e[41]=F):F=e[41];let z;e[42]!==$||e[43]!==F?(z=o.jsxs(qr,{children:[$,F]}),e[42]=$,e[43]=F,e[44]=z):z=e[44];let W;e[45]!==l?(W=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[45]=l,e[46]=W):W=e[46];let K;e[47]!==W?(K=o.jsx(Xr,{children:W}),e[47]=W,e[48]=K):K=e[48];let H;e[49]!==S?(H=X=>{X.preventDefault(),S()},e[49]=S,e[50]=H):H=e[50];let q;e[51]!==l?(q=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[51]=l,e[52]=q):q=e[52];let G;e[53]!==H||e[54]!==q?(G=o.jsx(Qr,{onClick:H,children:q}),e[53]=H,e[54]=q,e[55]=G):G=e[55];let Q;e[56]!==K||e[57]!==G?(Q=o.jsxs(Jr,{children:[K,G]}),e[56]=K,e[57]=G,e[58]=Q):Q=e[58];let se;e[59]!==z||e[60]!==Q?(se=o.jsxs(Wr,{children:[z,Q]}),e[59]=z,e[60]=Q,e[61]=se):se=e[61];let Z;e[62]!==M||e[63]!==I||e[64]!==se?(Z=o.jsx(Kr,{open:M,onOpenChange:I,children:se}),e[62]=M,e[63]=I,e[64]=se,e[65]=Z):Z=e[65];let te;return e[66]!==E||e[67]!==R||e[68]!==Z||e[69]!==V?(te=o.jsxs("div",{className:"space-y-1",children:[V,E,R,Z]}),e[66]=E,e[67]=R,e[68]=Z,e[69]=V,e[70]=te):te=e[70],te}function A2e(t){const e=U.c(13),{onClick:s}=t,n=ce();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ng,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(Ke,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const Pb=new WeakMap;function Nie(t,e){let s=Pb.get(e);s||(s=new Map,Pb.set(e,s));let n=s.get(t);return n===void 0&&(n=zn(t,e),s.set(t,n)),n}function Vie(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function Tie(t,e){return{__resolveType:e,variants:[{rule:Fc(),value:structuredClone(t)},{rule:Fc(),value:structuredClone(t)}]}}function Aie(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>N3(n.rule));return s?s.value:e[e.length-1]?.value}function Pie(t){const e=[...t.variants],s=e[e.length-1],n={rule:Fc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function Eie(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Rie(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Die(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Mie(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function Iie(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function Eb(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const Rb=new WeakMap;function Oie(t){let e=Rb.get(t);return e||(e=tie(t),Rb.set(t,e)),e}function jk(t){const e=U.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=ce(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=A.useState(0);if(!Vie(l)){let $;e[0]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=$):$=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(ng,{size:14}),e[2]=O):O=e[2];let B;e[3]!==r?(B=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=B):B=e[4];let F;return e[5]!==B?(F=o.jsx(Ke,{children:B}),e[5]=B,e[6]=F):F=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":$,onClick:()=>{a(Tie(l,s)),h(0)},children:O})}),F]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==r?(g=($,O)=>({index:O,label:Hc($.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(O+1)})}),e[7]=r,e[8]=g):g=e[8];const x=m.map(g),b=m[p],y=b?.rule??{},_=y.__resolveType??"",L=b?.value,v=c?Oie(c):[],S=_&&c?Nie(_,c):null,{__resolveType:w,...k}=y,j=()=>{a(Aie(f)),h(0)},C=()=>{const $=Pie(f);a($),h($.variants.length-1)},V=$=>{const O=Eie(f,$);O&&(a(O),h(Die(p,$,O.variants.length)))},N=$=>{const O=Rie(f,$);a(O),h($+1)},T=($,O)=>{const B=Mie(f,$,O);a(B),p===$&&h(O)},P=$=>{const O=$?qQ($,c):{__resolveType:v3};a(Eb(f,p,O))},E=$=>{const O=$,B=_?{...O,__resolveType:_}:{...O};a(Eb(f,p,B))},R=$=>{a(Iie(f,p,$))},M=`${d}-${f.__resolveType}`;let I;e[9]!==r?(I=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=I):I=e[10];let D;return e[11]!==I?(D=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:I}),e[11]=I,e[12]=D):D=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(Yne,{listKey:M,variants:x,selectedIndex:p,onSelect:h,onDuplicate:N,onDelete:V,onRemoveAll:j,onReorder:T,onAdd:C}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[D,o.jsx(nie,{currentRt:_,currentLabel:Hc(y),matchers:v,onSelect:P}),S&&o.jsx("div",{className:"pt-1",children:o.jsx(Cie,{schema:S,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${_}`)})]}),n({...i,value:L,onChange:R})]})]})}const $ie="website/loaders/secret.ts";function cu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Bie(){return{__resolveType:$ie,name:"",encrypted:""}}function zie(t){const{value:e,...s}=t;return s}function I1(t){const e=U.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=ce();if(typeof n=="string"||n==null&&!cu(n)){const C=typeof n=="string"?n:"",V=a?.virtualMcpId;let N;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==V?(N=o.jsx(Hs,{htmlFor:l,label:r,description:s.description,virtualMcpId:V}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=V,e[4]=N):N=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let P;e[7]!==i?(P=M=>i(M.target.value),e[7]=i,e[8]=P):P=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==T||e[12]!==P?(E=o.jsx(kt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:P,className:"h-10"}),e[9]=l,e[10]=C,e[11]=T,e[12]=P,e[13]=E):E=e[13];let R;return e[14]!==N||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[N,E]}),e[14]=N,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=cu(n)?n:Bie(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(Hs,{htmlFor:m,label:r,description:s.description,virtualMcpId:p}),e[19]=r,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let y;e[26]!==u||e[27]!==i?(y=C=>i({...u,name:C.target.value}),e[26]=u,e[27]=i,e[28]=y):y=e[28];let _;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==y?(_=o.jsx(kt,{id:x,value:h,placeholder:b,onChange:y,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=y,e[33]=_):_=e[33];const L=`${l}-value`;let v;e[34]!==f||e[35]!==c?(v=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=v):v=e[36];let S;e[37]!==u||e[38]!==f||e[39]!==i?(S=C=>{const V=C.target.value;if(!V){i(f?zie(u):u);return}i({...u,value:V})},e[37]=u,e[38]=f,e[39]=i,e[40]=S):S=e[40];let w;e[41]!==v||e[42]!==S||e[43]!==L?(w=o.jsx(kt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:v,onChange:S,className:"h-10"}),e[41]=v,e[42]=S,e[43]=L,e[44]=w):w=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==w||e[49]!==k||e[50]!==g||e[51]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,w,k]}),e[48]=w,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function Fie(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],r=[],l=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let a,c=-1;for(const d of r){const u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function Uie(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const Hie=new Set(["__resolveType","@type"]);function Kie(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function Wie(t){if(j9(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function Db(t){if(t.type==="array"&&t.items)return t;const e=t.items??Wie(t);return e?{...t,type:"array",items:e}:null}function qie(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function Ck(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=zn(n,s);return i?o.jsx(Oi,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Bl(t){const{schema:e,value:s}=t,n=a=>t.readOnly?o.jsx(Yee,{children:a},t.path):a;if(cf(s)){const a=yZ(s),c=Db(e);if(a!==null&&c)return o.jsx(th,{...t,schema:c,value:a,onChange:d=>t.onChange(_Z(s,d))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&j9(e)){const a=Db(e);if(a)return o.jsx(th,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!cf(s)&&e.type==="block-ref"){const a=Fie(e,s)??Uie(s);if(a){const c={...e,type:"array",items:a};return o.jsx(th,{...t,schema:c,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(Kie(e)){const a=e.anyOfRefs[0],c=a.schema?.properties?.variants?.items?.properties?.value,d=c&&c.type!=="block-ref"?c:e.plainSchema??c?.plainSchema??{type:"string"},u=h=>Bl({...h,schema:d});return o.jsx(jk,{...t,multivariateResolveType:a.resolveType,renderInnerField:u},t.path)}return e.anyOfRefs?o.jsx(kb,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Dne,{...t},t.path);if(e.format==="image-uri")return n(o.jsx(Lne,{...t},t.path));if(e.format==="file-uri"||e.format==="video-uri")return n(o.jsx(vne,{...t},t.path));if(e.format==="map")return n(o.jsx(Bne,{...t},t.path));if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return n(o.jsx(qse,{...t},t.path));if(e.format==="location")return n(o.jsx(gk,{...t},t.path));if(e.enum&&e.enum.length>0)return n(o.jsx(Ete,{...t},t.path));if(e.type==="anyOf")return o.jsx(kb,{...t},t.path);if(cu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(I1,{...t},t.path);if(!e.format&&!e.enum){const a=Ck(t);if(a)return a}const i=s??qie(e.type,e.default);if(i==null)return cu(s)?n(o.jsx(I1,{...t},t.path)):null;if(cu(i))return n(o.jsx(I1,{...t,value:i},t.path));const r={...t,value:i},l=s==null?e.type??typeof i:Array.isArray(i)?"array":typeof i;if(l==="array"||Array.isArray(i))return o.jsx(th,{...r},t.path);switch(l){case"boolean":return n(o.jsx(Nte,{...r},t.path));case"number":case"integer":return n(o.jsx(Cte,{...r},t.path));case"string":{const a=e.format;return n(a==="color-input"||a==="color"?o.jsx(Z0,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(Z0,{...r},t.path):o.jsx(Z0,{...r},t.path))}case"object":return i!==null&&typeof i=="object"&&!Array.isArray(i)?o.jsx(Vse,{...r},t.path):null;default:return n(o.jsx(Z0,{...r},t.path))}}function Gie(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Bl({...t,schema:e});const s=Ck(t);return s||Bl(e?{...t,schema:e}:t)}function Oi({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=ce(),p=N9(),g=t.properties;if(!g)return t.type==="inline-union"?Bl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,readOnly:p}):null;if(vZ(e)&&g.variants){const T=g.variants.items?.properties?.value;return o.jsx(jk,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:P=>Gie(P,T)},n)}const x=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},b=Object.keys(g).filter(T=>!Hie.has(T)&&g[T]?.hidden!==!0),y=new Set(t.required??[]);if(b.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const _=(T,P)=>{if(P===void 0){const{[T]:E,...R}=x;s(R);return}s({...x,[T]:P})},L=typeof x.__resolveType=="string"?x.__resolveType:void 0,v=b.filter(T=>{const P=g[T];return P!=null&&Ec(P,x[T])}).length>1,S=ase(b,g,x),w=i.length>0?dse(b,g,x,i,a,l):null,k=w?g[w]:null,j=w&&k?[w]:b,C=w&&k?lse(w,k,i,Eu(w,b,g)):i,V=ose(i,C),N=V.length>0&&r?T=>r([...V,...T]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:j.map(T=>{const P=g[T];if(!P)return null;const E=n?`${n}.${T}`:T,R=Eu(T,b,g),M=$l(T,P),$=(V.length===0&&b.some(O=>{const B=g[O];return O!==T&&B!=null&&$l(O,B)===M})||V.length===0&&S.has(T))&&N?P.type==="block-ref"?O=>N(ise(T,O)):O=>N(nse(R,O)):N;return Bl({schema:P,value:x[T],onChange:O=>_(T,O),path:E,label:R,readOnly:p,required:y.has(T),breadcrumbPath:C,onBreadcrumbChange:$,hasSiblingDrillDownFields:v,focused:w===T,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function Yie(t){const e=U.c(3),{isPending:s,isError:n}=t;if(n){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(yn,{size:13}),"Couldn't save"]}),e[0]=r):r=e[0],r}if(s){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(st,{className:"size-[13px]"}),"Saving…"]}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx(zt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const Mb=3e4;function Jie(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function Xie(t,{resolveType:e,props:s}){let n;try{n=await fetch(ES(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Mb)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${Mb/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let r=null,l=!1;try{r=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?r:i}function Qie(t){const e=U.c(2);let s;return e[0]!==t?(s={mutationFn:n=>Xie(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function Nk({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=_s()?.taskId??null,g=ce(),x=ro(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,y=zn(a.resolveType,i),_=!y&&wQ(a.resolveType,i),L=_?kQ(c):null,v=y??L,[S,w]=A.useState(c),[k,j]=A.useState([]),[C,V]=A.useState(0),[N,T]=A.useState(!1),[P,E]=A.useState(null),[R,M]=A.useState(!1),[I,D]=A.useState(!1),[$,O]=A.useState(!1),B=P!==null,{save:F,flush:z,isPending:W}=E3({orgSlug:t,virtualMcpId:e,branch:s}),K=Qie({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});A.useEffect(()=>()=>{z()},[]);const H=ww(l),q=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,G={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},Q=le=>{w(le),a.mode==="saved"&&F(a.blockKey,{__resolveType:a.resolveType,...le})},se=()=>{B?(E(null),T(!1),V(le=>le+1)):E(JSON.stringify(S,null,2))},Z=le=>{const ne=le??"";try{const me=JSON.parse(ne);if(me&&typeof me=="object"&&!Array.isArray(me)){T(!1),Q(me);return}T(!0)}catch{T(!0)}},te=async le=>{const ne=F3(le,r);if(ne){xe.error(ne);return}await u(le,{__resolveType:a.resolveType,...S}),M(!1)},X=()=>{D(!0),K.mutate({resolveType:a.resolveType,props:S})},Y=()=>{n&&window.open(Jie(n,a.resolveType,S,Date.now()),"_blank","noopener")},de=[a.title,...k],re=le=>{j(k.slice(0,le)),V(ne=>ne+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(Kf,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:de.map((le,ne)=>{const me=ne===de.length-1,ee=Nn(le);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ne>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>re(ne),title:ee,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",me?"font-medium text-foreground":"text-muted-foreground"),children:ee})]},`${ee}-${ne}`)})}),a.mode==="saved"&&o.jsx(Yie,{isPending:W,isError:!1}),m&&o.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:X,disabled:K.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:H}),children:[K.isPending?o.jsx(st,{className:"size-3.5"}):o.jsx(Tl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>M(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:H}),children:o.jsx(R2,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:H})})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:B?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:se,"aria-label":g(B?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":B,children:B?o.jsx(Ws,{size:14}):o.jsx(Qc,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g(B?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:H}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:q,singular:H})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:ae("relative min-h-0 flex-1",I&&$&&"hidden"),children:[o.jsx(Ql,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[L&&v===L&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:H})}),v?o.jsx(Oi,{schema:v,value:S,onChange:le=>Q(le),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:h,sandbox:G},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:H}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:H})})]})})}),P!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ld,{language:"json",height:"100%",code:P,onChange:Z,onSave:le=>{Z(le),z()}})})]})]}),I&&o.jsx(Zie,{singular:H,result:{isPending:K.isPending,error:K.error,data:K.data,hasRun:K.status!=="idle"},expanded:$,onToggleExpand:()=>O(le=>!le),onOpenInNewTab:n?Y:void 0,onClose:()=>{D(!1),O(!1)}})]}),o.jsx(U3,{open:R,onOpenChange:M,defaultBlockId:"",isPending:d,onSubmit:te})]})}function Zie(t){const e=U.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=ce();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=ae("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(mn,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?o.jsx(PT,{size:14}):o.jsx(M6,{size:14}),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(y=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=y):y=e[21];let _;e[22]!==i||e[23]!==c?(_=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=_):_=e[24];let L;e[25]!==_?(L=o.jsx(Ke,{side:"bottom",children:_}),e[25]=_,e[26]=L):L=e[26];let v;e[27]!==L||e[28]!==y?(v=o.jsxs(We,{children:[y,L]}),e[27]=L,e[28]=y,e[29]=v):v=e[29];let S;e[30]!==c?(S=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=S):S=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Ws,{size:14}),e[32]=w):w=e[32];let k;e[33]!==a||e[34]!==S?(k=o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":S,children:w}),e[33]=a,e[34]=S,e[35]=k):k=e[35];let j;e[36]!==v||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,v,k]}),e[36]=v,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=C):C=e[42];let V;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(V=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(st,{className:"size-4"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(ld,{language:"json",height:"100%",code:u,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=u,e[47]=s,e[48]=c,e[49]=V):V=e[49];let N;return e[50]!==C||e[51]!==V||e[52]!==f?(N=o.jsxs("div",{className:f,children:[C,V]}),e[50]=C,e[51]=V,e[52]=f,e[53]=N):N=e[53],N}function ere(t){const e=U.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=ce();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=m0(u);let f;e[4]!==h?(f=D3((v,S)=>h.mutate({blockKey:v,data:S})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=Vw(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let v;e[9]!==d?(v=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=v):v=e[10];let S;return e[11]!==v?(S=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:v}),e[11]=v,e[12]=S):S=e[12],S}const y=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let L;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==y||e[26]!==_||e[27]!==n?(L=o.jsx(Nk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:h.isPending,onCreate:tre,onSaveReferencedBlock:m,showRun:!1},y),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=h.isPending,e[24]=m,e[25]=y,e[26]=_,e[27]=n,e[28]=L):L=e[28],L}async function tre(){}function sre(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function Ib(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:sre(t.error)}}function nre(t){switch(t){case"clone-failed":case"install-failed":case"start-failed":return"terminal-error";case"idle":case"cloning":return"booting";case"checking-out":case"installing":case"starting":case"running":case"crashed":return"snapshot-readable"}}function ire(t){if(t.fastPreviewActive)return t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData?{kind:"error",source:"data"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"};const e=nre(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const s=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return s&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(i=>i.status==="error"&&!i.hasData&&i.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:s?t.lifecyclePhase==="running"||t.lifecyclePhase==="crashed"?{kind:"error",source:"data"}:{kind:"loading"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"}}const rre="https://github.com/decocms/blocks";function ore(){const t=U.c(14),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(ET,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=r):r=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(mn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(fe,{size:"sm",asChild:!0,children:o.jsxs("a",{href:rre,target:"_blank",rel:"noreferrer",children:[r,l]})}),t[8]=r,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=o.jsx(Vi,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function lre(t){const e=U.c(15),{source:s,onRetry:n}=t,i=ce();let r;e[0]!==s||e[1]!==i?(r=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=r):r=e[2];const l=r;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(yn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let u;e[8]!==n||e[9]!==d?(u=o.jsx(fe,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=o.jsx(Vi,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}const are=A.lazy(()=>Ys(()=>import("./sections-editor-D-QRzAnK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157])).then(t=>({default:t.SectionsEditor})));function Ob(t){const e=U.c(60),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=Fe(),{currentBranch:a,taskId:c}=an(),d=Vs(s),u=j2(d,a);let h;e[0]!==u||e[1]!==d?(h=Yl(d)&&u,e[0]=u,e[1]=d,e[2]=h):h=e[2];const f=h,m=fi(),p=nl(),g=Aw(),x=m.lifecycle.phase==="running",b=p.previewUrl;let y;e[3]!==a||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==s?(y=a?{orgSlug:l.slug,virtualMcpId:s,branch:a,threadId:c??null,previewUrl:b}:null,e[3]=a,e[4]=l,e[5]=b,e[6]=c,e[7]=s,e[8]=y):y=e[8];const _=y;let L;e[9]!==x?(L={fetchEnabled:x},e[9]=x,e[10]=L):L=e[10];const v=L9(_,L);let S;e[11]!==x?(S={fetchEnabled:x},e[11]=x,e[12]=S):S=e[12];const w=j3(_,S),k=ire({lifecyclePhase:m.lifecycle.phase,decofile:Ib(v),meta:Ib(w),hasEditableContent:QS(v.data,w.data),fastPreviewActive:Sn(s).runtime==="cms"}),j=cre;if(k.kind==="loading"){let K;return e[13]===Symbol.for("react.memo_cache_sentinel")?(K=j(o.jsx(Sl,{})),e[13]=K):K=e[13],K}if(k.kind==="empty"){let K;return e[14]===Symbol.for("react.memo_cache_sentinel")?(K=j(o.jsx(ore,{})),e[14]=K):K=e[14],K}if(k.kind==="error"){let K;e[15]!==v||e[16]!==p||e[17]!==w||e[18]!==k.source?(K=()=>{if(k.source==="sandbox"){p.retry();return}Promise.all([v.refetch(),w.refetch()])},e[15]=v,e[16]=p,e[17]=w,e[18]=k.source,e[19]=K):K=e[19];const H=K;let q;return e[20]!==H||e[21]!==k.source?(q=j(o.jsx(lre,{source:k.source,onRetry:H})),e[20]=H,e[21]=k.source,e[22]=q):q=e[22],q}let C;e[23]!==f||e[24]!==s?(C=K=>j(o.jsx(Rw,{readOnly:f,virtualMcpId:s,className:"h-full min-h-0",children:K})),e[23]=f,e[24]=s,e[25]=C):C=e[25];const V=C,N=g.state.target;if(N?.kind==="loader"&&v.data&&w.data){const K=a??"",H=b??null;let q;e[26]!==v.data||e[27]!==w.data||e[28]!==l.slug||e[29]!==K||e[30]!==H||e[31]!==N.key||e[32]!==s?(q=o.jsx(ere,{orgSlug:l.slug,virtualMcpId:s,branch:K,previewUrl:H,meta:w.data,decofile:v.data,blockKey:N.key}),e[26]=v.data,e[27]=w.data,e[28]=l.slug,e[29]=K,e[30]=H,e[31]=N.key,e[32]=s,e[33]=q):q=e[33];let G;return e[34]!==V||e[35]!==q?(G=V(q),e[34]=V,e[35]=q,e[36]=G):G=e[36],G}let T;e[37]!==a||e[38]!==l.slug||e[39]!==N||e[40]!==s?(T=N||!a?null:T3(V3(l.slug,s,a)),e[37]=a,e[38]=l.slug,e[39]=N,e[40]=s,e[41]=T):T=e[41];const P=T;let E="/",R=null,M=null;N?.kind==="page"?(E=N.path,R=N.key):N?.kind==="section"?M=N.key:P&&(E=P.path,R=P.pageKey);const I=R?`page:${R}`:M?`section:${M}`:`path:${E}`;let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}),e[42]=D):D=e[42];const $=a??"",O=b??void 0,B=M?null:r,F=!!R&&g.state.editSeoPageKey===R;let z;e[43]!==M||e[44]!==R||e[45]!==E||e[46]!==I||e[47]!==i||e[48]!==l.slug||e[49]!==O||e[50]!==B||e[51]!==F||e[52]!==$||e[53]!==s||e[54]!==g.consumeEditSeo||e[55]!==g.setVariantOverride?(z=o.jsx(A.Suspense,{fallback:D,children:o.jsx(are,{orgSlug:l.slug,virtualMcpId:s,branch:$,previewReady:!0,previewUrl:O,currentPath:E,activePageBlockKey:R,activeGlobalBlockKey:M,externalSelection:B,initialEditSeo:F,onExitSeo:g.consumeEditSeo,onVariantPreviewOverride:g.setVariantOverride,onViewJsonFile:i},I)}),e[43]=M,e[44]=R,e[45]=E,e[46]=I,e[47]=i,e[48]=l.slug,e[49]=O,e[50]=B,e[51]=F,e[52]=$,e[53]=s,e[54]=g.consumeEditSeo,e[55]=g.setVariantOverride,e[56]=z):z=e[56];let W;return e[57]!==V||e[58]!==z?(W=V(z),e[57]=V,e[58]=z,e[59]=W):W=e[59],W}function cre(t){return o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function $b(t){const e=U.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=ce(),{org:a}=Fe(),{currentBranch:c,taskId:d}=an(),h=nl().previewUrl;let f;e[0]!==c||e[1]!==a.slug||e[2]!==h||e[3]!==d||e[4]!==s?(f=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:h}:null,e[0]=c,e[1]=a.slug,e[2]=h,e[3]=d,e[4]=s,e[5]=f):f=e[5];const p=L9(f),g=c??"";let x;e[6]!==a.slug||e[7]!==g||e[8]!==s?(x={orgSlug:a.slug,virtualMcpId:s,branch:g},e[6]=a.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:y}=E3(x),_=p.data?.[n],L=p.data===void 0&&p.isLoading,v=p.data!==void 0&&_===void 0,S=!c||v||L;let w;e[10]!==_?(w=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=w):w=e[11];const k=w;let j;e[12]!==n||e[13]!==S||e[14]!==b?(j=$=>{if(S)return;let O;try{O=JSON.parse($)}catch{return}O===null||typeof O!="object"||Array.isArray(O)||b(n,O)},e[12]=n,e[13]=S,e[14]=b,e[15]=j):j=e[15];const C=j;let V;e[16]!==y?(V=()=>({flush:y}),e[16]=y,e[17]=V):V=e[17],A.useImperativeHandle(r,V);let N;e[18]!==l?(N=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=N):N=e[19];let T;e[20]!==N?(T=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=T):T=e[21];let P;e[22]!==l?(P=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=P):P=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ws,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==P?(R=o.jsx(fe,{variant:"ghost",size:"icon",onClick:i,"aria-label":P,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=P,e[27]=R):R=e[27];let M;e[28]!==R||e[29]!==T?(M=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[T,R]}),e[28]=R,e[29]=T,e[30]=M):M=e[30];let I;e[31]!==p.data||e[32]!==y||e[33]!==k||e[34]!==L||e[35]!==v||e[36]!==n||e[37]!==S||e[38]!==C||e[39]!==l?(I=L?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}):v?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",l("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ld,{code:k,language:"json",readOnly:S,height:"100%",onChange:$=>C($??""),onSave:$=>{C($),y()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=y,e[33]=k,e[34]=L,e[35]=v,e[36]=n,e[37]=S,e[38]=C,e[39]=l,e[40]=I):I=e[40];let D;return e[41]!==M||e[42]!==I?(D=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[M,I]}),e[41]=M,e[42]=I,e[43]=D):D=e[43],D}function Vk(t){return t.contentEditingEnabled&&!t.isMobile}function dre(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function ure(t){return Vk({contentEditingEnabled:x6(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function hre(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const fre=500,mre={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Bb=1,O1=["desktop","mobile","tablet"],zb={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Fb(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function pre(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function nh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function $1(t,e){try{return new URL(t,e).href}catch{return null}}function gre(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return r.at(-1)===s?a=Math.max(a,95):r.includes(s)&&(a=Math.max(a,90)),a}function xre(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function bre({virtualMcpId:t}){const e=ce(),s=sd(),n=Hl(),i=lQ(),{currentBranch:r,taskId:l}=an(),a=Aw(),c=ro(),d=Sn(t),u=e0(c?.entity?.id===t?c.entity.metadata?.ui?.layout??null:null),h=x6(u),f=Vk({contentEditingEnabled:h,isMobile:n}),[m,p]=A.useState(()=>ure({cmsMode:u,isMobile:n})),[g,x]=A.useState("desktop"),[b,y]=A.useState(null),[_,L]=A.useState(null),v=A.useRef(null),S=A.useRef(null),[w,k]=A.useState(!1),j=A.useRef(null),C=()=>{j.current?.flush(),k(!1)},V=()=>k(be=>(be&&j.current?.flush(),!be)),[N,T]=A.useState({width:0,height:0}),[P,E]=A.useState(null),[R,M]=A.useState(!1),[I,D]=A.useState(""),$=A.useRef(null),[O,B]=A.useState(!1),[F,z]=A.useState(),[W,K]=A.useState(null),[H,q]=A.useState(null),[G,Q]=A.useState(null),[se,Z]=A.useState("/"),[te,X]=A.useState(null),[Y,de]=A.useState({}),[re,le]=A.useState(!1),ne=A.useRef(null),me=()=>{le(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>le(!1),15e3)},ee=()=>{ne.current&&(clearTimeout(ne.current),ne.current=null),le(!1)},{org:oe}=Fe(),ie=fi(),ue=nl(),J=ue.vmEntry,he=ue.previewUrl,ve=ie.lifecycle.phase,je=ve==="running",Ce=c?.entity?.id===t?m2(c.entity.metadata):null,Le=c?.entity?.id===t&&d.runtime==="cms",_e=d.projectDefault==="cms",Ne=nZ({sandboxUrl:he,previewServerUrl:Ce,fastPreviewActive:Le}),ge=t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r,threadId:l??null,previewUrl:he}:null,Te=L9(ge,{fetchEnabled:je}),Se=j3(ge,{fetchEnabled:je}),we=Te.data,Ye=Se.data,Ge=we?of(we).sort((be,De)=>be.name.localeCompare(De.name)):[],Ie=t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r}:null,Oe=Pee(Ie),pt=we&&Ye?k3(we,Ye):[],nt=we&&Ye?Nw(Ye,we,"loaders"):[],lt=I?(()=>{const be=I.toLowerCase();return Ge.map(De=>({page:De,score:gre(De.name,De.path,be)})).filter(({score:De})=>De>0).sort((De,yt)=>yt.score-De.score||De.page.path.length-yt.page.path.length).map(({page:De})=>De)})():Ge,gt=pt.filter(be=>{if(!I)return!0;const De=I.toLowerCase();return be.name.toLowerCase().includes(De)||be.key.toLowerCase().includes(De)||be.resolveType.toLowerCase().includes(De)}),bt=f?nt:[],rt=bt.filter(be=>{if(!I)return!0;const De=I.toLowerCase();return be.title.toLowerCase().includes(De)||be.key.toLowerCase().includes(De)||be.resolveType.toLowerCase().includes(De)}),ct=H?nt.find(be=>be.key===H)??null:null,Qe=$o,dt=W||H?null:op(Ge,se,te),ye=W?W.name:ct?.title??dt?.name,ke=dt?.key??null,et=dt?.path??null,tt=(ke?Y[ke]:void 0)??{},ut=Rr(se,tt),jt={};if(je&&he&&Ye&&we){const be=Iee(Ye,"loaders"),De=ke?we[ke]:void 0,yt=tee(De,we,os=>be.has(os)),Nt=JZ(yt);for(const os of tf(se)){if(os.type!=="param")continue;const pn=qZ(se,os.name,yt),Xs=ZZ(pn,be,Nt);Xs.length>0&&(jt[os.name]=Xs)}}const mt=t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r,threadId:l??null}:null,ft=we&&ke?uw(we,ke,0):[],at=we?ow(ft,we):[],vt=at.map(be=>be.isSavedBlock?be.label:""),wt=at.map(be=>be.isSavedBlock?"global":be.isMultivariate?"variant":"normal"),Me=ft.map(be=>ap(be,we??{})),ht=A.useRef(null),St=A.useRef(null),xt=ie.status.state==="paused",$t=ie.phase,pe=pw({claimPhase:$t,lifecycle:ie.lifecycle}),Pe=ue.previewState,Ue=ue.userStopped,Ae=C3(oe.slug,t??"",r??""),{url:Je}=rw(Le&&t&&r?{orgSlug:oe.slug,virtualMcpId:t,branch:r,previewServerUrl:Ce??null,path:ut}:null),_t=_e&&d.runtime==="sandbox",ot=ZX({previewState:Pe,progressStatus:pe.status,previewServerUrl:Ce,fastPreviewActive:Le,fastPreviewReady:!!Je,codingSession:_t}),ts=ot.mode!=="none",Ve=ot.mode==="production"&&ot.iframeBase?nh(ot.iframeBase):null,Be=!s,Vt=ot.mode==="production"?Ve:nh(he),Ct=c?.entity?.id===t&&c.entity.metadata?.fastPreviewInPlace===!0,As=ot.mode==="production"&&Le&&Ct&&f&&m==="blocks",wn=A.useRef(null);As||(wn.current=Je);const oo=wn.current,lo=As?oo??Je:Je,Js=pre(ot.mode==="sandbox"?q0(Fb(G??$1(ut,ot.iframeBase)??ot.iframeBase,g),a.state.variantOverride??[]):ot.mode==="production"&&Be?q0(Fb(iw(G??lo??$1(ut,ot.iframeBase)??ot.iframeBase,ot.showWakingPill?tZ:null),g),a.state.variantOverride??[]):null);A.useEffect(()=>{},[s,Ve,P]);const mi="sandbox.preview.openInNewTab",br=Je??(ot.iframeBase?$1(ut,ot.iframeBase):null),ao=ot.mode==="production"?br?q0(br,a.state.variantOverride??[]):null:Js??ot.iframeBase,co=async()=>{const be=ao;if(be){window.open(be,"_blank","noopener");return}},pi=t&&r?V3(oe.slug,t,r):null,gi=be=>{pi&&HZ(pi,be)},is=a.state.target;A.useEffect(()=>{if(!(!is||!Ne||!Ye))if(is.kind==="page"){const be=Y[is.key]??{};St.current=Rr(is.path,be),K(null),q(null),Q(null),X(is.key),Z(is.path),gi({path:is.path,pageKey:is.key,params:be})}else if(is.kind==="loader")St.current=null,K(null),q(is.key),Q(null);else{const be=pt.find(De=>De.key===is.key);if(be){St.current=null;const De=sf(Ye);q(null),K(be),Q(nb(Ne,De,be.key))}}},[is,Ne,Ye,Y]),A.useEffect(()=>{!ke||et===null||is?.kind==="page"&&is.key===ke&&is.path===et||a.selectTarget({kind:"page",key:ke,path:et})},[ke,et,is]);const[vr,$i]=A.useState(null);if(Pe.kind==="iframe"&&vr!==Pe.previewUrl){const be=vr!==null;$i(Pe.previewUrl);const De=pi?T3(pi):null;if(De){if(St.current=Rr(De.path,De.params),Z(De.path),X(De.pageKey),Q(null),K(null),q(null),De.pageKey&&Object.keys(De.params).length>0){const yt=De.pageKey;de(Nt=>({...Nt,[yt]:De.params}))}}else be&&(St.current=null,Z("/"),Q(null),X(null),K(null),q(null))}ht.current=Js;const yr=nQ({iframeRef:v,src:ot.mode==="sandbox"?Js:null,active:ot.mode==="sandbox"}),_r=A.useRef(null);A.useEffect(()=>{if(!Je||!Js||_r.current===Je)return;_r.current=Je;const be=v.current;be&&be.getAttribute("src")!==Js&&(me(),be.src=Js)},[Je,Js]);const Lr=()=>{const be=v.current?.contentWindow,De=Vt;if(!be||!De||!we||!ke)return;const yt=we[ke];if(!yt||typeof yt!="object")return;const Nt=sZ({previewBaseUrl:De,pageBlock:yt,decofile:we,path:ut,pathTemplate:se});if(!Nt)return;const os=q0(Nt.src,a.state.variantOverride??[]);be.postMessage({type:"cms-editor::render",src:os,body:Nt.body},De)},uo=A.useRef(null);A.useEffect(()=>{if(!As||W||H||!ke||!we){uo.current=null;return}const be=JSON.stringify({page:ke,path:ut,pathTemplate:se,decofile:we});if(uo.current===be)return;const De=uo.current===null;uo.current=be,!De&&Lr()},[we,As,W,H,ke,ut,se]);const Bi=A.useRef(null);A.useEffect(()=>{if(!As||W||H||!ke||!we){Bi.current=null;return}const be=JSON.stringify(a.state.variantOverride??null),De=Bi.current;Bi.current={page:ke,sig:be},!(!De||De.page!==ke||De.sig===be)&&Lr()},[a.state.variantOverride,As,W,H,ke]);const ho=!!t&&!!r&&!ie.notFound&&!Ue&&!xt&&($t?.kind==="ready"||ve!=="idle"),Bs=hre({editingMode:m,sandboxDisplay:ot.mode==="sandbox",blocksEditingEnabled:f});A.useEffect(()=>{const be=Vt;if(!be)return;const De=yt=>{if(yt.origin===be)if(yt.data?.type==="visual-editor::element-clicked"){const Nt=aZ.safeParse(yt.data.payload);Nt.success&&y(Nt.data)}else if(yt.data?.type==="cms-editor::section-clicked"){const Nt=uZ.safeParse(yt.data.payload);Nt.success&&L({index:Nt.data.sectionIndex,seq:Nt.data.clickSeq})}else yt.data?.type==="cms-editor::render-start"?me():yt.data?.type==="cms-editor::render-end"?(ee(),v.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:vt,kinds:wt,keys:Me},be)):yt.data?.type==="cms-editor::render-error"&&ee()};return window.addEventListener("message",De),()=>window.removeEventListener("message",De)},[Vt,vt,wt,Me]);const Sr=()=>{const be=v.current?.contentWindow,De=nh(he);!be||!De||be.postMessage({type:"visual-editor::activate",script:cZ},De)},fo=()=>{const be=v.current?.contentWindow,De=nh(he);!be||!De||be.postMessage({type:"visual-editor::deactivate"},De)},ol=()=>{const be=v.current?.contentWindow,De=Vt;!be||!De||(be.postMessage(ot.mode==="production"?{type:"editor::inject",args:{script:rb}}:{type:"visual-editor::activate",script:rb},De),be.postMessage({type:"cms-editor::set-labels",labels:vt,kinds:wt,keys:Me},De))},mo=()=>{const be=v.current?.contentWindow,De=Vt;!be||!De||be.postMessage({type:"cms-editor::deactivate"},De)},zi=be=>{if(be==="blocks"&&!f)return;const De=m;!n&&be!==De&&(be==="blocks"?S.current?.resize("30%"):S.current?.collapse()),be!=="blocks"&&C(),p(be),y(null),L(null),be!=="blocks"&&q(null),De==="visual"&&fo(),be==="visual"&&Sr(),De==="blocks"&&be!=="blocks"&&mo(),be==="blocks"&&ol()},po=()=>{zi(dre(m,f))},go=()=>{if(!v.current||!Js)return;me();const be=v.current;be.src=Js};q$(()=>{const be=v.current;if(!be)return;me();const De=document.activeElement,yt=be.tabIndex;be.tabIndex=-1,be.style.pointerEvents="none",be.blur(),xre(be,ht.current);let Nt;const os=()=>{clearTimeout(Nt),be.tabIndex=yt,be.style.pointerEvents="";const pn=document.activeElement;(!pn||pn===document.body||pn===be)&&De?.focus(),be.removeEventListener("load",os)};be.addEventListener("load",os),Nt=setTimeout(os,3e3)});const xo=()=>{const be=O1.indexOf(g);x(O1[(be+1)%O1.length])},Fi=(be,De)=>{if(!ke)return;const yt=ke,Nt={...tt,[be]:De};St.current=Rr(se,Nt),de(os=>({...os,[yt]:Nt})),gi({path:se,pageKey:yt,params:Nt})},wr=Vee({iframeBase:ot.iframeBase,resolvedPath:ut,activeGlobalSectionName:W?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Ui=be=>{const De=Y[be.key]??{},yt=Rr(be.path,De);(W||Qe(yt)!==Qe(ut))&&me(),St.current=yt,K(null),q(null),Q(null),L(null),X(be.key),Z(be.path),gi({path:be.path,pageKey:be.key,params:De}),a.selectTarget({kind:"page",key:be.key,path:be.path})},B9=be=>{if(!Ne||!Ye){xe.error(e("sandbox.preview.previewMetadataNotReady"));return}me(),St.current=null;const De=sf(Ye),yt=nb(Ne,De,be.key);K(be),q(null),Q(yt),L(null),a.selectTarget({kind:"section",key:be.key})},bo=be=>{f&&(K(null),q(be.key),Q(null),zi("blocks"),a.selectTarget({kind:"loader",key:be.key}))},vo=async({name:be,path:De,templateKey:yt})=>{if(!t||!r)return;const Nt=w9(De);if(Nt){z(Nt);return}const os=De.trim().startsWith("/")?De.trim():`/${De.trim()}`;if(Ge.some(Xs=>Qe(Xs.path)===Qe(os))){z(e("sandbox.preview.pageAlreadyExists",{path:os}));return}let pn;if(yt&&(pn=we?.[yt],!pn)){z(e("sandbox.preview.templateNoLongerExists"));return}z(void 0);try{const Xs=await Oe.mutateAsync({name:be,path:os,template:pn});B(!1),xe.success(e("sandbox.preview.pageCreated",{name:be})),await rd(fre),Ui({key:Xs.key,name:Xs.name,path:Xs.path}),zi("blocks")}catch(Xs){z(Xs instanceof Error?Xs.message:e("sandbox.preview.failedToCreatePage"))}},kr=ts&&(ho||ot.mode==="production"),yo=Tee({showPreviewToolbar:kr,contentEditingEnabled:h}),xi=kr?o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{onClick:go,"aria-label":e("sandbox.preview.refresh"),children:o.jsx($n,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),yo?o.jsxs("div",{ref:$,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>M(be=>!be),children:[W&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Hr,{size:11}),"Global"]}),ct&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Vl,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:ae("text-[13px] font-medium text-foreground",ye==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ye??wr}),!W&&!H&&ye!=null&&se&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:tf(se).map((be,De)=>{if(be.type==="text")return o.jsx("span",{className:ae(De===0?"min-w-0 truncate":"shrink-0"),children:be.text},`text-${De}`);const yt=jt[be.name];return yt&&mt?o.jsx(gee,{sources:yt,template:se,paramName:be.name,value:tt[be.name]??"",sandboxRef:mt,onCommit:Nt=>Fi(be.name,Nt)},`${ke}:${be.name}`):o.jsx(Cee,{name:be.name,value:tt[be.name]??"",onCommit:Nt=>Fi(be.name,Nt)},`${ke}:${be.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>M(be=>!be),"aria-label":e("sandbox.preview.choosePage"),"aria-expanded":R,children:o.jsx(Ls,{size:12,className:ae("shrink-0 text-muted-foreground transition-transform",R&&"rotate-180")})})]}),R&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:I,onChange:be=>D(be.target.value),onKeyDown:be=>{if(be.key!=="Enter")return;const De=I.trim();if(!De)return;const yt=lt.find(Nt=>Qe(Nt.path)===Qe(De));yt&&(be.preventDefault(),M(!1),D(""),Ui(yt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:be=>{be.preventDefault(),M(!1),D(""),z(void 0),B(!0)},children:[o.jsx(Yt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),lt.length===0&>.length===0&&rt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Ge.length===0&&pt.length===0&&bt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[lt.length>0&&o.jsx("div",{className:"p-1.5",children:lt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),M(!1),D(""),Ui(be)},children:[o.jsx(Mo,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.path})]},be.key))}),gt.length>0&&o.jsxs("div",{className:ae("p-1.5",lt.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),gt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),M(!1),D(""),B9(be)},children:[o.jsx(Hr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]}),rt.length>0&&o.jsxs("div",{className:ae("p-1.5",(lt.length>0||gt.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),rt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),M(!1),D(""),bo(be)},children:[o.jsx(Vl,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:wr}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{"aria-label":e(mi),onClick:()=>{co()},children:o.jsx(mn,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e(mi)})]})]}):null,jr=xi?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:xi}):null,_o=ot.mode==="sandbox",bi=mre[g],vi=g==="desktop"&&(N.width===0||N.width>=bi.width+2*Bb),Cr=vi?1:Math.min(N.width>0?N.width/(bi.width+2*Bb):1,1),bd=vi?{width:"100%",height:"100%"}:{width:`${bi.width}px`,height:N.height>0?`${N.height/Cr}px`:`${bi.height}px`,transform:`scale(${Cr})`,transformOrigin:"top center"},Lo=ts?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[_o&&o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{onClick:po,"aria-pressed":Bs==="visual","aria-label":e("sandbox.preview.visualEditor"),active:Bs==="visual",className:"rounded-full",children:o.jsx(Px,{size:16})})}),o.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(Eo,{onClick:xo,"aria-label":e(zb[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(RT,{size:16}),g==="tablet"&&o.jsx(DT,{size:16}),g==="desktop"&&o.jsx(MT,{size:16})]},g)})}),o.jsx(Ke,{side:"top",children:e(zb[g])})]})]})}):null,vd=!!H&&Bs==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[mt&&Object.entries(jt).map(([be,De])=>(tt[be]??"")===""?o.jsx(kee,{sources:De,template:se,paramName:be,sandboxRef:mt,onFill:yt=>Fi(be,yt)},`${ke}:${be}`):null),i?jr&&o.jsx(oQ,{children:jr}):xi&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex-1"}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:xi}),o.jsx("div",{className:"flex-1"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:vd?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(Ob,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V}),w&&ke&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx($b,{ref:j,virtualMcpId:t,pageKey:ke,onClose:C})})]}):o.jsxs(Im,{orientation:"horizontal",disabled:Bs!=="blocks",children:[o.jsx(Lc,{ref:S,id:"preview-blocks-editor",defaultSize:Bs==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Bs==="blocks"&&o.jsx(Ob,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V})}),Bs==="blocks"&&o.jsx(Om,{withHandle:!0}),o.jsx(Lc,{id:"preview-canvas",defaultSize:Bs==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(Im,{orientation:"horizontal",disabled:!(w&&ke),children:[w&&ke&&o.jsxs(o.Fragment,{children:[o.jsx(Lc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx($b,{ref:j,virtualMcpId:t,pageKey:ke,onClose:C})}),o.jsx(Om,{withHandle:!0})]}),o.jsx(Lc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:be=>{if(!be)return;const De=()=>T(Nt=>Nt.width===be.clientWidth&&Nt.height===be.clientHeight?Nt:{width:be.clientWidth,height:be.clientHeight});De();const yt=new ResizeObserver(De);return yt.observe(be),()=>yt.disconnect()},className:ae("h-full relative overflow-clip flex justify-center",ts&&!vi&&"bg-muted/30"),children:[(re||Ae)&&ts&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),ot.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Pc,{kind:"starting",progress:pe,claimPhase:$t})}),Pe.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Pc,{kind:"suspended",onResume:ue.resume})}),Pe.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Pc,{kind:"errored",error:Pe.error,onRetry:ue.retry,connectionsHref:`/${oe.slug}/settings/connections`})}),ot.showWakingPill&&o.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(st,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Bs==="visual"&&!b&&o.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(Px,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Bs==="visual"&&b&&o.jsx(NZ,{element:b,onDismiss:()=>y(null)}),Lo,ts&&Js&&o.jsx("div",{className:ae("shrink-0",!vi&&"border-x border-border bg-background shadow-sm"),style:bd,children:o.jsx("iframe",{ref:v,src:Js,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:yr.handleError,onLoad:()=>{if(yr.handleLoad(),ee(),ot.mode!=="sandbox"){ot.mode==="production"&&!ot.showWakingPill&&Bs==="blocks"&&ol();return}if(qe("vm_preview_loaded",{view_mode:Bs,vm_id:J?.sandboxHandle??null}),!W)try{const be=v.current?.contentWindow?.location?.pathname;if(!be)return;const De=St.current;if(De!==null&&(St.current=null,Qe(be)!==Qe(De))||Qe(be)===Qe(ut))return;Z(be),gi({path:be,pageKey:te,params:tt})}catch{}Bs==="visual"&&Sr(),Bs==="blocks"&&ol()}},ot.iframeBase)})]})})]})})]})}),o.jsx(Ree,{open:O,onOpenChange:B,isPending:Oe.isPending,error:F,templates:Ge,onSubmit:vo})]})}function vre(t){const e=U.c(22),{virtualMcpId:s}=t,n=ce(),i=Vs(s),{activeTask:r,taskId:l,currentBranch:a}=an(),c=g_(l),[d,u]=A.useState(!1);if(x_({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:bn(i?.metadata),threadHasRepo:bn(c)||bn(r?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(_n,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>u(!0),b=o.jsx(_n,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let y;e[7]!==n?(y=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsxs(fe,{onClick:x,children:[b,y]}),e[9]=y,e[10]=_):_=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==_?(L=o.jsx(Vi,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=L):L=e[14];let v;e[15]!==d?(v=o.jsx(Ju,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=v):v=e[16];let S;return e[17]!==L||e[18]!==v?(S=o.jsxs(o.Fragment,{children:[L,v]}),e[17]=L,e[18]=v,e[19]=S):S=e[19],S}let f;return e[20]!==s?(f=o.jsx(bre,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}function yre(t){const e=U.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,enabled:l}=t,a=l===void 0?!0:l;let c;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c=it.sandboxRepoDir(s,n,i,r),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==r||e[8]!==n?(d=async()=>{const f=eo({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==a||e[11]!==c||e[12]!==d?(u={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=u):u=e[13],Qt(u).data??null}const _re=A.lazy(()=>Ys(()=>import("./file-explorer-DQ8njhcM.js"),__vite__mapDeps([158,1,2,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,94,96,88,97,69,98,99,100,101,102,103,104,70,144,142,92,138,109,78,79,80,81,82,83,84,85,86,87,89,90,91,93,95,105,106,107,108,75,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,139,140,141,143,145,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.FileExplorer})));function Lre(t){const e=U.c(26),{openPath:s}=t,n=ce(),i=ro(),{org:r}=Fe(),{currentBranch:l,taskId:a}=an(),c=i?.entity?.id??null,d=sd(),u=nl(),h=fi();u.vmEntry,h.lifecycle.phase;const f=d,m=c??"",p=l??"",g=a??null,x=f;let b;e[0]!==r.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=r.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],yre(b);const y=null;if(!c||!l){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;e[8]!==n?(j=n("mainPanelTabs.codeTab.noSandboxToBrowseDescription"),e[8]=n,e[9]=j):j=e[9];let C;return e[10]!==k||e[11]!==j?(C=o.jsx(Vi,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=C):C=e[12],C}let _;e[13]!==y||e[14]!==n?(_=y,e[13]=y,e[14]=n,e[15]=_):_=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}),e[16]=L):L=e[16];const v=a??null;let S;e[17]!==l||e[18]!==s||e[19]!==r.slug||e[20]!==v||e[21]!==c?(S=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(A.Suspense,{fallback:L,children:o.jsx(_re,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:v,openPath:s})})}),e[17]=l,e[18]=s,e[19]=r.slug,e[20]=v,e[21]=c,e[22]=S):S=e[22];let w;return e[23]!==_||e[24]!==S?(w=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,S]}),e[23]=_,e[24]=S,e[25]=w):w=e[25],w}function Sre(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function wre(t,e,s){return typeof t!="string"?null:Sre(zn(t,e),s)}function Tk(t,e,s){if(!e||typeof t!="string")return!1;const n=wre(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function kre({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ms(),i=_s()?.taskId??null,r=f0(e),l=Sn(e).runtime==="cms";return Rs({mutationKey:yg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await $7({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return Lg(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:u0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=h0(r,p8(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():l9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=it.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:it.liveMeta(t,e,s)})}})}function mc(t){const e=U.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let r;e[0]!==i||e[1]!==n||e[2]!==s?(r=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==r?(l=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5],l}function E9(t,e){return`${t}-${e}`}function Ak(t,e){return`site/apps/${t}/${e}.ts`}function Pk(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function jre(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Cre(t){return t==="local"?"Custom":"Installed"}function Ek(t,e,s){const n=new Set([E9(t,e),e].map(r=>r.toLowerCase())),i=Ak(t,e);for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(r.toLowerCase())||a.__resolveType===i)return r}return null}function Nre(t,e){const s=t.vendor.alias,n=t.name,i=Ek(s,n,e);return{id:E9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Ak(s,n),blockKey:i,installed:i!==null}}function Vre(t,e,s){if(t===w3)return null;const n=Pk(t);if(!n)return null;const{vendor:i,app:r}=n,l=Ek(i,r,s),a=rl(t,e);return{id:E9(i,r),app:r,vendor:i,title:a.title??r,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function Tre(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Uc(t,e)||!$S(n))return null;const i=Pk(n)??jre(t);if(!i)return null;const r=rl(n,s),{vendor:l,app:a}=i;return{id:E9(l,a),app:a,vendor:l,title:r.title??lf(t,e,s),description:r.description??"",category:Cre(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function Are(t,e,s){const n=new Map;for(const r of t){const l=Nre(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=Vre(r,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=Tre(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Pre)}function Pre(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Ere(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function Rre(t,e,s){const n=U.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=it.decoApps(),n[0]=r):r=n[0];let l;n[1]!==i?(l={queryKey:r,queryFn:Ere,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Qt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Are(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function Dre(t){const e=U.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=ce();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const u=s==="pages";let h;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==u?(h=o.jsx(Fn,{id:"pages",icon:Mo,label:d,count:n.pages,active:u,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==r||e[15]!==f||e[16]!==m?(p=o.jsx(Fn,{id:"sections",icon:Hr,label:f,count:n.sections,active:m,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==r||e[22]!==x||e[23]!==g?(b=o.jsx(Fn,{id:"apps",icon:Z6,label:g,count:n.apps,active:x,onSelect:r}),e[20]=n.apps,e[21]=r,e[22]=x,e[23]=g,e[24]=b):b=e[24];let y;e[25]!==l?(y=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=y):y=e[26];const _=s==="redirects";let L;e[27]!==n.redirects||e[28]!==r||e[29]!==y||e[30]!==_?(L=o.jsx(Fn,{id:"redirects",icon:F6,label:y,count:n.redirects,active:_,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=y,e[30]=_,e[31]=L):L=e[31];let v;e[32]!==l?(v=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=v):v=e[33];const S=s==="loaders";let w;e[34]!==n.loaders||e[35]!==r||e[36]!==v||e[37]!==S?(w=o.jsx(Fn,{id:"loaders",icon:Vl,label:v,count:n.loaders,active:S,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=v,e[37]=S,e[38]=w):w=e[38];let k;e[39]!==l?(k=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=k):k=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==r||e[43]!==k||e[44]!==j?(C=o.jsx(Fn,{id:"actions",icon:dr,label:k,count:n.actions,active:j,onSelect:r}),e[41]=n.actions,e[42]=r,e[43]=k,e[44]=j,e[45]=C):C=e[45];let V;e[46]!==l?(V=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=V):V=e[47];const N=s==="site";let T;e[48]!==r||e[49]!==V||e[50]!==N?(T=o.jsx(Fn,{id:"site",icon:C6,label:V,active:N,onSelect:r}),e[48]=r,e[49]=V,e[50]=N,e[51]=T):T=e[51];let P;e[52]!==l?(P=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=P):P=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==P||e[56]!==E?(R=o.jsx(Fn,{id:"seo",icon:U6,label:P,active:E,onSelect:r}),e[54]=r,e[55]=P,e[56]=E,e[57]=R):R=e[57];let M;e[58]!==l?(M=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=M):M=e[59];const I=s==="calendar";let D;e[60]!==r||e[61]!==M||e[62]!==I?(D=o.jsx(Fn,{id:"calendar",icon:Zc,label:M,active:I,onSelect:r}),e[60]=r,e[61]=M,e[62]=I,e[63]=D):D=e[63];let $;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?($=i&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Mc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Fn,{id:"posts",icon:Ai,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Fn,{id:"authors",icon:t9,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Fn,{id:"categories",icon:M2,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Fn,{id:"post-schedule",icon:IT,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=r,e[69]=i,e[70]=l,e[71]=$):$=e[71];let O;e[72]!==b||e[73]!==L||e[74]!==w||e[75]!==C||e[76]!==T||e[77]!==R||e[78]!==D||e[79]!==$||e[80]!==h||e[81]!==p?(O=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,L,w,C,T,R,D,$]}),e[72]=b,e[73]=L,e[74]=w,e[75]=C,e[76]=T,e[77]=R,e[78]=D,e[79]=$,e[80]=h,e[81]=p,e[82]=O):O=e[82];let B;return e[83]!==c||e[84]!==O?(B=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,O]}),e[83]=c,e[84]=O,e[85]=B):B=e[85],B}function Fn(t){const e=U.c(18),{id:s,icon:n,label:i,count:r,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let u;e[3]!==d?(u=ae("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=o.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==r?(m=r!==void 0&&o.jsx("span",{className:ae("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[9]=l,e[10]=r,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function Mre(t){const e=U.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=pw({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=o.jsx(Pc,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==r?(a=o.jsx(Pc,{kind:"suspended",onResume:r}),e[6]=r,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==r||e[10]!==s.error?(a=o.jsx(Pc,{kind:"errored",error:s.error,onRetry:r,connectionsHref:l}),e[8]=l,e[9]=r,e[10]=s.error,e[11]=a):a=e[11],a}}}const Ire=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Ore(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Ire.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Ub(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const r=`${s} (copy ${i})`;if(!t.has(r))return r}return`${s} (copy ${Date.now()})`}function $re(t,e){const s=$o,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const l=`${n}-copy-${r}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function Bre(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const r=`${s}_copy_${i}`;if(!Object.hasOwn(t,r))return r}return`${s}_copy_${Date.now()}`}function zre(t){const e=P3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Fre(t,e){return _w(t,e)}const Ure=1e3;function Hre(t,e){for(let s=0;s<Ure;s++){const n=P3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Kre={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Wre={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},qre={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Gre(t){const e=U.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=ce(),[p,g]=A.useState(i),[x,b]=A.useState(r),[y,_]=A.useState(Bo),[L,v]=A.useState(null),[S,w]=A.useState(s);s!==S&&(w(s),s&&(g(i),b(r),_(Bo),v(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=ee=>{!ee&&!f&&(v(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const C=j;let V;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==k||e[8]!==y||e[9]!==d?(V=async ee=>{ee.preventDefault();const oe=p.trim(),ie=x.trim();if(!oe||!ie||f)return;const ue=w9(ie);if(ue){v(ue);return}const J=d?.({name:oe,path:ie});if(J){v(J);return}v(null),await u({name:oe,path:ie,templateKey:k&&y!==Bo?y:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=k,e[8]=y,e[9]=d,e[10]=V):V=e[10];const N=V,T=L??a,P=Kre[n];let E;e[11]!==m||e[12]!==P?(E=m(P),e[11]=m,e[12]=P,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(ms,{children:o.jsx(Gt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let M;e[16]!==f||e[17]!==k||e[18]!==m||e[19]!==y||e[20]!==c?(M=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(Lw,{id:"page-form-template",value:y,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=y,e[20]=c,e[21]=M):M=e[21];let I;e[22]!==m?(I=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=I):I=e[23];let D;e[24]!==I?(D=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:I}),e[24]=I,e[25]=D):D=e[25];let $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=ee=>g(ee.target.value),e[26]=$):$=e[26];let O;e[27]!==m?(O=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=O):O=e[28];let B;e[29]!==f||e[30]!==p||e[31]!==O?(B=o.jsx(kt,{id:"page-form-name",value:p,onChange:$,placeholder:O,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=O,e[32]=B):B=e[32];let F;e[33]!==B||e[34]!==D?(F=o.jsxs("div",{className:"space-y-1.5",children:[D,B]}),e[33]=B,e[34]=D,e[35]=F):F=e[35];let z;e[36]!==m?(z=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=z):z=e[37];let W;e[38]!==z?(W=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:z}),e[38]=z,e[39]=W):W=e[39];let K;e[40]===Symbol.for("react.memo_cache_sentinel")?(K=ee=>b(ee.target.value),e[40]=K):K=e[40];let H;e[41]!==m?(H=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=H):H=e[42];let q;e[43]!==f||e[44]!==x||e[45]!==H?(q=o.jsx(kt,{id:"page-form-path",value:x,onChange:K,placeholder:H,disabled:f}),e[43]=f,e[44]=x,e[45]=H,e[46]=q):q=e[46];let G;e[47]!==W||e[48]!==q?(G=o.jsxs("div",{className:"space-y-1.5",children:[W,q]}),e[47]=W,e[48]=q,e[49]=G):G=e[49];let Q;e[50]!==T?(Q=T&&o.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=Q):Q=e[51];let se;e[52]!==F||e[53]!==G||e[54]!==Q||e[55]!==M?(se=o.jsxs("div",{className:"space-y-4 py-4",children:[M,F,G,Q]}),e[52]=F,e[53]=G,e[54]=Q,e[55]=M,e[56]=se):se=e[56];let Z;e[57]!==h?(Z=()=>h(!1),e[57]=h,e[58]=Z):Z=e[58];let te;e[59]!==m?(te=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=te):te=e[60];let X;e[61]!==f||e[62]!==Z||e[63]!==te?(X=o.jsx(fe,{type:"button",variant:"outline",onClick:Z,disabled:f,children:te}),e[61]=f,e[62]=Z,e[63]=te,e[64]=X):X=e[64];let Y;e[65]!==f||e[66]!==p||e[67]!==x?(Y=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=Y):Y=e[68];let de;e[69]!==f||e[70]!==n||e[71]!==m?(de=f?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),m(qre[n])]}):m(Wre[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=de):de=e[72];let re;e[73]!==Y||e[74]!==de?(re=o.jsx(fe,{type:"submit",disabled:Y,children:de}),e[73]=Y,e[74]=de,e[75]=re):re=e[75];let le;e[76]!==X||e[77]!==re?(le=o.jsxs(Yn,{children:[X,re]}),e[76]=X,e[77]=re,e[78]=le):le=e[78];let ne;e[79]!==N||e[80]!==se||e[81]!==le||e[82]!==R?(ne=o.jsx(Ft,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[R,se,le]})}),e[79]=N,e[80]=se,e[81]=le,e[82]=R,e[83]=ne):ne=e[83];let me;return e[84]!==C||e[85]!==s||e[86]!==ne?(me=o.jsx(Ut,{open:s,onOpenChange:C,children:ne}),e[84]=C,e[85]=s,e[86]=ne,e[87]=me):me=e[87],me}function Yre(t){const e=U.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=ce(),[u,h]=A.useState(i),[f,m]=A.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=K=>{!K&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==u||e[5]!==l?(x=async K=>{K.preventDefault();const H=u.trim();!H||c||await l(H)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let y;e[7]!==d?(y=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsx(Gt,{children:y}),e[9]=y,e[10]=_):_=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let v;e[13]!==L?(v=o.jsx(Tn,{children:L}),e[13]=L,e[14]=v):v=e[14];let S;e[15]!==_||e[16]!==v?(S=o.jsxs(ms,{children:[_,v]}),e[15]=_,e[16]=v,e[17]=S):S=e[17];let w;e[18]!==d?(w=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=w):w=e[19];let k;e[20]!==w?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:w}),e[20]=w,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=K=>h(K.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==u?(C=o.jsx(kt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=C):C=e[25];let V;e[26]!==k||e[27]!==C?(V=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=V):V=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let T;e[31]!==N?(T=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=T):T=e[32];let P;e[33]!==n?(P=o.jsx(kt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=P):P=e[34];let E;e[35]!==T||e[36]!==P?(E=o.jsxs("div",{className:"space-y-1.5",children:[T,P]}),e[35]=T,e[36]=P,e[37]=E):E=e[37];let R;e[38]!==V||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[V,E]}),e[38]=V,e[39]=E,e[40]=R):R=e[40];let M;e[41]!==a?(M=()=>a(!1),e[41]=a,e[42]=M):M=e[42];let I;e[43]!==d?(I=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=I):I=e[44];let D;e[45]!==c||e[46]!==M||e[47]!==I?(D=o.jsx(fe,{type:"button",variant:"outline",onClick:M,disabled:c,children:I}),e[45]=c,e[46]=M,e[47]=I,e[48]=D):D=e[48];let $;e[49]!==c||e[50]!==u?($=!u.trim()||c,e[49]=c,e[50]=u,e[51]=$):$=e[51];let O;e[52]!==c||e[53]!==d?(O=c?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=O):O=e[54];let B;e[55]!==$||e[56]!==O?(B=o.jsx(fe,{type:"submit",disabled:$,children:O}),e[55]=$,e[56]=O,e[57]=B):B=e[57];let F;e[58]!==D||e[59]!==B?(F=o.jsxs(Yn,{children:[D,B]}),e[58]=D,e[59]=B,e[60]=F):F=e[60];let z;e[61]!==b||e[62]!==R||e[63]!==F||e[64]!==S?(z=o.jsx(Ft,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[S,R,F]})}),e[61]=b,e[62]=R,e[63]=F,e[64]=S,e[65]=z):z=e[65];let W;return e[66]!==g||e[67]!==s||e[68]!==z?(W=o.jsx(Ut,{open:s,onOpenChange:g,children:z}),e[66]=g,e[67]=s,e[68]=z,e[69]=W):W=e[69],W}function Jre(t){const e=U.c(7),{type:s}=t,n=EQ[s];let i;e[0]!==n?(i=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const r=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==r?(l=o.jsx(Ke,{side:"left",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs(We,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const B1={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},J3=["posts","authors","categories"],du={posts:"post",authors:"author",categories:"category"};function uu(t){return J3.includes(t)}const X3={posts:"post",authors:"author",categories:"category"},Rk={posts:B1.post,authors:B1.author,categories:B1.category},Xre=Object.fromEntries(Object.entries(Rk).map(([t,e])=>[e,t]));function Qre(t){return typeof t=="string"?Xre[t]??null:null}function Xo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function cs(t){return typeof t=="string"?t:""}function Zre(t,e){switch(t){case"posts":return{label:cs(e.title)||"Untitled post",subtitle:cs(e.slug)};case"authors":return{label:cs(e.name)||"Unnamed author",subtitle:cs(e.email)};case"categories":return{label:cs(e.name)||"Unnamed category",subtitle:cs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Dk(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Xo(n);if(!i)continue;const r=Qre(i.__resolveType);if(!r)continue;const l=Xo(i[X3[r]])??{},{label:a,subtitle:c}=Zre(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of J3)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function eoe(t,e){return Dk(t)[e]}function Ru(t,e){return eoe(t,e).map(s=>({key:s.key,payload:Kd(Xo(t[s.key])??void 0,e)}))}const Hb=Object.freeze({});function Kd(t,e){return t?Xo(t[X3[e]])??Hb:Hb}function pc(t,e,s){return{name:t,__resolveType:Rk[e],[X3[e]]:s}}function P2e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:cs(Xo(f)?.[s]),l=f=>typeof f=="string"?f:cs(Xo(f)?.name),a=f=>{const m=r(f),p=m?t.find(({payload:x})=>cs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>cs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:cs(m.name)||cs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||r(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function zl(t){return Array.isArray(t)?t:[]}function Fr(t){if(typeof t=="string")return t;const e=Xo(t);return e?cs(e.slug):""}function toe(t){if(typeof t=="string")return t;const e=Xo(t);return e?cs(e.email):""}function Mk(t){const e=[];return cs(t.title).trim()||e.push("Title"),cs(t.slug).trim()||e.push("Slug"),zl(t.categories).map(Fr).filter(Boolean).length===0&&e.push("Category"),cs(t.excerpt).trim()||e.push("Excerpt"),cs(t.image).trim()||e.push("Cover image"),e}const Ik=8;function Ok(t){const e=cs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function E2e(t,e){return e!=="published"||Ok(t)==="published"?!1:Mk(t).length>0}function soe(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Ik).toISOString()}function R2e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=cs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?soe(s):n}}function $k(t){return Ru(t,"posts").map(({key:e,payload:s})=>({key:e,title:cs(s.title)||"Untitled post",slug:cs(s.slug),date:cs(s.date),scheduledDatetime:cs(s.scheduledDatetime),categorySlugs:zl(s.categories).map(Fr).filter(Boolean),authorEmails:zl(s.authors).map(toe).filter(Boolean),missing:Mk(s),status:Ok(s)}))}function noe(t,e){const s=zl(t.categories);return s.some(n=>Fr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function ioe(t,e){const s=zl(t.categories);return s.length===1&&Fr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function D2e(t,e,s){const n=zl(t.categories);if(!n.some(a=>Fr(a)===e))return t;const i=n.map(a=>{const c=Fr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=Fr(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function roe(t,e){const s=zl(t.categories);return s.some(n=>Fr(n)===e)?{...t,categories:s.filter(n=>Fr(n)!==e)}:t}function Kb(t){return{...t,dateModified:new Date().toISOString()}}function pp(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function z1(t,e){const s=`collections/blog/${e}/${pp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Bk(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${pp(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${pp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const ooe={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Wb="Box";function loe(t){return t.startsWith("site/")?"site":"app"}function aoe(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Vd(...t){for(const e of t)if(e!==void 0)return e}function M2e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!uoe(r)||e.has(r))continue;e.add(r);const l=rl(r,t),a=coe(r),c=ooe[a],d=loe(r),u=(d==="site"?Vd(l.title,c?.title):Vd(c?.title,l.title))??a,h=d==="site"?Vd(l.description,c?.description):Vd(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&aoe(f)?f:void 0,p=m!==void 0?c?.iconName??Wb:Vd(f,c?.iconName)??Wb;s.push({resolveType:r,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function coe(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const doe=["blog/sections/blocks/","site/sections/Blog/Post/"];function uoe(t){return doe.some(e=>t.startsWith(e))}const I2e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],O2e=["January","February","March","April","May","June","July","August","September","October","November","December"],zk=1440*60*1e3;function jl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function $2e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function B2e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function gf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function gp(t,e){return Math.round((jl(t).getTime()-jl(e).getTime())/zk)}function hoe(t){const e=(t.getTime()-jl(t).getTime())/zk;return Math.min(Math.max(e,0),1)}function qb(t,e){return gp(t,e)+hoe(t)}function z2e(t){const e=gf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(gf(e,n*7+r));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function F2e(t,e){const s=jl(t[0]),n=gf(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const u=jl(d.start),h=jl(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?gf(n,-1):h,p=gp(f,s),g=gp(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),y=qb(new Date(x),s),_=Math.max(qb(new Date(b),s)-y,0);_<=0||l.push({variant:d,startCol:p,span:g,leftUnits:y,widthUnits:_})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function xf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const Fk=/^(\d{4})-(\d{2})-(\d{2})$/;function bf(t){const e=t.trim();if(!e)return null;const s=Fk.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,l=Number(s[3]),a=new Date(i,r,l);return a.getMonth()===r&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:jl(n)}function foe(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Ik);return{...Bk("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:xf(t)}}function moe(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(Fk.test(e))return bf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function poe(t,e){const s=moe(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===xf(s)&&(i.date=xf(n)),i}function goe(t){return bf(t.scheduledDatetime)??bf(t.date)}function U2e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:bf(i.scheduledDatetime)!==null},l=goe(i);if(!l){s.push(r);continue}const a=xf(l),c=e.get(a);c?c.push(r):e.set(a,[r])}const n=(i,r)=>Number(r.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(r.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const xoe="0.161.0",boe="0.162.0",H2e="deno task update";function Gb(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Yb(t,e){const s=Gb(t),n=Gb(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const r=s[i]-n[i];if(r!==0)return r}return 0}const Uk=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function voe(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Uk.exec(s)?.[1];if(n)return n}return null}function yoe(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Uk.exec(n)?.[1];if(i)return i}return null}function _oe(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=voe(t.denoJson)??yoe(t.meta);return!e||Yb(e,xoe)<0?{kind:"outdated",version:e}:Yb(e,boe)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function K2e(t){return t.kind==="publish-only"||t.kind==="full"}function W2e(t){return t.kind==="full"}function Loe(t){const e=U.c(16),s=Vs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=f0(t.virtualMcpId),i=_s()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=it.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await p3({...t,threadId:i},h0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==r||e[9]!==l||e[10]!==a?(c={queryKey:r,queryFn:l,enabled:a,staleTime:3e5},e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Qt(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=_oe({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Soe({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=ce(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=A.useState(!1),[h,f]=A.useState(c),[m,p]=A.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},y=async _=>{if(!i||m)return;let L;try{L=JSON.parse(_)}catch{xe.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(L),xe.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(v){xe.error(r("sectionsEditor.pageJsonDialog.saveError",{error:v instanceof Error?v.message:String(v)}))}finally{p(!1)}};return o.jsx(Ut,{open:t,onOpenChange:e,children:o.jsxs(Ft,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ms,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Gt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(fe,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(gr,{size:12}):o.jsx(vn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(fe,{size:"sm",onClick:()=>y(h),disabled:!x||m,className:"h-7 text-xs",children:r(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",r("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(ld,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{y(_)}})})]})})}function _i(t){const e=U.c(46),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,y=ce(),_=a==="global";let L;e[0]!==s||e[1]!==l||e[2]!==_||e[3]!==n||e[4]!==c?(L=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(Ke,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:ae("flex size-8 shrink-0 items-center justify-center rounded-lg",_?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:ae("shrink-0",!_&&(l?"text-accent-foreground":"text-muted-foreground")),style:_?{color:b3}:void 0})}),e[0]=s,e[1]=l,e[2]=_,e[3]=n,e[4]=c,e[5]=L):L=e[5];const v=L,S=l?_?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":_?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==S?(w=ae("group relative flex min-w-0 items-center rounded-md transition-colors",S),e[6]=S,e[7]=w):w=e[7];let k;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==y||e[13]!==i?(k=u&&o.jsx("span",{className:ae("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:woe,children:o.jsx(id,{checked:f,onCheckedChange:()=>g?.(),"aria-label":y("sandbox.itemRow.selectItem",{title:i})})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=y,e[13]=i,e[14]=k):k=e[14];const j=m&&!l&&"text-destructive";let C;e[15]!==j?(C=ae("block truncate text-sm font-medium",j),e[15]=j,e[16]=C):C=e[16];let V;e[17]!==C||e[18]!==i?(V=o.jsx("span",{className:C,children:i}),e[17]=C,e[18]=i,e[19]=V):V=e[19];const N=l?"text-accent-foreground/70":"text-muted-foreground";let T;e[20]!==N?(T=ae("block truncate text-xs",N),e[20]=N,e[21]=T):T=e[21];let P;e[22]!==r||e[23]!==T?(P=o.jsx("span",{className:T,children:r}),e[22]=r,e[23]=T,e[24]=P):P=e[24];let E;e[25]!==P||e[26]!==V?(E=o.jsxs("span",{className:"min-w-0 flex-1",children:[V,P]}),e[25]=P,e[26]=V,e[27]=E):E=e[27];let R;e[28]!==l||e[29]!==m||e[30]!==p?(R=m&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx("span",{className:ae("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(yn,{size:14})})}),p&&o.jsx(Ke,{side:"bottom",children:p})]}),e[28]=l,e[29]=m,e[30]=p,e[31]=R):R=e[31];let M;e[32]!==x||e[33]!==v||e[34]!==E||e[35]!==R||e[36]!==d?(M=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[v,E,R,d]}),e[32]=x,e[33]=v,e[34]=E,e[35]=R,e[36]=d,e[37]=M):M=e[37];let I;e[38]!==l||e[39]!==b?(I=b&&o.jsx("div",{className:ae("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[38]=l,e[39]=b,e[40]=I):I=e[40];let D;return e[41]!==M||e[42]!==I||e[43]!==w||e[44]!==k?(D=o.jsxs("div",{className:w,children:[k,M,I]}),e[41]=M,e[42]=I,e[43]=w,e[44]=k,e[45]=D):D=e[45],D}function woe(t){return t.stopPropagation()}function Ro(t){const e=U.c(10),{icon:s,title:n,description:i}=t;let r;e[0]!==s?(r=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=r):r=e[1];let l;e[2]!==n?(l=o.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[r,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const koe={loaders:Vl,actions:dr},joe={loaders:"Loaders",actions:"Actions"},Coe={analytics:dP,blog:Mc,commerce:cP,site:OT,website:An};function Noe(t,e){return e===0?Coe[t.toLowerCase()]??Ho:Ho}function ih(t,e){return e===0?Bee(t):t}function Voe(t){const e=U.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=ce();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u),[m,p]=A.useState(null),[g,x]=A.useState(""),[b,y]=A.useState(Ioe),[_,L]=A.useState(c);_!==c&&(L(c),f([]),p(null),x(""),y(new Set));let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=z=>{y(W=>{const K=new Set(W);return K.has(z)?K.delete(z):K.add(z),K})},e[1]=v):v=e[1];const S=v;let w;e[2]!==i||e[3]!==s||e[4]!==n?(w={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=w):w=e[5];const k=m0(w);let j;e[6]!==k?(j=D3((z,W)=>k.mutate({blockKey:z,data:W})),e[6]=k,e[7]=j):j=e[7];const C=j;let V;e[8]!==c?(V=ww(c),e[8]=c,e[9]=V):V=e[9];const N=V,T=koe[c];let P,E,R,M,I,D,$;if(e[10]!==T||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==N||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const z=[...Nw(l,a,c).map(Moe),...jw(l,c).map(Doe)],W=g.trim().toLowerCase(),K=W.length>0,H=K?z.filter(ge=>ge.title.toLowerCase().includes(W)||ge.resolveType.toLowerCase().includes(W)):[],q=new Map,G=[],Q=new Map;if(!K){for(const ge of z){const Te=ge.folderPath;if(!(Te.length<h.length)&&h.every((Se,we)=>Te[we]===Se))if(Te.length===h.length)if(ge.savedKey!==void 0){const Se=Q.get(ge.resolveType);Se?Se.push(ge):Q.set(ge.resolveType,[ge])}else G.push(ge);else{const Se=Te[h.length],we=q.get(Se)??{count:0,savedCount:0};ge.savedKey!==void 0?we.savedCount=we.savedCount+1:we.count=we.count+1,q.set(Se,we)}}G.sort(Roe);for(const ge of Q.values())ge.sort(Eoe)}const se=[...Q.entries()].filter(ge=>{const[Te]=ge;return!G.some(Se=>Se.resolveType===Te)}).flatMap(Poe).sort(Aoe);let Z;e[33]!==h?(Z=(ge,Te)=>ih(ge.name,h.length).localeCompare(ih(Te.name,h.length)),e[33]=h,e[34]=Z):Z=e[34];const te=[...q.entries()].map(Toe).sort(Z);let X;e[35]===Symbol.for("react.memo_cache_sentinel")?(X=ge=>{p(ge.savedKey!==void 0?{mode:"saved",key:ge.savedKey}:{mode:"available",resolveType:ge.resolveType,title:ge.title})},e[35]=X):X=e[35];const Y=X;let de;e[36]!==k||e[37]!==N||e[38]!==d?(de=async(ge,Te)=>{await k.mutateAsync({blockKey:ge,data:Te}),xe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:ge})),p({mode:"saved",key:ge})},e[36]=k,e[37]=N,e[38]=d,e[39]=de):de=e[39];const re=de;let le;e[40]!==a||e[41]!==m?(le=Ooe(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ne=le;if(ne){const ge=`${ne.mode}:${ne.mode==="saved"?ne.blockKey:ne.resolveType}`;let Te;e[43]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>p(null),e[43]=Te):Te=e[43];let Se;e[44]!==i||e[45]!==a||e[46]!==re||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==ge||e[54]!==ne.editorTarget||e[55]!==ne.initialValue||e[56]!==n?(Se=o.jsx(Nk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:ne.editorTarget,initialValue:ne.initialValue,isCreating:k.isPending,onCreate:re,onSaveReferencedBlock:C,onBack:Te},ge),e[44]=i,e[45]=a,e[46]=re,e[47]=c,e[48]=l,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=ge,e[54]=ne.editorTarget,e[55]=ne.initialValue,e[56]=n,e[57]=Se):Se=e[57],R=Se;break e}$="flex h-full w-full min-w-0 flex-col";let me;e[58]!==d?(me=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=me):me=e[59];let ee;e[60]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>f([]),e[60]=ee):ee=e[60];const oe=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ie;e[61]!==oe?(ie=ae("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",oe),e[61]=oe,e[62]=ie):ie=e[62];const ue=joe[c];let J;e[63]!==ie||e[64]!==ue?(J=o.jsx("button",{type:"button",onClick:ee,className:ie,children:ue}),e[63]=ie,e[64]=ue,e[65]=J):J=e[65];let he;e[66]!==h?(he=h.map((ge,Te)=>{const Se=Te===h.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Te+1)),className:ae("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Se?"font-medium text-foreground":"text-muted-foreground"),children:ih(ge,Te)})]},`${ge}-${Te}`)}),e[66]=h,e[67]=he):he=e[67];let ve;e[68]!==me||e[69]!==J||e[70]!==he?(ve=o.jsxs("nav",{"aria-label":me,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[J,he]}),e[68]=me,e[69]=J,e[70]=he,e[71]=ve):ve=e[71];let je;e[72]===Symbol.for("react.memo_cache_sentinel")?(je=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=je):je=e[72];let Ce;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ce=ge=>x(ge.target.value),e[73]=Ce):Ce=e[73];let Le;e[74]!==c||e[75]!==d?(Le=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Le):Le=e[76];let _e;e[77]!==c||e[78]!==d?(_e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=_e):_e=e[79];let Ne;e[80]!==g||e[81]!==Le||e[82]!==_e?(Ne=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[je,o.jsx("input",{type:"text",value:g,onChange:Ce,placeholder:Le,"aria-label":_e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Le,e[82]=_e,e[83]=Ne):Ne=e[83],e[84]!==ve||e[85]!==Ne?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ve,Ne]}),e[84]=ve,e[85]=Ne,e[86]=E):E=e[86],P=Ql,D="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",M="mx-auto w-full max-w-4xl px-6 py-5",I=K?H.length===0?o.jsx(Ro,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:H.map(ge=>o.jsx(_i,{icon:T,accent:ge.savedKey!==void 0?"global":void 0,title:ge.title,subtitle:ge.resolveType,active:!1,onClick:()=>Y(ge)},ge.savedKey??ge.resolveType))}):te.length===0&&G.length===0&&se.length===0?o.jsx(Ro,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[te.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:te.map(ge=>{const Te=Noe(ge.name,h.length);return o.jsxs("button",{type:"button",onClick:()=>f([...h,ge.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(Te,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:ih(ge.name,h.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[ge.count," ",ge.count===1?N:c,ge.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:ge.savedCount})]})]})]})]},ge.name)})}),(G.length>0||se.length>0)&&o.jsxs("div",{className:ae("flex flex-col gap-1",te.length>0&&"mt-4"),children:[G.map(ge=>{const Te=Q.get(ge.resolveType)??[],Se=b.has(ge.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(_i,{icon:T,title:ge.title,subtitle:ge.resolveType,active:!1,onClick:()=>Y(ge)}),Te.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>S(ge.resolveType),"aria-expanded":Se,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:b3},children:[Se?o.jsx(Ls,{size:12,className:"shrink-0"}):o.jsx(qs,{size:12,className:"shrink-0"}),d(Se?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Te.length,")"]}),Se&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Te.map(we=>o.jsx(_i,{icon:T,accent:"global",title:we.title,subtitle:we.resolveType,active:!1,onClick:()=>Y(we)},we.savedKey))})]})]},ge.resolveType)}),se.map(ge=>o.jsx(_i,{icon:T,accent:"global",title:ge.title,subtitle:ge.resolveType,active:!1,onClick:()=>Y(ge)},ge.savedKey))]})]})}e[10]=T,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=m,e[23]=N,e[24]=d,e[25]=n,e[26]=P,e[27]=E,e[28]=R,e[29]=M,e[30]=I,e[31]=D,e[32]=$}else P=e[26],E=e[27],R=e[28],M=e[29],I=e[30],D=e[31],$=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let O;e[87]!==M||e[88]!==I?(O=o.jsx("div",{className:M,children:I}),e[87]=M,e[88]=I,e[89]=O):O=e[89];let B;e[90]!==P||e[91]!==O||e[92]!==D?(B=o.jsx(P,{className:D,children:O}),e[90]=P,e[91]=O,e[92]=D,e[93]=B):B=e[93];let F;return e[94]!==E||e[95]!==B||e[96]!==$?(F=o.jsxs("div",{className:$,children:[E,B]}),e[94]=E,e[95]=B,e[96]=$,e[97]=F):F=e[97],F}function Toe(t){const[e,s]=t;return{name:e,...s}}function Aoe(t,e){return t.title.localeCompare(e.title)}function Poe(t){const[,e]=t;return e}function Eoe(t,e){return t.title.localeCompare(e.title)}function Roe(t,e){return t.title.localeCompare(e.title)}function Doe(t){return{resolveType:t.resolveType,title:t.title,folderPath:Cw(t.resolveType)}}function Moe(t){return{resolveType:t.resolveType,title:t.title,folderPath:Cw(t.resolveType),savedKey:t.key}}function Ioe(){return new Set}function Ooe(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=Vw(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function $oe(t){const e=U.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=ce(),g=ro(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[y,_]=A.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[v,S]=A.useState(L),[w,k]=A.useState(0),[j,C]=A.useState(!1);let V;e[2]!==l||e[3]!==c?(V=zn(c,l),e[2]=l,e[3]=c,e[4]=V):V=e[4];const N=V,T=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,P=_s()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==P||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:P,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=P,e[10]=n,e[11]=R):R=e[11];const M=R;let I,D,$,O,B,F,z,W;if(e[12]!==a||e[13]!==v||e[14]!==y||e[15]!==f||e[16]!==p||e[17]!==d){const ie=[d,...v],ue=he=>{S(v.slice(0,he)),k(Boe)};let J;e[26]!==a||e[27]!==y||e[28]!==f?(J=async he=>{const ve=F3(he,a);if(ve){xe.error(ve);return}await f(he,y),C(!1)},e[26]=a,e[27]=y,e[28]=f,e[29]=J):J=e[29],I=J,O="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",D="shrink-0 border-b px-3 py-2.5",W="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(B=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=B):B=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",z=ie.map((he,ve)=>{const je=ve===ie.length-1,Ce=Nn(he);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ve>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ue(ve),title:Ce,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",je?"font-medium text-foreground":"text-muted-foreground"),children:Ce})]},`${Ce}-${ve}`)}),e[12]=a,e[13]=v,e[14]=y,e[15]=f,e[16]=p,e[17]=d,e[18]=I,e[19]=D,e[20]=$,e[21]=O,e[22]=B,e[23]=F,e[24]=z,e[25]=W}else I=e[18],D=e[19],$=e[20],O=e[21],B=e[22],F=e[23],z=e[24],W=e[25];let K;e[32]!==B||e[33]!==F||e[34]!==z?(K=o.jsx("nav",{"aria-label":B,className:F,children:z}),e[32]=B,e[33]=F,e[34]=z,e[35]=K):K=e[35];let H;e[36]===Symbol.for("react.memo_cache_sentinel")?(H=()=>C(!0),e[36]=H):H=e[36];let q;e[37]!==p?(q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=q):q=e[38];let G;e[39]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(R2,{size:14}),e[39]=G):G=e[39];let Q;e[40]!==h||e[41]!==q?(Q=o.jsx(He,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:H,"aria-label":q,children:G})}),e[40]=h,e[41]=q,e[42]=Q):Q=e[42];let se;e[43]!==p?(se=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=se):se=e[44];let Z;e[45]!==se?(Z=o.jsx(Ke,{side:"bottom",children:se}),e[45]=se,e[46]=Z):Z=e[46];let te;e[47]!==Q||e[48]!==Z?(te=o.jsxs(We,{children:[Q,Z]}),e[47]=Q,e[48]=Z,e[49]=te):te=e[49];let X;e[50]!==K||e[51]!==te||e[52]!==W?(X=o.jsxs("div",{className:W,children:[K,te]}),e[50]=K,e[51]=te,e[52]=W,e[53]=X):X=e[53];const Y="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",de=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:T});let re;e[54]!==de?(re=o.jsx("p",{className:Y,children:de}),e[54]=de,e[55]=re):re=e[55];let le;e[56]!==D||e[57]!==X||e[58]!==re?(le=o.jsxs("div",{className:D,children:[X,re]}),e[56]=D,e[57]=X,e[58]=re,e[59]=le):le=e[59];let ne;e[60]!==a||e[61]!==v||e[62]!==w||e[63]!==y||e[64]!==l||e[65]!==m||e[66]!==M||e[67]!==N||e[68]!==p?(ne=o.jsx(Ql,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:N?o.jsx(Oi,{schema:N,value:y,onChange:ie=>_(ie),basePath:"",breadcrumbPath:v,onBreadcrumbChange:S,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:M},w):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=v,e[62]=w,e[63]=y,e[64]=l,e[65]=m,e[66]=M,e[67]=N,e[68]=p,e[69]=ne):ne=e[69];let me;e[70]!==$||e[71]!==le||e[72]!==ne?(me=o.jsxs("div",{className:$,children:[le,ne]}),e[70]=$,e[71]=le,e[72]=ne,e[73]=me):me=e[73];let ee;e[74]!==u||e[75]!==I||e[76]!==h||e[77]!==j?(ee=o.jsx(U3,{open:j,onOpenChange:C,defaultBlockId:u,isPending:h,onSubmit:I}),e[74]=u,e[75]=I,e[76]=h,e[77]=j,e[78]=ee):ee=e[78];let oe;return e[79]!==O||e[80]!==me||e[81]!==ee?(oe=o.jsxs("div",{className:O,children:[me,ee]}),e[79]=O,e[80]=me,e[81]=ee,e[82]=oe):oe=e[82],oe}function Boe(t){return t+1}var zoe=Object.prototype.toString,pd=Array.isArray||function(e){return zoe.call(e)==="[object Array]"};function Q3(t){return typeof t=="function"}function Foe(t){return pd(t)?"array":typeof t}function F1(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Jb(t,e){return t!=null&&typeof t=="object"&&e in t}function Uoe(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Hoe=RegExp.prototype.test;function Koe(t,e){return Hoe.call(t,e)}var Woe=/\S/;function qoe(t){return!Koe(Woe,t)}var Goe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Yoe(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return Goe[s]})}var Joe=/\s*/,Xoe=/\s+/,Xb=/\s*=/,Qoe=/\s*\}/,Zoe=/#|\^|\/|>|\{|&|=|!/;function ele(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var h,f,m;function p(k){if(typeof k=="string"&&(k=k.split(Xoe,2)),!pd(k)||k.length!==2)throw new Error("Invalid tags: "+k);h=new RegExp(F1(k[0])+"\\s*"),f=new RegExp("\\s*"+F1(k[1])),m=new RegExp("\\s*"+F1("}"+k[1]))}p(e||Ri.tags);for(var g=new p0(t),x,b,y,_,L,v;!g.eos();){if(x=g.pos,y=g.scanUntil(h),y)for(var S=0,w=y.length;S<w;++S)_=y.charAt(S),qoe(_)?(r.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
|
|
621
621
|
`&&(u(),c="",d=0,s=!1);if(!g.scan(h))break;if(l=!0,b=g.scan(Zoe)||"name",g.scan(Joe),b==="="?(y=g.scanUntil(Xb),g.scan(Xb),g.scanUntil(f)):b==="{"?(y=g.scanUntil(m),g.scan(Qoe),g.scanUntil(f),b="&"):y=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?L=[b,y,x,g.pos,c,d,s]:L=[b,y,x,g.pos],d++,i.push(L),b==="#"||b==="^")n.push(L);else if(b==="/"){if(v=n.pop(),!v)throw new Error('Unopened section "'+y+'" at '+x);if(v[1]!==y)throw new Error('Unclosed section "'+v[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&p(y)}if(u(),v=n.pop(),v)throw new Error('Unclosed section "'+v[1]+'" at '+g.pos);return sle(tle(i))}function tle(t){for(var e=[],s,n,i=0,r=t.length;i<r;++i)s=t[i],s&&(s[0]==="text"&&n&&n[0]==="text"?(n[1]+=s[1],n[3]=s[3]):(e.push(s),n=s));return e}function sle(t){for(var e=[],s=e,n=[],i,r,l=0,a=t.length;l<a;++l)switch(i=t[l],i[0]){case"#":case"^":s.push(i),n.push(i),s=i[4]=[];break;case"/":r=n.pop(),r[5]=i[2],s=n.length>0?n[n.length-1][4]:e;break;default:s.push(i)}return e}function p0(t){this.string=t,this.tail=t,this.pos=0}p0.prototype.eos=function(){return this.tail===""};p0.prototype.scan=function(e){var s=this.tail.match(e);if(!s||s.index!==0)return"";var n=s[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};p0.prototype.scanUntil=function(e){var s=this.tail.search(e),n;switch(s){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,s),this.tail=this.tail.substring(s)}return this.pos+=n.length,n};function Wc(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Wc.prototype.push=function(e){return new Wc(e,this)};Wc.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var i=this,r,l,a,c=!1;i;){if(e.indexOf(".")>0)for(r=i.view,l=e.split("."),a=0;r!=null&&a<l.length;)a===l.length-1&&(c=Jb(r,l[a])||Uoe(r,l[a])),r=r[l[a++]];else r=i.view[e],c=Jb(i.view,e);if(c){n=r;break}i=i.parent}s[e]=n}return Q3(n)&&(n=n.call(this.view)),n};function Rn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Rn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Rn.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Ri.tags).join(":"),r=typeof n<"u",l=r?n.get(i):void 0;return l==null&&(l=ele(e,s),r&&n.set(i,l)),l};Rn.prototype.render=function(e,s,n,i){var r=this.getConfigTags(i),l=this.parse(e,r),a=s instanceof Wc?s:new Wc(s,void 0);return this.renderTokens(l,a,n,e,i)};Rn.prototype.renderTokens=function(e,s,n,i,r){for(var l="",a,c,d,u=0,h=e.length;u<h;++u)d=void 0,a=e[u],c=a[0],c==="#"?d=this.renderSection(a,s,n,i,r):c==="^"?d=this.renderInverted(a,s,n,i,r):c===">"?d=this.renderPartial(a,s,n,r):c==="&"?d=this.unescapedValue(a,s):c==="name"?d=this.escapedValue(a,s,r):c==="text"&&(d=this.rawValue(a)),d!==void 0&&(l+=d);return l};Rn.prototype.renderSection=function(e,s,n,i,r){var l=this,a="",c=s.lookup(e[1]);function d(f){return l.render(f,s,n,r)}if(c){if(pd(c))for(var u=0,h=c.length;u<h;++u)a+=this.renderTokens(e[4],s.push(c[u]),n,i,r);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],s.push(c),n,i,r);else if(Q3(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(s.view,i.slice(e[3],e[5]),d),c!=null&&(a+=c)}else a+=this.renderTokens(e[4],s,n,i,r);return a}};Rn.prototype.renderInverted=function(e,s,n,i,r){var l=s.lookup(e[1]);if(!l||pd(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,r)};Rn.prototype.indentPartial=function(e,s,n){for(var i=s.replace(/[^ \t]/g,""),r=e.split(`
|
|
622
622
|
`),l=0;l<r.length;l++)r[l].length&&(l>0||!n)&&(r[l]=i+r[l]);return r.join(`
|
|
623
|
-
`)};Rn.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Q3(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,r);return this.renderTokens(h,s,n,u,i)}}};Rn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Rn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ri.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Ri.escape?String(r):i(r)};Rn.prototype.rawValue=function(e){return e[1]};Rn.prototype.getConfigTags=function(e){return pd(e)?e:e&&typeof e=="object"?e.tags:void 0};Rn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!pd(e))return e.escape};var Ri={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Du.templateCache=t},get templateCache(){return Du.templateCache}},Du=new Rn;Ri.clearCache=function(){return Du.clearCache()};Ri.parse=function(e,s){return Du.parse(e,s)};Ri.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Foe(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Du.render(e,s,n,i)};Ri.escape=Yoe;Ri.Scanner=p0;Ri.Context=Wc;Ri.Writer=Rn;function nle(t,e){const s={__resolveType:t},n=ow([s],e)[0];return n?tse(s,n,e):null}function ile({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=ce(),d=ro(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=A.useState(()=>nle(l,r)),[f,m]=A.useState(h?.data??{}),[p,g]=A.useState([]),[x,b]=A.useState(0),[y,_]=A.useState(!1),[L,v]=A.useState(null),S=L!==null,{save:w,flush:k}=E3({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?zn(h.resolveType,i):null,C=r[l],V=C?Il(l,C):l,N=_s()?.taskId??null,T={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:u},P=D=>{m(D),w(l,D)},E=()=>{S?(v(null),_(!1),b(D=>D+1)):v(JSON.stringify(f,null,2))},R=D=>{const $=D??"";try{const O=JSON.parse($);if(O&&typeof O=="object"&&!Array.isArray(O)){_(!1),P(O);return}_(!0)}catch{_(!0)}},M=[V,...p],I=D=>{g(p.slice(0,D)),b($=>$+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:b3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:M.map((D,$)=>{const O=$===M.length-1,B=Nn(D);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>I($),title:B,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",O?"font-medium text-foreground":"text-muted-foreground"),children:B})]},`${B}-${$}`)})}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:S?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":S,children:S?o.jsx(Ws,{size:14}):o.jsx(Qc,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(Ql,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Oi,{schema:j,value:f,onChange:D=>P(D),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:T},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),L!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[y&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ld,{language:"json",height:"100%",code:L,onChange:R,onSave:D=>{R(D),k()}})})]})]})]})})}function rle(t){const e=U.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=ce();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Ro,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let y;e[7]!==s.title?(y=tk(s.title),e[7]=s.title,e[8]=y):y=e[8];let _;e[9]!==u||e[10]!==s.resolveType?(_=(v,S)=>u(s.resolveType,v,S),e[9]=u,e[10]=s.resolveType,e[11]=_):_=e[11];let L;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==y||e[23]!==_||e[24]!==i?(L=o.jsx($oe,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:y,isCreating:d,onCreate:_,onSaveReferencedBlock:h},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=y,e[23]=_,e[24]=i,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=o.jsx(ile,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=r,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Qb="__all__",Zb={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},ole={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},_h={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},ev="status:";function tv(t){if(!t.startsWith(ev))return null;const e=t.slice(ev.length);return e in _h?e:null}const sv=A.forwardRef(function(e,s){const n=U.c(20);let i,r,l,a,c;n[0]!==e?({icon:i,active:r,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=l,n[4]=a,n[5]=c):(i=n[1],r=n[2],l=n[3],a=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=ae("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ls,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=o.jsxs(fe,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function Z3(t){const e=U.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function lle(t){const e=U.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=ce();let p;if(e[0]!==s||e[1]!==r){let ne;e[3]!==r?(ne=me=>me.slug===r,e[3]=r,e[4]=ne):ne=e[4],p=s.find(ne),e[0]=s,e[1]=r,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let ne;e[8]!==l?(ne=me=>me.email===l,e[8]=l,e[9]=ne):ne=e[9],x=n.find(ne),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,y=!!(r||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(_=g?.name??b?.name??m(a?_h[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=_):_=e[14];const L=_,v=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Qb;let S;e[15]!==u||e[16]!==d||e[17]!==h?(S=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=S):S=e[18];const w=S;let k;e[19]!==w||e[20]!==u||e[21]!==d||e[22]!==h?(k=ne=>{ne.startsWith("cat:")?(u(null),h(null),d(ne.slice(4))):ne.startsWith("author:")?(d(null),h(null),u(ne.slice(7))):tv(ne)?(d(null),u(null),h(tv(ne))):w()},e[19]=w,e[20]=u,e[21]=d,e[22]=h,e[23]=k):k=e[23];const j=k;let C;e[24]!==L||e[25]!==y?(C=o.jsx(Kt,{asChild:!0,children:o.jsx(sv,{icon:$T,active:y,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=y,e[26]=C):C=e[26];let V;e[27]!==m?(V=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=V):V=e[28];let N;e[29]!==V?(N=o.jsx(yd,{children:V}),e[29]=V,e[30]=N):N=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let P;e[33]!==T?(P=o.jsx(Io,{value:Qb,children:T}),e[33]=T,e[34]=P):P=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(yd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let M;e[39]===Symbol.for("react.memo_cache_sentinel")?(M=Object.keys(_h),e[39]=M):M=e[39];let I;e[40]!==i||e[41]!==m?(I=M.map(ne=>o.jsxs(Io,{value:`status:${ne}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(_h[ne])}),o.jsx(Z3,{count:i[ne]})]},`status:${ne}`)),e[40]=i,e[41]=m,e[42]=I):I=e[42];let D;e[43]!==s.length||e[44]!==m?(D=s.length>0&&o.jsx(yd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=D):D=e[45];let $;e[46]!==s?($=s.map(cle),e[46]=s,e[47]=$):$=e[47];let O;e[48]!==n.length||e[49]!==m?(O=n.length>0&&o.jsx(yd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=O):O=e[50];let B;e[51]!==n?(B=n.map(ale),e[51]=n,e[52]=B):B=e[52];let F;e[53]!==v||e[54]!==j||e[55]!==P||e[56]!==R||e[57]!==I||e[58]!==D||e[59]!==$||e[60]!==O||e[61]!==B?(F=o.jsxs(Ih,{value:v,onValueChange:j,children:[P,R,I,D,$,O,B]}),e[53]=v,e[54]=j,e[55]=P,e[56]=R,e[57]=I,e[58]=D,e[59]=$,e[60]=O,e[61]=B,e[62]=F):F=e[62];let z;e[63]!==F||e[64]!==N?(z=o.jsxs(Wt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,F]}),e[63]=F,e[64]=N,e[65]=z):z=e[65];let W;e[66]!==z||e[67]!==C?(W=o.jsxs(Ht,{children:[C,z]}),e[66]=z,e[67]=C,e[68]=W):W=e[68];let K;e[69]!==w||e[70]!==y||e[71]!==m?(K=y&&o.jsx(dle,{label:m("sandbox.postToolbar.clearFilter"),onClick:w}),e[69]=w,e[70]=y,e[71]=m,e[72]=K):K=e[72];const H=ole[c];let q;e[73]!==m||e[74]!==H?(q=m(H),e[73]=m,e[74]=H,e[75]=q):q=e[75];let G;e[76]!==q?(G=o.jsx(Kt,{asChild:!0,children:o.jsx(sv,{icon:BT,active:!0,value:q})}),e[76]=q,e[77]=G):G=e[77];let Q;e[78]!==m?(Q=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=Q):Q=e[79];let se;e[80]!==Q?(se=o.jsx(yd,{children:Q}),e[80]=Q,e[81]=se):se=e[81];let Z;e[82]!==f?(Z=ne=>f(ne),e[82]=f,e[83]=Z):Z=e[83];let te;e[84]===Symbol.for("react.memo_cache_sentinel")?(te=Object.keys(Zb),e[84]=te):te=e[84];let X;e[85]!==m?(X=te.map(ne=>o.jsx(Io,{value:ne,children:m(Zb[ne])},ne)),e[85]=m,e[86]=X):X=e[86];let Y;e[87]!==c||e[88]!==Z||e[89]!==X?(Y=o.jsx(Ih,{value:c,onValueChange:Z,children:X}),e[87]=c,e[88]=Z,e[89]=X,e[90]=Y):Y=e[90];let de;e[91]!==se||e[92]!==Y?(de=o.jsxs(Wt,{align:"end",className:"w-44",children:[se,Y]}),e[91]=se,e[92]=Y,e[93]=de):de=e[93];let re;e[94]!==G||e[95]!==de?(re=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ht,{children:[G,de]})}),e[94]=G,e[95]=de,e[96]=re):re=e[96];let le;return e[97]!==W||e[98]!==K||e[99]!==re?(le=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[W,K,re]}),e[97]=W,e[98]=K,e[99]=re,e[100]=le):le=e[100],le}function ale(t){return o.jsxs(Io,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Z3,{count:t.count})]},`author:${t.email}`)}function cle(t){return o.jsxs(Io,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Z3,{count:t.count})]},`cat:${t.slug}`)}function dle(t){const e=U.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ws,{size:12}),e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function ule(t){const e=U.c(18),{checked:s,disabled:n,onToggle:i}=t,r=ce();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r?(a=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:hle,children:o.jsx(id,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==r?(d=r(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=r,e[12]=d):d=e[12];let u;e[13]!==d?(u=o.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=o.jsxs(We,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function hle(t){return t.stopPropagation()}function fle(t){const e=U.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=ce();let c;e[0]!==n||e[1]!==i?(c=o.jsx(ule,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(on,{size:14}),e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==h||e[13]!==f?(p=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:r,"aria-label":f,children:m})}),e[11]=r,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(We,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=y):y=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ws,{size:14}),e[24]=_):_=e[24];let L;e[25]!==l||e[26]!==y?(L=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":y,children:_})}),e[25]=l,e[26]=y,e[27]=L):L=e[27];let v;e[28]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=v):v=e[29];let S;e[30]!==v?(S=o.jsx(Ke,{side:"bottom",children:v}),e[30]=v,e[31]=S):S=e[31];let w;e[32]!==L||e[33]!==S?(w=o.jsxs(We,{children:[L,S]}),e[32]=L,e[33]=S,e[34]=w):w=e[34];let k;e[35]!==b||e[36]!==w?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,w]}),e[35]=b,e[36]=w,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==u?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,k]}),e[38]=c,e[39]=k,e[40]=u,e[41]=j):j=e[41],j}function Td(t){const e=U.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=ce();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ci,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=o.jsx(Kt,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:mle,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Ze,{onClick:n,children:[o.jsx(n9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(Ze,{onClick:s,children:[o.jsx(vn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&o.jsxs(o.Fragment,{children:[o.jsx(jc,{}),o.jsxs(Ze,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(ng,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(jc,{}),r&&o.jsxs(Ze,{onClick:r,children:[o.jsx(U6,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Ze,{onClick:l,children:[o.jsx(Qc,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(jc,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(on,{size:14}),e[19]=b):b=e[19];let y;e[20]!==c?(y=c("sandbox.itemActions.delete"),e[20]=c,e[21]=y):y=e[21];let _;e[22]!==a||e[23]!==y?(_=o.jsxs(Ze,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,y]}),e[22]=a,e[23]=y,e[24]=_):_=e[24];let L;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=o.jsxs(Wt,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let v;return e[31]!==L||e[32]!==h?(v=o.jsxs(Ht,{children:[h,L]}),e[31]=L,e[32]=h,e[33]=v):v=e[33],v}function mle(t){return t.stopPropagation()}function ple(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function gle(t){const e=new Map;for(const s of t){const n=ple(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function nv(t){const e=U.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=ae("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s?(l=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:r,children:[l,n]}),e[4]=n,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}const iv=A.lazy(()=>Ys(()=>import("./app-editor-DNnqs-BT.js"),__vite__mapDeps([159,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,35,67,68,34,22,77,23,24,25,26,27,28,29,30,31,32,33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,69,70,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.AppEditor}))),xle=A.lazy(()=>Ys(()=>import("./post-editor-DH3cc2rR.js"),__vite__mapDeps([160,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,24,52,23,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,70,75,161,131,136,100,101,69,71,112,76,128,162,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,163,164,110,111,68,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,129,130,132,133,72,134,135,137,138,139,140,141,142,143,144,145,67,146,147,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.PostEditor}))),ble=A.lazy(()=>Ys(()=>import("./record-editor-DNyePUjb.js"),__vite__mapDeps([165,1,2,70,75,68,34,22,128,163,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,164,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.RecordEditor}))),vle=A.lazy(()=>Ys(()=>import("./category-editor-vpz2dWAT.js"),__vite__mapDeps([166,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,29,31,52,23,24,25,26,27,28,30,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,144,70,75,162,100,101,69,71,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,163,164,110,111,68,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,145,67,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.CategoryEditor}))),yle=A.lazy(()=>Ys(()=>import("./bulk-category-panel-DN63hkby.js"),__vite__mapDeps([167,1,2,31,75,168,37,68,34,22])).then(t=>({default:t.BulkCategoryPanel}))),_le=A.lazy(()=>Ys(()=>import("./sections-editor-CWq03Vnp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157])).then(t=>({default:t.SectionsEditor}))),Lle=A.lazy(()=>Ys(()=>import("./seo-editor-O_gPOD8y.js"),__vite__mapDeps([169,1,2,35,23,24,25,26,27,28,29,30,31,32,33,34,22,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,74,75,76,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,70,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157])).then(t=>({default:t.SeoEditor}))),Sle=A.lazy(()=>Ys(()=>import("./variant-calendar-BGv44m4Q.js"),__vite__mapDeps([170,1,2,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,75,67,68,76,171,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,70,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.VariantCalendar}))),wle=A.lazy(()=>Ys(()=>import("./post-calendar-B09pnMW9.js"),__vite__mapDeps([172,1,2,24,23,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,173,67,68,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,70,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.PostCalendar}))),kle=A.lazy(()=>Ys(()=>import("./redirect-editor-BI-Kllix.js"),__vite__mapDeps([174,1,2,136,34,70,75,68,22,164,26,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.RedirectEditor})));function jle(t){const e=U.c(20),{deepLinkPage:s}=t,n=ro(),{currentBranch:i}=an(),{org:r}=Fe(),l=n?.entity?.id??null,a=fi(),c=nl(),{runtime:d,previewServerUrl:u}=Sn(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=Ore({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(Mre,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ro,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==p||e[18]!==l?(g=o.jsx(Nle,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const rv=2e3,Cle=15;function ov(t,e,s,n){return typeof e!="string"||s&&(Tk(e,s,n)||t.state.dataUpdateCount>=Cle)?!1:rv}function Nle({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=ce(),d=_s()?.taskId??null,u=Vs(e),h=j2(u,s),f=Yl(u)&&h,m={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:p,isLoading:g}=L9(m,{fetchEnabled:l}),[x,b]=A.useState("pages"),[y,_]=A.useState(null),[L,v]=A.useState(null),S=!!(r?.pageId||r?.path||r?.pathTemplate),[w,k]=A.useState(!1);if(S&&!w&&y===null&&p){k(!0);const pe=$Q(of(p),r??{});pe&&(b("pages"),_({collection:"pages",key:pe.key,path:pe.path}))}const[j,C]=A.useState(""),[V,N]=A.useState(null),[T,P]=A.useState(null),[E,R]=A.useState(null),[M,I]=A.useState("date-desc"),[D,$]=A.useState(()=>new Set),[O,B]=A.useState(null),F=()=>{$(new Set),B(null)},z=pe=>{_(pe),v(null)},[W,K]=A.useState(x);W!==x&&(K(x),C(""),N(null),P(null),R(null),I("date-desc"),$(new Set),B(null));const{data:H,isLoading:q,isFetching:G}=j3(m,{fetchEnabled:l,refetchInterval:pe=>{const Pe=pe.state.data;if(x==="apps"&&y&&y.collection==="apps"){const Ue=p?.[y.key];return ov(pe,typeof Ue?.__resolveType=="string"?Ue.__resolveType:void 0,Pe)}if(x==="site"&&p){const Ue=Pe?lp(p,Pe):null,Ae=p.site,Je=Ue?.resolveType??(typeof Ae?.__resolveType=="string"?Ae.__resolveType:void 0);return ov(pe,Je,Pe,["seo"])}return!1}}),Q=(pe,Pe)=>!Tk(pe,H,Pe)&&(q||G),{catalog:se,isLoading:Z}=Rre(H??void 0,p??void 0,{enabled:x==="apps"}),te=Loe({orgSlug:t,virtualMcpId:e,branch:s,meta:H}),X=m0(m),Y=kre(m),[de,re]=A.useState(null),[le,ne]=A.useState(),[me,ee]=A.useState(null),[oe,ie]=A.useState(null),[ue,J]=A.useState(null),he=!p||!H;if(g||q||he&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})});if(he)return o.jsx(Ro,{title:"Could not load site data."});const ve=of(p).sort((pe,Pe)=>pe.name.localeCompare(Pe.name)),je=YS(p).sort((pe,Pe)=>pe.from.localeCompare(Pe.from)),Ce=k3(p,H),Le=x==="sections"?TQ(H):[],_e=lp(p,H),Ne=Dk(p),ge=J3.some(pe=>Ne[pe].length>0),Te=uu(x)?Ne[x]:[],Se=(ge?Ru(p,"categories"):[]).map(({key:pe,payload:Pe})=>{const Ue=typeof Pe.slug=="string"?Pe.slug:"",Ae=typeof Pe.name=="string"?Pe.name:"";return{slug:Ue||pe,name:Ae||Ue||pe}}).filter(pe=>pe.slug).sort((pe,Pe)=>pe.name.localeCompare(Pe.name)),we=x==="posts"&&(D.size>0||O!==null),Ye=we?$k(p).filter(pe=>D.has(pe.key)):[],Ge=ub(H,"loaders"),Ie=ub(H,"actions");if(!QS(p,H)&&!ge&&Ge===0&&Ie===0)return o.jsx(Ro,{icon:yn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Oe={pages:ve.length,sections:Ce.length,apps:se.length,loaders:Ge,actions:Ie,redirects:je.length,posts:Ne.posts.length,authors:Ne.authors.length,categories:Ne.categories.length},pt=new Set(ve.map(pe=>$o(pe.path))),nt=new Set(ve.map(pe=>pe.name)),lt=new Set(Ce.map(pe=>pe.name)),gt=async pe=>{const Pe=p[pe.key];if(!Pe)return;const Ue=dw(p,pe.key),Ae=uw(p,pe.key,Math.max(0,Ue-1)),Je=wZ(Pe.sections,Ae);if(Je)try{await X.mutateAsync({blockKey:pe.key,data:{...Pe,sections:Je}}),xe.success(`Variant added to "${pe.name}"`),_({collection:"pages",key:pe.key,path:pe.path})}catch(_t){xe.error(_t instanceof Error?_t.message:"Could not add variant")}},bt=()=>{ne(void 0),re({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},rt=pe=>{ne(void 0),re({mode:"duplicate",sourceKey:pe.key,initialName:Ub(nt,pe.name),initialPath:$re(pt,pe.path)})},ct=pe=>{ne(void 0),re({mode:"rename",sourceKey:pe.key,initialName:pe.name,initialPath:pe.path})},Qe=async pe=>{if(!de)return;const{mode:Pe,sourceKey:Ue}=de;try{if(Pe==="create"){let Ae;if(pe.templateKey){const _t=p[pe.templateKey];if(!_t)throw new Error("Selected template no longer exists.");Ae={..._t,name:pe.name,path:pe.path}}else Ae=Fre(pe.name,pe.path);const Je=Hre(p,pe.name);await X.mutateAsync({blockKey:Je,data:Ae}),xe.success(`Created "${pe.name}"`),_({collection:"pages",key:Je,path:pe.path})}else if(Pe==="duplicate"&&Ue){const Ae=p[Ue];if(!Ae)throw new Error("Source page not found");const{key:Je,data:_t}=zre({source:Ae,pages:ve,newName:pe.name,newPath:pe.path});await X.mutateAsync({blockKey:Je,data:_t}),xe.success(`Duplicated as "${pe.name}"`),_({collection:"pages",key:Je,path:pe.path})}else if(Pe==="rename"&&Ue){const Ae=p[Ue];if(!Ae)throw new Error("Page not found");const Je={...Ae,name:pe.name,path:pe.path};await X.mutateAsync({blockKey:Ue,data:Je}),xe.success("Page updated"),y?.collection==="pages"&&y.key===Ue&&_({collection:"pages",key:Ue,path:pe.path})}re(null)}catch(Ae){ne(Ae instanceof Error?Ae.message:"Save failed")}},dt=({path:pe})=>{if(!de)return null;const Pe=$o(pe);return(de.mode==="rename"?$o(de.initialPath):null)!==Pe&&pt.has(Pe)?`A page with path "${pe}" already exists.`:null},ye=async(pe,Pe,Ue)=>{await X.mutateAsync({blockKey:Pe,data:{...Ue,name:Pe,__resolveType:pe}}),xe.success(c("sandbox.contentBrowser.createdSection",{name:Pe})),_({collection:"sections",key:Pe})},ke=D3((pe,Pe)=>X.mutate({blockKey:pe,data:Pe})),et=async pe=>{const Pe=p[pe.key];if(!Pe){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Ue=Bre(p,pe.key),Ae=Ub(lt,pe.name),Je={...Pe,name:Ae};try{await X.mutateAsync({blockKey:Ue,data:Je}),xe.success(c("sandbox.contentBrowser.duplicatedSection",{name:pe.name})),_({collection:"sections",key:Ue})}catch(_t){xe.error(_t instanceof Error?_t.message:c("sandbox.contentBrowser.duplicateFailed"))}},tt=async pe=>{if(!me)return;const Pe=p[me];if(!Pe){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await X.mutateAsync({blockKey:me,data:{...Pe,name:pe}}),xe.success(c("sandbox.contentBrowser.sectionRenamed")),ee(null)}catch(Ue){xe.error(Ue instanceof Error?Ue.message:c("sandbox.contentBrowser.renameFailed"))}},ut=async()=>{const pe="/redirect-from",Pe=OQ(p,pe),Ue=DQ({from:pe,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await X.mutateAsync({blockKey:Pe,data:Ue}),xe.success("Created redirect"),_({collection:"redirects",key:Pe})}catch(Ae){xe.error(Ae instanceof Error?Ae.message:"Could not create redirect")}},jt=async pe=>{const Pe=z1(p,pe),Ue=pc(Pe,pe,Bk(pe));try{await X.mutateAsync({blockKey:Pe,data:Ue}),xe.success(`Created ${du[pe]}`),_({collection:pe,key:Pe})}catch(Ae){xe.error(Ae instanceof Error?Ae.message:"Could not create")}},mt=async pe=>{const Pe=z1(p,"posts"),Ue=pc(Pe,"posts",foe(pe));try{await X.mutateAsync({blockKey:Pe,data:Ue}),xe.success(c("sandbox.postCalendar.createdScheduledPost")),b("posts"),K("posts"),_({collection:"posts",key:Pe}),v(null)}catch(Ae){xe.error(Ae instanceof Error?Ae.message:c("sandbox.postCalendar.couldNotCreate"))}},ft=async(pe,Pe)=>{const Ue=p[pe],Ae=Ue?poe(Kd(Ue,"posts"),Pe):null;if(!Ae){xe.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await X.mutateAsync({blockKey:pe,data:pc(pe,"posts",Ae)})}catch(Je){xe.error(Je instanceof Error?Je.message:c("sandbox.postCalendar.couldNotReschedule"))}},at=async pe=>{const Pe=p[pe.key];if(!Pe){xe.error("Record not found.");return}const Ue=z1(p,pe.kind),Ae=pe.kind==="posts"?"title":"name",Je={...structuredClone(Kd(Pe,pe.kind)),[Ae]:`${pe.label} (copy)`};try{await X.mutateAsync({blockKey:Ue,data:pc(Ue,pe.kind,Je)}),xe.success(`Duplicated "${pe.label}"`),_({collection:pe.kind,key:Ue})}catch(_t){xe.error(_t instanceof Error?_t.message:"Duplicate failed")}},vt=pe=>{$(Pe=>{const Ue=new Set(Pe);return Ue.has(pe)?Ue.delete(pe):Ue.add(pe),Ue})},wt=pe=>{b("posts"),K("posts"),_(null),v(null),C(""),N(null),P(null),R(null),I("date-desc"),$(new Set),B(pe||null)},Me=async(pe,Pe)=>{const Ue=[...D];let Ae=0;for(const Je of Ue){const _t=p[Je],ot=Kd(_t,"posts"),ts=pe==="add"?noe(ot,Pe):ioe(ot,Pe);ts!==ot&&(await X.mutateAsync({blockKey:Je,data:pc(Je,"posts",Kb(ts))}),Ae+=1)}return Ae},ht=async(pe,Pe)=>{const Ue=D.size;try{const Ae=await Me(pe,Pe),Je=pe==="add"?"Added to":"Moved",_t=Ue-Ae;xe.success(`${Je} ${Ae} ${Ae===1?"post":"posts"}`+(_t>0?` (${_t} already set)`:"")),F()}catch(Ae){xe.error(Ae instanceof Error?Ae.message:"Bulk update failed")}},St=async()=>{if(oe)try{if(oe.kind==="blog-bulk"){for(const Ae of oe.keys)await Y.mutateAsync({blockKey:Ae});xe.success(`Deleted ${oe.count} ${oe.count===1?"post":"posts"}`),y&&y.collection!=="available-section"&&oe.keys.includes(y.key)&&_(null),F(),ie(null);return}const{kind:pe,key:Pe,label:Ue}=oe;if(pe==="blog"){if(oe.blogKind==="categories"){const Ae=Kd(p[Pe],"categories").slug,Je=typeof Ae=="string"?Ae:"";if(Je)for(const{key:_t,payload:ot}of Ru(p,"posts")){const ts=roe(ot,Je);ts!==ot&&await X.mutateAsync({blockKey:_t,data:pc(_t,"posts",Kb(ts))})}}await Y.mutateAsync({blockKey:Pe})}else await Y.mutateAsync({blockKey:Pe});xe.success(`Deleted "${Ue}"`),y&&y.collection!=="available-section"&&y.key===Pe&&_(null),ie(null)}catch(pe){xe.error(pe instanceof Error?pe.message:"Delete failed")}},xt=Y.isPending||X.isPending,$t=oe?.kind==="blog"?du[oe.blogKind]:oe?.kind==="blog-bulk"?`${oe.count} ${oe.count===1?"post":"posts"}`:oe?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(Dre,{active:x,counts:Oe,showBlog:ge,onSelect:pe=>{b(pe),_(null),v(null)}}),x!=="seo"&&x!=="site"&&x!=="calendar"&&x!=="post-schedule"&&x!=="loaders"&&x!=="actions"&&o.jsx(Vle,{activeCollection:x,pages:ve,redirects:je,sections:Ce,availableSections:Le,appCatalog:se,appCatalogLoading:Z,blogEntries:Te,decofile:p,searchQuery:j,onSearchChange:C,postCategoryFilter:V,postAuthorFilter:T,postStatusFilter:E,postSort:M,onPostCategoryFilterChange:pe=>{N(pe),$(new Set)},onPostAuthorFilterChange:pe=>{P(pe),$(new Set)},onPostStatusFilterChange:pe=>{R(pe),$(new Set)},onPostSortChange:I,selectedPostKeys:D,postBulkPanelOpen:we,onTogglePostSelect:vt,onSelectAllPosts:pe=>$(new Set(pe)),onClearPostSelection:()=>$(new Set),onExitPostSelection:F,onBulkDeletePosts:()=>ie({kind:"blog-bulk",keys:[...D],count:D.size}),selection:y,onSelect:z,onCreate:()=>{x==="pages"?bt():x==="redirects"?ut():uu(x)&&jt(x)},onDuplicatePage:rt,onRenamePage:ct,onAddPageVariant:gt,onDeletePage:pe=>ie({kind:"page",key:pe.key,label:pe.name}),onEditPageSeo:pe=>{const Pe={collection:"pages",key:pe.key,path:pe.path};_(Pe),v(pe.key)},onViewPageJson:pe=>J(pe.key),onDuplicateSection:et,onRenameSection:pe=>ee(pe.key),onDeleteSection:pe=>ie({kind:"section",key:pe.key,label:pe.name}),onDeleteRedirect:pe=>ie({kind:"redirect",key:pe.key,label:pe.from||pe.key}),onDuplicateBlog:at,onDeleteBlog:pe=>ie({kind:"blog",blogKind:pe.kind,key:pe.key,label:pe.label})}),o.jsx(Rw,{readOnly:f,virtualMcpId:e,className:"flex-1 min-w-0",children:x==="loaders"||x==="actions"?o.jsx(Voe,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:p,kind:x}):o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}),children:x==="calendar"?o.jsx(Sle,{decofile:p}):x==="post-schedule"?o.jsx(wle,{decofile:p,support:te,isCreating:X.isPending,onCreate:pe=>{mt(pe)},onReschedule:(pe,Pe)=>{ft(pe,Pe)},onSelect:pe=>{b("posts"),K("posts"),_({collection:"posts",key:pe}),v(null)}}):x==="site"?_e?o.jsx(iv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:_e.key,block:p[_e.key],decofile:p,meta:H,title:"Site",excludeFields:["seo"],schemaPending:Q(_e.resolveType,["seo"]),previewBaseUrl:n},`site:${_e.key}`):o.jsx(Ro,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):x==="seo"?o.jsx(Lle,{orgSlug:t,virtualMcpId:e,branch:s,decofile:p,meta:H,target:{kind:"site"},previewBaseUrl:i}):x==="sections"?o.jsx(rle,{selection:y?.collection==="sections"||y?.collection==="available-section"?y:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:p,isCreating:X.isPending,onCreateAvailable:ye,onSaveReferencedBlock:ke}):we?o.jsx(yle,{posts:Ye,categories:Se,initialSlug:O,isPending:X.isPending,onApply:(pe,Pe)=>{ht(pe,Pe)},onClose:F},O??"selection"):y&&y.collection!=="available-section"?y.collection==="apps"?o.jsx(iv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key],decofile:p,meta:H,previewBaseUrl:n,schemaPending:Q(typeof p[y.key]?.__resolveType=="string"?String(p[y.key].__resolveType):void 0)},`app:${y.key}`):y.collection==="posts"?o.jsx(xle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key],decofile:p,meta:H,previewBaseUrl:i},`post:${y.key}`):y.collection==="categories"?o.jsx(vle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key],decofile:p,meta:H,onManagePosts:wt,onOpenPost:pe=>{b("posts"),K("posts"),_({collection:"posts",key:pe}),v(null)},previewBaseUrl:i},`category:${y.key}`):y.collection==="authors"?o.jsx(ble,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:y.key,block:p[y.key]},`authors:${y.key}`):y.collection==="redirects"?o.jsx(kle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key]},`redirect:${y.key}`):o.jsx(_le,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:y.collection==="pages"?y.path:"/",activePageBlockKey:y.collection==="pages"?y.key:null,activeGlobalBlockKey:y.collection==="sections"?y.key:null,initialEditSeo:y.collection==="pages"&&L===y.key,onExitSeo:()=>v(null)},y.collection==="pages"?`page:${y.key}`:`section:${y.key}`):o.jsx(Ro,{title:`Select ${uu(x)?`a ${du[x]}`:x==="pages"?"a page":x==="apps"?"an app":x==="redirects"?"a redirect":"a section"} to edit`,description:x==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),de&&o.jsx(Gre,{open:!!de,mode:de.mode,initialName:de.initialName,initialPath:de.initialPath,isPending:X.isPending,error:le,templates:ve,validate:dt,onSubmit:Qe,onOpenChange:pe=>{pe||(re(null),ne(void 0))}}),me&&o.jsx(Yre,{open:!!me,blockKey:me,initialName:Ce.find(pe=>pe.key===me)?.name??me,isPending:X.isPending,onSubmit:tt,onOpenChange:pe=>{pe||ee(null)}}),ue&&o.jsx(Soe,{open:!!ue,onOpenChange:pe=>{pe||J(null)},pageKey:ue,decofile:p,onSave:pe=>X.mutateAsync({blockKey:ue,data:pe})}),o.jsx(Kr,{open:!!oe,onOpenChange:pe=>{!pe&&!xt&&ie(null)},children:o.jsxs(Wr,{children:[o.jsxs(qr,{children:[o.jsx(Gr,{children:`Delete ${$t}?`}),o.jsx(Yr,{children:oe?.kind==="section"?`"${oe.label}" will be removed. Pages that still reference it will lose this section.`:oe?.kind==="blog-bulk"?`${oe.count} ${oe.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:oe?`"${oe.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Jr,{children:[o.jsx(Xr,{disabled:xt,children:"Cancel"}),o.jsx(Qr,{onClick:pe=>{pe.preventDefault(),St()},disabled:xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:xt?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function Vle(t){const e=U.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:y,onPostStatusFilterChange:_,onPostSortChange:L,selectedPostKeys:v,postBulkPanelOpen:S,onTogglePostSelect:w,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:V,selection:N,onSelect:T,onCreate:P,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:M,onDeletePage:I,onEditPageSeo:D,onViewPageJson:$,onDuplicateSection:O,onRenameSection:B,onDeleteSection:F,onDeleteRedirect:z,onDuplicateBlog:W,onDeleteBlog:K}=t;let H,q,G,Q,se,Z,te;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==M||e[7]!==V||e[8]!==j||e[9]!==P||e[10]!==K||e[11]!==I||e[12]!==z||e[13]!==F||e[14]!==W||e[15]!==E||e[16]!==O||e[17]!==D||e[18]!==C||e[19]!==y||e[20]!==b||e[21]!==L||e[22]!==_||e[23]!==R||e[24]!==B||e[25]!==f||e[26]!==T||e[27]!==k||e[28]!==w||e[29]!==$||e[30]!==n||e[31]!==p||e[32]!==S||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==r||e[39]!==v||e[40]!==N){const re=h.toLowerCase(),le=n.filter(ye=>!re||ye.name.toLowerCase().includes(re)||ye.path.toLowerCase().includes(re)),ne=i.filter(ye=>!re||ye.from.toLowerCase().includes(re)||ye.to.toLowerCase().includes(re)),me=r.filter(ye=>!re||ye.name.toLowerCase().includes(re)||ye.key.toLowerCase().includes(re)||ye.resolveType.toLowerCase().includes(re)),ee=l.filter(ye=>!re||ye.title.toLowerCase().includes(re)||ye.resolveType.toLowerCase().includes(re)||(ye.description?.toLowerCase().includes(re)??!1)),oe=gle(me),ie=a.filter(ye=>!re||ye.title.toLowerCase().includes(re)||ye.app.toLowerCase().includes(re)||ye.vendor.toLowerCase().includes(re)||ye.category.toLowerCase().includes(re)),ue=d.filter(ye=>!re||ye.label.toLowerCase().includes(re)||ye.subtitle.toLowerCase().includes(re)),J=s==="posts",he=Ele,ve=J?$k(u):[],je=new Map,Ce=new Map,Le={published:0,scheduled:0,draft:0};for(const ye of ve)Le[ye.status]=Le[ye.status]+1;for(const ye of ve){for(const ke of ye.categorySlugs)je.set(ke,(je.get(ke)??0)+1);for(const ke of ye.authorEmails)Ce.set(ke,(Ce.get(ke)??0)+1)}const _e=(J?Ru(u,"categories"):[]).map(ye=>{const{key:ke,payload:et}=ye,tt=he(et.slug)||ke;return{slug:tt,name:he(et.name)||he(et.slug)||ke,count:je.get(tt)??0}}).filter(Ple),Ne=(J?Ru(u,"authors"):[]).map(ye=>{const{key:ke,payload:et}=ye,tt=he(et.email);return{email:tt,name:he(et.name)||he(et.email)||ke,count:Ce.get(tt)??0}}).filter(Ale);let ge;e[48]!==m?(ge=ye=>!m||ye.categorySlugs.includes(m),e[48]=m,e[49]=ge):ge=e[49];let Te;e[50]!==p?(Te=ye=>!p||ye.authorEmails.includes(p),e[50]=p,e[51]=Te):Te=e[51];let Se;e[52]!==g?(Se=ye=>!g||ye.status===g,e[52]=g,e[53]=Se):Se=e[53];let we;e[54]!==x?(we=(ye,ke)=>{if(x==="az")return ye.title.localeCompare(ke.title);if(x==="za")return ke.title.localeCompare(ye.title);const et=ye.date.localeCompare(ke.date);return x==="date-asc"?et:-et},e[54]=x,e[55]=we):we=e[55];const Ye=ve.filter(ye=>!re||ye.title.toLowerCase().includes(re)||ye.slug.toLowerCase().includes(re)).filter(ge).filter(Te).filter(Se).sort(we),Ge=v.size,Ie=Ye.map(Tle),Oe=Ie.length>0&&Ie.every(ye=>v.has(ye)),pt=Ge>0||S,nt=()=>{Oe?j():k(Ie)},lt=`Search ${s}…`,gt=uu(s)?`Create new ${du[s]}`:s==="redirects"?"Create new redirect":"Create new page",bt=s!=="apps"&&s!=="sections";se="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let rt;e[56]===Symbol.for("react.memo_cache_sentinel")?(rt=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=rt):rt=e[56];let ct;e[57]!==f?(ct=ye=>f(ye.target.value),e[57]=f,e[58]=ct):ct=e[58];let Qe;e[59]!==lt||e[60]!==h||e[61]!==ct?(Qe=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[rt,o.jsx("input",{type:"text",value:h,onChange:ct,placeholder:lt,"aria-label":lt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=lt,e[60]=h,e[61]=ct,e[62]=Qe):Qe=e[62];let dt;e[63]!==gt||e[64]!==P||e[65]!==bt?(dt=bt&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:P,"aria-label":gt,children:o.jsx(Yt,{size:14})})}),o.jsx(Ke,{side:"bottom",children:gt})]}),e[63]=gt,e[64]=P,e[65]=bt,e[66]=dt):dt=e[66],e[67]!==Qe||e[68]!==dt?(Z=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Qe,dt]}),e[67]=Qe,e[68]=dt,e[69]=Z):Z=e[69],te=J&&(pt?o.jsx(fle,{count:Ge,allSelected:Oe,onToggleSelectAll:nt,onDelete:V,onExit:C}):o.jsx(lle,{categories:_e,authors:Ne,categoryFilter:m,statusCounts:Le,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:y,onStatusFilterChange:_,onSortChange:L})),H=Ql,Q="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",q="flex flex-col gap-1 p-1.5",G=s==="pages"?le.length===0?o.jsx(mc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(ye=>{const ke=N?.collection==="pages"&&N.key===ye.key,et=dw(u,ye.key);return o.jsx(_i,{icon:Mo,title:ye.name,subtitle:ye.path,active:ke,variantCount:et,onClick:()=>T({collection:"pages",key:ye.key,path:ye.path}),menu:o.jsx(Td,{onDuplicate:()=>E(ye),onRename:()=>R(ye),onAddVariant:()=>M(ye),onEditSeo:()=>D(ye),onViewJson:()=>$(ye),onDelete:()=>I(ye)})},ye.key)}):s==="sections"?me.length===0&&ee.length===0?o.jsx(mc,{hasItems:r.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[oe.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(nv,{icon:Hr,label:"Saved sections"}),oe.map(ye=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ye.label}),ye.sections.map(ke=>{const et=N?.collection==="sections"&&N.key===ke.key;return o.jsx(_i,{icon:Hr,accent:"global",title:ke.name,subtitle:ye.label,active:et,onClick:()=>T({collection:"sections",key:ke.key}),menu:o.jsx(Td,{onDuplicate:()=>O(ke),onRename:()=>B(ke),onDelete:()=>F(ke)})},ke.key)})]},ye.label))]}),ee.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(nv,{icon:Mo,label:"Available sections",className:ae(oe.length>0&&"mt-3")}),ee.map(ye=>{const ke=N?.collection==="available-section"&&N.resolveType===ye.resolveType,et=ye.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(_i,{icon:Mo,title:ye.title,subtitle:et??ye.resolveType,active:ke,onClick:()=>T({collection:"available-section",resolveType:ye.resolveType,title:ye.title})},ye.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(st,{className:"size-4.5 text-muted-foreground"})}):ie.length===0?o.jsx(mc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ie.map(ye=>{const ke=N?.collection==="apps"&&ye.blockKey!==null&&N.key===ye.blockKey;return o.jsx(_i,{icon:Z6,logoUrl:ye.logo,title:ye.title,subtitle:ye.category,active:ke,trailing:ye.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!ye.installed||!ye.blockKey){xe.message(`${ye.title} is not installed on this site.`);return}T({collection:"apps",key:ye.blockKey})}},ye.id)}):s==="redirects"?ne.length===0?o.jsx(mc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ne.map(ye=>o.jsx(_i,{icon:F6,title:ye.from||"(no source)",subtitle:`→ ${ye.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===ye.key,trailing:o.jsx(Jre,{type:ye.type}),onClick:()=>T({collection:"redirects",key:ye.key}),menu:o.jsx(Td,{onDelete:()=>z(ye)})},ye.key)):J?Ye.length===0?o.jsx(mc,{hasItems:ve.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ye.map(ye=>{const ke={key:ye.key,kind:"posts",label:ye.title,subtitle:ye.slug};return o.jsx(_i,{icon:Ai,title:ye.title,subtitle:ye.slug||"no slug",invalid:ye.missing.length>0,invalidReason:`Missing: ${ye.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===ye.key,selectable:!0,selectionActive:pt,selected:v.has(ye.key),onToggleSelect:()=>w(ye.key),onClick:()=>pt?w(ye.key):T({collection:"posts",key:ye.key}),menu:o.jsx(Td,{onDuplicate:()=>W(ke),onDelete:()=>K(ke)})},ye.key)}):ue.length===0?o.jsx(mc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${uu(s)?du[s]:"item"}.`}):ue.map(ye=>{const ke=N?.collection===ye.kind&&N.key===ye.key;return o.jsx(_i,{icon:ye.kind==="posts"?Ai:ye.kind==="authors"?t9:M2,title:ye.label,subtitle:ye.subtitle,active:ke,onClick:()=>T({collection:ye.kind,key:ye.key}),menu:o.jsx(Td,{onDuplicate:()=>W(ye),onDelete:()=>K(ye)})},ye.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=M,e[7]=V,e[8]=j,e[9]=P,e[10]=K,e[11]=I,e[12]=z,e[13]=F,e[14]=W,e[15]=E,e[16]=O,e[17]=D,e[18]=C,e[19]=y,e[20]=b,e[21]=L,e[22]=_,e[23]=R,e[24]=B,e[25]=f,e[26]=T,e[27]=k,e[28]=w,e[29]=$,e[30]=n,e[31]=p,e[32]=S,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=r,e[39]=v,e[40]=N,e[41]=H,e[42]=q,e[43]=G,e[44]=Q,e[45]=se,e[46]=Z,e[47]=te}else H=e[41],q=e[42],G=e[43],Q=e[44],se=e[45],Z=e[46],te=e[47];let X;e[70]!==q||e[71]!==G?(X=o.jsx("div",{className:q,children:G}),e[70]=q,e[71]=G,e[72]=X):X=e[72];let Y;e[73]!==H||e[74]!==Q||e[75]!==X?(Y=o.jsx(H,{className:Q,children:X}),e[73]=H,e[74]=Q,e[75]=X,e[76]=Y):Y=e[76];let de;return e[77]!==se||e[78]!==Z||e[79]!==te||e[80]!==Y?(de=o.jsxs("div",{className:se,children:[Z,te,Y]}),e[77]=se,e[78]=Z,e[79]=te,e[80]=Y,e[81]=de):de=e[81],de}function Tle(t){return t.key}function Ale(t){return t.email}function Ple(t){return t.slug}function Ele(t){return typeof t=="string"?t:""}function Rle(t){const e=U.c(25),{virtualMcpId:s}=t,n=ce(),[i,r]=A.useState(!1),l=Vs(s),{activeTask:a}=an();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=Zo(c);if(!(bn(l?.metadata)||bn(a?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(_n,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let m;e[2]!==n?(m=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=p):p=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>r(!0),x=o.jsx(_n,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let b;e[8]!==n?(b=n("mainPanelTabs.previewTab.connectGithub"),e[8]=n,e[9]=b):b=e[9];let y;e[10]!==b?(y=o.jsxs(fe,{onClick:g,children:[x,b]}),e[10]=b,e[11]=y):y=e[11];let _;e[12]!==m||e[13]!==p||e[14]!==y?(_=o.jsx(Vi,{className:"h-full",image:f,title:m,description:p,actions:y}),e[12]=m,e[13]=p,e[14]=y,e[15]=_):_=e[15];let L;e[16]!==i?(L=o.jsx(Ju,{open:i,onOpenChange:r,mode:"agent"}),e[16]=i,e[17]=L):L=e[17];let v;return e[18]!==L||e[19]!==_?(v=o.jsxs(o.Fragment,{children:[_,L]}),e[18]=L,e[19]=_,e[20]=v):v=e[20],v}let h;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(h=o.jsx(jle,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=h):h=e[24],h}function Dle(){const t=U.c(3),[e,s]=A.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let r;return t[1]!==e?(r=[e,i],t[1]=e,t[2]=r):r=t[2],r}function Mle(t){const e=U.c(6),{virtualMcpId:s}=t,n=Vs(s),i=I8();let r;e[0]!==i||e[1]!==n?(r=qf(i,$8(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const l=r;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Ile,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(Ble,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function Ile(){const t=U.c(12),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(ig,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Ole(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function $le(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function Ble(t){const e=U.c(99),{config:s}=t,n=ce(),[i,r]=A.useState(""),l=r9(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=nk(a),d=A9(),[u,h]=A.useState(!1),[f,m]=A.useState(null),p=A.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(O){if(!O)return;const B=Array.from(O);if(B.length===0)return;const F=[];for(const z of B)try{await d.mutateAsync({configId:s.id,file:z})}catch(W){const K=W;F.push(`${z.name} (${K instanceof Error?K.message:"upload failed"})`)}await c.refetch(),F.length>0&&xe.error(F.length===B.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(O){O.preventDefault(),h(!0)},e[8]=b):b=e[8];const y=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){h(!1)},e[9]=_):_=e[9];const L=_;let v;e[10]!==x?(v=function(O){O.preventDefault(),O.stopPropagation(),h(!1),x(O.dataTransfer.files)},e[10]=x,e[11]=v):v=e[11];const S=v,[w,k]=Dle();let j,C,V,N,T,P;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==w||e[16]!==x||e[17]!==u||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==S||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const O=(c.data?.pages??[]).flatMap(zle),B=$le(O,Ole(w)),F=l.trim(),z=i!==l||c.isFetching&&!c.isFetchingNextPage;T="flex h-full min-h-0 flex-col gap-3 p-4";let W;e[31]!==n?(W=n("assets.browser.title"),e[31]=n,e[32]=W):W=e[32];let K;e[33]!==W?(K=o.jsx("h2",{className:"text-sm font-semibold",children:W}),e[33]=W,e[34]=K):K=e[34];let H;e[35]!==s.name||e[36]!==n?(H=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=H):H=e[37];let q;e[38]!==H?(q=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:H}),e[38]=H,e[39]=q):q=e[39];let G;e[40]!==K||e[41]!==q?(G=o.jsxs("div",{className:"min-w-0",children:[K,q]}),e[40]=K,e[41]=q,e[42]=G):G=e[42];let Q;e[43]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>p.current?.click(),e[43]=Q):Q=e[43];let se;e[44]!==d.isPending?(se=d.isPending?o.jsx(st,{className:"size-3.5"}):o.jsx(Jn,{size:14}),e[44]=d.isPending,e[45]=se):se=e[45];let Z;e[46]!==n||e[47]!==d.isPending?(Z=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=Z):Z=e[48];let te;e[49]!==se||e[50]!==Z||e[51]!==d.isPending?(te=o.jsxs(fe,{type:"button",size:"sm",disabled:d.isPending,onClick:Q,children:[se,Z]}),e[49]=se,e[50]=Z,e[51]=d.isPending,e[52]=te):te=e[52];let X;e[53]!==x?(X=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ue=>{const J=Array.from(ue.target.files??[]);ue.target.value="",x(J)}}),e[53]=x,e[54]=X):X=e[54],e[55]!==G||e[56]!==te||e[57]!==X?(P=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[G,te,X]}),e[55]=G,e[56]=te,e[57]=X,e[58]=P):P=e[58];let Y;e[59]!==n?(Y=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=Y):Y=e[60],e[61]!==z||e[62]!==i||e[63]!==Y?(j=o.jsx(e9,{value:i,onChange:r,isSearching:z,placeholder:Y,className:"shrink-0"}),e[61]=z,e[62]=i,e[63]=Y,e[64]=j):j=e[64];let de;e[65]===Symbol.for("react.memo_cache_sentinel")?(de=()=>p.current?.click(),e[65]=de):de=e[65];const re=u&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ne;e[66]!==re||e[67]!==le?(ne=ae("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",re,le),e[66]=re,e[67]=le,e[68]=ne):ne=e[68];let me;e[69]===Symbol.for("react.memo_cache_sentinel")?(me=o.jsx(Jn,{size:16,className:"text-muted-foreground"}),e[69]=me):me=e[69];let ee;e[70]!==n?(ee=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ee):ee=e[71];let oe;e[72]!==n?(oe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=oe):oe=e[73];let ie;e[74]!==ee||e[75]!==oe?(ie=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ee," ",oe]}),e[74]=ee,e[75]=oe,e[76]=ie):ie=e[76],e[77]!==S||e[78]!==ne||e[79]!==ie?(C=o.jsxs("button",{type:"button",onClick:de,onDragOver:y,onDragLeave:L,onDrop:S,className:ne,children:[me,ie]}),e[77]=S,e[78]=ne,e[79]=ie,e[80]=C):C=e[80],V="min-h-0 flex-1 overflow-y-auto pr-1",N=O.length===0?F?o.jsx(lv,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(lv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:B.map((ue,J)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ue.map(he=>o.jsx(Fle,{item:he,onDelete:()=>m(he)},he.key))},J))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=w,e[16]=x,e[17]=u,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=S,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=V,e[28]=N,e[29]=T,e[30]=P}else j=e[25],C=e[26],V=e[27],N=e[28],T=e[29],P=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let R;e[84]!==E||e[85]!==V||e[86]!==N?(R=o.jsxs("div",{className:V,children:[N,E]}),e[84]=E,e[85]=V,e[86]=N,e[87]=R):R=e[87];let M;e[88]===Symbol.for("react.memo_cache_sentinel")?(M=()=>m(null),e[88]=M):M=e[88];let I;e[89]!==s.id||e[90]!==f?(I=o.jsx(Kle,{configId:s.id,item:f,onClose:M}),e[89]=s.id,e[90]=f,e[91]=I):I=e[91];let D;return e[92]!==j||e[93]!==C||e[94]!==R||e[95]!==I||e[96]!==T||e[97]!==P?(D=o.jsxs("div",{className:T,children:[P,j,C,R,I]}),e[92]=j,e[93]=C,e[94]=R,e[95]=I,e[96]=T,e[97]=P,e[98]=D):D=e[98],D}function zle(t){return t.items}function lv(t){const e=U.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(li,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,l]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Fle(t){const e=U.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=ik(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=H3(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:Ule}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Ai,{size:28,className:"text-muted-foreground"})}),e[4]=a,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const u=s.key;let h;e[12]!==s.key?(h=mf(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=rk(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==r||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",m]}),e[19]=r,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(Hle,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let y;return e[31]!==b||e[32]!==d?(y=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=y):y=e[33],y}function Ule(t){t.target.style.display="none"}function Hle(t){const e=U.c(36),{item:s,onDelete:n}=t,i=ce(),[r,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{xe.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(i9,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==r?(f=r?o.jsx(zt,{size:14}):o.jsx(vn,{size:14}),e[8]=r,e[9]=f):f=e[9];let m;e[10]!==r||e[11]!==i?(m=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs(Ze,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(mn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let y;e[20]!==s.publicUrl||e[21]!==b?(y=o.jsx(Ze,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(on,{size:14}),e[23]=_):_=e[23];let L;e[24]!==i?(L=i("assets.browser.deleteAction"),e[24]=i,e[25]=L):L=e[25];let v;e[26]!==n||e[27]!==L?(v=o.jsxs(Ze,{variant:"destructive",onClick:n,children:[_,L]}),e[26]=n,e[27]=L,e[28]=v):v=e[28];let S;e[29]!==y||e[30]!==v||e[31]!==p?(S=o.jsxs(Wt,{align:"end",children:[p,y,v]}),e[29]=y,e[30]=v,e[31]=p,e[32]=S):S=e[32];let w;return e[33]!==S||e[34]!==h?(w=o.jsxs(Ht,{children:[h,S]}),e[33]=S,e[34]=h,e[35]=w):w=e[35],w}function Kle(t){const e=U.c(47),{configId:s,item:n,onClose:i}=t,r=ce(),l=Xse();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==r?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),xe.success(r("assets.browser.deleted")),i()}catch{xe.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=r,e[5]=a):a=e[5];const c=a,d=!!n;let u;e[6]!==i?(u=N=>!N&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r?(h=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=h):h=e[9];let f;e[10]!==h?(f=o.jsx(Gr,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==r?(m=r("assets.browser.deleteConfirmDescription",{name:n?mf(n.key):""}),e[12]=n,e[13]=r,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(Yr,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=o.jsxs(qr,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let y;e[22]!==l.isPending||e[23]!==b?(y=o.jsx(Xr,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=y):y=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=ae(Xy({variant:"destructive"})),e[25]=_):_=e[25];const L=l.isPending;let v;e[26]!==c?(v=N=>{N.preventDefault(),c()},e[26]=c,e[27]=v):v=e[27];let S;e[28]!==l.isPending?(S=l.isPending?o.jsx(st,{className:"size-3.5"}):null,e[28]=l.isPending,e[29]=S):S=e[29];let w;e[30]!==r?(w=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=w):w=e[31];let k;e[32]!==l.isPending||e[33]!==v||e[34]!==S||e[35]!==w?(k=o.jsxs(Qr,{className:_,disabled:L,onClick:v,children:[S,w]}),e[32]=l.isPending,e[33]=v,e[34]=S,e[35]=w,e[36]=k):k=e[36];let j;e[37]!==y||e[38]!==k?(j=o.jsxs(Jr,{children:[y,k]}),e[37]=y,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(Wr,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let V;return e[43]!==C||e[44]!==d||e[45]!==u?(V=o.jsx(Kr,{open:d,onOpenChange:u,children:C}),e[43]=C,e[44]=d,e[45]=u,e[46]=V):V=e[46],V}const U1={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:tl},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:zr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:j6}},Wle=["fast","smart","thinking"];function qle(t){const e=U.c(19),{tier:s,onSelect:n}=t,i=ce(),[r,l]=A.useState(!1),a=U1[s].icon;let c;e[0]!==a?(c=o.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=U1[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Ls,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=Wle.map(x=>{const b=U1[x],y=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ae("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(y,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:i(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&o.jsx(zt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(hs,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==p?(g=o.jsxs(fs,{open:r,onOpenChange:l,children:[f,p]}),e[15]=r,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Gle(t){const e=U.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=ce(),[a,c]=A.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?o.jsx(A.Suspense,{fallback:o.jsx(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(Yle,{override:i,onOverrideChange:r})}):o.jsx(qle,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==r?(f=y=>{c(y),y||r(null)},e[11]=r,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=o.jsx(ii,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==h||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function Yle(t){const e=U.c(25),{override:s,onOverrideChange:n}=t,i=ce(),r=Jf(),l=r[0]?.id??null;let a;e[0]!==l||e[1]!==r||e[2]!==s?.credentialId?(a=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=r,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=A.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==r?(u=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=u):u=e[7];const h=u;let f;e[8]!==r||e[9]!==s?(f=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=f):f=e[10];const m=f;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let y;return e[13]!==b?(y=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=y):y=e[14],y}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==n?(g=b=>{const y=b.keyId??h??"";d(y),n({modelId:b.modelId,credentialId:y,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(UA,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const Hk=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:cg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:An},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:li},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:sr},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Uu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Ho,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Hf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:n9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:A2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:wu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Ho},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:zT}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Vl,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Vl},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Mc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Mc}]}],Jle=Hk.flatMap(t=>t.tools.map(e=>e.name));function Xle(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Qle(t){const e=U.c(12),{agentId:s,value:n,onChange:i}=t,r=ce();let l;e[0]!==r?(l=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(A.Suspense,{fallback:o.jsxs(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(cg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(Zle,{agentId:s,value:n,onChange:i})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:r("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=r,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function av(t){const e=U.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(id,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==r?(u=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=o.jsxs(us,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function cv(t){const e=U.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=ce(),d=r===l;let u;e[0]!==i||e[1]!==s?(u=s?o.jsx(so,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(qP,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=o.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==l?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",l]}),e[9]=r,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=_=>{_.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let y;return e[23]!==u||e[24]!==f||e[25]!==b?(y=o.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=y):y=e[26],y}function Zle(t){const e=U.c(83),{agentId:s,value:n,onChange:i}=t,r=ce(),{org:l}=Fe(),[a,c]=A.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=$s(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=y6(h),p=Ti();let g,x,b,y,_,L,v,S,w,k,j,C,V;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(p.map(iae)),M=new Map;for(const oe of f?.tools??[]){const ie=$r(oe._meta)??"__other__",ue=$u(oe.name,ie==="__other__"?void 0:ie),J=oe.title,he=J&&J!==oe.name?J:Xle(ue);M.has(ie)||M.set(ie,{clientId:ie,conn:R.get(ie),tools:[]}),M.get(ie).tools.push({name:oe.name,display:he,description:oe.description})}const I=[...M.values()].sort(nae),D=(f?.tools??[]).map(sae),$=[...Jle,...D],O=n===null?new Set($):new Set(n),B=$.every(oe=>O.has(oe)),F=oe=>i($.every(ie=>oe.has(ie))?null:[...oe]),z=oe=>{const ie=new Set(O);ie.has(oe)?ie.delete(oe):ie.add(oe),F(ie)},W=(oe,ie)=>{const ue=new Set(O);for(const J of oe)ie?ue.add(J):ue.delete(J);F(ue)};y=fs,V=a,_=c;let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(cg,{size:14,className:"text-muted-foreground"}),e[26]=K):K=e[26];let H;e[27]!==B||e[28]!==r?(H=r(B?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=B,e[28]=r,e[29]=H):H=e[29];const q=!B&&o.jsxs(iE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[O.size,"/",$.length]});let G;e[30]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(Ls,{size:14,className:"text-muted-foreground"}),e[30]=G):G=e[30],e[31]!==H||e[32]!==q?(L=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[K,H,q,G]})}),e[31]=H,e[32]=q,e[33]=L):L=e[33],b=hs,j="p-0 w-80",C="start",x=Di;let Q;e[34]!==r?(Q=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=Q):Q=e[35],e[36]!==Q?(w=o.jsx(ui,{placeholder:Q}),e[36]=Q,e[37]=w):w=e[37];const se=B?r("automations.automationConfig.allToolsEnabled",{count:$.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:O.size,total:$.length});let Z;e[38]!==se?(Z=o.jsx("span",{className:"text-xs text-muted-foreground",children:se}),e[38]=se,e[39]=Z):Z=e[39];let te;e[40]!==i?(te=()=>i(null),e[40]=i,e[41]=te):te=e[41];let X;e[42]!==r?(X=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=X):X=e[43];let Y;e[44]!==B||e[45]!==te||e[46]!==X?(Y=o.jsx("button",{type:"button",onClick:te,disabled:B,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:X}),e[44]=B,e[45]=te,e[46]=X,e[47]=Y):Y=e[47];let de;e[48]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=de):de=e[48];let re;e[49]!==i?(re=()=>i([]),e[49]=i,e[50]=re):re=e[50];const le=O.size===0;let ne;e[51]!==r?(ne=r("automations.automationConfig.clear"),e[51]=r,e[52]=ne):ne=e[52];let me;e[53]!==re||e[54]!==le||e[55]!==ne?(me=o.jsx("button",{type:"button",onClick:re,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ne}),e[53]=re,e[54]=le,e[55]=ne,e[56]=me):me=e[56];let ee;e[57]!==Y||e[58]!==me?(ee=o.jsxs("div",{className:"flex items-center gap-2",children:[Y,de,me]}),e[57]=Y,e[58]=me,e[59]=ee):ee=e[59],e[60]!==Z||e[61]!==ee?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[Z,ee]}),e[60]=Z,e[61]=ee,e[62]=k):k=e[62],g=hi,v="max-h-80",S=m?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(Bn,{children:r("automations.automationConfig.noToolsFound")}),Hk.map(oe=>{const ie=oe.tools.map(tae),ue=ie.filter(J=>O.has(J)).length;return o.jsx(Es,{heading:o.jsx(cv,{label:r(oe.headingKey),icon:oe.icon,on:ue,total:ie.length,onToggle:()=>W(ie,ue!==ie.length)}),children:oe.tools.map(J=>o.jsx(av,{value:`${r(J.titleKey)} ${J.name}`,checked:O.has(J.name),onToggle:()=>z(J.name),title:r(J.titleKey),description:r(J.descriptionKey),leading:o.jsx(J.icon,{size:16,className:"text-muted-foreground"})},J.name))},oe.key)}),I.map(oe=>{const ie=oe.tools.map(eae),ue=ie.filter(J=>O.has(J)).length;return o.jsx(Es,{heading:o.jsx(cv,{conn:oe.conn,on:ue,total:ie.length,onToggle:()=>W(ie,ue!==ie.length)}),children:oe.tools.map(J=>o.jsx(av,{value:`${J.display} ${J.name} ${oe.conn?.title??""}`,checked:O.has(J.name),onToggle:()=>z(J.name),title:J.display,description:J.description},J.name))},oe.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=y,e[17]=_,e[18]=L,e[19]=v,e[20]=S,e[21]=w,e[22]=k,e[23]=j,e[24]=C,e[25]=V}else g=e[13],x=e[14],b=e[15],y=e[16],_=e[17],L=e[18],v=e[19],S=e[20],w=e[21],k=e[22],j=e[23],C=e[24],V=e[25];let N;e[63]!==g||e[64]!==v||e[65]!==S?(N=o.jsx(g,{className:v,children:S}),e[63]=g,e[64]=v,e[65]=S,e[66]=N):N=e[66];let T;e[67]!==x||e[68]!==N||e[69]!==w||e[70]!==k?(T=o.jsxs(x,{children:[w,k,N]}),e[67]=x,e[68]=N,e[69]=w,e[70]=k,e[71]=T):T=e[71];let P;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==C?(P=o.jsx(b,{className:j,align:C,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=C,e[76]=P):P=e[76];let E;return e[77]!==y||e[78]!==_||e[79]!==L||e[80]!==P||e[81]!==V?(E=o.jsxs(y,{open:V,onOpenChange:_,children:[L,P]}),e[77]=y,e[78]=_,e[79]=L,e[80]=P,e[81]=V,e[82]=E):E=e[82],E}function eae(t){return t.name}function tae(t){return t.name}function sae(t){return t.name}function nae(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function iae(t){return[t.id,t]}function hu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function rae(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const a=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function oae(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function lae(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function aae(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const cae=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function dae({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=ce(),{triggerAdd:a}=Qu(),[c,d]=A.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),xe.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");xe.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?r?.(p.webhook):xe.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");xe.error(g)}};return o.jsxs(Ht,{open:u,onOpenChange:h,children:[o.jsx(Kt,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",children:[o.jsx(Yt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(Wt,{align:"end",className:"w-[200px]",children:[o.jsxs(Zi,{children:[o.jsxs(er,{className:"gap-2.5",children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(tr,{className:"w-[160px]",children:cae.map(p=>o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[o.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[o.jsx(An,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Kk(t){const e=U.c(39),{open:s,onOpenChange:n,url:i,token:r,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,u=ce(),[h,f]=A.useState(null),[m,p]=A.useState("curl"),[g,x]=A.useState("header"),b=A.useId();let y;e[0]!==u?(y=async(I,D)=>{try{await navigator.clipboard.writeText(I),f(D),xe.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{xe.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=y):y=e[1];const _=y;let L;e[2]!==g||e[3]!==r||e[4]!==i?(L=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=L):L=e[5];const v=L,S=i&&r?g==="header"?`curl -X POST "${v}" \\
|
|
623
|
+
`)};Rn.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Q3(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,r);return this.renderTokens(h,s,n,u,i)}}};Rn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Rn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ri.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Ri.escape?String(r):i(r)};Rn.prototype.rawValue=function(e){return e[1]};Rn.prototype.getConfigTags=function(e){return pd(e)?e:e&&typeof e=="object"?e.tags:void 0};Rn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!pd(e))return e.escape};var Ri={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Du.templateCache=t},get templateCache(){return Du.templateCache}},Du=new Rn;Ri.clearCache=function(){return Du.clearCache()};Ri.parse=function(e,s){return Du.parse(e,s)};Ri.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Foe(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Du.render(e,s,n,i)};Ri.escape=Yoe;Ri.Scanner=p0;Ri.Context=Wc;Ri.Writer=Rn;function nle(t,e){const s={__resolveType:t},n=ow([s],e)[0];return n?tse(s,n,e):null}function ile({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=ce(),d=ro(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=A.useState(()=>nle(l,r)),[f,m]=A.useState(h?.data??{}),[p,g]=A.useState([]),[x,b]=A.useState(0),[y,_]=A.useState(!1),[L,v]=A.useState(null),S=L!==null,{save:w,flush:k}=E3({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?zn(h.resolveType,i):null,C=r[l],V=C?Il(l,C):l,N=_s()?.taskId??null,T={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:u},P=D=>{m(D),w(l,D)},E=()=>{S?(v(null),_(!1),b(D=>D+1)):v(JSON.stringify(f,null,2))},R=D=>{const $=D??"";try{const O=JSON.parse($);if(O&&typeof O=="object"&&!Array.isArray(O)){_(!1),P(O);return}_(!0)}catch{_(!0)}},M=[V,...p],I=D=>{g(p.slice(0,D)),b($=>$+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:b3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:M.map((D,$)=>{const O=$===M.length-1,B=Nn(D);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>I($),title:B,className:ae("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",O?"font-medium text-foreground":"text-muted-foreground"),children:B})]},`${B}-${$}`)})}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:S?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":S,children:S?o.jsx(Ws,{size:14}):o.jsx(Qc,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(Ql,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Oi,{schema:j,value:f,onChange:D=>P(D),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:T},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),L!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[y&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ld,{language:"json",height:"100%",code:L,onChange:R,onSave:D=>{R(D),k()}})})]})]})]})})}function rle(t){const e=U.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=ce();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Ro,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let y;e[7]!==s.title?(y=tk(s.title),e[7]=s.title,e[8]=y):y=e[8];let _;e[9]!==u||e[10]!==s.resolveType?(_=(v,S)=>u(s.resolveType,v,S),e[9]=u,e[10]=s.resolveType,e[11]=_):_=e[11];let L;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==y||e[23]!==_||e[24]!==i?(L=o.jsx($oe,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:y,isCreating:d,onCreate:_,onSaveReferencedBlock:h},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=y,e[23]=_,e[24]=i,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=o.jsx(ile,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=r,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Qb="__all__",Zb={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},ole={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},_h={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},ev="status:";function tv(t){if(!t.startsWith(ev))return null;const e=t.slice(ev.length);return e in _h?e:null}const sv=A.forwardRef(function(e,s){const n=U.c(20);let i,r,l,a,c;n[0]!==e?({icon:i,active:r,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=l,n[4]=a,n[5]=c):(i=n[1],r=n[2],l=n[3],a=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=ae("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ls,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=o.jsxs(fe,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function Z3(t){const e=U.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function lle(t){const e=U.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=ce();let p;if(e[0]!==s||e[1]!==r){let ne;e[3]!==r?(ne=me=>me.slug===r,e[3]=r,e[4]=ne):ne=e[4],p=s.find(ne),e[0]=s,e[1]=r,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let ne;e[8]!==l?(ne=me=>me.email===l,e[8]=l,e[9]=ne):ne=e[9],x=n.find(ne),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,y=!!(r||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(_=g?.name??b?.name??m(a?_h[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=_):_=e[14];const L=_,v=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Qb;let S;e[15]!==u||e[16]!==d||e[17]!==h?(S=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=S):S=e[18];const w=S;let k;e[19]!==w||e[20]!==u||e[21]!==d||e[22]!==h?(k=ne=>{ne.startsWith("cat:")?(u(null),h(null),d(ne.slice(4))):ne.startsWith("author:")?(d(null),h(null),u(ne.slice(7))):tv(ne)?(d(null),u(null),h(tv(ne))):w()},e[19]=w,e[20]=u,e[21]=d,e[22]=h,e[23]=k):k=e[23];const j=k;let C;e[24]!==L||e[25]!==y?(C=o.jsx(Kt,{asChild:!0,children:o.jsx(sv,{icon:$T,active:y,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=y,e[26]=C):C=e[26];let V;e[27]!==m?(V=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=V):V=e[28];let N;e[29]!==V?(N=o.jsx(yd,{children:V}),e[29]=V,e[30]=N):N=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let P;e[33]!==T?(P=o.jsx(Io,{value:Qb,children:T}),e[33]=T,e[34]=P):P=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(yd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let M;e[39]===Symbol.for("react.memo_cache_sentinel")?(M=Object.keys(_h),e[39]=M):M=e[39];let I;e[40]!==i||e[41]!==m?(I=M.map(ne=>o.jsxs(Io,{value:`status:${ne}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(_h[ne])}),o.jsx(Z3,{count:i[ne]})]},`status:${ne}`)),e[40]=i,e[41]=m,e[42]=I):I=e[42];let D;e[43]!==s.length||e[44]!==m?(D=s.length>0&&o.jsx(yd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=D):D=e[45];let $;e[46]!==s?($=s.map(cle),e[46]=s,e[47]=$):$=e[47];let O;e[48]!==n.length||e[49]!==m?(O=n.length>0&&o.jsx(yd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=O):O=e[50];let B;e[51]!==n?(B=n.map(ale),e[51]=n,e[52]=B):B=e[52];let F;e[53]!==v||e[54]!==j||e[55]!==P||e[56]!==R||e[57]!==I||e[58]!==D||e[59]!==$||e[60]!==O||e[61]!==B?(F=o.jsxs(Ih,{value:v,onValueChange:j,children:[P,R,I,D,$,O,B]}),e[53]=v,e[54]=j,e[55]=P,e[56]=R,e[57]=I,e[58]=D,e[59]=$,e[60]=O,e[61]=B,e[62]=F):F=e[62];let z;e[63]!==F||e[64]!==N?(z=o.jsxs(Wt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,F]}),e[63]=F,e[64]=N,e[65]=z):z=e[65];let W;e[66]!==z||e[67]!==C?(W=o.jsxs(Ht,{children:[C,z]}),e[66]=z,e[67]=C,e[68]=W):W=e[68];let K;e[69]!==w||e[70]!==y||e[71]!==m?(K=y&&o.jsx(dle,{label:m("sandbox.postToolbar.clearFilter"),onClick:w}),e[69]=w,e[70]=y,e[71]=m,e[72]=K):K=e[72];const H=ole[c];let q;e[73]!==m||e[74]!==H?(q=m(H),e[73]=m,e[74]=H,e[75]=q):q=e[75];let G;e[76]!==q?(G=o.jsx(Kt,{asChild:!0,children:o.jsx(sv,{icon:BT,active:!0,value:q})}),e[76]=q,e[77]=G):G=e[77];let Q;e[78]!==m?(Q=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=Q):Q=e[79];let se;e[80]!==Q?(se=o.jsx(yd,{children:Q}),e[80]=Q,e[81]=se):se=e[81];let Z;e[82]!==f?(Z=ne=>f(ne),e[82]=f,e[83]=Z):Z=e[83];let te;e[84]===Symbol.for("react.memo_cache_sentinel")?(te=Object.keys(Zb),e[84]=te):te=e[84];let X;e[85]!==m?(X=te.map(ne=>o.jsx(Io,{value:ne,children:m(Zb[ne])},ne)),e[85]=m,e[86]=X):X=e[86];let Y;e[87]!==c||e[88]!==Z||e[89]!==X?(Y=o.jsx(Ih,{value:c,onValueChange:Z,children:X}),e[87]=c,e[88]=Z,e[89]=X,e[90]=Y):Y=e[90];let de;e[91]!==se||e[92]!==Y?(de=o.jsxs(Wt,{align:"end",className:"w-44",children:[se,Y]}),e[91]=se,e[92]=Y,e[93]=de):de=e[93];let re;e[94]!==G||e[95]!==de?(re=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ht,{children:[G,de]})}),e[94]=G,e[95]=de,e[96]=re):re=e[96];let le;return e[97]!==W||e[98]!==K||e[99]!==re?(le=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[W,K,re]}),e[97]=W,e[98]=K,e[99]=re,e[100]=le):le=e[100],le}function ale(t){return o.jsxs(Io,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Z3,{count:t.count})]},`author:${t.email}`)}function cle(t){return o.jsxs(Io,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Z3,{count:t.count})]},`cat:${t.slug}`)}function dle(t){const e=U.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ws,{size:12}),e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function ule(t){const e=U.c(18),{checked:s,disabled:n,onToggle:i}=t,r=ce();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r?(a=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:hle,children:o.jsx(id,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==r?(d=r(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=r,e[12]=d):d=e[12];let u;e[13]!==d?(u=o.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=o.jsxs(We,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function hle(t){return t.stopPropagation()}function fle(t){const e=U.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=ce();let c;e[0]!==n||e[1]!==i?(c=o.jsx(ule,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(on,{size:14}),e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==h||e[13]!==f?(p=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:r,"aria-label":f,children:m})}),e[11]=r,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(We,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=y):y=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ws,{size:14}),e[24]=_):_=e[24];let L;e[25]!==l||e[26]!==y?(L=o.jsx(He,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":y,children:_})}),e[25]=l,e[26]=y,e[27]=L):L=e[27];let v;e[28]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=v):v=e[29];let S;e[30]!==v?(S=o.jsx(Ke,{side:"bottom",children:v}),e[30]=v,e[31]=S):S=e[31];let w;e[32]!==L||e[33]!==S?(w=o.jsxs(We,{children:[L,S]}),e[32]=L,e[33]=S,e[34]=w):w=e[34];let k;e[35]!==b||e[36]!==w?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,w]}),e[35]=b,e[36]=w,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==u?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,k]}),e[38]=c,e[39]=k,e[40]=u,e[41]=j):j=e[41],j}function Td(t){const e=U.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=ce();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ci,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=o.jsx(Kt,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:mle,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Ze,{onClick:n,children:[o.jsx(n9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(Ze,{onClick:s,children:[o.jsx(vn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&o.jsxs(o.Fragment,{children:[o.jsx(jc,{}),o.jsxs(Ze,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(ng,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(jc,{}),r&&o.jsxs(Ze,{onClick:r,children:[o.jsx(U6,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Ze,{onClick:l,children:[o.jsx(Qc,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(jc,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(on,{size:14}),e[19]=b):b=e[19];let y;e[20]!==c?(y=c("sandbox.itemActions.delete"),e[20]=c,e[21]=y):y=e[21];let _;e[22]!==a||e[23]!==y?(_=o.jsxs(Ze,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,y]}),e[22]=a,e[23]=y,e[24]=_):_=e[24];let L;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=o.jsxs(Wt,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let v;return e[31]!==L||e[32]!==h?(v=o.jsxs(Ht,{children:[h,L]}),e[31]=L,e[32]=h,e[33]=v):v=e[33],v}function mle(t){return t.stopPropagation()}function ple(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function gle(t){const e=new Map;for(const s of t){const n=ple(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function nv(t){const e=U.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=ae("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s?(l=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:r,children:[l,n]}),e[4]=n,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}const iv=A.lazy(()=>Ys(()=>import("./app-editor-DR0tLRro.js"),__vite__mapDeps([159,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,35,67,68,34,22,77,23,24,25,26,27,28,29,30,31,32,33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,69,70,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.AppEditor}))),xle=A.lazy(()=>Ys(()=>import("./post-editor-GHkZtflO.js"),__vite__mapDeps([160,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,24,52,23,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,70,75,161,131,136,100,101,69,71,112,76,128,162,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,163,164,110,111,68,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,129,130,132,133,72,134,135,137,138,139,140,141,142,143,144,145,67,146,147,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.PostEditor}))),ble=A.lazy(()=>Ys(()=>import("./record-editor-2DwNqvUy.js"),__vite__mapDeps([165,1,2,70,75,68,34,22,128,163,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,164,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.RecordEditor}))),vle=A.lazy(()=>Ys(()=>import("./category-editor-COqxAE1f.js"),__vite__mapDeps([166,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,29,31,52,23,24,25,26,27,28,30,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,144,70,75,162,100,101,69,71,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,163,164,110,111,68,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,145,67,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.CategoryEditor}))),yle=A.lazy(()=>Ys(()=>import("./bulk-category-panel-3QzafbMh.js"),__vite__mapDeps([167,1,2,31,75,168,37,68,34,22])).then(t=>({default:t.BulkCategoryPanel}))),_le=A.lazy(()=>Ys(()=>import("./sections-editor-D-QRzAnK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157])).then(t=>({default:t.SectionsEditor}))),Lle=A.lazy(()=>Ys(()=>import("./seo-editor-g6APT0uI.js"),__vite__mapDeps([169,1,2,35,23,24,25,26,27,28,29,30,31,32,33,34,22,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,74,75,76,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,70,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157])).then(t=>({default:t.SeoEditor}))),Sle=A.lazy(()=>Ys(()=>import("./variant-calendar-DaQkdUZ_.js"),__vite__mapDeps([170,1,2,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,75,67,68,76,171,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,70,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.VariantCalendar}))),wle=A.lazy(()=>Ys(()=>import("./post-calendar-DM4--jD1.js"),__vite__mapDeps([172,1,2,24,23,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,173,67,68,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,70,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.PostCalendar}))),kle=A.lazy(()=>Ys(()=>import("./redirect-editor-Bat0o4y3.js"),__vite__mapDeps([174,1,2,136,34,70,75,68,22,164,26,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,78,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,79,80,81,82,83,84,85,86,87,88,89,90,91,92,69,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,71,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,72,134,135,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,151,152,153,154,73,155,156,157])).then(t=>({default:t.RedirectEditor})));function jle(t){const e=U.c(20),{deepLinkPage:s}=t,n=ro(),{currentBranch:i}=an(),{org:r}=Fe(),l=n?.entity?.id??null,a=fi(),c=nl(),{runtime:d,previewServerUrl:u}=Sn(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=Ore({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(Mre,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ro,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==p||e[18]!==l?(g=o.jsx(Nle,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const rv=2e3,Cle=15;function ov(t,e,s,n){return typeof e!="string"||s&&(Tk(e,s,n)||t.state.dataUpdateCount>=Cle)?!1:rv}function Nle({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=ce(),d=_s()?.taskId??null,u=Vs(e),h=j2(u,s),f=Yl(u)&&h,m={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:p,isLoading:g}=L9(m,{fetchEnabled:l}),[x,b]=A.useState("pages"),[y,_]=A.useState(null),[L,v]=A.useState(null),S=!!(r?.pageId||r?.path||r?.pathTemplate),[w,k]=A.useState(!1);if(S&&!w&&y===null&&p){k(!0);const pe=$Q(of(p),r??{});pe&&(b("pages"),_({collection:"pages",key:pe.key,path:pe.path}))}const[j,C]=A.useState(""),[V,N]=A.useState(null),[T,P]=A.useState(null),[E,R]=A.useState(null),[M,I]=A.useState("date-desc"),[D,$]=A.useState(()=>new Set),[O,B]=A.useState(null),F=()=>{$(new Set),B(null)},z=pe=>{_(pe),v(null)},[W,K]=A.useState(x);W!==x&&(K(x),C(""),N(null),P(null),R(null),I("date-desc"),$(new Set),B(null));const{data:H,isLoading:q,isFetching:G}=j3(m,{fetchEnabled:l,refetchInterval:pe=>{const Pe=pe.state.data;if(x==="apps"&&y&&y.collection==="apps"){const Ue=p?.[y.key];return ov(pe,typeof Ue?.__resolveType=="string"?Ue.__resolveType:void 0,Pe)}if(x==="site"&&p){const Ue=Pe?lp(p,Pe):null,Ae=p.site,Je=Ue?.resolveType??(typeof Ae?.__resolveType=="string"?Ae.__resolveType:void 0);return ov(pe,Je,Pe,["seo"])}return!1}}),Q=(pe,Pe)=>!Tk(pe,H,Pe)&&(q||G),{catalog:se,isLoading:Z}=Rre(H??void 0,p??void 0,{enabled:x==="apps"}),te=Loe({orgSlug:t,virtualMcpId:e,branch:s,meta:H}),X=m0(m),Y=kre(m),[de,re]=A.useState(null),[le,ne]=A.useState(),[me,ee]=A.useState(null),[oe,ie]=A.useState(null),[ue,J]=A.useState(null),he=!p||!H;if(g||q||he&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})});if(he)return o.jsx(Ro,{title:"Could not load site data."});const ve=of(p).sort((pe,Pe)=>pe.name.localeCompare(Pe.name)),je=YS(p).sort((pe,Pe)=>pe.from.localeCompare(Pe.from)),Ce=k3(p,H),Le=x==="sections"?TQ(H):[],_e=lp(p,H),Ne=Dk(p),ge=J3.some(pe=>Ne[pe].length>0),Te=uu(x)?Ne[x]:[],Se=(ge?Ru(p,"categories"):[]).map(({key:pe,payload:Pe})=>{const Ue=typeof Pe.slug=="string"?Pe.slug:"",Ae=typeof Pe.name=="string"?Pe.name:"";return{slug:Ue||pe,name:Ae||Ue||pe}}).filter(pe=>pe.slug).sort((pe,Pe)=>pe.name.localeCompare(Pe.name)),we=x==="posts"&&(D.size>0||O!==null),Ye=we?$k(p).filter(pe=>D.has(pe.key)):[],Ge=ub(H,"loaders"),Ie=ub(H,"actions");if(!QS(p,H)&&!ge&&Ge===0&&Ie===0)return o.jsx(Ro,{icon:yn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Oe={pages:ve.length,sections:Ce.length,apps:se.length,loaders:Ge,actions:Ie,redirects:je.length,posts:Ne.posts.length,authors:Ne.authors.length,categories:Ne.categories.length},pt=new Set(ve.map(pe=>$o(pe.path))),nt=new Set(ve.map(pe=>pe.name)),lt=new Set(Ce.map(pe=>pe.name)),gt=async pe=>{const Pe=p[pe.key];if(!Pe)return;const Ue=dw(p,pe.key),Ae=uw(p,pe.key,Math.max(0,Ue-1)),Je=wZ(Pe.sections,Ae);if(Je)try{await X.mutateAsync({blockKey:pe.key,data:{...Pe,sections:Je}}),xe.success(`Variant added to "${pe.name}"`),_({collection:"pages",key:pe.key,path:pe.path})}catch(_t){xe.error(_t instanceof Error?_t.message:"Could not add variant")}},bt=()=>{ne(void 0),re({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},rt=pe=>{ne(void 0),re({mode:"duplicate",sourceKey:pe.key,initialName:Ub(nt,pe.name),initialPath:$re(pt,pe.path)})},ct=pe=>{ne(void 0),re({mode:"rename",sourceKey:pe.key,initialName:pe.name,initialPath:pe.path})},Qe=async pe=>{if(!de)return;const{mode:Pe,sourceKey:Ue}=de;try{if(Pe==="create"){let Ae;if(pe.templateKey){const _t=p[pe.templateKey];if(!_t)throw new Error("Selected template no longer exists.");Ae={..._t,name:pe.name,path:pe.path}}else Ae=Fre(pe.name,pe.path);const Je=Hre(p,pe.name);await X.mutateAsync({blockKey:Je,data:Ae}),xe.success(`Created "${pe.name}"`),_({collection:"pages",key:Je,path:pe.path})}else if(Pe==="duplicate"&&Ue){const Ae=p[Ue];if(!Ae)throw new Error("Source page not found");const{key:Je,data:_t}=zre({source:Ae,pages:ve,newName:pe.name,newPath:pe.path});await X.mutateAsync({blockKey:Je,data:_t}),xe.success(`Duplicated as "${pe.name}"`),_({collection:"pages",key:Je,path:pe.path})}else if(Pe==="rename"&&Ue){const Ae=p[Ue];if(!Ae)throw new Error("Page not found");const Je={...Ae,name:pe.name,path:pe.path};await X.mutateAsync({blockKey:Ue,data:Je}),xe.success("Page updated"),y?.collection==="pages"&&y.key===Ue&&_({collection:"pages",key:Ue,path:pe.path})}re(null)}catch(Ae){ne(Ae instanceof Error?Ae.message:"Save failed")}},dt=({path:pe})=>{if(!de)return null;const Pe=$o(pe);return(de.mode==="rename"?$o(de.initialPath):null)!==Pe&&pt.has(Pe)?`A page with path "${pe}" already exists.`:null},ye=async(pe,Pe,Ue)=>{await X.mutateAsync({blockKey:Pe,data:{...Ue,name:Pe,__resolveType:pe}}),xe.success(c("sandbox.contentBrowser.createdSection",{name:Pe})),_({collection:"sections",key:Pe})},ke=D3((pe,Pe)=>X.mutate({blockKey:pe,data:Pe})),et=async pe=>{const Pe=p[pe.key];if(!Pe){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Ue=Bre(p,pe.key),Ae=Ub(lt,pe.name),Je={...Pe,name:Ae};try{await X.mutateAsync({blockKey:Ue,data:Je}),xe.success(c("sandbox.contentBrowser.duplicatedSection",{name:pe.name})),_({collection:"sections",key:Ue})}catch(_t){xe.error(_t instanceof Error?_t.message:c("sandbox.contentBrowser.duplicateFailed"))}},tt=async pe=>{if(!me)return;const Pe=p[me];if(!Pe){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await X.mutateAsync({blockKey:me,data:{...Pe,name:pe}}),xe.success(c("sandbox.contentBrowser.sectionRenamed")),ee(null)}catch(Ue){xe.error(Ue instanceof Error?Ue.message:c("sandbox.contentBrowser.renameFailed"))}},ut=async()=>{const pe="/redirect-from",Pe=OQ(p,pe),Ue=DQ({from:pe,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await X.mutateAsync({blockKey:Pe,data:Ue}),xe.success("Created redirect"),_({collection:"redirects",key:Pe})}catch(Ae){xe.error(Ae instanceof Error?Ae.message:"Could not create redirect")}},jt=async pe=>{const Pe=z1(p,pe),Ue=pc(Pe,pe,Bk(pe));try{await X.mutateAsync({blockKey:Pe,data:Ue}),xe.success(`Created ${du[pe]}`),_({collection:pe,key:Pe})}catch(Ae){xe.error(Ae instanceof Error?Ae.message:"Could not create")}},mt=async pe=>{const Pe=z1(p,"posts"),Ue=pc(Pe,"posts",foe(pe));try{await X.mutateAsync({blockKey:Pe,data:Ue}),xe.success(c("sandbox.postCalendar.createdScheduledPost")),b("posts"),K("posts"),_({collection:"posts",key:Pe}),v(null)}catch(Ae){xe.error(Ae instanceof Error?Ae.message:c("sandbox.postCalendar.couldNotCreate"))}},ft=async(pe,Pe)=>{const Ue=p[pe],Ae=Ue?poe(Kd(Ue,"posts"),Pe):null;if(!Ae){xe.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await X.mutateAsync({blockKey:pe,data:pc(pe,"posts",Ae)})}catch(Je){xe.error(Je instanceof Error?Je.message:c("sandbox.postCalendar.couldNotReschedule"))}},at=async pe=>{const Pe=p[pe.key];if(!Pe){xe.error("Record not found.");return}const Ue=z1(p,pe.kind),Ae=pe.kind==="posts"?"title":"name",Je={...structuredClone(Kd(Pe,pe.kind)),[Ae]:`${pe.label} (copy)`};try{await X.mutateAsync({blockKey:Ue,data:pc(Ue,pe.kind,Je)}),xe.success(`Duplicated "${pe.label}"`),_({collection:pe.kind,key:Ue})}catch(_t){xe.error(_t instanceof Error?_t.message:"Duplicate failed")}},vt=pe=>{$(Pe=>{const Ue=new Set(Pe);return Ue.has(pe)?Ue.delete(pe):Ue.add(pe),Ue})},wt=pe=>{b("posts"),K("posts"),_(null),v(null),C(""),N(null),P(null),R(null),I("date-desc"),$(new Set),B(pe||null)},Me=async(pe,Pe)=>{const Ue=[...D];let Ae=0;for(const Je of Ue){const _t=p[Je],ot=Kd(_t,"posts"),ts=pe==="add"?noe(ot,Pe):ioe(ot,Pe);ts!==ot&&(await X.mutateAsync({blockKey:Je,data:pc(Je,"posts",Kb(ts))}),Ae+=1)}return Ae},ht=async(pe,Pe)=>{const Ue=D.size;try{const Ae=await Me(pe,Pe),Je=pe==="add"?"Added to":"Moved",_t=Ue-Ae;xe.success(`${Je} ${Ae} ${Ae===1?"post":"posts"}`+(_t>0?` (${_t} already set)`:"")),F()}catch(Ae){xe.error(Ae instanceof Error?Ae.message:"Bulk update failed")}},St=async()=>{if(oe)try{if(oe.kind==="blog-bulk"){for(const Ae of oe.keys)await Y.mutateAsync({blockKey:Ae});xe.success(`Deleted ${oe.count} ${oe.count===1?"post":"posts"}`),y&&y.collection!=="available-section"&&oe.keys.includes(y.key)&&_(null),F(),ie(null);return}const{kind:pe,key:Pe,label:Ue}=oe;if(pe==="blog"){if(oe.blogKind==="categories"){const Ae=Kd(p[Pe],"categories").slug,Je=typeof Ae=="string"?Ae:"";if(Je)for(const{key:_t,payload:ot}of Ru(p,"posts")){const ts=roe(ot,Je);ts!==ot&&await X.mutateAsync({blockKey:_t,data:pc(_t,"posts",Kb(ts))})}}await Y.mutateAsync({blockKey:Pe})}else await Y.mutateAsync({blockKey:Pe});xe.success(`Deleted "${Ue}"`),y&&y.collection!=="available-section"&&y.key===Pe&&_(null),ie(null)}catch(pe){xe.error(pe instanceof Error?pe.message:"Delete failed")}},xt=Y.isPending||X.isPending,$t=oe?.kind==="blog"?du[oe.blogKind]:oe?.kind==="blog-bulk"?`${oe.count} ${oe.count===1?"post":"posts"}`:oe?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(Dre,{active:x,counts:Oe,showBlog:ge,onSelect:pe=>{b(pe),_(null),v(null)}}),x!=="seo"&&x!=="site"&&x!=="calendar"&&x!=="post-schedule"&&x!=="loaders"&&x!=="actions"&&o.jsx(Vle,{activeCollection:x,pages:ve,redirects:je,sections:Ce,availableSections:Le,appCatalog:se,appCatalogLoading:Z,blogEntries:Te,decofile:p,searchQuery:j,onSearchChange:C,postCategoryFilter:V,postAuthorFilter:T,postStatusFilter:E,postSort:M,onPostCategoryFilterChange:pe=>{N(pe),$(new Set)},onPostAuthorFilterChange:pe=>{P(pe),$(new Set)},onPostStatusFilterChange:pe=>{R(pe),$(new Set)},onPostSortChange:I,selectedPostKeys:D,postBulkPanelOpen:we,onTogglePostSelect:vt,onSelectAllPosts:pe=>$(new Set(pe)),onClearPostSelection:()=>$(new Set),onExitPostSelection:F,onBulkDeletePosts:()=>ie({kind:"blog-bulk",keys:[...D],count:D.size}),selection:y,onSelect:z,onCreate:()=>{x==="pages"?bt():x==="redirects"?ut():uu(x)&&jt(x)},onDuplicatePage:rt,onRenamePage:ct,onAddPageVariant:gt,onDeletePage:pe=>ie({kind:"page",key:pe.key,label:pe.name}),onEditPageSeo:pe=>{const Pe={collection:"pages",key:pe.key,path:pe.path};_(Pe),v(pe.key)},onViewPageJson:pe=>J(pe.key),onDuplicateSection:et,onRenameSection:pe=>ee(pe.key),onDeleteSection:pe=>ie({kind:"section",key:pe.key,label:pe.name}),onDeleteRedirect:pe=>ie({kind:"redirect",key:pe.key,label:pe.from||pe.key}),onDuplicateBlog:at,onDeleteBlog:pe=>ie({kind:"blog",blogKind:pe.kind,key:pe.key,label:pe.label})}),o.jsx(Rw,{readOnly:f,virtualMcpId:e,className:"flex-1 min-w-0",children:x==="loaders"||x==="actions"?o.jsx(Voe,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:p,kind:x}):o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(st,{className:"size-5 text-muted-foreground"})}),children:x==="calendar"?o.jsx(Sle,{decofile:p}):x==="post-schedule"?o.jsx(wle,{decofile:p,support:te,isCreating:X.isPending,onCreate:pe=>{mt(pe)},onReschedule:(pe,Pe)=>{ft(pe,Pe)},onSelect:pe=>{b("posts"),K("posts"),_({collection:"posts",key:pe}),v(null)}}):x==="site"?_e?o.jsx(iv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:_e.key,block:p[_e.key],decofile:p,meta:H,title:"Site",excludeFields:["seo"],schemaPending:Q(_e.resolveType,["seo"]),previewBaseUrl:n},`site:${_e.key}`):o.jsx(Ro,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):x==="seo"?o.jsx(Lle,{orgSlug:t,virtualMcpId:e,branch:s,decofile:p,meta:H,target:{kind:"site"},previewBaseUrl:i}):x==="sections"?o.jsx(rle,{selection:y?.collection==="sections"||y?.collection==="available-section"?y:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:p,isCreating:X.isPending,onCreateAvailable:ye,onSaveReferencedBlock:ke}):we?o.jsx(yle,{posts:Ye,categories:Se,initialSlug:O,isPending:X.isPending,onApply:(pe,Pe)=>{ht(pe,Pe)},onClose:F},O??"selection"):y&&y.collection!=="available-section"?y.collection==="apps"?o.jsx(iv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key],decofile:p,meta:H,previewBaseUrl:n,schemaPending:Q(typeof p[y.key]?.__resolveType=="string"?String(p[y.key].__resolveType):void 0)},`app:${y.key}`):y.collection==="posts"?o.jsx(xle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key],decofile:p,meta:H,previewBaseUrl:i},`post:${y.key}`):y.collection==="categories"?o.jsx(vle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key],decofile:p,meta:H,onManagePosts:wt,onOpenPost:pe=>{b("posts"),K("posts"),_({collection:"posts",key:pe}),v(null)},previewBaseUrl:i},`category:${y.key}`):y.collection==="authors"?o.jsx(ble,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:y.key,block:p[y.key]},`authors:${y.key}`):y.collection==="redirects"?o.jsx(kle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:p[y.key]},`redirect:${y.key}`):o.jsx(_le,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:y.collection==="pages"?y.path:"/",activePageBlockKey:y.collection==="pages"?y.key:null,activeGlobalBlockKey:y.collection==="sections"?y.key:null,initialEditSeo:y.collection==="pages"&&L===y.key,onExitSeo:()=>v(null)},y.collection==="pages"?`page:${y.key}`:`section:${y.key}`):o.jsx(Ro,{title:`Select ${uu(x)?`a ${du[x]}`:x==="pages"?"a page":x==="apps"?"an app":x==="redirects"?"a redirect":"a section"} to edit`,description:x==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),de&&o.jsx(Gre,{open:!!de,mode:de.mode,initialName:de.initialName,initialPath:de.initialPath,isPending:X.isPending,error:le,templates:ve,validate:dt,onSubmit:Qe,onOpenChange:pe=>{pe||(re(null),ne(void 0))}}),me&&o.jsx(Yre,{open:!!me,blockKey:me,initialName:Ce.find(pe=>pe.key===me)?.name??me,isPending:X.isPending,onSubmit:tt,onOpenChange:pe=>{pe||ee(null)}}),ue&&o.jsx(Soe,{open:!!ue,onOpenChange:pe=>{pe||J(null)},pageKey:ue,decofile:p,onSave:pe=>X.mutateAsync({blockKey:ue,data:pe})}),o.jsx(Kr,{open:!!oe,onOpenChange:pe=>{!pe&&!xt&&ie(null)},children:o.jsxs(Wr,{children:[o.jsxs(qr,{children:[o.jsx(Gr,{children:`Delete ${$t}?`}),o.jsx(Yr,{children:oe?.kind==="section"?`"${oe.label}" will be removed. Pages that still reference it will lose this section.`:oe?.kind==="blog-bulk"?`${oe.count} ${oe.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:oe?`"${oe.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Jr,{children:[o.jsx(Xr,{disabled:xt,children:"Cancel"}),o.jsx(Qr,{onClick:pe=>{pe.preventDefault(),St()},disabled:xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:xt?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function Vle(t){const e=U.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:y,onPostStatusFilterChange:_,onPostSortChange:L,selectedPostKeys:v,postBulkPanelOpen:S,onTogglePostSelect:w,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:V,selection:N,onSelect:T,onCreate:P,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:M,onDeletePage:I,onEditPageSeo:D,onViewPageJson:$,onDuplicateSection:O,onRenameSection:B,onDeleteSection:F,onDeleteRedirect:z,onDuplicateBlog:W,onDeleteBlog:K}=t;let H,q,G,Q,se,Z,te;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==M||e[7]!==V||e[8]!==j||e[9]!==P||e[10]!==K||e[11]!==I||e[12]!==z||e[13]!==F||e[14]!==W||e[15]!==E||e[16]!==O||e[17]!==D||e[18]!==C||e[19]!==y||e[20]!==b||e[21]!==L||e[22]!==_||e[23]!==R||e[24]!==B||e[25]!==f||e[26]!==T||e[27]!==k||e[28]!==w||e[29]!==$||e[30]!==n||e[31]!==p||e[32]!==S||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==r||e[39]!==v||e[40]!==N){const re=h.toLowerCase(),le=n.filter(ye=>!re||ye.name.toLowerCase().includes(re)||ye.path.toLowerCase().includes(re)),ne=i.filter(ye=>!re||ye.from.toLowerCase().includes(re)||ye.to.toLowerCase().includes(re)),me=r.filter(ye=>!re||ye.name.toLowerCase().includes(re)||ye.key.toLowerCase().includes(re)||ye.resolveType.toLowerCase().includes(re)),ee=l.filter(ye=>!re||ye.title.toLowerCase().includes(re)||ye.resolveType.toLowerCase().includes(re)||(ye.description?.toLowerCase().includes(re)??!1)),oe=gle(me),ie=a.filter(ye=>!re||ye.title.toLowerCase().includes(re)||ye.app.toLowerCase().includes(re)||ye.vendor.toLowerCase().includes(re)||ye.category.toLowerCase().includes(re)),ue=d.filter(ye=>!re||ye.label.toLowerCase().includes(re)||ye.subtitle.toLowerCase().includes(re)),J=s==="posts",he=Ele,ve=J?$k(u):[],je=new Map,Ce=new Map,Le={published:0,scheduled:0,draft:0};for(const ye of ve)Le[ye.status]=Le[ye.status]+1;for(const ye of ve){for(const ke of ye.categorySlugs)je.set(ke,(je.get(ke)??0)+1);for(const ke of ye.authorEmails)Ce.set(ke,(Ce.get(ke)??0)+1)}const _e=(J?Ru(u,"categories"):[]).map(ye=>{const{key:ke,payload:et}=ye,tt=he(et.slug)||ke;return{slug:tt,name:he(et.name)||he(et.slug)||ke,count:je.get(tt)??0}}).filter(Ple),Ne=(J?Ru(u,"authors"):[]).map(ye=>{const{key:ke,payload:et}=ye,tt=he(et.email);return{email:tt,name:he(et.name)||he(et.email)||ke,count:Ce.get(tt)??0}}).filter(Ale);let ge;e[48]!==m?(ge=ye=>!m||ye.categorySlugs.includes(m),e[48]=m,e[49]=ge):ge=e[49];let Te;e[50]!==p?(Te=ye=>!p||ye.authorEmails.includes(p),e[50]=p,e[51]=Te):Te=e[51];let Se;e[52]!==g?(Se=ye=>!g||ye.status===g,e[52]=g,e[53]=Se):Se=e[53];let we;e[54]!==x?(we=(ye,ke)=>{if(x==="az")return ye.title.localeCompare(ke.title);if(x==="za")return ke.title.localeCompare(ye.title);const et=ye.date.localeCompare(ke.date);return x==="date-asc"?et:-et},e[54]=x,e[55]=we):we=e[55];const Ye=ve.filter(ye=>!re||ye.title.toLowerCase().includes(re)||ye.slug.toLowerCase().includes(re)).filter(ge).filter(Te).filter(Se).sort(we),Ge=v.size,Ie=Ye.map(Tle),Oe=Ie.length>0&&Ie.every(ye=>v.has(ye)),pt=Ge>0||S,nt=()=>{Oe?j():k(Ie)},lt=`Search ${s}…`,gt=uu(s)?`Create new ${du[s]}`:s==="redirects"?"Create new redirect":"Create new page",bt=s!=="apps"&&s!=="sections";se="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let rt;e[56]===Symbol.for("react.memo_cache_sentinel")?(rt=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=rt):rt=e[56];let ct;e[57]!==f?(ct=ye=>f(ye.target.value),e[57]=f,e[58]=ct):ct=e[58];let Qe;e[59]!==lt||e[60]!==h||e[61]!==ct?(Qe=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[rt,o.jsx("input",{type:"text",value:h,onChange:ct,placeholder:lt,"aria-label":lt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=lt,e[60]=h,e[61]=ct,e[62]=Qe):Qe=e[62];let dt;e[63]!==gt||e[64]!==P||e[65]!==bt?(dt=bt&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:P,"aria-label":gt,children:o.jsx(Yt,{size:14})})}),o.jsx(Ke,{side:"bottom",children:gt})]}),e[63]=gt,e[64]=P,e[65]=bt,e[66]=dt):dt=e[66],e[67]!==Qe||e[68]!==dt?(Z=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Qe,dt]}),e[67]=Qe,e[68]=dt,e[69]=Z):Z=e[69],te=J&&(pt?o.jsx(fle,{count:Ge,allSelected:Oe,onToggleSelectAll:nt,onDelete:V,onExit:C}):o.jsx(lle,{categories:_e,authors:Ne,categoryFilter:m,statusCounts:Le,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:y,onStatusFilterChange:_,onSortChange:L})),H=Ql,Q="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",q="flex flex-col gap-1 p-1.5",G=s==="pages"?le.length===0?o.jsx(mc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(ye=>{const ke=N?.collection==="pages"&&N.key===ye.key,et=dw(u,ye.key);return o.jsx(_i,{icon:Mo,title:ye.name,subtitle:ye.path,active:ke,variantCount:et,onClick:()=>T({collection:"pages",key:ye.key,path:ye.path}),menu:o.jsx(Td,{onDuplicate:()=>E(ye),onRename:()=>R(ye),onAddVariant:()=>M(ye),onEditSeo:()=>D(ye),onViewJson:()=>$(ye),onDelete:()=>I(ye)})},ye.key)}):s==="sections"?me.length===0&&ee.length===0?o.jsx(mc,{hasItems:r.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[oe.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(nv,{icon:Hr,label:"Saved sections"}),oe.map(ye=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ye.label}),ye.sections.map(ke=>{const et=N?.collection==="sections"&&N.key===ke.key;return o.jsx(_i,{icon:Hr,accent:"global",title:ke.name,subtitle:ye.label,active:et,onClick:()=>T({collection:"sections",key:ke.key}),menu:o.jsx(Td,{onDuplicate:()=>O(ke),onRename:()=>B(ke),onDelete:()=>F(ke)})},ke.key)})]},ye.label))]}),ee.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(nv,{icon:Mo,label:"Available sections",className:ae(oe.length>0&&"mt-3")}),ee.map(ye=>{const ke=N?.collection==="available-section"&&N.resolveType===ye.resolveType,et=ye.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(_i,{icon:Mo,title:ye.title,subtitle:et??ye.resolveType,active:ke,onClick:()=>T({collection:"available-section",resolveType:ye.resolveType,title:ye.title})},ye.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(st,{className:"size-4.5 text-muted-foreground"})}):ie.length===0?o.jsx(mc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ie.map(ye=>{const ke=N?.collection==="apps"&&ye.blockKey!==null&&N.key===ye.blockKey;return o.jsx(_i,{icon:Z6,logoUrl:ye.logo,title:ye.title,subtitle:ye.category,active:ke,trailing:ye.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!ye.installed||!ye.blockKey){xe.message(`${ye.title} is not installed on this site.`);return}T({collection:"apps",key:ye.blockKey})}},ye.id)}):s==="redirects"?ne.length===0?o.jsx(mc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ne.map(ye=>o.jsx(_i,{icon:F6,title:ye.from||"(no source)",subtitle:`→ ${ye.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===ye.key,trailing:o.jsx(Jre,{type:ye.type}),onClick:()=>T({collection:"redirects",key:ye.key}),menu:o.jsx(Td,{onDelete:()=>z(ye)})},ye.key)):J?Ye.length===0?o.jsx(mc,{hasItems:ve.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ye.map(ye=>{const ke={key:ye.key,kind:"posts",label:ye.title,subtitle:ye.slug};return o.jsx(_i,{icon:Ai,title:ye.title,subtitle:ye.slug||"no slug",invalid:ye.missing.length>0,invalidReason:`Missing: ${ye.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===ye.key,selectable:!0,selectionActive:pt,selected:v.has(ye.key),onToggleSelect:()=>w(ye.key),onClick:()=>pt?w(ye.key):T({collection:"posts",key:ye.key}),menu:o.jsx(Td,{onDuplicate:()=>W(ke),onDelete:()=>K(ke)})},ye.key)}):ue.length===0?o.jsx(mc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${uu(s)?du[s]:"item"}.`}):ue.map(ye=>{const ke=N?.collection===ye.kind&&N.key===ye.key;return o.jsx(_i,{icon:ye.kind==="posts"?Ai:ye.kind==="authors"?t9:M2,title:ye.label,subtitle:ye.subtitle,active:ke,onClick:()=>T({collection:ye.kind,key:ye.key}),menu:o.jsx(Td,{onDuplicate:()=>W(ye),onDelete:()=>K(ye)})},ye.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=M,e[7]=V,e[8]=j,e[9]=P,e[10]=K,e[11]=I,e[12]=z,e[13]=F,e[14]=W,e[15]=E,e[16]=O,e[17]=D,e[18]=C,e[19]=y,e[20]=b,e[21]=L,e[22]=_,e[23]=R,e[24]=B,e[25]=f,e[26]=T,e[27]=k,e[28]=w,e[29]=$,e[30]=n,e[31]=p,e[32]=S,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=r,e[39]=v,e[40]=N,e[41]=H,e[42]=q,e[43]=G,e[44]=Q,e[45]=se,e[46]=Z,e[47]=te}else H=e[41],q=e[42],G=e[43],Q=e[44],se=e[45],Z=e[46],te=e[47];let X;e[70]!==q||e[71]!==G?(X=o.jsx("div",{className:q,children:G}),e[70]=q,e[71]=G,e[72]=X):X=e[72];let Y;e[73]!==H||e[74]!==Q||e[75]!==X?(Y=o.jsx(H,{className:Q,children:X}),e[73]=H,e[74]=Q,e[75]=X,e[76]=Y):Y=e[76];let de;return e[77]!==se||e[78]!==Z||e[79]!==te||e[80]!==Y?(de=o.jsxs("div",{className:se,children:[Z,te,Y]}),e[77]=se,e[78]=Z,e[79]=te,e[80]=Y,e[81]=de):de=e[81],de}function Tle(t){return t.key}function Ale(t){return t.email}function Ple(t){return t.slug}function Ele(t){return typeof t=="string"?t:""}function Rle(t){const e=U.c(25),{virtualMcpId:s}=t,n=ce(),[i,r]=A.useState(!1),l=Vs(s),{activeTask:a}=an();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=Zo(c);if(!(bn(l?.metadata)||bn(a?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(_n,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let m;e[2]!==n?(m=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=p):p=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>r(!0),x=o.jsx(_n,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let b;e[8]!==n?(b=n("mainPanelTabs.previewTab.connectGithub"),e[8]=n,e[9]=b):b=e[9];let y;e[10]!==b?(y=o.jsxs(fe,{onClick:g,children:[x,b]}),e[10]=b,e[11]=y):y=e[11];let _;e[12]!==m||e[13]!==p||e[14]!==y?(_=o.jsx(Vi,{className:"h-full",image:f,title:m,description:p,actions:y}),e[12]=m,e[13]=p,e[14]=y,e[15]=_):_=e[15];let L;e[16]!==i?(L=o.jsx(Ju,{open:i,onOpenChange:r,mode:"agent"}),e[16]=i,e[17]=L):L=e[17];let v;return e[18]!==L||e[19]!==_?(v=o.jsxs(o.Fragment,{children:[_,L]}),e[18]=L,e[19]=_,e[20]=v):v=e[20],v}let h;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(h=o.jsx(jle,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=h):h=e[24],h}function Dle(){const t=U.c(3),[e,s]=A.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let r;return t[1]!==e?(r=[e,i],t[1]=e,t[2]=r):r=t[2],r}function Mle(t){const e=U.c(6),{virtualMcpId:s}=t,n=Vs(s),i=I8();let r;e[0]!==i||e[1]!==n?(r=qf(i,$8(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const l=r;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Ile,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(Ble,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function Ile(){const t=U.c(12),e=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(ig,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Ole(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function $le(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function Ble(t){const e=U.c(99),{config:s}=t,n=ce(),[i,r]=A.useState(""),l=r9(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=nk(a),d=A9(),[u,h]=A.useState(!1),[f,m]=A.useState(null),p=A.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(O){if(!O)return;const B=Array.from(O);if(B.length===0)return;const F=[];for(const z of B)try{await d.mutateAsync({configId:s.id,file:z})}catch(W){const K=W;F.push(`${z.name} (${K instanceof Error?K.message:"upload failed"})`)}await c.refetch(),F.length>0&&xe.error(F.length===B.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(O){O.preventDefault(),h(!0)},e[8]=b):b=e[8];const y=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){h(!1)},e[9]=_):_=e[9];const L=_;let v;e[10]!==x?(v=function(O){O.preventDefault(),O.stopPropagation(),h(!1),x(O.dataTransfer.files)},e[10]=x,e[11]=v):v=e[11];const S=v,[w,k]=Dle();let j,C,V,N,T,P;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==w||e[16]!==x||e[17]!==u||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==S||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const O=(c.data?.pages??[]).flatMap(zle),B=$le(O,Ole(w)),F=l.trim(),z=i!==l||c.isFetching&&!c.isFetchingNextPage;T="flex h-full min-h-0 flex-col gap-3 p-4";let W;e[31]!==n?(W=n("assets.browser.title"),e[31]=n,e[32]=W):W=e[32];let K;e[33]!==W?(K=o.jsx("h2",{className:"text-sm font-semibold",children:W}),e[33]=W,e[34]=K):K=e[34];let H;e[35]!==s.name||e[36]!==n?(H=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=H):H=e[37];let q;e[38]!==H?(q=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:H}),e[38]=H,e[39]=q):q=e[39];let G;e[40]!==K||e[41]!==q?(G=o.jsxs("div",{className:"min-w-0",children:[K,q]}),e[40]=K,e[41]=q,e[42]=G):G=e[42];let Q;e[43]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>p.current?.click(),e[43]=Q):Q=e[43];let se;e[44]!==d.isPending?(se=d.isPending?o.jsx(st,{className:"size-3.5"}):o.jsx(Jn,{size:14}),e[44]=d.isPending,e[45]=se):se=e[45];let Z;e[46]!==n||e[47]!==d.isPending?(Z=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=Z):Z=e[48];let te;e[49]!==se||e[50]!==Z||e[51]!==d.isPending?(te=o.jsxs(fe,{type:"button",size:"sm",disabled:d.isPending,onClick:Q,children:[se,Z]}),e[49]=se,e[50]=Z,e[51]=d.isPending,e[52]=te):te=e[52];let X;e[53]!==x?(X=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ue=>{const J=Array.from(ue.target.files??[]);ue.target.value="",x(J)}}),e[53]=x,e[54]=X):X=e[54],e[55]!==G||e[56]!==te||e[57]!==X?(P=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[G,te,X]}),e[55]=G,e[56]=te,e[57]=X,e[58]=P):P=e[58];let Y;e[59]!==n?(Y=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=Y):Y=e[60],e[61]!==z||e[62]!==i||e[63]!==Y?(j=o.jsx(e9,{value:i,onChange:r,isSearching:z,placeholder:Y,className:"shrink-0"}),e[61]=z,e[62]=i,e[63]=Y,e[64]=j):j=e[64];let de;e[65]===Symbol.for("react.memo_cache_sentinel")?(de=()=>p.current?.click(),e[65]=de):de=e[65];const re=u&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ne;e[66]!==re||e[67]!==le?(ne=ae("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",re,le),e[66]=re,e[67]=le,e[68]=ne):ne=e[68];let me;e[69]===Symbol.for("react.memo_cache_sentinel")?(me=o.jsx(Jn,{size:16,className:"text-muted-foreground"}),e[69]=me):me=e[69];let ee;e[70]!==n?(ee=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ee):ee=e[71];let oe;e[72]!==n?(oe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=oe):oe=e[73];let ie;e[74]!==ee||e[75]!==oe?(ie=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ee," ",oe]}),e[74]=ee,e[75]=oe,e[76]=ie):ie=e[76],e[77]!==S||e[78]!==ne||e[79]!==ie?(C=o.jsxs("button",{type:"button",onClick:de,onDragOver:y,onDragLeave:L,onDrop:S,className:ne,children:[me,ie]}),e[77]=S,e[78]=ne,e[79]=ie,e[80]=C):C=e[80],V="min-h-0 flex-1 overflow-y-auto pr-1",N=O.length===0?F?o.jsx(lv,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(lv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:B.map((ue,J)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ue.map(he=>o.jsx(Fle,{item:he,onDelete:()=>m(he)},he.key))},J))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=w,e[16]=x,e[17]=u,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=S,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=V,e[28]=N,e[29]=T,e[30]=P}else j=e[25],C=e[26],V=e[27],N=e[28],T=e[29],P=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(st,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let R;e[84]!==E||e[85]!==V||e[86]!==N?(R=o.jsxs("div",{className:V,children:[N,E]}),e[84]=E,e[85]=V,e[86]=N,e[87]=R):R=e[87];let M;e[88]===Symbol.for("react.memo_cache_sentinel")?(M=()=>m(null),e[88]=M):M=e[88];let I;e[89]!==s.id||e[90]!==f?(I=o.jsx(Kle,{configId:s.id,item:f,onClose:M}),e[89]=s.id,e[90]=f,e[91]=I):I=e[91];let D;return e[92]!==j||e[93]!==C||e[94]!==R||e[95]!==I||e[96]!==T||e[97]!==P?(D=o.jsxs("div",{className:T,children:[P,j,C,R,I]}),e[92]=j,e[93]=C,e[94]=R,e[95]=I,e[96]=T,e[97]=P,e[98]=D):D=e[98],D}function zle(t){return t.items}function lv(t){const e=U.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(li,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,l]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Fle(t){const e=U.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=ik(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=H3(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:Ule}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Ai,{size:28,className:"text-muted-foreground"})}),e[4]=a,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const u=s.key;let h;e[12]!==s.key?(h=mf(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=rk(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==r||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",m]}),e[19]=r,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(Hle,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let y;return e[31]!==b||e[32]!==d?(y=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=y):y=e[33],y}function Ule(t){t.target.style.display="none"}function Hle(t){const e=U.c(36),{item:s,onDelete:n}=t,i=ce(),[r,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{xe.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(i9,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==r?(f=r?o.jsx(zt,{size:14}):o.jsx(vn,{size:14}),e[8]=r,e[9]=f):f=e[9];let m;e[10]!==r||e[11]!==i?(m=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs(Ze,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(mn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let y;e[20]!==s.publicUrl||e[21]!==b?(y=o.jsx(Ze,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(on,{size:14}),e[23]=_):_=e[23];let L;e[24]!==i?(L=i("assets.browser.deleteAction"),e[24]=i,e[25]=L):L=e[25];let v;e[26]!==n||e[27]!==L?(v=o.jsxs(Ze,{variant:"destructive",onClick:n,children:[_,L]}),e[26]=n,e[27]=L,e[28]=v):v=e[28];let S;e[29]!==y||e[30]!==v||e[31]!==p?(S=o.jsxs(Wt,{align:"end",children:[p,y,v]}),e[29]=y,e[30]=v,e[31]=p,e[32]=S):S=e[32];let w;return e[33]!==S||e[34]!==h?(w=o.jsxs(Ht,{children:[h,S]}),e[33]=S,e[34]=h,e[35]=w):w=e[35],w}function Kle(t){const e=U.c(47),{configId:s,item:n,onClose:i}=t,r=ce(),l=Xse();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==r?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),xe.success(r("assets.browser.deleted")),i()}catch{xe.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=r,e[5]=a):a=e[5];const c=a,d=!!n;let u;e[6]!==i?(u=N=>!N&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r?(h=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=h):h=e[9];let f;e[10]!==h?(f=o.jsx(Gr,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==r?(m=r("assets.browser.deleteConfirmDescription",{name:n?mf(n.key):""}),e[12]=n,e[13]=r,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(Yr,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=o.jsxs(qr,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let y;e[22]!==l.isPending||e[23]!==b?(y=o.jsx(Xr,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=y):y=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=ae(Xy({variant:"destructive"})),e[25]=_):_=e[25];const L=l.isPending;let v;e[26]!==c?(v=N=>{N.preventDefault(),c()},e[26]=c,e[27]=v):v=e[27];let S;e[28]!==l.isPending?(S=l.isPending?o.jsx(st,{className:"size-3.5"}):null,e[28]=l.isPending,e[29]=S):S=e[29];let w;e[30]!==r?(w=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=w):w=e[31];let k;e[32]!==l.isPending||e[33]!==v||e[34]!==S||e[35]!==w?(k=o.jsxs(Qr,{className:_,disabled:L,onClick:v,children:[S,w]}),e[32]=l.isPending,e[33]=v,e[34]=S,e[35]=w,e[36]=k):k=e[36];let j;e[37]!==y||e[38]!==k?(j=o.jsxs(Jr,{children:[y,k]}),e[37]=y,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(Wr,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let V;return e[43]!==C||e[44]!==d||e[45]!==u?(V=o.jsx(Kr,{open:d,onOpenChange:u,children:C}),e[43]=C,e[44]=d,e[45]=u,e[46]=V):V=e[46],V}const U1={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:tl},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:zr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:j6}},Wle=["fast","smart","thinking"];function qle(t){const e=U.c(19),{tier:s,onSelect:n}=t,i=ce(),[r,l]=A.useState(!1),a=U1[s].icon;let c;e[0]!==a?(c=o.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=U1[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Ls,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=Wle.map(x=>{const b=U1[x],y=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ae("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(y,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:i(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&o.jsx(zt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(hs,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==p?(g=o.jsxs(fs,{open:r,onOpenChange:l,children:[f,p]}),e[15]=r,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Gle(t){const e=U.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=ce(),[a,c]=A.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?o.jsx(A.Suspense,{fallback:o.jsx(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(Yle,{override:i,onOverrideChange:r})}):o.jsx(qle,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==r?(f=y=>{c(y),y||r(null)},e[11]=r,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=o.jsx(ii,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==h||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function Yle(t){const e=U.c(25),{override:s,onOverrideChange:n}=t,i=ce(),r=Jf(),l=r[0]?.id??null;let a;e[0]!==l||e[1]!==r||e[2]!==s?.credentialId?(a=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=r,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=A.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==r?(u=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=u):u=e[7];const h=u;let f;e[8]!==r||e[9]!==s?(f=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=f):f=e[10];const m=f;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let y;return e[13]!==b?(y=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=y):y=e[14],y}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==n?(g=b=>{const y=b.keyId??h??"";d(y),n({modelId:b.modelId,credentialId:y,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(UA,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const Hk=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:cg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:An},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:li},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:sr},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Uu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Ho,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Hf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:n9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:A2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:wu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Ho},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:zT}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Vl,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Vl},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Mc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Mc}]}],Jle=Hk.flatMap(t=>t.tools.map(e=>e.name));function Xle(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Qle(t){const e=U.c(12),{agentId:s,value:n,onChange:i}=t,r=ce();let l;e[0]!==r?(l=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(A.Suspense,{fallback:o.jsxs(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(cg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(Zle,{agentId:s,value:n,onChange:i})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:r("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=r,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function av(t){const e=U.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(id,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==r?(u=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=o.jsxs(us,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function cv(t){const e=U.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=ce(),d=r===l;let u;e[0]!==i||e[1]!==s?(u=s?o.jsx(so,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(qP,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=o.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==l?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",l]}),e[9]=r,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=_=>{_.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let y;return e[23]!==u||e[24]!==f||e[25]!==b?(y=o.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=y):y=e[26],y}function Zle(t){const e=U.c(83),{agentId:s,value:n,onChange:i}=t,r=ce(),{org:l}=Fe(),[a,c]=A.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=$s(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=y6(h),p=Ti();let g,x,b,y,_,L,v,S,w,k,j,C,V;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(p.map(iae)),M=new Map;for(const oe of f?.tools??[]){const ie=$r(oe._meta)??"__other__",ue=$u(oe.name,ie==="__other__"?void 0:ie),J=oe.title,he=J&&J!==oe.name?J:Xle(ue);M.has(ie)||M.set(ie,{clientId:ie,conn:R.get(ie),tools:[]}),M.get(ie).tools.push({name:oe.name,display:he,description:oe.description})}const I=[...M.values()].sort(nae),D=(f?.tools??[]).map(sae),$=[...Jle,...D],O=n===null?new Set($):new Set(n),B=$.every(oe=>O.has(oe)),F=oe=>i($.every(ie=>oe.has(ie))?null:[...oe]),z=oe=>{const ie=new Set(O);ie.has(oe)?ie.delete(oe):ie.add(oe),F(ie)},W=(oe,ie)=>{const ue=new Set(O);for(const J of oe)ie?ue.add(J):ue.delete(J);F(ue)};y=fs,V=a,_=c;let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(cg,{size:14,className:"text-muted-foreground"}),e[26]=K):K=e[26];let H;e[27]!==B||e[28]!==r?(H=r(B?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=B,e[28]=r,e[29]=H):H=e[29];const q=!B&&o.jsxs(iE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[O.size,"/",$.length]});let G;e[30]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(Ls,{size:14,className:"text-muted-foreground"}),e[30]=G):G=e[30],e[31]!==H||e[32]!==q?(L=o.jsx(ds,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[K,H,q,G]})}),e[31]=H,e[32]=q,e[33]=L):L=e[33],b=hs,j="p-0 w-80",C="start",x=Di;let Q;e[34]!==r?(Q=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=Q):Q=e[35],e[36]!==Q?(w=o.jsx(ui,{placeholder:Q}),e[36]=Q,e[37]=w):w=e[37];const se=B?r("automations.automationConfig.allToolsEnabled",{count:$.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:O.size,total:$.length});let Z;e[38]!==se?(Z=o.jsx("span",{className:"text-xs text-muted-foreground",children:se}),e[38]=se,e[39]=Z):Z=e[39];let te;e[40]!==i?(te=()=>i(null),e[40]=i,e[41]=te):te=e[41];let X;e[42]!==r?(X=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=X):X=e[43];let Y;e[44]!==B||e[45]!==te||e[46]!==X?(Y=o.jsx("button",{type:"button",onClick:te,disabled:B,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:X}),e[44]=B,e[45]=te,e[46]=X,e[47]=Y):Y=e[47];let de;e[48]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=de):de=e[48];let re;e[49]!==i?(re=()=>i([]),e[49]=i,e[50]=re):re=e[50];const le=O.size===0;let ne;e[51]!==r?(ne=r("automations.automationConfig.clear"),e[51]=r,e[52]=ne):ne=e[52];let me;e[53]!==re||e[54]!==le||e[55]!==ne?(me=o.jsx("button",{type:"button",onClick:re,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ne}),e[53]=re,e[54]=le,e[55]=ne,e[56]=me):me=e[56];let ee;e[57]!==Y||e[58]!==me?(ee=o.jsxs("div",{className:"flex items-center gap-2",children:[Y,de,me]}),e[57]=Y,e[58]=me,e[59]=ee):ee=e[59],e[60]!==Z||e[61]!==ee?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[Z,ee]}),e[60]=Z,e[61]=ee,e[62]=k):k=e[62],g=hi,v="max-h-80",S=m?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(Bn,{children:r("automations.automationConfig.noToolsFound")}),Hk.map(oe=>{const ie=oe.tools.map(tae),ue=ie.filter(J=>O.has(J)).length;return o.jsx(Es,{heading:o.jsx(cv,{label:r(oe.headingKey),icon:oe.icon,on:ue,total:ie.length,onToggle:()=>W(ie,ue!==ie.length)}),children:oe.tools.map(J=>o.jsx(av,{value:`${r(J.titleKey)} ${J.name}`,checked:O.has(J.name),onToggle:()=>z(J.name),title:r(J.titleKey),description:r(J.descriptionKey),leading:o.jsx(J.icon,{size:16,className:"text-muted-foreground"})},J.name))},oe.key)}),I.map(oe=>{const ie=oe.tools.map(eae),ue=ie.filter(J=>O.has(J)).length;return o.jsx(Es,{heading:o.jsx(cv,{conn:oe.conn,on:ue,total:ie.length,onToggle:()=>W(ie,ue!==ie.length)}),children:oe.tools.map(J=>o.jsx(av,{value:`${J.display} ${J.name} ${oe.conn?.title??""}`,checked:O.has(J.name),onToggle:()=>z(J.name),title:J.display,description:J.description},J.name))},oe.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=y,e[17]=_,e[18]=L,e[19]=v,e[20]=S,e[21]=w,e[22]=k,e[23]=j,e[24]=C,e[25]=V}else g=e[13],x=e[14],b=e[15],y=e[16],_=e[17],L=e[18],v=e[19],S=e[20],w=e[21],k=e[22],j=e[23],C=e[24],V=e[25];let N;e[63]!==g||e[64]!==v||e[65]!==S?(N=o.jsx(g,{className:v,children:S}),e[63]=g,e[64]=v,e[65]=S,e[66]=N):N=e[66];let T;e[67]!==x||e[68]!==N||e[69]!==w||e[70]!==k?(T=o.jsxs(x,{children:[w,k,N]}),e[67]=x,e[68]=N,e[69]=w,e[70]=k,e[71]=T):T=e[71];let P;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==C?(P=o.jsx(b,{className:j,align:C,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=C,e[76]=P):P=e[76];let E;return e[77]!==y||e[78]!==_||e[79]!==L||e[80]!==P||e[81]!==V?(E=o.jsxs(y,{open:V,onOpenChange:_,children:[L,P]}),e[77]=y,e[78]=_,e[79]=L,e[80]=P,e[81]=V,e[82]=E):E=e[82],E}function eae(t){return t.name}function tae(t){return t.name}function sae(t){return t.name}function nae(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function iae(t){return[t.id,t]}function hu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function rae(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const a=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function oae(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function lae(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function aae(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const cae=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function dae({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=ce(),{triggerAdd:a}=Qu(),[c,d]=A.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),xe.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");xe.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?r?.(p.webhook):xe.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");xe.error(g)}};return o.jsxs(Ht,{open:u,onOpenChange:h,children:[o.jsx(Kt,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",children:[o.jsx(Yt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(Wt,{align:"end",className:"w-[200px]",children:[o.jsxs(Zi,{children:[o.jsxs(er,{className:"gap-2.5",children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(tr,{className:"w-[160px]",children:cae.map(p=>o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[o.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[o.jsx(An,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Kk(t){const e=U.c(39),{open:s,onOpenChange:n,url:i,token:r,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,u=ce(),[h,f]=A.useState(null),[m,p]=A.useState("curl"),[g,x]=A.useState("header"),b=A.useId();let y;e[0]!==u?(y=async(I,D)=>{try{await navigator.clipboard.writeText(I),f(D),xe.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{xe.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=y):y=e[1];const _=y;let L;e[2]!==g||e[3]!==r||e[4]!==i?(L=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=L):L=e[5];const v=L,S=i&&r?g==="header"?`curl -X POST "${v}" \\
|
|
624
624
|
-H "Authorization: Bearer ${r}" \\
|
|
625
625
|
-H "Content-Type: application/json" \\
|
|
626
626
|
-d '{"hello":"world"}'`:`curl -X POST "${v}" \\
|
|
@@ -639,7 +639,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
639
639
|
},
|
|
640
640
|
body: JSON.stringify({ hello: "world" }),
|
|
641
641
|
});`:"",k=m==="curl"?S:w;let j;e[6]!==c?(j=o.jsx(Gt,{children:c}),e[6]=c,e[7]=j):j=e[7];let C;e[8]!==d?(C=o.jsx(Tn,{children:d}),e[8]=d,e[9]=C):C=e[9];let V;e[10]!==j||e[11]!==C?(V=o.jsxs(ms,{children:[j,C]}),e[10]=j,e[11]=C,e[12]=V):V=e[12];let N;e[13]!==g||e[14]!==h||e[15]!==_||e[16]!==v||e[17]!==m||e[18]!==k||e[19]!==u||e[20]!==r||e[21]!==b||e[22]!==i?(N=i&&r?o.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:u("automations.webhookSecretDialog.url")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:v}),o.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>_(v,"url"),children:[o.jsx(vn,{size:13}),u(h==="url"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:u("automations.webhookSecretDialog.tokenLabel")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:r}),o.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>_(r,"token"),children:[o.jsx(vn,{size:13}),u(h==="token"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:u("automations.webhookSecretDialog.snippet")}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Xl,{value:m,onValueChange:I=>p(I),children:o.jsxs(ed,{className:"h-8 p-[2px]",children:[o.jsx(ni,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),o.jsx(ni,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),o.jsxs("label",{htmlFor:b,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[o.jsx(id,{id:b,checked:g==="url",onCheckedChange:I=>x(I?"url":"header")}),u("automations.webhookSecretDialog.tokenInUrl")]})]}),o.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>_(k,"example"),children:[o.jsx(vn,{size:13}),u(h==="example"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]}),o.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:o.jsx(ld,{code:k,language:m==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[13]=g,e[14]=h,e[15]=_,e[16]=v,e[17]=m,e[18]=k,e[19]=u,e[20]=r,e[21]=b,e[22]=i,e[23]=N):N=e[23];let T;e[24]!==n?(T=()=>n(!1),e[24]=n,e[25]=T):T=e[25];let P;e[26]!==u?(P=u("automations.webhookSecretDialog.done"),e[26]=u,e[27]=P):P=e[27];let E;e[28]!==P||e[29]!==T?(E=o.jsx(Yn,{children:o.jsx(fe,{onClick:T,children:P})}),e[28]=P,e[29]=T,e[30]=E):E=e[30];let R;e[31]!==E||e[32]!==V||e[33]!==N?(R=o.jsxs(Ft,{className:"max-w-lg",children:[V,N,E]}),e[31]=E,e[32]=V,e[33]=N,e[34]=R):R=e[34];let M;return e[35]!==n||e[36]!==s||e[37]!==R?(M=o.jsx(Ut,{open:s,onOpenChange:n,children:R}),e[35]=n,e[36]=s,e[37]=R,e[38]=M):M=e[38],M}function uae(t){const e=U.c(137),{trigger:s,automationId:n,connectionName:i}=t,r=ce(),{triggerAdd:l,triggerRemove:a,triggerRotateToken:c}=Qu(),[d,u]=A.useState(!1),[h,f]=A.useState(!1),[m,p]=A.useState(null);let g;e[0]!==s.cron_expression?(g=s.cron_expression?lae(s.cron_expression):null,e[0]=s.cron_expression,e[1]=g):g=e[1];const x=g,[b,y]=A.useState(x?.count??1),[_,L]=A.useState(!1),[v,S]=A.useState(s.cron_expression??""),w=a.isPending||l.isPending||c.isPending,k=s.type==="cron",j=s.type==="webhook";let C;e[2]!==n||e[3]!==a||e[4]!==r||e[5]!==s.id?(C=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:n}),xe.success(r("automations.triggerCard.starterRemoved"))}catch{xe.error(r("automations.triggerCard.failedToRemoveStarter"))}u(!1)},e[2]=n,e[3]=a,e[4]=r,e[5]=s.id,e[6]=C):C=e[6];const V=C;let N;e[7]!==l||e[8]!==n||e[9]!==a||e[10]!==s.id?(N=async Oe=>{await l.mutateAsync({automation_id:n,type:"cron",cron_expression:Oe}),await a.mutateAsync({trigger_id:s.id,automation_id:n})},e[7]=l,e[8]=n,e[9]=a,e[10]=s.id,e[11]=N):N=e[11];const T=N;let P;e[12]!==v||e[13]!==T||e[14]!==r||e[15]!==s.cron_expression?(P=async()=>{const Oe=v.trim();if(!Oe||!hu(Oe)||Oe===s.cron_expression){L(!1),S(s.cron_expression??"");return}try{await T(Oe),L(!1)}catch{xe.error(r("automations.triggerCard.failedToUpdateStarter")),S(s.cron_expression??""),L(!1)}},e[12]=v,e[13]=T,e[14]=r,e[15]=s.cron_expression,e[16]=P):P=e[16];const E=P;let R;e[17]!==n||e[18]!==c||e[19]!==s.id?(R=async()=>{f(!1);try{const Oe=await c.mutateAsync({trigger_id:s.id,automation_id:n});p({url:Oe.url,token:Oe.token})}catch(Oe){const pt=Oe,nt=pt instanceof Error?pt.message:"Failed to rotate token";xe.error(nt)}},e[17]=n,e[18]=c,e[19]=s.id,e[20]=R):R=e[20];const M=R;let I;e[21]!==x||e[22]!==T||e[23]!==r||e[24]!==s.cron_expression?(I=async Oe=>{if(!x)return;const pt=x.unit==="minutes"?5:1,nt=Math.max(pt,Oe);nt!==Oe&&y(nt);const lt=oae(nt,x.unit);if(lt!==s.cron_expression)try{await T(lt)}catch{xe.error(r("automations.triggerCard.failedToUpdateStarter")),y(x.count)}},e[21]=x,e[22]=T,e[23]=r,e[24]=s.cron_expression,e[25]=I):I=e[25];const D=I;let $;e[26]!==k||e[27]!==j?($=k?o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}):j?o.jsx(An,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=k,e[27]=j,e[28]=$):$=e[28];let O;e[29]!==i||e[30]!==b||e[31]!==v||e[32]!==D||e[33]!==E||e[34]!==x||e[35]!==k||e[36]!==_||e[37]!==w||e[38]!==j||e[39]!==r||e[40]!==s.cron_expression||e[41]!==s.event_type||e[42]!==s.params?(O=x&&k?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:r("automations.triggerCard.every")}),o.jsx("input",{type:"number",min:x.unit==="minutes"?5:1,value:b,onChange:Oe=>y(parseInt(Oe.target.value)||1),onBlur:()=>D(b),onKeyDown:Oe=>{Oe.key==="Enter"&&Oe.target.blur(),Oe.key==="Escape"&&y(x.count)},disabled:w,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("span",{className:"text-sm",children:aae(x.unit,b)})]}):k&&_?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:v,onChange:Oe=>S(Oe.target.value),onBlur:E,onKeyDown:Oe=>{Oe.key==="Enter"&&Oe.target.blur(),Oe.key==="Escape"&&(L(!1),S(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),v&&!hu(v)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:r("automations.triggerCard.invalid")})]}):o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:k?rae(s.cron_expression??""):j?r("automations.triggerCard.webhookPostToFire"):`${s.event_type}${i?` · ${i}`:""}`}),!k&&!j&&s.params&&Object.keys(s.params).length>0&&o.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(hae).join(", ")})]}),e[29]=i,e[30]=b,e[31]=v,e[32]=D,e[33]=E,e[34]=x,e[35]=k,e[36]=_,e[37]=w,e[38]=j,e[39]=r,e[40]=s.cron_expression,e[41]=s.event_type,e[42]=s.params,e[43]=O):O=e[43];let B;e[44]!==w?(B=w&&o.jsx(st,{className:"size-[13px] text-muted-foreground"}),e[44]=w,e[45]=B):B=e[45];let F;e[46]!==x||e[47]!==k||e[48]!==_||e[49]!==s.cron_expression?(F=k&&!x&&!_&&o.jsx(fe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{S(s.cron_expression??""),L(!0)},children:o.jsx(n9,{size:13,className:"text-muted-foreground"})}),e[46]=x,e[47]=k,e[48]=_,e[49]=s.cron_expression,e[50]=F):F=e[50];let z;e[51]!==j||e[52]!==r?(z=j&&o.jsx(fe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:r("automations.triggerCard.rotateToken"),onClick:()=>f(!0),children:o.jsx($n,{size:13,className:"text-muted-foreground"})}),e[51]=j,e[52]=r,e[53]=z):z=e[53];let W;e[54]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(fe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>u(!0),children:o.jsx(Ni,{size:13,className:"text-muted-foreground"})}),e[54]=W):W=e[54];let K;e[55]!==F||e[56]!==z||e[57]!==B?(K=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[B,F,z,W]}),e[55]=F,e[56]=z,e[57]=B,e[58]=K):K=e[58];let H;e[59]!==K||e[60]!==$||e[61]!==O?(H=o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[$,O,K]}),e[59]=K,e[60]=$,e[61]=O,e[62]=H):H=e[62];let q;e[63]!==r?(q=r("automations.triggerCard.removeStarter"),e[63]=r,e[64]=q):q=e[64];let G;e[65]!==q?(G=o.jsx(Gr,{children:q}),e[65]=q,e[66]=G):G=e[66];let Q;e[67]!==r?(Q=r("automations.triggerCard.confirmRemoveStarter"),e[67]=r,e[68]=Q):Q=e[68];let se;e[69]!==Q?(se=o.jsx(Yr,{children:Q}),e[69]=Q,e[70]=se):se=e[70];let Z;e[71]!==G||e[72]!==se?(Z=o.jsxs(qr,{children:[G,se]}),e[71]=G,e[72]=se,e[73]=Z):Z=e[73];let te;e[74]!==r?(te=r("automations.triggerCard.cancel"),e[74]=r,e[75]=te):te=e[75];let X;e[76]!==te?(X=o.jsx(Xr,{children:te}),e[76]=te,e[77]=X):X=e[77];let Y;e[78]!==r?(Y=r("automations.triggerCard.remove"),e[78]=r,e[79]=Y):Y=e[79];let de;e[80]!==V||e[81]!==Y?(de=o.jsx(Qr,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[80]=V,e[81]=Y,e[82]=de):de=e[82];let re;e[83]!==X||e[84]!==de?(re=o.jsxs(Jr,{children:[X,de]}),e[83]=X,e[84]=de,e[85]=re):re=e[85];let le;e[86]!==Z||e[87]!==re?(le=o.jsxs(Wr,{children:[Z,re]}),e[86]=Z,e[87]=re,e[88]=le):le=e[88];let ne;e[89]!==d||e[90]!==le?(ne=o.jsx(Kr,{open:d,onOpenChange:u,children:le}),e[89]=d,e[90]=le,e[91]=ne):ne=e[91];let me;e[92]!==r?(me=r("automations.triggerCard.rotateWebhookToken"),e[92]=r,e[93]=me):me=e[93];let ee;e[94]!==me?(ee=o.jsx(Gr,{children:me}),e[94]=me,e[95]=ee):ee=e[95];let oe;e[96]!==r?(oe=r("automations.triggerCard.rotateWebhookTokenDescription"),e[96]=r,e[97]=oe):oe=e[97];let ie;e[98]!==oe?(ie=o.jsx(Yr,{children:oe}),e[98]=oe,e[99]=ie):ie=e[99];let ue;e[100]!==ee||e[101]!==ie?(ue=o.jsxs(qr,{children:[ee,ie]}),e[100]=ee,e[101]=ie,e[102]=ue):ue=e[102];let J;e[103]!==r?(J=r("automations.triggerCard.cancel"),e[103]=r,e[104]=J):J=e[104];let he;e[105]!==J?(he=o.jsx(Xr,{children:J}),e[105]=J,e[106]=he):he=e[106];let ve;e[107]!==r?(ve=r("automations.triggerCard.rotate"),e[107]=r,e[108]=ve):ve=e[108];let je;e[109]!==M||e[110]!==ve?(je=o.jsx(Qr,{onClick:M,children:ve}),e[109]=M,e[110]=ve,e[111]=je):je=e[111];let Ce;e[112]!==he||e[113]!==je?(Ce=o.jsxs(Jr,{children:[he,je]}),e[112]=he,e[113]=je,e[114]=Ce):Ce=e[114];let Le;e[115]!==ue||e[116]!==Ce?(Le=o.jsxs(Wr,{children:[ue,Ce]}),e[115]=ue,e[116]=Ce,e[117]=Le):Le=e[117];let _e;e[118]!==h||e[119]!==Le?(_e=o.jsx(Kr,{open:h,onOpenChange:f,children:Le}),e[118]=h,e[119]=Le,e[120]=_e):_e=e[120];const Ne=m!==null;let ge;e[121]===Symbol.for("react.memo_cache_sentinel")?(ge=Oe=>{Oe||p(null)},e[121]=ge):ge=e[121];const Te=m?.url??null,Se=m?.token??null;let we;e[122]!==r?(we=r("automations.triggerCard.newWebhookToken"),e[122]=r,e[123]=we):we=e[123];let Ye;e[124]!==r?(Ye=r("automations.triggerCard.newWebhookTokenDescription"),e[124]=r,e[125]=Ye):Ye=e[125];let Ge;e[126]!==Ne||e[127]!==Te||e[128]!==Se||e[129]!==we||e[130]!==Ye?(Ge=o.jsx(Kk,{open:Ne,onOpenChange:ge,url:Te,token:Se,title:we,description:Ye}),e[126]=Ne,e[127]=Te,e[128]=Se,e[129]=we,e[130]=Ye,e[131]=Ge):Ge=e[131];let Ie;return e[132]!==H||e[133]!==ne||e[134]!==_e||e[135]!==Ge?(Ie=o.jsxs(o.Fragment,{children:[H,ne,_e,Ge]}),e[132]=H,e[133]=ne,e[134]=_e,e[135]=Ge,e[136]=Ie):Ie=e[136],Ie}function hae(t){const[e,s]=t;return`${e}: ${s}`}function fae(t){const e=U.c(70),{automationId:s,onDone:n}=t,i=ce();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const l=Ti(r),[a,c]=A.useState(),[d,u]=A.useState();let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h={},e[1]=h):h=e[1];const[f,m]=A.useState(h),{triggerAdd:p}=Qu(),{data:g,isLoading:x}=rE(a);let b,y,_,L,v,S;if(e[2]!==p||e[3]!==s||e[4]!==a||e[5]!==d||e[6]!==x||e[7]!==n||e[8]!==f||e[9]!==i||e[10]!==l||e[11]!==g){const j=g?.find(B=>B.type===d);let C;e[18]!==p||e[19]!==s||e[20]!==a||e[21]!==d||e[22]!==n||e[23]!==f||e[24]!==i?(C=async()=>{if(!(!a||!d))try{await p.mutateAsync({automation_id:s,type:"event",event_type:d,connection_id:a,params:f}),qe("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:d}),xe.success(i("automations.eventTriggerForm.successAdded")),n()}catch{xe.error(i("automations.eventTriggerForm.errorFailed"))}},e[18]=p,e[19]=s,e[20]=a,e[21]=d,e[22]=n,e[23]=f,e[24]=i,e[25]=C):C=e[25],b=C,y="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=V):V=e[26];let N;e[27]!==i?(N=i("automations.eventTriggerForm.title"),e[27]=i,e[28]=N):N=e[28];let T;e[29]!==N?(T=o.jsx("span",{className:"text-sm font-medium",children:N}),e[29]=N,e[30]=T):T=e[30];let P;e[31]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Ni,{size:13}),e[31]=P):P=e[31];let E;e[32]!==n?(E=o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:n,children:P}),e[32]=n,e[33]=E):E=e[33],e[34]!==T||e[35]!==E?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[V,T,E]}),e[34]=T,e[35]=E,e[36]=_):_=e[36];const R=a??"";let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=B=>{c(B),u(void 0),m({})},e[37]=M):M=e[37];let I;e[38]!==i?(I=i("automations.eventTriggerForm.selectConnectionPlaceholder"),e[38]=i,e[39]=I):I=e[39];let D;e[40]!==I?(D=o.jsx(js,{className:"w-full",children:o.jsx(Ds,{placeholder:I})}),e[40]=I,e[41]=D):D=e[41];let $;e[42]!==i||e[43]!==l?($=l.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:i("automations.eventTriggerForm.noConnectionsWithTrigger")}):l.map(gae),e[42]=i,e[43]=l,e[44]=$):$=e[44];let O;e[45]!==$?(O=o.jsx(Cs,{children:$}),e[45]=$,e[46]=O):O=e[46],e[47]!==R||e[48]!==D||e[49]!==O?(L=o.jsxs(ks,{value:R,onValueChange:M,children:[D,O]}),e[47]=R,e[48]=D,e[49]=O,e[50]=L):L=e[50],e[51]!==a||e[52]!==d||e[53]!==x||e[54]!==i||e[55]!==g?(v=a&&o.jsxs(ks,{value:d??"",onValueChange:B=>{u(B),m({})},children:[o.jsx(js,{className:"w-full",children:x?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(st,{className:"size-[13px]"}),i("automations.eventTriggerForm.loadingEvents")]}):o.jsx(Ds,{placeholder:i("automations.eventTriggerForm.selectEventTypePlaceholder"),children:d??i("automations.eventTriggerForm.selectEventTypePlaceholder")})}),o.jsx(Cs,{children:g?.map(pae)})]}),e[51]=a,e[52]=d,e[53]=x,e[54]=i,e[55]=g,e[56]=v):v=e[56],S=j?.paramsSchema&&Object.keys(j.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(j.paramsSchema).map(B=>{const[F,z]=B;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[F,z.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",z.description]})]}),z.enum?o.jsxs(ks,{value:f[F]??"",onValueChange:W=>m(K=>({...K,[F]:W})),children:[o.jsx(js,{className:"w-full",children:o.jsx(Ds,{placeholder:i("automations.eventTriggerForm.selectParamPlaceholder",{key:F})})}),o.jsx(Cs,{children:z.enum.map(mae)})]}):o.jsx("input",{type:"text",value:f[F]??"",onChange:W=>m(K=>({...K,[F]:W.target.value})),placeholder:z.description??F,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},F)})}),e[2]=p,e[3]=s,e[4]=a,e[5]=d,e[6]=x,e[7]=n,e[8]=f,e[9]=i,e[10]=l,e[11]=g,e[12]=b,e[13]=y,e[14]=_,e[15]=L,e[16]=v,e[17]=S}else b=e[12],y=e[13],_=e[14],L=e[15],v=e[16],S=e[17];let w;e[57]!==p||e[58]!==a||e[59]!==d||e[60]!==b||e[61]!==i?(w=a&&d&&o.jsx(fe,{size:"sm",onClick:b,disabled:p.isPending,children:p.isPending?o.jsx(st,{className:"size-[13px]"}):i("automations.eventTriggerForm.addTriggerButton")}),e[57]=p,e[58]=a,e[59]=d,e[60]=b,e[61]=i,e[62]=w):w=e[62];let k;return e[63]!==y||e[64]!==_||e[65]!==L||e[66]!==v||e[67]!==S||e[68]!==w?(k=o.jsxs("div",{className:y,children:[_,L,v,S,w]}),e[63]=y,e[64]=_,e[65]=L,e[66]=v,e[67]=S,e[68]=w,e[69]=k):k=e[69],k}function mae(t){return o.jsx(Ot,{value:t,children:t},t)}function pae(t){return o.jsx(Ot,{value:t.type,children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:t.type}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function gae(t){return o.jsx(Ot,{value:t.id,children:t.title},t.id)}const xae=30;function bae(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},n=new Set(s.fields);for(const i of e.fields)n.add(i);return{...s,fields:n,saveCount:s.saveCount+1}}case"reset":return null}}function vae({automationId:t,automation:e,onBack:s,onDelete:n}){const i=ce(),r=e.virtual_mcp_id,{org:l}=Fe(),{update:a,triggerAdd:c,run:d}=Qu(),u=Ti(),h=new Map(u.map(Y=>[Y.id,Y.title])),{openTask:f}=an(),{openSidePanel:m}=Gl(),{sendMessage:p}=ci(),g=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[x,b]=A.useState(g),[y,_]=A.useState(!1),[L,v]=A.useState(!1),[S,w]=A.useState(!1),[k,j]=A.useState(""),[C,V]=A.useState(!1),[N,T]=A.useState(null),[P,E]=A.useState(!1),[R,M]=A.useState(!1),[I,D]=A.useState(!1),$=async()=>{if(P)return;const de=IN(x).filter(re=>re.type==="text").map(re=>re.text).join(`
|
|
642
|
-
`);if(de.trim()){E(!0);try{Z(),qe("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:de.length}),m(),await p({tiptapDoc:b_({managerAgentId:u6.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:de})})}finally{E(!1)}}},O=e.models?.tier??"smart",B=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=a2({defaultValues:{name:e.name,active:e.active,tier:O,modelOverride:B,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),z=F.watch("active"),[W,K]=A.useReducer(bae,null),H=()=>{W!==null&&(qe("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(W.fields),save_count:W.saveCount,edit_duration_ms:Date.now()-W.start}),K({type:"reset"}))},q=async()=>{const Y=F.control._formState.dirtyFields,de=Object.keys(Y);if(de.length===0&&!I)return!0;const re=F.getValues(),le=F.control._defaultValues;F.reset(re,{keepValues:!0});const ne=I;D(!1);const me={tier:re.tier,...re.modelOverride?{modelId:re.modelOverride.modelId,credentialId:re.modelOverride.credentialId,modelTitle:re.modelOverride.title}:{}},ee={id:t,name:re.name,active:re.active,models:me,tools:re.tools,maxAgentSteps:re.maxAgentSteps,messages:MN(x),temperature:0};try{await a.mutateAsync(ee)}catch{return F.reset(le,{keepValues:!0}),ne&&D(!0),!1}const oe=[...de];return ne&&oe.push("messages"),K({type:"accumulate",now:Date.now(),fields:oe}),se(),!0},{schedule:G,flush:Q}=Oh({save:q}),{schedule:se,flush:Z}=Oh({delayMs:3e4,save:async()=>H()});A.useEffect(()=>{const Y=F.watch(()=>G());return()=>Y.unsubscribe()},[]);const te=Y=>{if(b(Y),!R){M(!0);return}D(!0),G()},X=async()=>{qe("automation_test_clicked",{automation_id:t,agent_id:r});const Y=await Q();if(Z(),!!Y){if(!x){xe.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const de=await d.mutateAsync(t);de.threadId&&(m(),f(de.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(fe,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Kf,{size:14}),i("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(vs,{control:F.control,name:"name",render:({field:Y})=>o.jsx(kt,{...Y,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(fe,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(on,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vs,{control:F.control,name:"active",render:({field:Y})=>o.jsx(ii,{checked:Y.value,onCheckedChange:de=>{Y.onChange(de),Q()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i(z?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(v_,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.starter")}),o.jsx(dae,{automationId:t,open:y,onOpenChange:_,onCustomSelect:()=>{w(!0),V(!1),j("")},onEventSelect:()=>{V(!0),w(!1)},onWebhookCreated:Y=>{qe("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),T(Y)}})]}),e.triggers.length===0&&!S?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[i("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>_(!0),children:i("automations.automationDetail.addStarter")})," ",i("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Y=>o.jsx(uae,{trigger:Y,automationId:t,connectionName:Y.connection_id?h.get(Y.connection_id):void 0},Y.id))}),S&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:Y=>j(Y.target.value),onBlur:async()=>{const Y=k.trim();if(!(!Y||!hu(Y)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:Y}),qe("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),xe.success(i("automations.automationDetail.starterAdded")),w(!1),j("")}catch{xe.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async Y=>{const de=k.trim();Y.key==="Enter"&&de&&hu(de)&&Y.target.blur(),Y.key==="Escape"&&(w(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!hu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(st,{className:"size-[13px] text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),j("")},children:o.jsx(Ni,{size:13})})]}),C&&o.jsx(A.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(st,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(fae,{automationId:t,onDone:()=>V(!1)})}),o.jsx(Kk,{open:N!==null,onOpenChange:Y=>{Y||T(null)},url:N?.url??null,token:N?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:P||!x,onClick:$,children:[o.jsx(zr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(D7,{tiptapDoc:x,setTiptapDoc:te,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(M7,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:X,disabled:!r,children:[o.jsx(Af,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(Ke,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(c6,{open:L,onOpenChange:v,className:"flex flex-col gap-2.5",children:[o.jsxs(l6,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.advanced")}),o.jsx(Ls,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(a6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(Gle,{tier:F.watch("tier"),onTierChange:Y=>F.setValue("tier",Y,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:Y=>F.setValue("modelOverride",Y,{shouldDirty:!0})}),o.jsx(Qle,{agentId:r||null,value:F.watch("tools"),onChange:Y=>F.setValue("tools",Y,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.maxSteps")}),o.jsx(kt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:xae}),value:F.watch("maxAgentSteps")??"",onChange:Y=>{const de=Y.target.value.trim(),re=de===""?null:Number(de);F.setValue("maxAgentSteps",re===null||Number.isNaN(re)?null:re,{shouldDirty:!0})}})]})]})]})]})]})}const Wk=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function qk(t){const e=Wk.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function yae(t){const e=U.c(16),{automationId:s,triggerIds:n}=t,i=ce(),[r,l]=A.useState("30d"),[a,c]=A.useState(_ae);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(qk(b))},e[0]=d):d=e[0];let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(js,{className:"w-44",children:o.jsx(Ds,{})}),e[1]=u):u=e[1];let h;e[2]!==i?(h=Wk.map(x=>o.jsx(Ot,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=h):h=e[3];let f;e[4]!==h?(f=o.jsx(Cs,{children:h}),e[4]=h,e[5]=f):f=e[5];let m;e[6]!==f||e[7]!==r?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ks,{value:r,onValueChange:d,children:[u,f]})}),e[6]=f,e[7]=r,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==a||e[11]!==n?(p=o.jsx(CV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function _ae(){return qk("30d")}function Lae(t){const e=U.c(5),{tabId:s}=t;let n;e[0]!==s?(n=Ry(s),e[0]=s,e[1]=n):n=e[1];const i=n;if(!i)return null;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Sl,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(A.Suspense,{fallback:r,children:o.jsx(Sae,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function Sae(t){const e=U.c(41),{id:s}=t,n=ce(),{openPanel:i}=pr(),{data:r,isLoading:l}=oE(s),[a,c]=A.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const u=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Sl,{}),e[2]=C):C=e[2],C}if(!r){let C;e[3]!==n?(C=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=C):C=e[4];let V;return e[5]!==C?(V=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:C}),e[5]=C,e[6]=V):V=e[6],V}let h;e[7]!==r.triggers?(h=r.triggers.map(wae),e[7]=r.triggers,e[8]=h):h=e[8];const f=h;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Kf,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==u||e[13]!==p?(g=o.jsxs(fe,{variant:"ghost",size:"sm",onClick:u,children:[m,p]}),e[12]=u,e[13]=p,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let y;e[19]!==n?(y=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=y):y=e[20];let _;e[21]!==y?(_={id:"runs",label:y},e[21]=y,e[22]=_):_=e[22];let L;e[23]!==b||e[24]!==_?(L=[b,_],e[23]=b,e[24]=_,e[25]=L):L=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=C=>c(C),e[26]=v):v=e[26];let S;e[27]!==L||e[28]!==a?(S=o.jsx(L8,{tabs:L,activeTab:a,onTabChange:v}),e[27]=L,e[28]=a,e[29]=S):S=e[29];let w;e[30]!==S||e[31]!==g?(w=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,S]}),e[30]=S,e[31]=g,e[32]=w):w=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==a||e[36]!==f?(k=a==="settings"?o.jsx(vae,{automationId:s,automation:r}):o.jsx(yae,{automationId:s,triggerIds:f}),e[33]=r,e[34]=s,e[35]=a,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==w||e[39]!==k?(j=o.jsx(On,{children:o.jsx(On.Content,{children:o.jsxs(On.Body,{children:[w,k]})})}),e[38]=w,e[39]=k,e[40]=j):j=e[40],j}function wae(t){return t.id}function kae(t){const e=U.c(29),{virtualMcpId:s}=t,n=ce(),{openPanel:i}=pr(),{data:r}=lE(s),l=r===void 0?[]:r,{create:a}=Qu(),[c,d]=A.useState(""),u=c.toLowerCase(),h=l.filter(R=>R.name.toLowerCase().includes(u));let f;e[0]!==i?(f=R=>i(`automation:${R}`),e[0]=i,e[1]=f):f=e[1];const m=f,p=async()=>{if(a.isPending)return;qe("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(aE(s));m(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Yt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let y;e[5]!==a.isPending||e[6]!==p||e[7]!==b?(y=o.jsxs(fe,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=p,e[7]=b,e[8]=y):y=e[8];const _=y,L=On,v=On,S=On;let w;e[9]!==n?(w=n("automations.automationsList.title"),e[9]=n,e[10]=w):w=e[10];let k;e[11]!==w?(k=o.jsx(On.Title,{children:w}),e[11]=w,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(e9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==_||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,_]}),e[13]=_,e[14]=j,e[15]=C):C=e[15];let V;e[16]!==k||e[17]!==C?(V=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=V):V=e[18];const N=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Vi,{image:o.jsx(dr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):h.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Vi,{image:o.jsx(dr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:h.map(R=>o.jsx(cE,{automation:R,onClick:()=>m(R.id)},R.id))});let T;e[19]!==V||e[20]!==N||e[21]!==S.Body?(T=o.jsxs(S.Body,{children:[V,N]}),e[19]=V,e[20]=N,e[21]=S.Body,e[22]=T):T=e[22];let P;e[23]!==T||e[24]!==v.Content?(P=o.jsx(v.Content,{children:T}),e[23]=T,e[24]=v.Content,e[25]=P):P=e[25];let E;return e[26]!==L||e[27]!==P?(E=o.jsx(L,{children:P}),e[26]=L,e[27]=P,e[28]=E):E=e[28],E}function jae(t){const e=U.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Sl,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(A.Suspense,{fallback:n,children:o.jsx(kae,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function Cae(t){const e=U.c(60),{file:s,onClose:n}=t,i=ce();let r,l;e[0]!==s.filename?(r=o.jsx(Ko,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),l=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=l):(r=e[1],l=e[2]);let a;e[3]!==s.size?(a=b8(s.size),e[3]=s.size,e[4]=a):a=e[4];let c;e[5]!==a?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,l,c]}),e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];let u;e[11]!==i?(u=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(_u,{size:14}),e[13]=h):h=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:h}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let m;e[17]!==u||e[18]!==f?(m=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":u,asChild:!0,children:f})}),e[17]=u,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==i?(p=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(Ke,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(We,{children:[m,g]}),e[24]=g,e[25]=m,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let y;e[29]!==s.downloadUrl?(y=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=y):y=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(mn,{size:14}),e[31]=_):_=e[31];let L;e[32]!==b||e[33]!==y?(L=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[32]=b,e[33]=y,e[34]=L):L=e[34];let v;e[35]!==i?(v=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=v):v=e[36];let S;e[37]!==v?(S=o.jsx(Ke,{side:"bottom",children:v}),e[37]=v,e[38]=S):S=e[38];let w;e[39]!==L||e[40]!==S?(w=o.jsxs(We,{children:[L,S]}),e[39]=L,e[40]=S,e[41]=w):w=e[41];let k;e[42]!==i?(k=i("mainPanelTabs.fileTab.close"),e[42]=i,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Ni,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let V;e[48]!==i?(V=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=V):V=e[49];let N;e[50]!==V?(N=o.jsx(Ke,{side:"bottom",children:V}),e[50]=V,e[51]=N):N=e[51];let T;e[52]!==C||e[53]!==N?(T=o.jsxs(We,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=T):T=e[54];let P;return e[55]!==x||e[56]!==w||e[57]!==T||e[58]!==d?(P=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,w,T]}),e[55]=x,e[56]=w,e[57]=T,e[58]=d,e[59]=P):P=e[59],P}function Nae(t){const e=U.c(31),{fileKey:s,taskId:n}=t,i=ce(),{closePanel:r}=pr(),{data:l,isPending:a}=s6(n);let c;e[0]!==s||e[1]!==l?(c=l?.find(g=>g.key===s)??null,e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=c;let u;e[3]!==r?(u=()=>r(),e[3]=r,e[4]=u):u=e[4];const h=u;if(!d){if(a){let S;return e[5]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(g8,{})}),e[5]=S):S=e[5],S}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Ko,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==i?(b=i("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=i,e[11]=b):b=e[11];let y;e[12]!==b?(y=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=y):y=e[13];let _;e[14]!==i?(_=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=_):_=e[15];let L;e[16]!==h||e[17]!==_?(L=o.jsx(fe,{variant:"ghost",size:"sm",onClick:h,children:_}),e[16]=h,e[17]=_,e[18]=L):L=e[18];let v;return e[19]!==x||e[20]!==y||e[21]!==L?(v=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,y,L]}),e[19]=x,e[20]=y,e[21]=L,e[22]=v):v=e[22],v}let f;e[23]!==d||e[24]!==h?(f=o.jsx(Cae,{file:d,onClose:h}),e[23]=d,e[24]=h,e[25]=f):f=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(x8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==f||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,m]}),e[28]=f,e[29]=m,e[30]=p):p=e[30],p}function Vae(t){const e=U.c(7),{onClose:s}=t,n=ce();let i;e[0]!==n?(i=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r=o.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=r):r=e[3];let l;return e[4]!==s||e[5]!==r?(l=o.jsx(og,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function Tae(){const t=U.c(10),{closePanel:e}=pr();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let i;t[2]!==n?(i=()=>o.jsx(Vae,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(QP,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(A.Suspense,{fallback:o.jsx(og,{onClose:n,footer:null,children:r}),children:o.jsx(Aae,{onDone:n,onClose:n})}),t[5]=n,t[6]=l):l=t[6];let a;return t[7]!==i||t[8]!==l?(a=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(rn,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function Aae(t){const e=U.c(46),{onDone:s,onClose:n}=t,i=ce(),{org:r}=Fe();let l;e[0]!==r.id?(l=$d.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=l):l=e[1];const a=l;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:Jc,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=$s(c);let u;e[5]!==a||e[6]!==r||e[7]!==d?(u={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=u):u=e[8];const h=ZP(u),[f,m]=A.useState(!1),[p,g]=A.useState(null);let x;e[9]!==d?(x={mutationFn:async P=>M8(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:P}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Rs(x);let y;e[11]!==s||e[12]!==b||e[13]!==h||e[14]!==i?(y=async()=>{if(g(null),h)try{await b.mutateAsync(h)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=h,e[14]=i,e[15]=y):y=e[15];const _=y;let L;e[16]!==p?(L=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=L):L=e[17];let v;e[18]!==b.isPending||e[19]!==i?(v=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=v):v=e[20];let S;e[21]!==_?(S=()=>{_()},e[21]=_,e[22]=S):S=e[22];let w;e[23]!==f||e[24]!==b.isPending||e[25]!==v||e[26]!==S?(w=o.jsx(IP,{ready:f,pending:b.isPending,label:v,onClick:S}),e[23]=f,e[24]=b.isPending,e[25]=v,e[26]=S,e[27]=w):w=e[27];let k;e[28]!==L||e[29]!==w?(k=o.jsxs(o.Fragment,{children:[L,w]}),e[28]=L,e[29]=w,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=i,e[32]=j):j=e[32];let C;e[33]!==j?(C=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=C):C=e[34];let V;e[35]!==a||e[36]!==r||e[37]!==h?(V=o.jsx(eE,{org:r,cdConnectionId:a,siteUrl:h,onReadinessChange:m}),e[35]=a,e[36]=r,e[37]=h,e[38]=V):V=e[38];let N;e[39]!==C||e[40]!==V?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,V]}),e[39]=C,e[40]=V,e[41]=N):N=e[41];let T;return e[42]!==n||e[43]!==k||e[44]!==N?(T=o.jsx(og,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=T):T=e[45],T}const Pae=A.lazy(()=>Ys(()=>import("./project-app-view-BW8nEgoK.js"),__vite__mapDeps([175,1,2,78,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,79,80,81,8,7,9,17,82,83,84,85,86,87,88,89,90,91,92,69,4,5,6,10,11,12,13,14,3,15,16,18,19,20,21,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,70,109,151,120,121,122,123,117,118,119,152,110,111,68,112,113,114,115,71,116,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,153,154,73,155,156,157])).then(t=>({default:t.AppViewContent})));function Eae(){const t=U.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=P8();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Sl,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Sl,{}),t[1]=d):d=t[1];let u;return t[2]!==i?(u=o.jsx(A.Suspense,{fallback:d,children:o.jsx(Pae,{connectionId:i,toolName:$V})}),t[2]=i,t[3]=u):u=t[3],u}let r;t[4]!==n?(r=()=>o.jsx(Gk,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Sl,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(A.Suspense,{fallback:l,children:o.jsx(Dae,{claimedSiteUrl:n})}),t[7]=n,t[8]=a):a=t[8];let c;return t[9]!==r||t[10]!==a?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(rn,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const Rae=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Gk(t){const e=U.c(27),{claimedSiteUrl:s,children:n}=t,i=ce(),r=s??void 0;let l;e[0]!==r?(l=Vm(r),e[0]=r,e[1]=l):l=e[1];const a=l;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(Bm,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(Bm,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let u;e[5]!==d?(u=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=u):u=e[6];let h;e[7]!==i?(h=i("reports.emptyState.description"),e[7]=i,e[8]=h):h=e[8];let f;e[9]!==h?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:h}),e[9]=h,e[10]=f):f=e[10];let m;e[11]!==u||e[12]!==f?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==a?(p=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=p):p=e[16];let g;e[17]!==i?(g=Rae.map(_=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(_)},_)),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let y;return e[24]!==b||e[25]!==m?(y=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=y):y=e[26],y}function Dae(t){const e=U.c(46),{claimedSiteUrl:s}=t,n=ce(),i=ln(),{org:r}=Fe();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:Jc,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=$s(l);let c;e[3]!==s?(c=Vm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,u]=A.useState(c),[h,f]=A.useState(null);let m;e[5]!==a?(m={mutationFn:async E=>M8(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=m):m=e[6];const p=Rs(m);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==p?(g=async E=>{const R=tE(E);if(!R.ok){f(R.error);return}f(null);const M=Vm(R.value)??void 0;qe("reports_start_diagnostic_submitted",{organization_id:r.id,domain:M});try{await p.mutateAsync(R.value)}catch(I){const D=I;qe("reports_start_diagnostic_failed",{organization_id:r.id,domain:M,error:D instanceof Error?D.message:String(D)}),f(D instanceof Error?D.message:"__configurationFailed");return}i({to:vl.agents,params:{org:r.slug,panel:void 0},search:{virtualmcpid:ql(r.id).id,connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const y=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=E=>u(E.target.value),e[17]=L):L=e[17];let v;e[18]!==n?(v=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=v):v=e[19];const S=!!h;let w;e[20]!==p.isPending||e[21]!==d||e[22]!==_||e[23]!==v||e[24]!==S?(w=o.jsx(kt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:L,placeholder:v,"aria-invalid":S,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=_,e[23]=v,e[24]=S,e[25]=w):w=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(mr,{size:16}),e[29]=j):j=e[29];let C;e[30]!==p.isPending||e[31]!==k?(C=o.jsxs(fe,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=C):C=e[32];let V;e[33]!==w||e[34]!==C?(V=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[w,C]}),e[33]=w,e[34]=C,e[35]=V):V=e[35];let N;e[36]!==h||e[37]!==n?(N=h?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:dE(n,h)}):null,e[36]=h,e[37]=n,e[38]=N):N=e[38];let T;e[39]!==y||e[40]!==V||e[41]!==N?(T=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:y,children:[V,N]}),e[39]=y,e[40]=V,e[41]=N,e[42]=T):T=e[42];let P;return e[43]!==s||e[44]!==T?(P=o.jsx(Gk,{claimedSiteUrl:s,children:T}),e[43]=s,e[44]=T,e[45]=P):P=e[45],P}function Mae(t){return[$d.SELF(t),$d.REGISTRY(t),$d.COMMUNITY_REGISTRY(t),$d.DEV_ASSETS(t)]}function Iae(t,e){const s=new Set(Mae(e));return t.some(n=>!s.has(n.id))}function Oae(){const t=U.c(78),e=ce(),{org:s}=Fe(),n=Ti();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"mcp-github"},t[0]=i):i=t[0];const r=Ti(i),{projects:l}=td(),a=Qf();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let u;t[3]!==e?(u=e("discover.setup.connectTitle"),t[3]=e,t[4]=u):u=t[4];let h;t[5]!==e?(h=e("discover.setup.connectBody"),t[5]=e,t[6]=h):h=t[6];let f;t[7]!==n||t[8]!==s.id?(f=Iae(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Vl,{size:18}),t[10]=m):m=t[10];let p;t[11]===Symbol.for("react.memo_cache_sentinel")?(p={tab:"all"},t[11]=p):p=t[11];let g;t[12]!==e?(g=e("discover.setup.connectAction"),t[12]=e,t[13]=g):g=t[13];let x;t[14]!==d||t[15]!==g?(x=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:"/$org/settings/connections",params:d,search:p,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==u||t[18]!==h||t[19]!==f||t[20]!==x?(b={key:"connect",title:u,body:h,done:f,icon:m,action:x},t[17]=u,t[18]=h,t[19]=f,t[20]=x,t[21]=b):b=t[21];let y;t[22]!==e?(y=e("discover.setup.githubTitle"),t[22]=e,t[23]=y):y=t[23];let _;t[24]!==e?(_=e("discover.setup.githubBody"),t[24]=e,t[25]=_):_=t[25];const L=r.length>0;let v;t[26]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(_n,{className:"size-[18px]"}),t[26]=v):v=t[26];let S;t[27]===Symbol.for("react.memo_cache_sentinel")?(S={tab:"all"},t[27]=S):S=t[27];let w;t[28]!==e?(w=e("discover.setup.githubAction"),t[28]=e,t[29]=w):w=t[29];let k;t[30]!==d||t[31]!==w?(k=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:"/$org/settings/connections",params:d,search:S,children:w})}),t[30]=d,t[31]=w,t[32]=k):k=t[32];let j;t[33]!==y||t[34]!==_||t[35]!==L||t[36]!==k?(j={key:"github",title:y,body:_,done:L,icon:v,action:k},t[33]=y,t[34]=_,t[35]=L,t[36]=k,t[37]=j):j=t[37];let C;t[38]!==e?(C=e("discover.setup.projectTitle"),t[38]=e,t[39]=C):C=t[39];let V;t[40]!==e?(V=e("discover.setup.projectBody"),t[40]=e,t[41]=V):V=t[41];const N=l.length>0;let T;t[42]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Yt,{size:18}),t[42]=T):T=t[42];let P;t[43]!==s.slug?(P={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=P):P=t[44];let E;t[45]===Symbol.for("react.memo_cache_sentinel")?(E={virtualmcpid:void 0},t[45]=E):E=t[45];let R;t[46]!==e?(R=e("discover.setup.projectAction"),t[46]=e,t[47]=R):R=t[47];let M;t[48]!==P||t[49]!==R?(M=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:vl.agents,params:P,search:E,children:R})}),t[48]=P,t[49]=R,t[50]=M):M=t[50];let I;t[51]!==C||t[52]!==V||t[53]!==N||t[54]!==M?(I={key:"project",title:C,body:V,done:N,icon:T,action:M},t[51]=C,t[52]=V,t[53]=N,t[54]=M,t[55]=I):I=t[55];let D;t[56]!==e?(D=e("discover.setup.inviteTitle"),t[56]=e,t[57]=D):D=t[57];let $;t[58]!==e?($=e("discover.setup.inviteBody"),t[58]=e,t[59]=$):$=t[59];let O;t[60]!==a.data?.data?.members?(O=a.data?.data?.members??[],t[60]=a.data?.data?.members,t[61]=O):O=t[61];const B=O.length>1;let F;t[62]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(t9,{size:18}),t[62]=F):F=t[62];let z;t[63]!==e?(z=e("discover.setup.inviteAction"),t[63]=e,t[64]=z):z=t[64];let W;t[65]!==d||t[66]!==z?(W=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:"/$org/settings/members",params:d,children:z})}),t[65]=d,t[66]=z,t[67]=W):W=t[67];let K;t[68]!==D||t[69]!==$||t[70]!==B||t[71]!==W?(K={key:"invite",title:D,body:$,done:B,icon:F,action:W},t[68]=D,t[69]=$,t[70]=B,t[71]=W,t[72]=K):K=t[72];let H;return t[73]!==j||t[74]!==I||t[75]!==K||t[76]!==b?(H=[b,j,I,K],t[73]=j,t[74]=I,t[75]=K,t[76]=b,t[77]=H):H=t[77],H}function $ae(){const t=U.c(51),e=ce(),{projects:s}=td();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const i=Ti(n),r=dg();let l;t[1]!==s?(l=s.some(zae),t[1]=s,t[2]=l):l=t[2];const a=l;let c;t[3]!==s?(c=s.some(Bae),t[3]=s,t[4]=c):c=t[4];const d=c;let u;if(t[5]!==r||t[6]!==s){let P;t[8]!==r?(P=E=>qf(r.data?.configs??[],$8(E)),t[8]=r,t[9]=P):P=t[9],u=s.some(P),t[5]=r,t[6]=s,t[7]=u}else u=t[7];const h=u;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let m;t[12]!==e?(m=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=m):m=t[13];let p;t[14]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Ai,{size:18}),t[14]=p):p=t[14];let g;t[15]!==a||t[16]!==f||t[17]!==m?(g={key:"preview",title:f,requirement:m,satisfied:a,icon:p},t[15]=a,t[16]=f,t[17]=m,t[18]=g):g=t[18];let x;t[19]!==e?(x=e("discover.capabilities.gitTitle"),t[19]=e,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("discover.capabilities.gitRequirement"),t[21]=e,t[22]=b):b=t[22];const y=i.length>0&&a;let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(_n,{className:"size-[18px]"}),t[23]=_):_=t[23];let L;t[24]!==y||t[25]!==x||t[26]!==b?(L={key:"git",title:x,requirement:b,satisfied:y,icon:_},t[24]=y,t[25]=x,t[26]=b,t[27]=L):L=t[27];let v;t[28]!==e?(v=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=v):v=t[29];let S;t[30]!==e?(S=e("discover.capabilities.contentRequirement"),t[30]=e,t[31]=S):S=t[31];let w;t[32]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Ai,{size:18}),t[32]=w):w=t[32];let k;t[33]!==d||t[34]!==v||t[35]!==S?(k={key:"content",title:v,requirement:S,satisfied:d,icon:w},t[33]=d,t[34]=v,t[35]=S,t[36]=k):k=t[36];let j;t[37]!==e?(j=e("discover.capabilities.assetsTitle"),t[37]=e,t[38]=j):j=t[38];let C;t[39]!==e?(C=e("discover.capabilities.assetsRequirement"),t[39]=e,t[40]=C):C=t[40];let V;t[41]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(li,{size:18}),t[41]=V):V=t[41];let N;t[42]!==h||t[43]!==j||t[44]!==C?(N={key:"assets",title:j,requirement:C,satisfied:h,icon:V},t[42]=h,t[43]=j,t[44]=C,t[45]=N):N=t[45];let T;return t[46]!==L||t[47]!==k||t[48]!==N||t[49]!==g?(T=[g,L,k,N],t[46]=L,t[47]=k,t[48]=N,t[49]=g,t[50]=T):T=t[50],T}function Bae(t){return!!sl(t)&&e0(t.metadata?.ui?.layout)!=="off"}function zae(t){return sl(t)}function H1(t){const e=U.c(10),{title:s,description:n,children:i}=t;let r;e[0]!==s?(r=o.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let l;e[2]!==n?(l=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==l?(a=o.jsxs("div",{className:"flex flex-col gap-1",children:[r,l]}),e[4]=r,e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==a?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[a,i]}),e[7]=i,e[8]=a,e[9]=c):c=e[9],c}function Fae(){const t=U.c(63),e=ce(),{org:s}=Fe(),n=Oae(),i=$ae();let r;t[0]!==n?(r=n.filter(Kae),t[0]=n,t[1]=r):r=t[1];const l=r;let a;t[2]!==e?(a=e("discover.title"),t[2]=e,t[3]=a):a=t[3];let c;t[4]!==a?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a}),t[4]=a,t[5]=c):c=t[5];let d;t[6]!==e?(d=e("discover.subtitle"),t[6]=e,t[7]=d):d=t[7];let u;t[8]!==d?(u=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,u]}),t[10]=c,t[11]=u,t[12]=h):h=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let m;t[15]!==l.length||t[16]!==e?(m=l.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=l.length,t[16]=e,t[17]=m):m=t[17];let p;t[18]!==n?(p=n.map(Hae),t[18]=n,t[19]=p):p=t[19];let g;t[20]!==p?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:p}),t[20]=p,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==m||t[24]!==g?(x=o.jsx(H1,{title:f,description:m,children:g}),t[22]=f,t[23]=m,t[24]=g,t[25]=x):x=t[25];let b;t[26]!==e?(b=e("discover.capabilities.title"),t[26]=e,t[27]=b):b=t[27];let y;t[28]!==e?(y=e("discover.capabilities.description"),t[28]=e,t[29]=y):y=t[29];let _;if(t[30]!==i||t[31]!==e){let E;t[33]!==e?(E=R=>o.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-border bg-card p-4",children:[o.jsx("span",{className:ae("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",R.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:R.satisfied?o.jsx(zt,{size:18}):R.icon}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:R.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:R.satisfied?e("discover.capabilities.ready"):R.requirement})]})]},R.key),t[33]=e,t[34]=E):E=t[34],_=i.map(E),t[30]=i,t[31]=e,t[32]=_}else _=t[32];let L;t[35]!==_?(L=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:_}),t[35]=_,t[36]=L):L=t[36];let v;t[37]!==b||t[38]!==y||t[39]!==L?(v=o.jsx(H1,{title:b,description:y,children:L}),t[37]=b,t[38]=y,t[39]=L,t[40]=v):v=t[40];let S;t[41]!==e?(S=e("discover.catalog.title"),t[41]=e,t[42]=S):S=t[42];let w;t[43]!==e?(w=e("discover.catalog.description"),t[43]=e,t[44]=w):w=t[44];let k;t[45]!==s.slug?(k={org:s.slug},t[45]=s.slug,t[46]=k):k=t[46];let j;t[47]===Symbol.for("react.memo_cache_sentinel")?(j={tab:"all"},t[47]=j):j=t[47];let C;t[48]!==e?(C=e("discover.catalog.action"),t[48]=e,t[49]=C):C=t[49];let V;t[50]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(mr,{size:18}),t[50]=V):V=t[50];let N;t[51]!==k||t[52]!==C?(N=o.jsx("div",{children:o.jsx(fe,{asChild:!0,size:"lg",children:o.jsxs(Ao,{to:"/$org/settings/connections",params:k,search:j,onClick:Uae,children:[C,V]})})}),t[51]=k,t[52]=C,t[53]=N):N=t[53];let T;t[54]!==S||t[55]!==w||t[56]!==N?(T=o.jsx(H1,{title:S,description:w,children:N}),t[54]=S,t[55]=w,t[56]=N,t[57]=T):T=t[57];let P;return t[58]!==x||t[59]!==v||t[60]!==T||t[61]!==h?(P=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-10 p-6 md:p-10",children:[h,x,v,T]})}),t[58]=x,t[59]=v,t[60]=T,t[61]=h,t[62]=P):P=t[62],P}function Uae(){return qe("discover_catalog_opened",{})}function Hae(t){return o.jsxs("li",{className:ae("flex items-start gap-3 rounded-xl border border-border bg-card p-4",t.done&&"opacity-60"),children:[o.jsx("span",{className:ae("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",t.done?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.done?o.jsx(zt,{size:18}):t.icon}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t.body})]}),!t.done&&o.jsx("div",{className:"shrink-0",children:t.action})]},t.key)}function Kae(t){return!t.done}function Wae(t){const e=U.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=ce();let a;e[0]!==s?(a=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=a):a=e[1];const c=a;let d;e[2]!==n||e[3]!==l?(d=n.deckDetected&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(Oy,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let u;e[5]!==c?(u=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=u):u=e[6];let h;e[7]!==c?(h=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=h):h=e[8];let f;e[9]!==c||e[10]!==u||e[11]!==h?(f=o.jsx("button",{type:"button",onClick:u,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:h}),e[9]=c,e[10]=u,e[11]=h,e[12]=f):f=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(m=n.agentUpdated&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx($n,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(Ke,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==l?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:l("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=l,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:ae(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(z6,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=l,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==l?(x=n.deckDetected?o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx(_u,{size:14})})}),o.jsxs(Wt,{align:"end",children:[o.jsxs(Ze,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(FT,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Ze,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(Hf,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(_u,{size:14})})})}),o.jsx(Ke,{side:"bottom",children:l("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=l,e[27]=x):x=e[27];let b;e[28]!==l?(b=l("deck.deckToolbar.openInNewTab"),e[28]=l,e[29]=b):b=e[29];let y;e[30]!==c?(y=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=y):y=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(mn,{size:14}),e[32]=_):_=e[32];let L;e[33]!==b||e[34]!==y?(L=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[33]=b,e[34]=y,e[35]=L):L=e[35];let v;e[36]!==l?(v=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=v):v=e[37];let S;e[38]!==v?(S=o.jsx(Ke,{side:"bottom",children:v}),e[38]=v,e[39]=S):S=e[39];let w;e[40]!==L||e[41]!==S?(w=o.jsxs(We,{children:[L,S]}),e[40]=L,e[41]=S,e[42]=w):w=e[42];let k;return e[43]!==w||e[44]!==d||e[45]!==f||e[46]!==m||e[47]!==p||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,m,p,g,x,w,r]}),e[43]=w,e[44]=d,e[45]=f,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const vc=1;function qae(t){if(typeof t!="object"||t===null||t.v!==vc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class jo extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function Yk(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Gae(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?Yk(s).length:null}function Yae(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new jo("no <deck-viewer> element in source","no-viewer");const i=Yk(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new jo(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new jo("cannot remove the last slide","bad-op");l.remove();break}case"duplicate":{const c=l.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");l.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new jo(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?i[e.to]:i[e.to].nextSibling;n.insertBefore(l,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new jo(`invalid attribute name: ${e.name}`,"bad-op");l.setAttribute(e.name,e.value);break}case"remove-attr":{l.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new jo("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new jo(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
|
|
642
|
+
`);if(de.trim()){E(!0);try{Z(),qe("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:de.length}),m(),await p({tiptapDoc:b_({managerAgentId:u6.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:de})})}finally{E(!1)}}},O=e.models?.tier??"smart",B=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=a2({defaultValues:{name:e.name,active:e.active,tier:O,modelOverride:B,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),z=F.watch("active"),[W,K]=A.useReducer(bae,null),H=()=>{W!==null&&(qe("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(W.fields),save_count:W.saveCount,edit_duration_ms:Date.now()-W.start}),K({type:"reset"}))},q=async()=>{const Y=F.control._formState.dirtyFields,de=Object.keys(Y);if(de.length===0&&!I)return!0;const re=F.getValues(),le=F.control._defaultValues;F.reset(re,{keepValues:!0});const ne=I;D(!1);const me={tier:re.tier,...re.modelOverride?{modelId:re.modelOverride.modelId,credentialId:re.modelOverride.credentialId,modelTitle:re.modelOverride.title}:{}},ee={id:t,name:re.name,active:re.active,models:me,tools:re.tools,maxAgentSteps:re.maxAgentSteps,messages:MN(x),temperature:0};try{await a.mutateAsync(ee)}catch{return F.reset(le,{keepValues:!0}),ne&&D(!0),!1}const oe=[...de];return ne&&oe.push("messages"),K({type:"accumulate",now:Date.now(),fields:oe}),se(),!0},{schedule:G,flush:Q}=Oh({save:q}),{schedule:se,flush:Z}=Oh({delayMs:3e4,save:async()=>H()});A.useEffect(()=>{const Y=F.watch(()=>G());return()=>Y.unsubscribe()},[]);const te=Y=>{if(b(Y),!R){M(!0);return}D(!0),G()},X=async()=>{qe("automation_test_clicked",{automation_id:t,agent_id:r});const Y=await Q();if(Z(),!!Y){if(!x){xe.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const de=await d.mutateAsync(t);de.threadId&&(m(),f(de.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(fe,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Kf,{size:14}),i("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(vs,{control:F.control,name:"name",render:({field:Y})=>o.jsx(kt,{...Y,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(fe,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(on,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vs,{control:F.control,name:"active",render:({field:Y})=>o.jsx(ii,{checked:Y.value,onCheckedChange:de=>{Y.onChange(de),Q()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i(z?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(v_,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.starter")}),o.jsx(dae,{automationId:t,open:y,onOpenChange:_,onCustomSelect:()=>{w(!0),V(!1),j("")},onEventSelect:()=>{V(!0),w(!1)},onWebhookCreated:Y=>{qe("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),T(Y)}})]}),e.triggers.length===0&&!S?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[i("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>_(!0),children:i("automations.automationDetail.addStarter")})," ",i("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Y=>o.jsx(uae,{trigger:Y,automationId:t,connectionName:Y.connection_id?h.get(Y.connection_id):void 0},Y.id))}),S&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Zd,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:Y=>j(Y.target.value),onBlur:async()=>{const Y=k.trim();if(!(!Y||!hu(Y)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:Y}),qe("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),xe.success(i("automations.automationDetail.starterAdded")),w(!1),j("")}catch{xe.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async Y=>{const de=k.trim();Y.key==="Enter"&&de&&hu(de)&&Y.target.blur(),Y.key==="Escape"&&(w(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!hu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(st,{className:"size-[13px] text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),j("")},children:o.jsx(Ni,{size:13})})]}),C&&o.jsx(A.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(st,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(fae,{automationId:t,onDone:()=>V(!1)})}),o.jsx(Kk,{open:N!==null,onOpenChange:Y=>{Y||T(null)},url:N?.url??null,token:N?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:P||!x,onClick:$,children:[o.jsx(zr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(D7,{tiptapDoc:x,setTiptapDoc:te,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(M7,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:X,disabled:!r,children:[o.jsx(Af,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(Ke,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(c6,{open:L,onOpenChange:v,className:"flex flex-col gap-2.5",children:[o.jsxs(l6,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.advanced")}),o.jsx(Ls,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(a6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(Gle,{tier:F.watch("tier"),onTierChange:Y=>F.setValue("tier",Y,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:Y=>F.setValue("modelOverride",Y,{shouldDirty:!0})}),o.jsx(Qle,{agentId:r||null,value:F.watch("tools"),onChange:Y=>F.setValue("tools",Y,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.maxSteps")}),o.jsx(kt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:xae}),value:F.watch("maxAgentSteps")??"",onChange:Y=>{const de=Y.target.value.trim(),re=de===""?null:Number(de);F.setValue("maxAgentSteps",re===null||Number.isNaN(re)?null:re,{shouldDirty:!0})}})]})]})]})]})]})}const Wk=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function qk(t){const e=Wk.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function yae(t){const e=U.c(16),{automationId:s,triggerIds:n}=t,i=ce(),[r,l]=A.useState("30d"),[a,c]=A.useState(_ae);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(qk(b))},e[0]=d):d=e[0];let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(js,{className:"w-44",children:o.jsx(Ds,{})}),e[1]=u):u=e[1];let h;e[2]!==i?(h=Wk.map(x=>o.jsx(Ot,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=h):h=e[3];let f;e[4]!==h?(f=o.jsx(Cs,{children:h}),e[4]=h,e[5]=f):f=e[5];let m;e[6]!==f||e[7]!==r?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ks,{value:r,onValueChange:d,children:[u,f]})}),e[6]=f,e[7]=r,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==a||e[11]!==n?(p=o.jsx(CV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function _ae(){return qk("30d")}function Lae(t){const e=U.c(5),{tabId:s}=t;let n;e[0]!==s?(n=Ry(s),e[0]=s,e[1]=n):n=e[1];const i=n;if(!i)return null;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Sl,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(A.Suspense,{fallback:r,children:o.jsx(Sae,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function Sae(t){const e=U.c(41),{id:s}=t,n=ce(),{openPanel:i}=pr(),{data:r,isLoading:l}=oE(s),[a,c]=A.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const u=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Sl,{}),e[2]=C):C=e[2],C}if(!r){let C;e[3]!==n?(C=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=C):C=e[4];let V;return e[5]!==C?(V=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:C}),e[5]=C,e[6]=V):V=e[6],V}let h;e[7]!==r.triggers?(h=r.triggers.map(wae),e[7]=r.triggers,e[8]=h):h=e[8];const f=h;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Kf,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==u||e[13]!==p?(g=o.jsxs(fe,{variant:"ghost",size:"sm",onClick:u,children:[m,p]}),e[12]=u,e[13]=p,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let y;e[19]!==n?(y=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=y):y=e[20];let _;e[21]!==y?(_={id:"runs",label:y},e[21]=y,e[22]=_):_=e[22];let L;e[23]!==b||e[24]!==_?(L=[b,_],e[23]=b,e[24]=_,e[25]=L):L=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=C=>c(C),e[26]=v):v=e[26];let S;e[27]!==L||e[28]!==a?(S=o.jsx(L8,{tabs:L,activeTab:a,onTabChange:v}),e[27]=L,e[28]=a,e[29]=S):S=e[29];let w;e[30]!==S||e[31]!==g?(w=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,S]}),e[30]=S,e[31]=g,e[32]=w):w=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==a||e[36]!==f?(k=a==="settings"?o.jsx(vae,{automationId:s,automation:r}):o.jsx(yae,{automationId:s,triggerIds:f}),e[33]=r,e[34]=s,e[35]=a,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==w||e[39]!==k?(j=o.jsx(On,{children:o.jsx(On.Content,{children:o.jsxs(On.Body,{children:[w,k]})})}),e[38]=w,e[39]=k,e[40]=j):j=e[40],j}function wae(t){return t.id}function kae(t){const e=U.c(29),{virtualMcpId:s}=t,n=ce(),{openPanel:i}=pr(),{data:r}=lE(s),l=r===void 0?[]:r,{create:a}=Qu(),[c,d]=A.useState(""),u=c.toLowerCase(),h=l.filter(R=>R.name.toLowerCase().includes(u));let f;e[0]!==i?(f=R=>i(`automation:${R}`),e[0]=i,e[1]=f):f=e[1];const m=f,p=async()=>{if(a.isPending)return;qe("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(aE(s));m(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Yt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let y;e[5]!==a.isPending||e[6]!==p||e[7]!==b?(y=o.jsxs(fe,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=p,e[7]=b,e[8]=y):y=e[8];const _=y,L=On,v=On,S=On;let w;e[9]!==n?(w=n("automations.automationsList.title"),e[9]=n,e[10]=w):w=e[10];let k;e[11]!==w?(k=o.jsx(On.Title,{children:w}),e[11]=w,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(e9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==_||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,_]}),e[13]=_,e[14]=j,e[15]=C):C=e[15];let V;e[16]!==k||e[17]!==C?(V=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=V):V=e[18];const N=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Vi,{image:o.jsx(dr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):h.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Vi,{image:o.jsx(dr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:h.map(R=>o.jsx(cE,{automation:R,onClick:()=>m(R.id)},R.id))});let T;e[19]!==V||e[20]!==N||e[21]!==S.Body?(T=o.jsxs(S.Body,{children:[V,N]}),e[19]=V,e[20]=N,e[21]=S.Body,e[22]=T):T=e[22];let P;e[23]!==T||e[24]!==v.Content?(P=o.jsx(v.Content,{children:T}),e[23]=T,e[24]=v.Content,e[25]=P):P=e[25];let E;return e[26]!==L||e[27]!==P?(E=o.jsx(L,{children:P}),e[26]=L,e[27]=P,e[28]=E):E=e[28],E}function jae(t){const e=U.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Sl,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(A.Suspense,{fallback:n,children:o.jsx(kae,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function Cae(t){const e=U.c(60),{file:s,onClose:n}=t,i=ce();let r,l;e[0]!==s.filename?(r=o.jsx(Ko,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),l=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=l):(r=e[1],l=e[2]);let a;e[3]!==s.size?(a=b8(s.size),e[3]=s.size,e[4]=a):a=e[4];let c;e[5]!==a?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,l,c]}),e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];let u;e[11]!==i?(u=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(_u,{size:14}),e[13]=h):h=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:h}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let m;e[17]!==u||e[18]!==f?(m=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":u,asChild:!0,children:f})}),e[17]=u,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==i?(p=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(Ke,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(We,{children:[m,g]}),e[24]=g,e[25]=m,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let y;e[29]!==s.downloadUrl?(y=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=y):y=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(mn,{size:14}),e[31]=_):_=e[31];let L;e[32]!==b||e[33]!==y?(L=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[32]=b,e[33]=y,e[34]=L):L=e[34];let v;e[35]!==i?(v=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=v):v=e[36];let S;e[37]!==v?(S=o.jsx(Ke,{side:"bottom",children:v}),e[37]=v,e[38]=S):S=e[38];let w;e[39]!==L||e[40]!==S?(w=o.jsxs(We,{children:[L,S]}),e[39]=L,e[40]=S,e[41]=w):w=e[41];let k;e[42]!==i?(k=i("mainPanelTabs.fileTab.close"),e[42]=i,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Ni,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let V;e[48]!==i?(V=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=V):V=e[49];let N;e[50]!==V?(N=o.jsx(Ke,{side:"bottom",children:V}),e[50]=V,e[51]=N):N=e[51];let T;e[52]!==C||e[53]!==N?(T=o.jsxs(We,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=T):T=e[54];let P;return e[55]!==x||e[56]!==w||e[57]!==T||e[58]!==d?(P=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,w,T]}),e[55]=x,e[56]=w,e[57]=T,e[58]=d,e[59]=P):P=e[59],P}function Nae(t){const e=U.c(31),{fileKey:s,taskId:n}=t,i=ce(),{closePanel:r}=pr(),{data:l,isPending:a}=s6(n);let c;e[0]!==s||e[1]!==l?(c=l?.find(g=>g.key===s)??null,e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=c;let u;e[3]!==r?(u=()=>r(),e[3]=r,e[4]=u):u=e[4];const h=u;if(!d){if(a){let S;return e[5]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(g8,{})}),e[5]=S):S=e[5],S}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Ko,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==i?(b=i("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=i,e[11]=b):b=e[11];let y;e[12]!==b?(y=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=y):y=e[13];let _;e[14]!==i?(_=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=_):_=e[15];let L;e[16]!==h||e[17]!==_?(L=o.jsx(fe,{variant:"ghost",size:"sm",onClick:h,children:_}),e[16]=h,e[17]=_,e[18]=L):L=e[18];let v;return e[19]!==x||e[20]!==y||e[21]!==L?(v=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,y,L]}),e[19]=x,e[20]=y,e[21]=L,e[22]=v):v=e[22],v}let f;e[23]!==d||e[24]!==h?(f=o.jsx(Cae,{file:d,onClose:h}),e[23]=d,e[24]=h,e[25]=f):f=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(x8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==f||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,m]}),e[28]=f,e[29]=m,e[30]=p):p=e[30],p}function Vae(t){const e=U.c(7),{onClose:s}=t,n=ce();let i;e[0]!==n?(i=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r=o.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=r):r=e[3];let l;return e[4]!==s||e[5]!==r?(l=o.jsx(og,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function Tae(){const t=U.c(10),{closePanel:e}=pr();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let i;t[2]!==n?(i=()=>o.jsx(Vae,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(QP,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(A.Suspense,{fallback:o.jsx(og,{onClose:n,footer:null,children:r}),children:o.jsx(Aae,{onDone:n,onClose:n})}),t[5]=n,t[6]=l):l=t[6];let a;return t[7]!==i||t[8]!==l?(a=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(rn,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function Aae(t){const e=U.c(46),{onDone:s,onClose:n}=t,i=ce(),{org:r}=Fe();let l;e[0]!==r.id?(l=$d.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=l):l=e[1];const a=l;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:Jc,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=$s(c);let u;e[5]!==a||e[6]!==r||e[7]!==d?(u={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=u):u=e[8];const h=ZP(u),[f,m]=A.useState(!1),[p,g]=A.useState(null);let x;e[9]!==d?(x={mutationFn:async P=>M8(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:P}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Rs(x);let y;e[11]!==s||e[12]!==b||e[13]!==h||e[14]!==i?(y=async()=>{if(g(null),h)try{await b.mutateAsync(h)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=h,e[14]=i,e[15]=y):y=e[15];const _=y;let L;e[16]!==p?(L=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=L):L=e[17];let v;e[18]!==b.isPending||e[19]!==i?(v=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=v):v=e[20];let S;e[21]!==_?(S=()=>{_()},e[21]=_,e[22]=S):S=e[22];let w;e[23]!==f||e[24]!==b.isPending||e[25]!==v||e[26]!==S?(w=o.jsx(IP,{ready:f,pending:b.isPending,label:v,onClick:S}),e[23]=f,e[24]=b.isPending,e[25]=v,e[26]=S,e[27]=w):w=e[27];let k;e[28]!==L||e[29]!==w?(k=o.jsxs(o.Fragment,{children:[L,w]}),e[28]=L,e[29]=w,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=i,e[32]=j):j=e[32];let C;e[33]!==j?(C=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=C):C=e[34];let V;e[35]!==a||e[36]!==r||e[37]!==h?(V=o.jsx(eE,{org:r,cdConnectionId:a,siteUrl:h,onReadinessChange:m}),e[35]=a,e[36]=r,e[37]=h,e[38]=V):V=e[38];let N;e[39]!==C||e[40]!==V?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,V]}),e[39]=C,e[40]=V,e[41]=N):N=e[41];let T;return e[42]!==n||e[43]!==k||e[44]!==N?(T=o.jsx(og,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=T):T=e[45],T}const Pae=A.lazy(()=>Ys(()=>import("./project-app-view-C5a0S8VK.js"),__vite__mapDeps([175,1,2,78,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,79,80,81,8,7,9,17,82,83,84,85,86,87,88,89,90,91,92,69,4,5,6,10,11,12,13,14,3,15,16,18,19,20,21,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,70,109,151,120,121,122,123,117,118,119,152,110,111,68,112,113,114,115,71,116,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,153,154,73,155,156,157])).then(t=>({default:t.AppViewContent})));function Eae(){const t=U.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=P8();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Sl,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Sl,{}),t[1]=d):d=t[1];let u;return t[2]!==i?(u=o.jsx(A.Suspense,{fallback:d,children:o.jsx(Pae,{connectionId:i,toolName:$V})}),t[2]=i,t[3]=u):u=t[3],u}let r;t[4]!==n?(r=()=>o.jsx(Gk,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Sl,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(A.Suspense,{fallback:l,children:o.jsx(Dae,{claimedSiteUrl:n})}),t[7]=n,t[8]=a):a=t[8];let c;return t[9]!==r||t[10]!==a?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(rn,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const Rae=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Gk(t){const e=U.c(27),{claimedSiteUrl:s,children:n}=t,i=ce(),r=s??void 0;let l;e[0]!==r?(l=Vm(r),e[0]=r,e[1]=l):l=e[1];const a=l;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(Bm,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(Bm,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let u;e[5]!==d?(u=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=u):u=e[6];let h;e[7]!==i?(h=i("reports.emptyState.description"),e[7]=i,e[8]=h):h=e[8];let f;e[9]!==h?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:h}),e[9]=h,e[10]=f):f=e[10];let m;e[11]!==u||e[12]!==f?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==a?(p=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=p):p=e[16];let g;e[17]!==i?(g=Rae.map(_=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(_)},_)),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let y;return e[24]!==b||e[25]!==m?(y=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=y):y=e[26],y}function Dae(t){const e=U.c(46),{claimedSiteUrl:s}=t,n=ce(),i=ln(),{org:r}=Fe();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:Jc,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=$s(l);let c;e[3]!==s?(c=Vm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,u]=A.useState(c),[h,f]=A.useState(null);let m;e[5]!==a?(m={mutationFn:async E=>M8(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=m):m=e[6];const p=Rs(m);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==p?(g=async E=>{const R=tE(E);if(!R.ok){f(R.error);return}f(null);const M=Vm(R.value)??void 0;qe("reports_start_diagnostic_submitted",{organization_id:r.id,domain:M});try{await p.mutateAsync(R.value)}catch(I){const D=I;qe("reports_start_diagnostic_failed",{organization_id:r.id,domain:M,error:D instanceof Error?D.message:String(D)}),f(D instanceof Error?D.message:"__configurationFailed");return}i({to:vl.agents,params:{org:r.slug,panel:void 0},search:{virtualmcpid:ql(r.id).id,connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const y=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=E=>u(E.target.value),e[17]=L):L=e[17];let v;e[18]!==n?(v=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=v):v=e[19];const S=!!h;let w;e[20]!==p.isPending||e[21]!==d||e[22]!==_||e[23]!==v||e[24]!==S?(w=o.jsx(kt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:L,placeholder:v,"aria-invalid":S,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=_,e[23]=v,e[24]=S,e[25]=w):w=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(mr,{size:16}),e[29]=j):j=e[29];let C;e[30]!==p.isPending||e[31]!==k?(C=o.jsxs(fe,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=C):C=e[32];let V;e[33]!==w||e[34]!==C?(V=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[w,C]}),e[33]=w,e[34]=C,e[35]=V):V=e[35];let N;e[36]!==h||e[37]!==n?(N=h?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:dE(n,h)}):null,e[36]=h,e[37]=n,e[38]=N):N=e[38];let T;e[39]!==y||e[40]!==V||e[41]!==N?(T=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:y,children:[V,N]}),e[39]=y,e[40]=V,e[41]=N,e[42]=T):T=e[42];let P;return e[43]!==s||e[44]!==T?(P=o.jsx(Gk,{claimedSiteUrl:s,children:T}),e[43]=s,e[44]=T,e[45]=P):P=e[45],P}function Mae(t){return[$d.SELF(t),$d.REGISTRY(t),$d.COMMUNITY_REGISTRY(t),$d.DEV_ASSETS(t)]}function Iae(t,e){const s=new Set(Mae(e));return t.some(n=>!s.has(n.id))}function Oae(){const t=U.c(78),e=ce(),{org:s}=Fe(),n=Ti();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"mcp-github"},t[0]=i):i=t[0];const r=Ti(i),{projects:l}=td(),a=Qf();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let u;t[3]!==e?(u=e("discover.setup.connectTitle"),t[3]=e,t[4]=u):u=t[4];let h;t[5]!==e?(h=e("discover.setup.connectBody"),t[5]=e,t[6]=h):h=t[6];let f;t[7]!==n||t[8]!==s.id?(f=Iae(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Vl,{size:18}),t[10]=m):m=t[10];let p;t[11]===Symbol.for("react.memo_cache_sentinel")?(p={tab:"all"},t[11]=p):p=t[11];let g;t[12]!==e?(g=e("discover.setup.connectAction"),t[12]=e,t[13]=g):g=t[13];let x;t[14]!==d||t[15]!==g?(x=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:"/$org/settings/connections",params:d,search:p,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==u||t[18]!==h||t[19]!==f||t[20]!==x?(b={key:"connect",title:u,body:h,done:f,icon:m,action:x},t[17]=u,t[18]=h,t[19]=f,t[20]=x,t[21]=b):b=t[21];let y;t[22]!==e?(y=e("discover.setup.githubTitle"),t[22]=e,t[23]=y):y=t[23];let _;t[24]!==e?(_=e("discover.setup.githubBody"),t[24]=e,t[25]=_):_=t[25];const L=r.length>0;let v;t[26]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(_n,{className:"size-[18px]"}),t[26]=v):v=t[26];let S;t[27]===Symbol.for("react.memo_cache_sentinel")?(S={tab:"all"},t[27]=S):S=t[27];let w;t[28]!==e?(w=e("discover.setup.githubAction"),t[28]=e,t[29]=w):w=t[29];let k;t[30]!==d||t[31]!==w?(k=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:"/$org/settings/connections",params:d,search:S,children:w})}),t[30]=d,t[31]=w,t[32]=k):k=t[32];let j;t[33]!==y||t[34]!==_||t[35]!==L||t[36]!==k?(j={key:"github",title:y,body:_,done:L,icon:v,action:k},t[33]=y,t[34]=_,t[35]=L,t[36]=k,t[37]=j):j=t[37];let C;t[38]!==e?(C=e("discover.setup.projectTitle"),t[38]=e,t[39]=C):C=t[39];let V;t[40]!==e?(V=e("discover.setup.projectBody"),t[40]=e,t[41]=V):V=t[41];const N=l.length>0;let T;t[42]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Yt,{size:18}),t[42]=T):T=t[42];let P;t[43]!==s.slug?(P={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=P):P=t[44];let E;t[45]===Symbol.for("react.memo_cache_sentinel")?(E={virtualmcpid:void 0},t[45]=E):E=t[45];let R;t[46]!==e?(R=e("discover.setup.projectAction"),t[46]=e,t[47]=R):R=t[47];let M;t[48]!==P||t[49]!==R?(M=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:vl.agents,params:P,search:E,children:R})}),t[48]=P,t[49]=R,t[50]=M):M=t[50];let I;t[51]!==C||t[52]!==V||t[53]!==N||t[54]!==M?(I={key:"project",title:C,body:V,done:N,icon:T,action:M},t[51]=C,t[52]=V,t[53]=N,t[54]=M,t[55]=I):I=t[55];let D;t[56]!==e?(D=e("discover.setup.inviteTitle"),t[56]=e,t[57]=D):D=t[57];let $;t[58]!==e?($=e("discover.setup.inviteBody"),t[58]=e,t[59]=$):$=t[59];let O;t[60]!==a.data?.data?.members?(O=a.data?.data?.members??[],t[60]=a.data?.data?.members,t[61]=O):O=t[61];const B=O.length>1;let F;t[62]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(t9,{size:18}),t[62]=F):F=t[62];let z;t[63]!==e?(z=e("discover.setup.inviteAction"),t[63]=e,t[64]=z):z=t[64];let W;t[65]!==d||t[66]!==z?(W=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Ao,{to:"/$org/settings/members",params:d,children:z})}),t[65]=d,t[66]=z,t[67]=W):W=t[67];let K;t[68]!==D||t[69]!==$||t[70]!==B||t[71]!==W?(K={key:"invite",title:D,body:$,done:B,icon:F,action:W},t[68]=D,t[69]=$,t[70]=B,t[71]=W,t[72]=K):K=t[72];let H;return t[73]!==j||t[74]!==I||t[75]!==K||t[76]!==b?(H=[b,j,I,K],t[73]=j,t[74]=I,t[75]=K,t[76]=b,t[77]=H):H=t[77],H}function $ae(){const t=U.c(51),e=ce(),{projects:s}=td();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const i=Ti(n),r=dg();let l;t[1]!==s?(l=s.some(zae),t[1]=s,t[2]=l):l=t[2];const a=l;let c;t[3]!==s?(c=s.some(Bae),t[3]=s,t[4]=c):c=t[4];const d=c;let u;if(t[5]!==r||t[6]!==s){let P;t[8]!==r?(P=E=>qf(r.data?.configs??[],$8(E)),t[8]=r,t[9]=P):P=t[9],u=s.some(P),t[5]=r,t[6]=s,t[7]=u}else u=t[7];const h=u;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let m;t[12]!==e?(m=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=m):m=t[13];let p;t[14]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Ai,{size:18}),t[14]=p):p=t[14];let g;t[15]!==a||t[16]!==f||t[17]!==m?(g={key:"preview",title:f,requirement:m,satisfied:a,icon:p},t[15]=a,t[16]=f,t[17]=m,t[18]=g):g=t[18];let x;t[19]!==e?(x=e("discover.capabilities.gitTitle"),t[19]=e,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("discover.capabilities.gitRequirement"),t[21]=e,t[22]=b):b=t[22];const y=i.length>0&&a;let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(_n,{className:"size-[18px]"}),t[23]=_):_=t[23];let L;t[24]!==y||t[25]!==x||t[26]!==b?(L={key:"git",title:x,requirement:b,satisfied:y,icon:_},t[24]=y,t[25]=x,t[26]=b,t[27]=L):L=t[27];let v;t[28]!==e?(v=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=v):v=t[29];let S;t[30]!==e?(S=e("discover.capabilities.contentRequirement"),t[30]=e,t[31]=S):S=t[31];let w;t[32]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Ai,{size:18}),t[32]=w):w=t[32];let k;t[33]!==d||t[34]!==v||t[35]!==S?(k={key:"content",title:v,requirement:S,satisfied:d,icon:w},t[33]=d,t[34]=v,t[35]=S,t[36]=k):k=t[36];let j;t[37]!==e?(j=e("discover.capabilities.assetsTitle"),t[37]=e,t[38]=j):j=t[38];let C;t[39]!==e?(C=e("discover.capabilities.assetsRequirement"),t[39]=e,t[40]=C):C=t[40];let V;t[41]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(li,{size:18}),t[41]=V):V=t[41];let N;t[42]!==h||t[43]!==j||t[44]!==C?(N={key:"assets",title:j,requirement:C,satisfied:h,icon:V},t[42]=h,t[43]=j,t[44]=C,t[45]=N):N=t[45];let T;return t[46]!==L||t[47]!==k||t[48]!==N||t[49]!==g?(T=[g,L,k,N],t[46]=L,t[47]=k,t[48]=N,t[49]=g,t[50]=T):T=t[50],T}function Bae(t){return!!sl(t)&&e0(t.metadata?.ui?.layout)!=="off"}function zae(t){return sl(t)}function H1(t){const e=U.c(10),{title:s,description:n,children:i}=t;let r;e[0]!==s?(r=o.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let l;e[2]!==n?(l=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==l?(a=o.jsxs("div",{className:"flex flex-col gap-1",children:[r,l]}),e[4]=r,e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==a?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[a,i]}),e[7]=i,e[8]=a,e[9]=c):c=e[9],c}function Fae(){const t=U.c(63),e=ce(),{org:s}=Fe(),n=Oae(),i=$ae();let r;t[0]!==n?(r=n.filter(Kae),t[0]=n,t[1]=r):r=t[1];const l=r;let a;t[2]!==e?(a=e("discover.title"),t[2]=e,t[3]=a):a=t[3];let c;t[4]!==a?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a}),t[4]=a,t[5]=c):c=t[5];let d;t[6]!==e?(d=e("discover.subtitle"),t[6]=e,t[7]=d):d=t[7];let u;t[8]!==d?(u=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,u]}),t[10]=c,t[11]=u,t[12]=h):h=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let m;t[15]!==l.length||t[16]!==e?(m=l.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=l.length,t[16]=e,t[17]=m):m=t[17];let p;t[18]!==n?(p=n.map(Hae),t[18]=n,t[19]=p):p=t[19];let g;t[20]!==p?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:p}),t[20]=p,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==m||t[24]!==g?(x=o.jsx(H1,{title:f,description:m,children:g}),t[22]=f,t[23]=m,t[24]=g,t[25]=x):x=t[25];let b;t[26]!==e?(b=e("discover.capabilities.title"),t[26]=e,t[27]=b):b=t[27];let y;t[28]!==e?(y=e("discover.capabilities.description"),t[28]=e,t[29]=y):y=t[29];let _;if(t[30]!==i||t[31]!==e){let E;t[33]!==e?(E=R=>o.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-border bg-card p-4",children:[o.jsx("span",{className:ae("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",R.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:R.satisfied?o.jsx(zt,{size:18}):R.icon}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:R.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:R.satisfied?e("discover.capabilities.ready"):R.requirement})]})]},R.key),t[33]=e,t[34]=E):E=t[34],_=i.map(E),t[30]=i,t[31]=e,t[32]=_}else _=t[32];let L;t[35]!==_?(L=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:_}),t[35]=_,t[36]=L):L=t[36];let v;t[37]!==b||t[38]!==y||t[39]!==L?(v=o.jsx(H1,{title:b,description:y,children:L}),t[37]=b,t[38]=y,t[39]=L,t[40]=v):v=t[40];let S;t[41]!==e?(S=e("discover.catalog.title"),t[41]=e,t[42]=S):S=t[42];let w;t[43]!==e?(w=e("discover.catalog.description"),t[43]=e,t[44]=w):w=t[44];let k;t[45]!==s.slug?(k={org:s.slug},t[45]=s.slug,t[46]=k):k=t[46];let j;t[47]===Symbol.for("react.memo_cache_sentinel")?(j={tab:"all"},t[47]=j):j=t[47];let C;t[48]!==e?(C=e("discover.catalog.action"),t[48]=e,t[49]=C):C=t[49];let V;t[50]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(mr,{size:18}),t[50]=V):V=t[50];let N;t[51]!==k||t[52]!==C?(N=o.jsx("div",{children:o.jsx(fe,{asChild:!0,size:"lg",children:o.jsxs(Ao,{to:"/$org/settings/connections",params:k,search:j,onClick:Uae,children:[C,V]})})}),t[51]=k,t[52]=C,t[53]=N):N=t[53];let T;t[54]!==S||t[55]!==w||t[56]!==N?(T=o.jsx(H1,{title:S,description:w,children:N}),t[54]=S,t[55]=w,t[56]=N,t[57]=T):T=t[57];let P;return t[58]!==x||t[59]!==v||t[60]!==T||t[61]!==h?(P=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-10 p-6 md:p-10",children:[h,x,v,T]})}),t[58]=x,t[59]=v,t[60]=T,t[61]=h,t[62]=P):P=t[62],P}function Uae(){return qe("discover_catalog_opened",{})}function Hae(t){return o.jsxs("li",{className:ae("flex items-start gap-3 rounded-xl border border-border bg-card p-4",t.done&&"opacity-60"),children:[o.jsx("span",{className:ae("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",t.done?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.done?o.jsx(zt,{size:18}):t.icon}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t.body})]}),!t.done&&o.jsx("div",{className:"shrink-0",children:t.action})]},t.key)}function Kae(t){return!t.done}function Wae(t){const e=U.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=ce();let a;e[0]!==s?(a=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=a):a=e[1];const c=a;let d;e[2]!==n||e[3]!==l?(d=n.deckDetected&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(Oy,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let u;e[5]!==c?(u=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=u):u=e[6];let h;e[7]!==c?(h=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=h):h=e[8];let f;e[9]!==c||e[10]!==u||e[11]!==h?(f=o.jsx("button",{type:"button",onClick:u,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:h}),e[9]=c,e[10]=u,e[11]=h,e[12]=f):f=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(m=n.agentUpdated&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx($n,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(Ke,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==l?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:l("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=l,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:ae(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(z6,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=l,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==l?(x=n.deckDetected?o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx(_u,{size:14})})}),o.jsxs(Wt,{align:"end",children:[o.jsxs(Ze,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(FT,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Ze,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(Hf,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(_u,{size:14})})})}),o.jsx(Ke,{side:"bottom",children:l("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=l,e[27]=x):x=e[27];let b;e[28]!==l?(b=l("deck.deckToolbar.openInNewTab"),e[28]=l,e[29]=b):b=e[29];let y;e[30]!==c?(y=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=y):y=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(mn,{size:14}),e[32]=_):_=e[32];let L;e[33]!==b||e[34]!==y?(L=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[33]=b,e[34]=y,e[35]=L):L=e[35];let v;e[36]!==l?(v=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=v):v=e[37];let S;e[38]!==v?(S=o.jsx(Ke,{side:"bottom",children:v}),e[38]=v,e[39]=S):S=e[39];let w;e[40]!==L||e[41]!==S?(w=o.jsxs(We,{children:[L,S]}),e[40]=L,e[41]=S,e[42]=w):w=e[42];let k;return e[43]!==w||e[44]!==d||e[45]!==f||e[46]!==m||e[47]!==p||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,m,p,g,x,w,r]}),e[43]=w,e[44]=d,e[45]=f,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const vc=1;function qae(t){if(typeof t!="object"||t===null||t.v!==vc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class jo extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function Yk(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Gae(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?Yk(s).length:null}function Yae(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new jo("no <deck-viewer> element in source","no-viewer");const i=Yk(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new jo(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new jo("cannot remove the last slide","bad-op");l.remove();break}case"duplicate":{const c=l.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");l.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new jo(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?i[e.to]:i[e.to].nextSibling;n.insertBefore(l,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new jo(`invalid attribute name: ${e.name}`,"bad-op");l.setAttribute(e.name,e.value);break}case"remove-attr":{l.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new jo("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new jo(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
|
|
643
643
|
`:""}${s.documentElement.outerHTML}
|
|
644
644
|
`}const dv="home",Jae=400,Xae=800;function Qae(t){const e=t.savePath!==void 0,{org:s}=Fe(),n=Ms(),i=a8(dv),[r,l]=A.useState(!1),[a,c]=A.useState(!1),[d,u]=A.useState(!1),[h,f]=A.useState(!1),[m,p]=A.useState(!1),[g,x]=A.useState(!1),[b,y]=A.useState(null),[_,L]=A.useState(null),[v,S]=A.useState(0),[w]=A.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),k=r||g||m,j=()=>{t.savePath!==void 0&&(n.invalidateQueries({queryKey:it.orgFsStat(s.id,dv,t.savePath)}),n.invalidateQueries({queryKey:it.orgFsRecent(s.id)}))},C=O=>{w.iframe?.contentWindow?.postMessage(O,"*")},V=()=>{w.source=null,f(!1),_&&y(_),S(O=>O+1),j()};t.statMarker!==_&&(L(t.statMarker),t.statMarker!==null&&(b===null?y(t.statMarker):w.selfMarkers.has(t.statMarker)||t.statMarker!==b&&(k?f(!0):(w.source=null,y(t.statMarker)))));const N=async()=>{w.saveTimer=null;const O=w.source;if(O===null){x(!1);return}p(!0);try{const B=await i.mutateAsync({path:t.savePath,body:O});w.selfMarkers.add(X2(B)),j()}catch(B){console.error("[deck-editor] save failed",B),xe.error("Couldn't save deck edits — reloading the preview."),M.current.reload()}finally{p(!1),x(!1)}},T=O=>{x(!0),w.saveTimer&&clearTimeout(w.saveTimer),w.saveTimer=setTimeout(()=>{M.current.flushSave()},O)},P=(O,B,F)=>{C({v:vc,type:"ack",opId:O,ok:B,error:F})},E=async O=>{if(!e){P(O.opId,!1,"read-only preview");return}try{if(w.source===null){const F=await fetch(t.readUrl,{credentials:"include"});if(!F.ok)throw new Error(`HTTP ${F.status}`);w.source=await F.text()}const B=Gae(w.source);if(B===null||B!==O.witness.childCount)throw new jo(`slide count drifted (source ${B}, iframe ${O.witness.childCount})`,"stale-index");w.source=Yae(w.source,O.op),P(O.opId,!0),T(O.op.kind==="replace"?Xae:Jae)}catch(B){console.error("[deck-editor] op failed",O.op,B),P(O.opId,!1,B instanceof Error?B.message:String(B)),xe.error("That edit couldn't be saved — reloading the preview."),M.current.reload()}},R=O=>{if(!w.iframe||O.source!==w.iframe.contentWindow)return;const B=qae(O.data);if(B){if(B.type==="ready"){c(!0),M.current.editMode?C({v:vc,type:"set-edit-mode",enabled:!0}):M.current.railOpen&&C({v:vc,type:"set-rail",open:!0});return}B.type==="op"&&(w.queue=w.queue.then(()=>M.current.handleOp(B)).catch(()=>{}))}},M=A.useRef({onMessage:R,handleOp:E,flushSave:N,reload:V,editMode:r,railOpen:d});M.current={onMessage:R,handleOp:E,flushSave:N,reload:V,editMode:r,railOpen:d};const[I]=A.useState(()=>{let O=null;return B=>{if(B){w.iframe=B;const F=z=>M.current.onMessage(z);window.addEventListener("message",F),O=()=>window.removeEventListener("message",F)}else O?.(),O=null,w.iframe=null}}),D=O=>{u(O),C({v:vc,type:"set-rail",open:O})},$=O=>{l(O),C({v:vc,type:"set-edit-mode",enabled:O}),O&&u(!0),!O&&h&&!g&&!m&&V()};return{iframeRef:I,deckDetected:a,writable:e,displayedMarker:b===null?null:`${b}.${v}`,editMode:r,setEditMode:$,railOpen:d,setRailOpen:D,saving:m,agentUpdated:h,reload:V,postToIframe:C}}const Zae=300;function Jk({readUrl:t,marker:e,title:s,savePath:n,trailing:i}){const r=Qae({readUrl:t,statMarker:e,savePath:n}),[l,a]=A.useState(null);if(r.displayedMarker===null)return null;const c=t.includes("?")?"&":"?",d=`${t}${c}v=${encodeURIComponent(r.displayedMarker)}`,u=l===d;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(Wae,{readUrl:t,editor:r,downloadName:s.split("/").pop()??s,trailing:i}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:r.iframeRef,src:d,onLoad:()=>a(d),sandbox:"allow-scripts allow-downloads",className:ae("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",u?"opacity-100":"opacity-0"),style:{transitionDuration:`${Zae}ms`},title:s},d)})]})}const ece=[{mode:"private",labelKey:"library.fileShareButton.modeOrgOnly",Icon:Gc},{mode:"public",labelKey:"library.fileShareButton.modePublic",Icon:An},{mode:"password",labelKey:"library.fileShareButton.modePassword",Icon:Zf}];function Xk(t){const e=U.c(56),{volume:s,path:n,kind:i,shareMode:r,effectivePublic:l,url:a}=t,c=ce(),d=eP(s),{data:u}=Q2(s,n),h=u?.shareMode??r,m=(u?.effectivePublic??l)&&h==="private",p=i==="dir",g=p?"folder":"file",[x,b]=A.useState(!1),[y,_]=A.useState(""),[L,v]=A.useState(!1);let S;e[0]!==n||e[1]!==d||e[2]!==g||e[3]!==c?(S=(O,B)=>{d.mutate({path:n,mode:O,password:B},{onSuccess:()=>{b(!1),_(""),xe.success(O==="private"?c("library.fileShareButton.toastOrgOnly",{subject:g}):O==="public"?c("library.fileShareButton.toastPublic",{subject:g}):c("library.fileShareButton.toastPassword",{subject:g}))},onError:F=>xe.error(F instanceof Error?F.message:c("library.fileShareButton.failedUpdateSharing"))})},e[0]=n,e[1]=d,e[2]=g,e[3]=c,e[4]=S):S=e[4];const w=S;let k;e[5]!==w?(k=O=>{if(O==="password"){b(!0);return}b(!1),w(O)},e[5]=w,e[6]=k):k=e[6];const j=k,C=x?"password":h;let V;e[7]!==c||e[8]!==a?(V=async()=>{a&&(await navigator.clipboard.writeText(a),v(!0),xe.success(c("library.fileShareButton.linkCopied")),setTimeout(()=>v(!1),2e3))},e[7]=c,e[8]=a,e[9]=V):V=e[9];const N=V;let T;e[10]!==L||e[11]!==N||e[12]!==c||e[13]!==a?(T=a?o.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/50 px-2 py-1.5",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:a}),o.jsx(fe,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:N,"aria-label":c("library.fileShareButton.copyLink"),children:L?o.jsx(zt,{size:12,className:"text-success"}):o.jsx(vn,{size:12})})]}):null,e[10]=L,e[11]=N,e[12]=c,e[13]=a,e[14]=T):T=e[14];const P=T;if(m){let O;e[15]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:o.jsx(An,{size:16})}),e[15]=O):O=e[15];let B;e[16]!==c?(B=c("library.fileShareButton.sharedViaParent"),e[16]=c,e[17]=B):B=e[17];let F;e[18]!==B?(F=o.jsx("span",{className:"text-sm font-medium text-foreground",children:B}),e[18]=B,e[19]=F):F=e[19];const z=p?"files in this folder":"this file";let W;e[20]!==c||e[21]!==z?(W=c("library.fileShareButton.inheritedDescription",{target:z}),e[20]=c,e[21]=z,e[22]=W):W=e[22];let K;e[23]!==W?(K=o.jsx("span",{className:"text-xs text-muted-foreground",children:W}),e[23]=W,e[24]=K):K=e[24];let H;e[25]!==K||e[26]!==F?(H=o.jsxs("div",{className:"flex items-start gap-3",children:[O,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,K]})]}),e[25]=K,e[26]=F,e[27]=H):H=e[27];let q;return e[28]!==P||e[29]!==H?(q=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[H,P]}),e[28]=P,e[29]=H,e[30]=q):q=e[30],q}let E;e[31]!==C||e[32]!==j||e[33]!==d.isPending||e[34]!==c?(E=ece.map(O=>{const{mode:B,labelKey:F,Icon:z}=O;return o.jsxs("button",{type:"button",disabled:d.isPending,onClick:()=>j(B),className:ae("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",C===B?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(z,{size:15}),c(F)]},B)}),e[31]=C,e[32]=j,e[33]=d.isPending,e[34]=c,e[35]=E):E=e[35];let R;e[36]!==E?(R=o.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:E}),e[36]=E,e[37]=R):R=e[37];let M;e[38]!==C||e[39]!==p||e[40]!==c?(M=C==="private"?c("library.fileShareButton.privateDescription",{target:p?"these files":"this link"}):C==="public"?c(p?"library.fileShareButton.publicFolderDescription":"library.fileShareButton.publicFileDescription"):c("library.fileShareButton.passwordDescription",{target:p?"files in this folder":"this file"}),e[38]=C,e[39]=p,e[40]=c,e[41]=M):M=e[41];let I;e[42]!==M?(I=o.jsx("p",{className:"text-xs text-muted-foreground",children:M}),e[42]=M,e[43]=I):I=e[43];let D;e[44]!==C||e[45]!==w||e[46]!==h||e[47]!==y||e[48]!==d.isPending||e[49]!==c?(D=C==="password"&&o.jsxs("form",{className:"flex items-center gap-2",onSubmit:O=>{O.preventDefault(),y&&w("password",y)},children:[o.jsx(kt,{type:"password",value:y,onChange:O=>_(O.target.value),placeholder:c(h==="password"?"library.fileShareButton.newPasswordPlaceholder":"library.fileShareButton.passwordPlaceholder"),autoComplete:"new-password",className:"h-8 text-xs"}),o.jsx(fe,{type:"submit",size:"sm",className:"shrink-0",disabled:!y||d.isPending,children:c(h==="password"?"library.fileShareButton.buttonUpdate":"library.fileShareButton.buttonSet")})]}),e[44]=C,e[45]=w,e[46]=h,e[47]=y,e[48]=d.isPending,e[49]=c,e[50]=D):D=e[50];let $;return e[51]!==P||e[52]!==R||e[53]!==I||e[54]!==D?($=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[R,I,D,P]}),e[51]=P,e[52]=R,e[53]=I,e[54]=D,e[55]=$):$=e[55],$}function xp(t){const e=U.c(21),{volume:s,path:n,shareMode:i,effectivePublic:r,url:l}=t,a=ce();let c;e[0]!==a?(c=a("library.fileShareButton.share"),e[0]=a,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(aP,{size:14}),e[2]=d):d=e[2];let u;e[3]!==c?(u=o.jsx(He,{asChild:!0,children:o.jsx(ds,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":c,children:d})})}),e[3]=c,e[4]=u):u=e[4];let h;e[5]!==a?(h=a("library.fileShareButton.share"),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==h?(f=o.jsx(Ke,{side:"bottom",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==u||e[10]!==f?(m=o.jsxs(We,{children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11];let p;e[12]!==r||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==s?(p=o.jsx(hs,{align:"end",className:"w-80 p-3",children:o.jsx(Xk,{volume:s,path:n,kind:"file",shareMode:i,effectivePublic:r,url:l})}),e[12]=r,e[13]=n,e[14]=i,e[15]=l,e[16]=s,e[17]=p):p=e[17];let g;return e[18]!==m||e[19]!==p?(g=o.jsxs(fs,{children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20],g}function tce(t){const e=U.c(14),{target:s,onOpenChange:n}=t,i=ce(),r=!!s,l=s?.kind==="dir"?"folder":"file";let a;e[0]!==i||e[1]!==l?(a=i("library.fileShareButton.shareDialogTitle",{type:l}),e[0]=i,e[1]=l,e[2]=a):a=e[2];let c;e[3]!==a?(c=o.jsx(ms,{children:o.jsx(Gt,{children:a})}),e[3]=a,e[4]=c):c=e[4];let d;e[5]!==s?(d=s&&o.jsx(Xk,{...s}),e[5]=s,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=o.jsxs(Ft,{className:"sm:max-w-md",children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==n||e[11]!==r||e[12]!==u?(h=o.jsx(Ut,{open:r,onOpenChange:n,children:u}),e[10]=n,e[11]=r,e[12]=u,e[13]=h):h=e[13],h}const K1="home";function sce(t){const e=U.c(5),{label:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(nn,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=n):n=e[0];let i;e[1]!==s?(i=s&&o.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=i):i=e[2];let r;return e[3]!==i?(r=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[n,i]}),e[3]=i,e[4]=r):r=e[4],r}function nce(t){const e=U.c(15),{path:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={refetchIntervalWhenAbsent:2e3},e[0]=n):n=e[0];const i=Q2(K1,s,n),r=J2(K1)(s);if(i.isPending||!i.data){const f=!i.isPending&&!i.data?"Waiting for the deck to sync…":void 0;let m;return e[1]!==f?(m=o.jsx(sce,{label:f}),e[1]=f,e[2]=m):m=e[2],m}let l;e[3]!==i.data?(l=X2(i.data),e[3]=i.data,e[4]=l):l=e[4];const a=i.data.shareMode??"private",c=i.data.effectivePublic??!1,d=window.location.origin+r;let u;e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==d?(u=o.jsx(xp,{volume:K1,path:s,shareMode:a,effectivePublic:c,url:d}),e[5]=s,e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==s||e[11]!==r||e[12]!==l||e[13]!==u?(h=o.jsx(Jk,{readUrl:r,marker:l,title:s,savePath:s,trailing:u}),e[10]=s,e[11]=r,e[12]=l,e[13]=u,e[14]=h):h=e[14],h}function ice(t){const e=U.c(13),{previewPath:s}=t,n=ce(),i=ln(),r=el({strict:!1}).org??"";let l;e[0]!==s?(l=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=l):l=e[1];const a=l;let c;e[2]!==i||e[3]!==r||e[4]!==a||e[5]!==s?(c=()=>{i({to:vl.library,params:{org:r},search:{path:a||void 0,preview:s}})},e[2]=i,e[3]=r,e[4]=a,e[5]=s,e[6]=c):c=e[6];const d=c;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ho,{size:14}),e[7]=u):u=e[7];let h;e[8]!==n?(h=n("library.seeInLibrary.label"),e[8]=n,e[9]=h):h=e[9];let f;return e[10]!==d||e[11]!==h?(f=o.jsxs(fe,{variant:"ghost",size:"sm",onClick:d,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:[u,h]}),e[10]=d,e[11]=h,e[12]=f):f=e[12],f}const rce=t=>/\.html?$/i.test(t);function uv(t){const e=U.c(10),{onClose:s}=t,n=ce();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ni,{size:14}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:s,children:i})}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=n("library.previewContent.close"),e[3]=n,e[4]=l):l=e[4];let a;e[5]!==l?(a=o.jsx(Ke,{side:"bottom",children:l}),e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==a?(c=o.jsxs(We,{children:[r,a]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c}function Qk(t){const e=U.c(67),{previewPath:s,onClose:n,showSeeInLibrary:i,variant:r}=t,l=i===void 0?!1:i,a=ce();let c;e[0]!==s?(c=rg(s),e[0]=s,e[1]=c):c=e[1];const d=c,{volume:u,dirPath:h}=d,{data:f,isPending:m}=Q2(u,h),p=J2(u??"");let g,x,b,y,_,L,v,S,w;if(e[2]!==p||e[3]!==f||e[4]!==h||e[5]!==n||e[6]!==s||e[7]!==l||e[8]!==r||e[9]!==u){w=Symbol.for("react.early_return_sentinel");e:{x=un(h),b=r==="dialog";let P;e[19]!==s||e[20]!==l?(P=l?o.jsx(ice,{previewPath:s}):null,e[19]=s,e[20]=l,e[21]=P):P=e[21];const E=P;if(g=f&&f.kind==="file"?{key:s,filename:x,size:f.size,downloadUrl:p(f.path)}:null,g&&f&&rce(x)){const M=g.downloadUrl;let I;e[22]!==f?(I=X2(f),e[22]=f,e[23]=I):I=e[23];const D=u??"",$=f.shareMode??"private",O=f.effectivePublic??!1,B=window.location.origin+g.downloadUrl;let F;e[24]!==h||e[25]!==D||e[26]!==$||e[27]!==O||e[28]!==B?(F=o.jsx(xp,{volume:D,path:h,shareMode:$,effectivePublic:O,url:B}),e[24]=h,e[25]=D,e[26]=$,e[27]=O,e[28]=B,e[29]=F):F=e[29];let z;e[30]!==b||e[31]!==n?(z=b?o.jsx("div",{className:"w-8 shrink-0"}):o.jsx(uv,{onClose:n}),e[30]=b,e[31]=n,e[32]=z):z=e[32];let W;e[33]!==E||e[34]!==F||e[35]!==z?(W=o.jsxs(o.Fragment,{children:[F,E,z]}),e[33]=E,e[34]=F,e[35]=z,e[36]=W):W=e[36],w=o.jsxs(o.Fragment,{children:[b&&o.jsx(Gt,{className:"sr-only",children:x}),o.jsx(Jk,{readUrl:M,marker:I,title:x,savePath:u==="home"?h:void 0,trailing:W},s)]});break e}const R=b?"h-11 py-1 pr-12 pl-2":"h-9 px-2";e[37]!==R?(S=ae("flex shrink-0 items-center gap-1 border-b border-border/60",R),e[37]=R,e[38]=S):S=e[38],y="flex min-w-0 flex-1 items-center gap-2 px-2",_=o.jsx(Ko,{filename:x,className:"h-4.5 w-3.5 shrink-0"}),L=b?o.jsx(Gt,{className:"truncate text-xs font-medium text-foreground",children:x}):o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:x}),v=g&&o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:b8(g.size)})}e[2]=p,e[3]=f,e[4]=h,e[5]=n,e[6]=s,e[7]=l,e[8]=r,e[9]=u,e[10]=g,e[11]=x,e[12]=b,e[13]=y,e[14]=_,e[15]=L,e[16]=v,e[17]=S,e[18]=w}else g=e[10],x=e[11],b=e[12],y=e[13],_=e[14],L=e[15],v=e[16],S=e[17],w=e[18];if(w!==Symbol.for("react.early_return_sentinel"))return w;let k;e[39]!==y||e[40]!==_||e[41]!==L||e[42]!==v?(k=o.jsxs("div",{className:y,children:[_,L,v]}),e[39]=y,e[40]=_,e[41]=L,e[42]=v,e[43]=k):k=e[43];let j;e[44]!==f?.effectivePublic||e[45]!==f?.shareMode||e[46]!==g||e[47]!==h||e[48]!==a||e[49]!==u?(j=g&&o.jsxs(o.Fragment,{children:[o.jsx(xp,{volume:u??"",path:h,shareMode:f?.shareMode??"private",effectivePublic:f?.effectivePublic??!1,url:window.location.origin+g.downloadUrl}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",asChild:!0,children:o.jsx("a",{href:g.downloadUrl,download:g.filename,children:o.jsx(_u,{size:14})})})}),o.jsx(Ke,{side:"bottom",children:a("library.previewContent.download")})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>window.open(g.downloadUrl,"_blank","noopener"),children:o.jsx(mn,{size:14})})}),o.jsx(Ke,{side:"bottom",children:a("library.previewContent.openInNewTab")})]})]}),e[44]=f?.effectivePublic,e[45]=f?.shareMode,e[46]=g,e[47]=h,e[48]=a,e[49]=u,e[50]=j):j=e[50];let C;e[51]!==b||e[52]!==n?(C=!b&&o.jsx(uv,{onClose:n}),e[51]=b,e[52]=n,e[53]=C):C=e[53];let V;e[54]!==j||e[55]!==C||e[56]!==S||e[57]!==k?(V=o.jsxs("div",{className:S,children:[k,j,C]}),e[54]=j,e[55]=C,e[56]=S,e[57]=k,e[58]=V):V=e[58];let N;e[59]!==g||e[60]!==x||e[61]!==m||e[62]!==a?(N=o.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:g?o.jsx(x8,{file:g}):m?o.jsx(g8,{}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[o.jsx(Ko,{filename:x,className:"h-7.5 w-6"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:a("library.previewContent.fileNotAvailable")})]})}),e[59]=g,e[60]=x,e[61]=m,e[62]=a,e[63]=N):N=e[63];let T;return e[64]!==V||e[65]!==N?(T=o.jsxs(o.Fragment,{children:[V,N]}),e[64]=V,e[65]=N,e[66]=T):T=e[66],T}function oce(t){const e=U.c(4),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;return e[0]!==n||e[1]!==s||e[2]!==r?(l=o.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:o.jsx(Qk,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"panel"})}),e[0]=n,e[1]=s,e[2]=r,e[3]=l):l=e[3],l}function lce(t){const e=U.c(5),{path:s}=t,{closePanel:n}=pr();let i;e[0]!==n?(i=()=>n(),e[0]=n,e[1]=i):i=e[1];const r=i;let l;return e[2]!==r||e[3]!==s?(l=o.jsx(oce,{previewPath:s,onClose:r,showSeeInLibrary:!0}),e[2]=r,e[3]=s,e[4]=l):l=e[4],l}function ace(t){const e=t("library.brandComponentsPreview.title"),s=t("library.brandComponentsPreview.subtitle"),n=t("library.brandComponentsPreview.monthlySavingsLabel"),i=t("library.brandComponentsPreview.primaryButton"),r=t("library.brandComponentsPreview.secondaryButton"),l=t("library.brandComponentsPreview.ghostButton"),a=t("library.brandComponentsPreview.successBadge"),c=t("library.brandComponentsPreview.warningBadge"),d=t("library.brandComponentsPreview.errorBadge"),u=t("library.brandComponentsPreview.infoBadge"),h=t("library.brandComponentsPreview.allChip"),f=t("library.brandComponentsPreview.incomeChip"),m=t("library.brandComponentsPreview.spendingChip"),p=t("library.brandComponentsPreview.emailPlaceholder");return`
|
|
645
645
|
<div class="stack">
|
|
@@ -801,7 +801,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
801
801
|
<p class="cta">slides-create --theme …</p>
|
|
802
802
|
</section>`].join(`
|
|
803
803
|
|
|
804
|
-
`);function mce(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",fce).replaceAll("{{title}}",hce).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function pce(t){const e=U.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=yu(s),l=yu(i??"");if(r.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(nn,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(r.isError||!r.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=mce(r.data,a),e[2]=a,e[3]=r.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function Wd(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function gce(t){const e=U.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>{const m=r(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":f.name,title:p,value:pE(m),onChange:g=>l(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):o.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function xce(t){const e=U.c(9),{token:s,value:n}=t;if(s.kind==="space"){let r;return e[0]!==n?(r=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=r):r=e[1],r}if(s.kind==="radius"){let r;return e[2]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=r):r=e[3],r}if(s.kind==="shadow"){let r;return e[4]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=r):r=e[5],r}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const r=`min(${n}, 22px)`;let l;return e[6]!==r?(l=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:r},children:"Ag"}),e[6]=r,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Zk(t){const e=U.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(xce,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==r||e[10]!==s.name||e[11]!==n?(d=i?o.jsx(kt,{value:n,onChange:h=>r(s.name,h.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Ad(t){const e=U.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=o.jsx(Wd,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>o.jsx(Zk,{token:f,value:r(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function bce({brandPath:t,onClose:e,variant:s}){const n=ce(),{org:i}=Fe(),r=rg(t),l=r.volume??"",a=r.dirPath,c=un(a),d=r.readOnly,u=Ms(),h=Wu(),f=a8(l),{upload:m,remove:p}=vu(l),g=A.useRef(null),x=c8(l,a),b=x.data??[],y=J=>b.some(he=>he.kind==="file"&&un(he.path)===J),_=y("tokens.css"),L=y("brand.md"),v=y("slides-theme.html"),S=uE(b),w=h(l,`${a}/tokens.css`),k=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),C=yu(w,{enabled:_}),V=yu(k,{enabled:L}),[N,T]=A.useState(!1),[P,E]=A.useState({}),[R,M]=A.useState(null),[I,D]=A.useState(!1),[$,O]=A.useState(!1),[B,F]=A.useState("deck"),z=C.data?hE(C.data):[],W=J=>z.find(he=>he.name===J)?.value,K=J=>P[J.name]??J.value,H=fE(z),q=z.filter(J=>J.kind==="font"),G=z.filter(J=>J.kind==="type"),Q=z.filter(J=>J.kind==="space"),se=z.filter(J=>J.kind==="radius"),Z=z.filter(J=>J.kind==="shadow"),te=z.filter(J=>J.kind==="motion"),X=z.filter(J=>J.kind==="other"),Y=(J,he)=>E(ve=>({...ve,[J]:he})),de=v&&B==="deck",re=R??V.data??"",le=Object.entries(P).filter(([J,he])=>W(J)!==he),ne=R!==null&&R!==(V.data??""),me=le.length>0||ne;function ee(){E({}),M(null),T(!1)}async function oe(){D(!0);try{if(le.length>0){let J=C.data??"";for(const[he,ve]of le)J=mE(J,he,ve);await f.mutateAsync({path:`${a}/tokens.css`,body:J,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:it.fileText(w)})}ne&&R!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:it.fileText(k)})),u.invalidateQueries({queryKey:it.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),E({}),M(null),T(!1),xe.success(n("library.brandPreview.brandSaved"))}catch(J){xe.error(J instanceof Error?J.message:n("library.brandPreview.failedSaveBrand"))}finally{D(!1)}}async function ie(J){const he=J?.[0];if(!he)return;const je=`logo.${(he.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([he],je,{type:he.type})]}),S&&un(S)!==je&&await p.mutateAsync(S),xe.success(n("library.brandPreview.logoUpdated"))}catch(Ce){xe.error(Ce instanceof Error?Ce.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ue=!x.isPending&&!_&&!L&&!S;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(Tm,{size:18})}),s==="dialog"?o.jsx(Gt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(N?o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",size:"sm",onClick:ee,disabled:I,children:n("library.brandPreview.cancel")}),o.jsx(fe,{size:"sm",disabled:!me||I,onClick:()=>{oe()},children:n(I?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[o.jsx(UT,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(AV,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Ws,{size:16})})}):o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Ws,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(nn,{className:"h-40 w-full rounded-xl"}),o.jsx(nn,{className:"h-4 w-1/3"}),o.jsx(nn,{className:"h-4 w-2/3"})]}):ue?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(v||_)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n($?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>O(J=>!J),onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),O(he=>!he))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:J=>J.stopPropagation(),children:[v&&o.jsx("button",{type:"button",onClick:()=>{F("deck"),O(!1)},className:ae("rounded-md px-2.5 py-1",de?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{F("components"),O(!1)},className:ae("rounded-md px-2.5 py-1",de?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),$?o.jsx(Ls,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(f6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!$&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:ae("w-full overflow-hidden rounded-xl border border-border bg-muted/30",de?"aspect-[16/9]":"h-96"),children:de?o.jsx(pce,{readUrl:j,title:`${c} deck theme`,tokensUrl:w}):o.jsx(uce,{tokensUrl:w})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:S?o.jsx("img",{src:h(l,S),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(Tm,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(fe,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Jn,{size:14}),n(S?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:J=>{ie(J.target.files)}})]})]})]}),H.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.colors")}),H.map(J=>o.jsx(gce,{family:J.family,tokens:J.tokens,editing:N,valueOf:K,onEdit:Y},J.family))]}),(q.length>0||G.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.typography")}),q.map(J=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:J.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(kt,{value:K(J),onChange:he=>Y(J.name,he.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:K(J)},children:K(J)})]},J.name)),G.map(J=>o.jsx(Zk,{token:J,value:K(J),editing:N,onEdit:Y},J.name))]}),o.jsx(Ad,{label:n("library.brandPreview.spacing"),tokens:Q,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.radius"),tokens:se,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.shadows"),tokens:Z,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.motion"),tokens:te,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.tokens"),tokens:X,editing:N,valueOf:K,onEdit:Y}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Wo,{value:re,onChange:J=>M(J.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):V.isPending&&L?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(nn,{className:"h-3 w-full"}),o.jsx(nn,{className:"h-3 w-5/6"})]}):re.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(nd,{id:`brand-preview-${t}`,text:re})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function ej(t){const e=U.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(Ft,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(bce,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==i||e[6]!==r?(l=o.jsx(Ut,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function tj(t){const e=U.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==r?(a=o.jsx(Ft,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(Qk,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=o.jsx(Ut,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function vce(t){const e=U.c(11),{onOpenDir:s}=t,n=ce(),i=gE();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(Zu,{name:d.volume,glyph:_n,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:B8(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=o.jsx(o.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function ex(t){return`${window.location.origin}${t}`}function fu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const yce=[Lu,"uploads","outputs"],sj=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Jn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:zr}],bp=new Set([...sj.map(t=>t.volume),Oc("public")]),_ce=6;function nj(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=y8(t),r=i?`public/${i}`:t==="home"?Su(s):t;return n?`${r}/${n}`:r}function rh(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function To(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Dr(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function R9(t){const e=U.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Dr,{children:Array.from({length:n*3},Lce)}),e[0]=n,e[1]=i):i=e[1],i}function Lce(t,e){return o.jsx(nn,{className:"h-16 rounded-2xl"},e)}function tx(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Sce(t){const e=U.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=ce(),a=sP(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(u=o.jsx(Zu,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=u):u=e[11],u}function wce(t){const e=U.c(12),{onOpenDir:s}=t,n=ce(),r=d8().data?.length??0;let l;e[0]!==s?(l=sj.map(u=>o.jsx(Sce,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r||e[4]!==n?(a=r>0&&o.jsx(Zu,{name:Oc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:dr,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=r,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=o.jsx(vce,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function kce(t){const e=U.c(19),{segments:s,onNavigate:n}=t,{org:i}=Fe();let r;e[0]!==s?(r=s[0]===Lu?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const l=r,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:Su(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Lu),children:Su(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(qs,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Oc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Oc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function jce(t){const e=U.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=ce(),{org:d}=Fe(),u=Wu(),h=tP(s,n);let f;e[0]!==u||e[1]!==l?(f=w=>l({volume:w.volume,path:w.path,kind:"file",shareMode:w.shareMode??"private",effectivePublic:w.effectivePublic??!1,url:ex(u(w.volume,w.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(R9,{rows:2}),e[3]=w):w=e[3],w}let p,g,x,b,y;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){y=Symbol.for("react.early_return_sentinel");e:{if(g=h.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(tx,{children:k}),e[17]=k,e[18]=j):j=e[18],y=j;break e}const w=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==w?(b=ae("flex flex-col gap-3",w),e[19]=w,e[20]=b):b=e[20],p=To,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=y}else p=e[9],g=e[10],x=e[11],b=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let _;e[21]!==p||e[22]!==x?(_=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let L;if(e[24]!==u||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==m){let w;e[31]!==u||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==m?(w=k=>{const j=y8(k.volume)!==null;return o.jsx(z8,{filename:un(k.path),updatedAt:k.updatedAt,downloadUrl:u(k.volume,k.path),subtitle:nj(k.volume,k.path,d.slug),publicState:fu(k),onOpen:()=>r(_8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=u,e[32]=a,e[33]=r,e[34]=d,e[35]=m,e[36]=w):w=e[36],L=g.map(w),e[24]=u,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let v;e[37]!==L?(v=o.jsx(Dr,{children:L}),e[37]=L,e[38]=v):v=e[38];let S;return e[39]!==b||e[40]!==_||e[41]!==v?(S=o.jsxs("div",{className:b,children:[_,v]}),e[39]=b,e[40]=_,e[41]=v,e[42]=S):S=e[42],S}function Cce(t){const e=U.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=ce(),{org:l}=Fe(),a=l8(),c=Wu();let d;e[0]!==c||e[1]!==n?(d=y=>n({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:ex(c(y.volume,y.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let y;e[3]!==r?(y=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=y):y=e[4];let _;e[5]!==y?(_=o.jsx(To,{children:y}),e[5]=y,e[6]=_):_=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(R9,{}),e[7]=L):L=e[7];let v;return e[8]!==_?(v=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,L]}),e[8]=_,e[9]=v):v=e[9],v}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const y=(a.data??[]).slice(0,_ce);if(y.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==r?(_=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=_):_=e[23],e[24]!==_?(p=o.jsx(To,{children:_}),e[24]=_,e[25]=p):p=e[25],h=Dr;let L;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(L=v=>o.jsx(vE,{filename:un(v.path),updatedAt:v.updatedAt,size:v.size,downloadUrl:c(v.volume,v.path),subtitle:nj(v.volume,v.path,l.slug),publicState:fu(v),onOpen:()=>s(_8(v.volume,v.path)),onShare:()=>u(v),onDelete:()=>i({volume:v.volume,path:v.path,kind:"file"})},`${v.volume}/${v.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=L):L=e[31],f=y.map(L)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=r,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=o.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Nce(t){const e=U.c(16),{onOpenDir:s}=t,n=ce(),i=d8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(R9,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.data?(r=i.data??[],e[1]=i.data,e[2]=r):r=e[2];const l=r;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let u;return e[5]!==d?(u=o.jsx(tx,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>o.jsx(Zu,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=o.jsx(Dr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Vce(t){const e=U.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=ce(),{org:m}=Fe(),p=s.volume??"",g=c8(p,s.dirPath),x=Wu();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=N=>s.isHomeRoot&&bp.has(N.toLowerCase())?`${Su(m.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const y=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(wce,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const L=_;if(g.isPending){let N;e[6]!==L||e[7]!==f?(N=L&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.folders")}),o.jsx(Dr,{children:L})]}),e[6]=L,e[7]=f,e[8]=N):N=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(R9,{rows:2}),e[9]=T):T=e[9];let P;return e[10]!==N?(P=o.jsxs(o.Fragment,{children:[N,T]}),e[10]=N,e[11]=P):P=e[11],P}if(g.isError){let N;e[12]!==g.error||e[13]!==f?(N=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=N):N=e[14];let T;return e[15]!==N?(T=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=T):T=e[16],T}let v,S,w,k,j;if(e[17]!==y||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],T=N.filter(Ece),P=N.filter(Pce),E=N.filter(Ace),R=N.filter(Tce);if(N.length===0&&!s.isHomeRoot){let O;e[38]!==s.readOnly||e[39]!==f?(O=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=O):O=e[40];let B;e[41]!==O?(B=o.jsx(tx,{children:O}),e[41]=O,e[42]=B):B=e[42],j=B;break e}let M;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(M=O=>s.readOnly?void 0:()=>c({volume:p,path:O.path,kind:O.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=M):M=e[46];const I=M;let D;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?(D=O=>s.readOnly?void 0:()=>a({volume:p,path:O.path,kind:O.kind,shareMode:O.shareMode??"private",effectivePublic:O.effectivePublic??!1,url:O.kind==="file"?ex(x(p,O.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=D):D=e[51];const $=D;v=T.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.skills")}),o.jsx(Dr,{children:T.map(O=>o.jsx(xE,{dirName:un(O.path),updatedAt:O.updatedAt,skillMdUrl:x(p,`${O.path}/SKILL.md`),publicState:fu(O),onOpen:()=>r(ac(s,O.path)),onBrowse:()=>n(ac(s,O.path)),onShare:$(O),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"dir",{onDragStart:d,onContextMenu:u})},O.path))})]}),S=P.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.brands")}),o.jsx(Dr,{children:P.map(O=>o.jsx(bE,{dirName:un(O.path),updatedAt:O.updatedAt,tokensUrl:x(p,`${O.path}/tokens.css`),onOpen:()=>l(ac(s,O.path)),onBrowse:()=>n(ac(s,O.path)),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"dir",{onDragStart:d,onContextMenu:u})},O.path))})]}),w=(E.length>0||L)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.folders")}),o.jsxs(Dr,{children:[L,E.map(O=>o.jsx(Zu,{name:un(O.path),meta:B8(O.updatedAt),subtitle:y(un(O.path)),readOnly:s.readOnly,publicState:fu(O),onOpen:()=>n(ac(s,O.path)),onShare:$(O),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},O.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.files")}),o.jsx(Dr,{children:R.map(O=>o.jsx(z8,{filename:un(O.path),updatedAt:O.updatedAt,downloadUrl:x(p,O.path),publicState:fu(O),onOpen:()=>i(ac(s,O.path)),onShare:$(O),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"file",{onDragStart:d,onContextMenu:u})},O.path))})]})}e[17]=y,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=L,e[31]=f,e[32]=p,e[33]=v,e[34]=S,e[35]=w,e[36]=k,e[37]=j}else v=e[33],S=e[34],w=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(C=s.isHomeRoot&&o.jsx(Cce,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let V;return e[57]!==v||e[58]!==S||e[59]!==w||e[60]!==k||e[61]!==C?(V=o.jsxs(o.Fragment,{children:[v,S,w,k,C]}),e[57]=v,e[58]=S,e[59]=w,e[60]=k,e[61]=C,e[62]=V):V=e[62],V}function Tce(t){return t.kind==="file"}function Ace(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Pce(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Ece(t){return t.kind==="dir"&&t.hasSkill}function Rce({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ce(),{org:i}=Fe(),r=Ms(),l=ln(),a=Hl(),c=Zo({strict:!1}),d=c.path||Lu,u=rg(d),h=yE(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(J,he)=>l({to:".",search:ve=>({...ve,[J]:he||void 0})}),p=J=>m("path",J),g=(J,he)=>l({to:".",search:ve=>({...ve,preview:void 0,skill:void 0,brand:void 0,[J]:he})}),x=t??(J=>g("preview",J)),b=e??(J=>g("skill",J)),y=s??(J=>g("brand",J)),[_,L]=A.useState(""),v=r9(_.trim(),300),S=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,w=S?n("library.library.searchInPlaceholder",{folder:Oc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?Su(i.slug):Oc(f.segments.at(-1)??""),[j,C]=A.useState(null),[V,N]=A.useState(null),[T,P]=A.useState(!1),[E,R]=A.useState(""),[M,I]=A.useState(!1),[D,$]=A.useState(null),[O,B]=A.useState(""),F=A.useRef(null),[z,W]=A.useState(!1),K=A.useRef(0),H=f.readOnly?null:f.volume,{upload:q,mkdir:G,move:Q}=vu(H??Lu),{remove:se}=vu(j?.volume??"uploads");async function Z(J){if(!(!H||!J||J.length===0))try{await q.mutateAsync({dir:f.dirPath,files:[...J]}),xe.success(J.length===1?n("library.library.uploadedSingle",{filename:J[0]?.name??""}):n("library.library.uploadedMultiple",{count:J.length}))}catch(he){xe.error(he instanceof Error?he.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const te=H!==null;function X(J){return J.dataTransfer.types.includes("Files")}function Y(J){!te||!X(J)||(J.preventDefault(),K.current+=1,W(!0))}function de(J){!te||!X(J)||J.preventDefault()}function re(){te&&(K.current=Math.max(0,K.current-1),K.current===0&&W(!1))}function le(J){te&&(J.preventDefault(),J.stopPropagation(),K.current=0,W(!1),J.dataTransfer.files.length>0&&Z(J.dataTransfer.files))}async function ne(){const J=E.trim();if(!(!H||!J)){if(f.isHomeRoot&&bp.has(J.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:J}));return}try{const he=f.dirPath;await G.mutateAsync(he?`${he}/${J}`:J),xe.success(n("library.library.folderCreated",{name:J})),P(!1),R("")}catch(he){xe.error(he instanceof Error?he.message:n("library.library.folderCreateFailed"))}}}async function me(){if(!j)return;const J=j;try{await se.mutateAsync(J.path),xe.success(n("library.library.deleted",{name:un(J.path)}))}catch(he){xe.error(he instanceof Error?he.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ee(){if(!D)return;const J=O.trim();if(!J||J.includes("/")||J.includes("..")||J===un(D.path)){I(!1),$(null),B("");return}if(D.kind==="dir"&&f.isHomeRoot&&bp.has(J.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:J}));return}try{const he=D.path.includes("/")?D.path.slice(0,D.path.lastIndexOf("/")):"",ve=he?`${he}/${J}`:J;await Q.mutateAsync({from:D.path,to:ve});const je=J.replace(/[<>]/g,"");xe.success(n("library.library.renamed",{name:je}))}catch(he){xe.error(he instanceof Error?he.message:n("library.library.renameFailed"))}finally{I(!1),$(null),B("")}}async function oe(J,he){try{const ve=un(J),je=he?`${he}/${ve}`:ve;await Q.mutateAsync({from:J,to:je}),xe.success(n("library.library.moved",{name:ve,destination:he||n("library.library.theLibrary")}))}catch(ve){xe.error(ve instanceof Error?ve.message:n("library.library.moveFailed"))}}function ie(){for(const J of yce)r.invalidateQueries({queryKey:it.orgFsVolume(i.id,J)});f.volume&&r.invalidateQueries({queryKey:it.orgFsVolume(i.id,f.volume)}),r.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:it.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:it.orgFsPublicSets(i.id)})}function ue(J){J.defaultPrevented||!H||J.target.closest("input, textarea, button, a, [role='button']")||(J.preventDefault(),P(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:Y,onDragOver:de,onDragLeave:re,onDrop:le,onContextMenu:ue,children:[z&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Jn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(kce,{segments:f.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(Yu,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(kt,{value:_,onChange:J=>L(J.target.value),onKeyDown:J=>{J.key==="Escape"&&L("")},placeholder:w,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(fe,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>L(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(Ni,{size:14})})]}),o.jsx(fe,{variant:"ghost",size:"icon",onClick:ie,"aria-label":n("library.library.refresh"),children:o.jsx($n,{size:14})}),H&&o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[o.jsx(Yt,{size:14}),n("library.library.newFolder")]}),f.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(Xu,{size:12}),n("library.library.readOnly")]}):o.jsxs(fe,{size:"sm",disabled:q.isPending,onClick:()=>F.current?.click(),children:[o.jsx(Jn,{size:14}),q.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:J=>{Z(J.target.files)}})]}),v?o.jsx(jce,{query:v,scope:S,stale:_.trim()!==v,onOpenFile:x,onShare:N,onDelete:C}):f.volume===null?o.jsx(Nce,{onOpenDir:p}):o.jsx(Vce,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:y,onShare:N,onDelete:C,onContextMenu:(J,he)=>{$({path:J,kind:he}),B(un(J)),I(!0)},onMove:oe},f.volume)]})}),a&&(c.preview?o.jsx(tj,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(v8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(ej,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(Ut,{open:T,onOpenChange:P,children:o.jsxs(Ft,{children:[o.jsxs(ms,{children:[o.jsx(Gt,{children:n("library.library.newFolderTitle")}),o.jsx(Tn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(kt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:J=>R(J.target.value),onKeyDown:J=>{J.key==="Enter"&&ne()}}),o.jsxs(Yn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>P(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!E.trim()||G.isPending,onClick:()=>{ne()},children:n("library.library.create")})]})]})}),o.jsx(Ut,{open:M,onOpenChange:J=>{I(J),J||($(null),B(""))},children:o.jsxs(Ft,{children:[o.jsxs(ms,{children:[o.jsx(Gt,{children:D&&n("library.library.renameTitle",{name:un(D.path)})}),o.jsx(Tn,{children:n("library.library.renameDescription")})]}),o.jsx(kt,{autoFocus:!0,value:O,onChange:J=>B(J.target.value),onKeyDown:J=>{J.key==="Enter"&&ee()}}),o.jsxs(Yn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>I(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!O.trim()||Q.isPending,onClick:()=>{ee()},children:n("library.library.rename")})]})]})}),o.jsx(tce,{target:V,onOpenChange:J=>{J||N(null)}}),o.jsx(Kr,{open:j!==null,onOpenChange:J=>{J||C(null)},children:o.jsxs(Wr,{children:[o.jsxs(qr,{children:[o.jsx(Gr,{children:n("library.library.deleteTitle",{name:j?un(j.path):""})}),o.jsx(Yr,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Jr,{children:[o.jsx(Xr,{children:n("library.library.cancel")}),o.jsx(Qr,{onClick:()=>{me()},children:n("library.library.delete")})]})]})})]})}function Dce(){const t=U.c(10),{openPanel:e}=pr(),[s,n]=A.useState(null),[i,r]=A.useState(null);let l;t[0]!==e?(l=o.jsx(Rce,{onOpenFile:u=>e(uN(u)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(v8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(ej,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==l||t[7]!==a||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[l,a,c]}),t[6]=l,t[7]=a,t[8]=c,t[9]=d):d=t[9],d}const hv=A.lazy(()=>Ys(()=>import("./project-app-view-BW8nEgoK.js"),__vite__mapDeps([175,1,2,78,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,79,80,81,8,7,9,17,82,83,84,85,86,87,88,89,90,91,92,69,4,5,6,10,11,12,13,14,3,15,16,18,19,20,21,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,70,109,151,120,121,122,123,117,118,119,152,110,111,68,112,113,114,115,71,116,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,153,154,73,155,156,157])).then(t=>({default:t.AppViewContent}))),Mce=A.lazy(()=>Ys(()=>import("./hosting-tab-yCo5MFnA.js"),__vite__mapDeps([176,1,2,24,22,35,23,25,26,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,131,70,75,144,69,68,82,177,17,8,7,9,133])).then(t=>({default:t.HostingTab}))),Ice=A.lazy(()=>Ys(()=>import("./e2e-tab-BKa3vgG1.js"),__vite__mapDeps([178,1,2,30,22,35,23,24,25,26,27,28,29,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,131,70,75,144,69,68,82,177,17,8,7,9,133,78,79,80,81,83,84,85,86,87,88,89,90,91,92,4,5,6,10,11,12,13,14,3,15,16,18,19,20,21,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,112])).then(t=>({default:t.E2eTab}))),Oce=A.lazy(()=>Ys(()=>import("./analytics-tab-C8Ml9hnf.js"),__vite__mapDeps([179,1,2,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,131,136,70,75,82,180,181,182,144,69,177,17,8,7,9,133])).then(t=>({default:t.AnalyticsTab}))),$ce=A.lazy(()=>Ys(()=>import("./cdn-tab-BbmlviYg.js"),__vite__mapDeps([183,1,2,46,180,181,182,177,71,17,8,7,9,133,184,185])).then(t=>({default:t.CdnTab})));function Bce(){const t=U.c(2),e=GA();let s;return t[0]!==e?(s=e?o.jsx($F,{}):o.jsx(EF,{}),t[0]=e,t[1]=s):s=t[1],s}function zce({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const l=WA(),a=mm().monitorEnabled===!0||mm().auth.localMode===!0;if(t==="overview")return o.jsx(Bce,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(dJ,{})});if(hN(t))return o.jsx(U4,{virtualMcpId:e});if(t==="git")return o.jsx(YX,{virtualMcpId:e});if(t==="automations")return o.jsx(jae,{virtualMcpId:e});if(t==="site-editor")return o.jsx(vre,{virtualMcpId:e});const c=fm(t);if(c)return o.jsx(Lre,{openPath:c.path});if(t==="content")return o.jsx(Rle,{virtualMcpId:e});if(t==="assets")return o.jsx(Mle,{virtualMcpId:e});if(t==="hosting"&&l.hosting)return o.jsx(Mce,{virtualMcpId:e});if(t==="e2e"&&l.e2e)return o.jsx(Ice,{virtualMcpId:e});if(t==="analytics"&&l.analytics)return o.jsx(Oce,{virtualMcpId:e});if(t==="cdn"&&a&&l.monitor)return o.jsx($ce,{virtualMcpId:e});if(t==="files")return o.jsx(Dce,{});if(t==="reports")return o.jsx(Eae,{});if(t==="discover")return o.jsx(Fae,{});if(t==="connect-sources")return o.jsx(Tae,{});if(r)return o.jsx(Lae,{tabId:t});const d=My(t);if(d)return o.jsx(nce,{path:d.path},d.path);const u=Dy(t);if(u)return o.jsx(Nae,{fileKey:u.key,taskId:s});const h=Iy(t);if(h)return o.jsx(lce,{path:h.path},h.path);const f=fN(t);if(f){const p=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(ki,{children:o.jsx(hv,{connectionId:f.connectionId,toolName:f.toolName,args:p?.args},t)})}const m=n.find(p=>p.id===t);return m?o.jsx(ki,{children:o.jsx(hv,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},t)}):o.jsx(U4,{virtualMcpId:e})}function Fce(t){const e=U.c(13),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:r,layoutTabs:l,expandedTools:a,automationTabParsed:c}=Ag(i);let d;e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==s||e[8]!==n?(d=o.jsx(ki,{children:o.jsx(zce,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[3]=r,e[4]=c,e[5]=a,e[6]=l,e[7]=s,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==d?(u=o.jsx(rn,{children:d},r),e[10]=r,e[11]=d,e[12]=u):u=e[12],u}const Uce=new Set(["site-editor","content"]);function Hce(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Uce.has(t.mainTab)}const Cl="setup";function Kce(t){const e=U.c(57),s=ce();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=v=>!t.scriptTabs.includes(v),e[3]=t.scriptTabs,e[4]=L):L=e[4],n=t.scripts.filter(L),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let r;e[5]!==t?(r=()=>{t.active===Cl?t.onToggle():t.onSelectTab(Cl)},e[5]=t,e[6]=r):r=e[6];const l=r;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(Ls,{className:"size-4"}):o.jsx(f6,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(d=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=o.jsx(Ke,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=o.jsxs(We,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===Cl;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(Wce,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(L=>o.jsx(Gce,{active:t.active===L,onClick:()=>{t.active===L?t.onToggle():t.onSelectTab(L)},onClose:()=>t.onCloseScript(L),t:s,children:L},L)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(Yce,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let y;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(y=t.showScriptControls?o.jsx(Jce,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(qce,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=y):y=e[52];let _;return e[53]!==b||e[54]!==y||e[55]!==f?(_=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,y]}),e[53]=b,e[54]=y,e[55]=f,e[56]=_):_=e[56],_}function Wce(t){const e=U.c(11),{active:s,open:n,onClick:i,t:r}=t,l=s&&n,a=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=ae("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(GP,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==r?(h=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function qce(t){const e=U.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Tl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Tl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx($n,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=ae(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(Ke,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(We,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(Ls,{className:"size-3"})})}),o.jsx(Wt,{align:"end",children:o.jsxs(Ze,{onClick:r,children:[o.jsx($n,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let y;return e[37]!==x||e[38]!==b?(y=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=y):y=e[39],y}return null}function Gce(t){const e=U.c(17),{active:s,onClick:n,onClose:i,children:r,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ae("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=ae("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==h?(f=o.jsx("button",{type:"button",onClick:n,className:h,children:r}),e[5]=r,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==l?(m=i&&o.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(Ws,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function Yce(t){const e=U.c(27),{scripts:s,onRun:n}=t,i=ce(),[r,l]=A.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Yt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(He,{asChild:!0,children:o.jsx(ds,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(Ke,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=o.jsxs(We,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(y=>o.jsxs("button",{type:"button",onClick:()=>{l(!1),n(y)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",y]},y)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=o.jsxs(hs,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(fs,{open:r,onOpenChange:l,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function Jce(t){const e=U.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(st,{className:"size-3.5"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(fe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Tl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=o.jsx(He,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(We,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==r||e[21]!==a?(c=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:r,children:a})}),e[20]=r,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let u;e[25]!==d?(u=o.jsx(Ke,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=o.jsxs(We,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var ij=Object.defineProperty,Xce=Object.getOwnPropertyDescriptor,Qce=(t,e)=>{for(var s in e)ij(t,s,{get:e[s],enumerable:!0})},Ts=(t,e,s,n)=>{for(var i=n>1?void 0:n?Xce(e,s):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&ij(e,s,i),i},Xe=(t,e)=>(s,n)=>e(s,n,t),fv="Terminal input",vp={get:()=>fv,set:t=>fv=t},mv="Too much output to announce, navigate to rows manually to read",yp={get:()=>mv,set:t=>mv=t};function Zce(t){return t.replace(/\r?\n/g,"\r")}function ede(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function tde(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function sde(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");rj(i,e,s,n)}}function rj(t,e,s,n){t=Zce(t),t=ede(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function oj(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,r=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function pv(t,e,s,n,i){oj(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function No(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function D9(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let r=t[i];r>65535?(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):n+=String.fromCharCode(r)}return n}var nde=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let r=t.charCodeAt(i++);56320<=r&&r<=57343?e[n++]=(this._interim-55296)*1024+r-56320+65536:(e[n++]=this._interim,e[n++]=r),this._interim=0}for(let r=i;r<s;++r){let l=t.charCodeAt(r);if(55296<=l&&l<=56319){if(++r>=s)return this._interim=l,n;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},ide=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,r,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((r=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(c=(i&31)<<6|r&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(r&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},lj="",Do=" ",g0=class aj{constructor(){this.fg=0,this.bg=0,this.extended=new vf}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new aj;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},vf=class cj{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new cj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oi=class dj extends g0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new vf,this.combinedData=""}static fromCharData(e){let s=new dj;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?No(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gv="di$target",_p="di$dependencies",W1=new Map;function rde(t){return t[_p]||[]}function cn(t){if(W1.has(t))return W1.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ode(e,s,i)};return e._id=t,W1.set(t,e),e}function ode(t,e,s){e[gv]===e?e[_p].push({id:t,index:s}):(e[_p]=[{id:t,index:s}],e[gv]=e)}var Dn=cn("BufferService"),uj=cn("CoreMouseService"),oa=cn("CoreService"),lde=cn("CharsetService"),sx=cn("InstantiationService"),hj=cn("LogService"),Mn=cn("OptionsService"),fj=cn("OscLinkService"),ade=cn("UnicodeService"),x0=cn("DecorationService"),Lp=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,r=new oi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=u,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):cde(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=u,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};Lp=Ts([Xe(0,Dn),Xe(1,Mn),Xe(2,fj)],Lp);function cde(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
804
|
+
`);function mce(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",fce).replaceAll("{{title}}",hce).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function pce(t){const e=U.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=yu(s),l=yu(i??"");if(r.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(nn,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(r.isError||!r.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=mce(r.data,a),e[2]=a,e[3]=r.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function Wd(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function gce(t){const e=U.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>{const m=r(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":f.name,title:p,value:pE(m),onChange:g=>l(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):o.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function xce(t){const e=U.c(9),{token:s,value:n}=t;if(s.kind==="space"){let r;return e[0]!==n?(r=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=r):r=e[1],r}if(s.kind==="radius"){let r;return e[2]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=r):r=e[3],r}if(s.kind==="shadow"){let r;return e[4]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=r):r=e[5],r}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const r=`min(${n}, 22px)`;let l;return e[6]!==r?(l=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:r},children:"Ag"}),e[6]=r,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Zk(t){const e=U.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(xce,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==r||e[10]!==s.name||e[11]!==n?(d=i?o.jsx(kt,{value:n,onChange:h=>r(s.name,h.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Ad(t){const e=U.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=o.jsx(Wd,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>o.jsx(Zk,{token:f,value:r(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function bce({brandPath:t,onClose:e,variant:s}){const n=ce(),{org:i}=Fe(),r=rg(t),l=r.volume??"",a=r.dirPath,c=un(a),d=r.readOnly,u=Ms(),h=Wu(),f=a8(l),{upload:m,remove:p}=vu(l),g=A.useRef(null),x=c8(l,a),b=x.data??[],y=J=>b.some(he=>he.kind==="file"&&un(he.path)===J),_=y("tokens.css"),L=y("brand.md"),v=y("slides-theme.html"),S=uE(b),w=h(l,`${a}/tokens.css`),k=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),C=yu(w,{enabled:_}),V=yu(k,{enabled:L}),[N,T]=A.useState(!1),[P,E]=A.useState({}),[R,M]=A.useState(null),[I,D]=A.useState(!1),[$,O]=A.useState(!1),[B,F]=A.useState("deck"),z=C.data?hE(C.data):[],W=J=>z.find(he=>he.name===J)?.value,K=J=>P[J.name]??J.value,H=fE(z),q=z.filter(J=>J.kind==="font"),G=z.filter(J=>J.kind==="type"),Q=z.filter(J=>J.kind==="space"),se=z.filter(J=>J.kind==="radius"),Z=z.filter(J=>J.kind==="shadow"),te=z.filter(J=>J.kind==="motion"),X=z.filter(J=>J.kind==="other"),Y=(J,he)=>E(ve=>({...ve,[J]:he})),de=v&&B==="deck",re=R??V.data??"",le=Object.entries(P).filter(([J,he])=>W(J)!==he),ne=R!==null&&R!==(V.data??""),me=le.length>0||ne;function ee(){E({}),M(null),T(!1)}async function oe(){D(!0);try{if(le.length>0){let J=C.data??"";for(const[he,ve]of le)J=mE(J,he,ve);await f.mutateAsync({path:`${a}/tokens.css`,body:J,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:it.fileText(w)})}ne&&R!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:it.fileText(k)})),u.invalidateQueries({queryKey:it.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),E({}),M(null),T(!1),xe.success(n("library.brandPreview.brandSaved"))}catch(J){xe.error(J instanceof Error?J.message:n("library.brandPreview.failedSaveBrand"))}finally{D(!1)}}async function ie(J){const he=J?.[0];if(!he)return;const je=`logo.${(he.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([he],je,{type:he.type})]}),S&&un(S)!==je&&await p.mutateAsync(S),xe.success(n("library.brandPreview.logoUpdated"))}catch(Ce){xe.error(Ce instanceof Error?Ce.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ue=!x.isPending&&!_&&!L&&!S;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(Tm,{size:18})}),s==="dialog"?o.jsx(Gt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(N?o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",size:"sm",onClick:ee,disabled:I,children:n("library.brandPreview.cancel")}),o.jsx(fe,{size:"sm",disabled:!me||I,onClick:()=>{oe()},children:n(I?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[o.jsx(UT,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(AV,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Ws,{size:16})})}):o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Ws,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(nn,{className:"h-40 w-full rounded-xl"}),o.jsx(nn,{className:"h-4 w-1/3"}),o.jsx(nn,{className:"h-4 w-2/3"})]}):ue?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(v||_)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n($?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>O(J=>!J),onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),O(he=>!he))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:J=>J.stopPropagation(),children:[v&&o.jsx("button",{type:"button",onClick:()=>{F("deck"),O(!1)},className:ae("rounded-md px-2.5 py-1",de?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{F("components"),O(!1)},className:ae("rounded-md px-2.5 py-1",de?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),$?o.jsx(Ls,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(f6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!$&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:ae("w-full overflow-hidden rounded-xl border border-border bg-muted/30",de?"aspect-[16/9]":"h-96"),children:de?o.jsx(pce,{readUrl:j,title:`${c} deck theme`,tokensUrl:w}):o.jsx(uce,{tokensUrl:w})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:S?o.jsx("img",{src:h(l,S),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(Tm,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(fe,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Jn,{size:14}),n(S?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:J=>{ie(J.target.files)}})]})]})]}),H.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.colors")}),H.map(J=>o.jsx(gce,{family:J.family,tokens:J.tokens,editing:N,valueOf:K,onEdit:Y},J.family))]}),(q.length>0||G.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.typography")}),q.map(J=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:J.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(kt,{value:K(J),onChange:he=>Y(J.name,he.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:K(J)},children:K(J)})]},J.name)),G.map(J=>o.jsx(Zk,{token:J,value:K(J),editing:N,onEdit:Y},J.name))]}),o.jsx(Ad,{label:n("library.brandPreview.spacing"),tokens:Q,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.radius"),tokens:se,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.shadows"),tokens:Z,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.motion"),tokens:te,editing:N,valueOf:K,onEdit:Y}),o.jsx(Ad,{label:n("library.brandPreview.tokens"),tokens:X,editing:N,valueOf:K,onEdit:Y}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Wd,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Wo,{value:re,onChange:J=>M(J.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):V.isPending&&L?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(nn,{className:"h-3 w-full"}),o.jsx(nn,{className:"h-3 w-5/6"})]}):re.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(nd,{id:`brand-preview-${t}`,text:re})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function ej(t){const e=U.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(Ft,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(bce,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==i||e[6]!==r?(l=o.jsx(Ut,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function tj(t){const e=U.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==r?(a=o.jsx(Ft,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(Qk,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=o.jsx(Ut,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function vce(t){const e=U.c(11),{onOpenDir:s}=t,n=ce(),i=gE();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(Zu,{name:d.volume,glyph:_n,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:B8(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=o.jsx(o.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function ex(t){return`${window.location.origin}${t}`}function fu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const yce=[Lu,"uploads","outputs"],sj=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Jn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:zr}],bp=new Set([...sj.map(t=>t.volume),Oc("public")]),_ce=6;function nj(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=y8(t),r=i?`public/${i}`:t==="home"?Su(s):t;return n?`${r}/${n}`:r}function rh(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function To(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Dr(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function R9(t){const e=U.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Dr,{children:Array.from({length:n*3},Lce)}),e[0]=n,e[1]=i):i=e[1],i}function Lce(t,e){return o.jsx(nn,{className:"h-16 rounded-2xl"},e)}function tx(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Sce(t){const e=U.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=ce(),a=sP(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(u=o.jsx(Zu,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=u):u=e[11],u}function wce(t){const e=U.c(12),{onOpenDir:s}=t,n=ce(),r=d8().data?.length??0;let l;e[0]!==s?(l=sj.map(u=>o.jsx(Sce,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r||e[4]!==n?(a=r>0&&o.jsx(Zu,{name:Oc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:dr,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=r,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=o.jsx(vce,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function kce(t){const e=U.c(19),{segments:s,onNavigate:n}=t,{org:i}=Fe();let r;e[0]!==s?(r=s[0]===Lu?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const l=r,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:Su(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Lu),children:Su(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(qs,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Oc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Oc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function jce(t){const e=U.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=ce(),{org:d}=Fe(),u=Wu(),h=tP(s,n);let f;e[0]!==u||e[1]!==l?(f=w=>l({volume:w.volume,path:w.path,kind:"file",shareMode:w.shareMode??"private",effectivePublic:w.effectivePublic??!1,url:ex(u(w.volume,w.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(R9,{rows:2}),e[3]=w):w=e[3],w}let p,g,x,b,y;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){y=Symbol.for("react.early_return_sentinel");e:{if(g=h.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(tx,{children:k}),e[17]=k,e[18]=j):j=e[18],y=j;break e}const w=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==w?(b=ae("flex flex-col gap-3",w),e[19]=w,e[20]=b):b=e[20],p=To,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=y}else p=e[9],g=e[10],x=e[11],b=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let _;e[21]!==p||e[22]!==x?(_=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let L;if(e[24]!==u||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==m){let w;e[31]!==u||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==m?(w=k=>{const j=y8(k.volume)!==null;return o.jsx(z8,{filename:un(k.path),updatedAt:k.updatedAt,downloadUrl:u(k.volume,k.path),subtitle:nj(k.volume,k.path,d.slug),publicState:fu(k),onOpen:()=>r(_8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=u,e[32]=a,e[33]=r,e[34]=d,e[35]=m,e[36]=w):w=e[36],L=g.map(w),e[24]=u,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let v;e[37]!==L?(v=o.jsx(Dr,{children:L}),e[37]=L,e[38]=v):v=e[38];let S;return e[39]!==b||e[40]!==_||e[41]!==v?(S=o.jsxs("div",{className:b,children:[_,v]}),e[39]=b,e[40]=_,e[41]=v,e[42]=S):S=e[42],S}function Cce(t){const e=U.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=ce(),{org:l}=Fe(),a=l8(),c=Wu();let d;e[0]!==c||e[1]!==n?(d=y=>n({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:ex(c(y.volume,y.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let y;e[3]!==r?(y=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=y):y=e[4];let _;e[5]!==y?(_=o.jsx(To,{children:y}),e[5]=y,e[6]=_):_=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(R9,{}),e[7]=L):L=e[7];let v;return e[8]!==_?(v=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,L]}),e[8]=_,e[9]=v):v=e[9],v}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const y=(a.data??[]).slice(0,_ce);if(y.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==r?(_=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=_):_=e[23],e[24]!==_?(p=o.jsx(To,{children:_}),e[24]=_,e[25]=p):p=e[25],h=Dr;let L;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(L=v=>o.jsx(vE,{filename:un(v.path),updatedAt:v.updatedAt,size:v.size,downloadUrl:c(v.volume,v.path),subtitle:nj(v.volume,v.path,l.slug),publicState:fu(v),onOpen:()=>s(_8(v.volume,v.path)),onShare:()=>u(v),onDelete:()=>i({volume:v.volume,path:v.path,kind:"file"})},`${v.volume}/${v.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=L):L=e[31],f=y.map(L)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=r,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=o.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Nce(t){const e=U.c(16),{onOpenDir:s}=t,n=ce(),i=d8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(R9,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.data?(r=i.data??[],e[1]=i.data,e[2]=r):r=e[2];const l=r;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let u;return e[5]!==d?(u=o.jsx(tx,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>o.jsx(Zu,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=o.jsx(Dr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Vce(t){const e=U.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=ce(),{org:m}=Fe(),p=s.volume??"",g=c8(p,s.dirPath),x=Wu();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=N=>s.isHomeRoot&&bp.has(N.toLowerCase())?`${Su(m.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const y=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(wce,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const L=_;if(g.isPending){let N;e[6]!==L||e[7]!==f?(N=L&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.folders")}),o.jsx(Dr,{children:L})]}),e[6]=L,e[7]=f,e[8]=N):N=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(R9,{rows:2}),e[9]=T):T=e[9];let P;return e[10]!==N?(P=o.jsxs(o.Fragment,{children:[N,T]}),e[10]=N,e[11]=P):P=e[11],P}if(g.isError){let N;e[12]!==g.error||e[13]!==f?(N=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=N):N=e[14];let T;return e[15]!==N?(T=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=T):T=e[16],T}let v,S,w,k,j;if(e[17]!==y||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],T=N.filter(Ece),P=N.filter(Pce),E=N.filter(Ace),R=N.filter(Tce);if(N.length===0&&!s.isHomeRoot){let O;e[38]!==s.readOnly||e[39]!==f?(O=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=O):O=e[40];let B;e[41]!==O?(B=o.jsx(tx,{children:O}),e[41]=O,e[42]=B):B=e[42],j=B;break e}let M;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(M=O=>s.readOnly?void 0:()=>c({volume:p,path:O.path,kind:O.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=M):M=e[46];const I=M;let D;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?(D=O=>s.readOnly?void 0:()=>a({volume:p,path:O.path,kind:O.kind,shareMode:O.shareMode??"private",effectivePublic:O.effectivePublic??!1,url:O.kind==="file"?ex(x(p,O.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=D):D=e[51];const $=D;v=T.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.skills")}),o.jsx(Dr,{children:T.map(O=>o.jsx(xE,{dirName:un(O.path),updatedAt:O.updatedAt,skillMdUrl:x(p,`${O.path}/SKILL.md`),publicState:fu(O),onOpen:()=>r(ac(s,O.path)),onBrowse:()=>n(ac(s,O.path)),onShare:$(O),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"dir",{onDragStart:d,onContextMenu:u})},O.path))})]}),S=P.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.brands")}),o.jsx(Dr,{children:P.map(O=>o.jsx(bE,{dirName:un(O.path),updatedAt:O.updatedAt,tokensUrl:x(p,`${O.path}/tokens.css`),onOpen:()=>l(ac(s,O.path)),onBrowse:()=>n(ac(s,O.path)),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"dir",{onDragStart:d,onContextMenu:u})},O.path))})]}),w=(E.length>0||L)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.folders")}),o.jsxs(Dr,{children:[L,E.map(O=>o.jsx(Zu,{name:un(O.path),meta:B8(O.updatedAt),subtitle:y(un(O.path)),readOnly:s.readOnly,publicState:fu(O),onOpen:()=>n(ac(s,O.path)),onShare:$(O),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},O.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(To,{children:f("library.libraryViews.files")}),o.jsx(Dr,{children:R.map(O=>o.jsx(z8,{filename:un(O.path),updatedAt:O.updatedAt,downloadUrl:x(p,O.path),publicState:fu(O),onOpen:()=>i(ac(s,O.path)),onShare:$(O),onDelete:I(O),draggable:!s.readOnly,...rh(O.path,"file",{onDragStart:d,onContextMenu:u})},O.path))})]})}e[17]=y,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=L,e[31]=f,e[32]=p,e[33]=v,e[34]=S,e[35]=w,e[36]=k,e[37]=j}else v=e[33],S=e[34],w=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(C=s.isHomeRoot&&o.jsx(Cce,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let V;return e[57]!==v||e[58]!==S||e[59]!==w||e[60]!==k||e[61]!==C?(V=o.jsxs(o.Fragment,{children:[v,S,w,k,C]}),e[57]=v,e[58]=S,e[59]=w,e[60]=k,e[61]=C,e[62]=V):V=e[62],V}function Tce(t){return t.kind==="file"}function Ace(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Pce(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Ece(t){return t.kind==="dir"&&t.hasSkill}function Rce({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ce(),{org:i}=Fe(),r=Ms(),l=ln(),a=Hl(),c=Zo({strict:!1}),d=c.path||Lu,u=rg(d),h=yE(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(J,he)=>l({to:".",search:ve=>({...ve,[J]:he||void 0})}),p=J=>m("path",J),g=(J,he)=>l({to:".",search:ve=>({...ve,preview:void 0,skill:void 0,brand:void 0,[J]:he})}),x=t??(J=>g("preview",J)),b=e??(J=>g("skill",J)),y=s??(J=>g("brand",J)),[_,L]=A.useState(""),v=r9(_.trim(),300),S=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,w=S?n("library.library.searchInPlaceholder",{folder:Oc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?Su(i.slug):Oc(f.segments.at(-1)??""),[j,C]=A.useState(null),[V,N]=A.useState(null),[T,P]=A.useState(!1),[E,R]=A.useState(""),[M,I]=A.useState(!1),[D,$]=A.useState(null),[O,B]=A.useState(""),F=A.useRef(null),[z,W]=A.useState(!1),K=A.useRef(0),H=f.readOnly?null:f.volume,{upload:q,mkdir:G,move:Q}=vu(H??Lu),{remove:se}=vu(j?.volume??"uploads");async function Z(J){if(!(!H||!J||J.length===0))try{await q.mutateAsync({dir:f.dirPath,files:[...J]}),xe.success(J.length===1?n("library.library.uploadedSingle",{filename:J[0]?.name??""}):n("library.library.uploadedMultiple",{count:J.length}))}catch(he){xe.error(he instanceof Error?he.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const te=H!==null;function X(J){return J.dataTransfer.types.includes("Files")}function Y(J){!te||!X(J)||(J.preventDefault(),K.current+=1,W(!0))}function de(J){!te||!X(J)||J.preventDefault()}function re(){te&&(K.current=Math.max(0,K.current-1),K.current===0&&W(!1))}function le(J){te&&(J.preventDefault(),J.stopPropagation(),K.current=0,W(!1),J.dataTransfer.files.length>0&&Z(J.dataTransfer.files))}async function ne(){const J=E.trim();if(!(!H||!J)){if(f.isHomeRoot&&bp.has(J.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:J}));return}try{const he=f.dirPath;await G.mutateAsync(he?`${he}/${J}`:J),xe.success(n("library.library.folderCreated",{name:J})),P(!1),R("")}catch(he){xe.error(he instanceof Error?he.message:n("library.library.folderCreateFailed"))}}}async function me(){if(!j)return;const J=j;try{await se.mutateAsync(J.path),xe.success(n("library.library.deleted",{name:un(J.path)}))}catch(he){xe.error(he instanceof Error?he.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ee(){if(!D)return;const J=O.trim();if(!J||J.includes("/")||J.includes("..")||J===un(D.path)){I(!1),$(null),B("");return}if(D.kind==="dir"&&f.isHomeRoot&&bp.has(J.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:J}));return}try{const he=D.path.includes("/")?D.path.slice(0,D.path.lastIndexOf("/")):"",ve=he?`${he}/${J}`:J;await Q.mutateAsync({from:D.path,to:ve});const je=J.replace(/[<>]/g,"");xe.success(n("library.library.renamed",{name:je}))}catch(he){xe.error(he instanceof Error?he.message:n("library.library.renameFailed"))}finally{I(!1),$(null),B("")}}async function oe(J,he){try{const ve=un(J),je=he?`${he}/${ve}`:ve;await Q.mutateAsync({from:J,to:je}),xe.success(n("library.library.moved",{name:ve,destination:he||n("library.library.theLibrary")}))}catch(ve){xe.error(ve instanceof Error?ve.message:n("library.library.moveFailed"))}}function ie(){for(const J of yce)r.invalidateQueries({queryKey:it.orgFsVolume(i.id,J)});f.volume&&r.invalidateQueries({queryKey:it.orgFsVolume(i.id,f.volume)}),r.invalidateQueries({queryKey:it.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:it.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:it.orgFsPublicSets(i.id)})}function ue(J){J.defaultPrevented||!H||J.target.closest("input, textarea, button, a, [role='button']")||(J.preventDefault(),P(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:Y,onDragOver:de,onDragLeave:re,onDrop:le,onContextMenu:ue,children:[z&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Jn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(kce,{segments:f.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(Yu,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(kt,{value:_,onChange:J=>L(J.target.value),onKeyDown:J=>{J.key==="Escape"&&L("")},placeholder:w,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(fe,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>L(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(Ni,{size:14})})]}),o.jsx(fe,{variant:"ghost",size:"icon",onClick:ie,"aria-label":n("library.library.refresh"),children:o.jsx($n,{size:14})}),H&&o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[o.jsx(Yt,{size:14}),n("library.library.newFolder")]}),f.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(Xu,{size:12}),n("library.library.readOnly")]}):o.jsxs(fe,{size:"sm",disabled:q.isPending,onClick:()=>F.current?.click(),children:[o.jsx(Jn,{size:14}),q.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:J=>{Z(J.target.files)}})]}),v?o.jsx(jce,{query:v,scope:S,stale:_.trim()!==v,onOpenFile:x,onShare:N,onDelete:C}):f.volume===null?o.jsx(Nce,{onOpenDir:p}):o.jsx(Vce,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:y,onShare:N,onDelete:C,onContextMenu:(J,he)=>{$({path:J,kind:he}),B(un(J)),I(!0)},onMove:oe},f.volume)]})}),a&&(c.preview?o.jsx(tj,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(v8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(ej,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(Ut,{open:T,onOpenChange:P,children:o.jsxs(Ft,{children:[o.jsxs(ms,{children:[o.jsx(Gt,{children:n("library.library.newFolderTitle")}),o.jsx(Tn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(kt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:J=>R(J.target.value),onKeyDown:J=>{J.key==="Enter"&&ne()}}),o.jsxs(Yn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>P(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!E.trim()||G.isPending,onClick:()=>{ne()},children:n("library.library.create")})]})]})}),o.jsx(Ut,{open:M,onOpenChange:J=>{I(J),J||($(null),B(""))},children:o.jsxs(Ft,{children:[o.jsxs(ms,{children:[o.jsx(Gt,{children:D&&n("library.library.renameTitle",{name:un(D.path)})}),o.jsx(Tn,{children:n("library.library.renameDescription")})]}),o.jsx(kt,{autoFocus:!0,value:O,onChange:J=>B(J.target.value),onKeyDown:J=>{J.key==="Enter"&&ee()}}),o.jsxs(Yn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>I(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!O.trim()||Q.isPending,onClick:()=>{ee()},children:n("library.library.rename")})]})]})}),o.jsx(tce,{target:V,onOpenChange:J=>{J||N(null)}}),o.jsx(Kr,{open:j!==null,onOpenChange:J=>{J||C(null)},children:o.jsxs(Wr,{children:[o.jsxs(qr,{children:[o.jsx(Gr,{children:n("library.library.deleteTitle",{name:j?un(j.path):""})}),o.jsx(Yr,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Jr,{children:[o.jsx(Xr,{children:n("library.library.cancel")}),o.jsx(Qr,{onClick:()=>{me()},children:n("library.library.delete")})]})]})})]})}function Dce(){const t=U.c(10),{openPanel:e}=pr(),[s,n]=A.useState(null),[i,r]=A.useState(null);let l;t[0]!==e?(l=o.jsx(Rce,{onOpenFile:u=>e(uN(u)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(v8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(ej,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==l||t[7]!==a||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[l,a,c]}),t[6]=l,t[7]=a,t[8]=c,t[9]=d):d=t[9],d}const hv=A.lazy(()=>Ys(()=>import("./project-app-view-C5a0S8VK.js"),__vite__mapDeps([175,1,2,78,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,79,80,81,8,7,9,17,82,83,84,85,86,87,88,89,90,91,92,69,4,5,6,10,11,12,13,14,3,15,16,18,19,20,21,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,75,70,109,151,120,121,122,123,117,118,119,152,110,111,68,112,113,114,115,71,116,124,125,126,127,128,129,130,131,132,133,72,134,135,136,137,138,139,140,141,142,143,144,145,67,146,147,76,148,149,150,153,154,73,155,156,157])).then(t=>({default:t.AppViewContent}))),Mce=A.lazy(()=>Ys(()=>import("./hosting-tab-DtuFDGvE.js"),__vite__mapDeps([176,1,2,24,22,35,23,25,26,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,131,70,75,144,69,68,82,177,17,8,7,9,133])).then(t=>({default:t.HostingTab}))),Ice=A.lazy(()=>Ys(()=>import("./e2e-tab-DAWapk18.js"),__vite__mapDeps([178,1,2,30,22,35,23,24,25,26,27,28,29,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,131,70,75,144,69,68,82,177,17,8,7,9,133,78,79,80,81,83,84,85,86,87,88,89,90,91,92,4,5,6,10,11,12,13,14,3,15,16,18,19,20,21,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,112])).then(t=>({default:t.E2eTab}))),Oce=A.lazy(()=>Ys(()=>import("./analytics-tab-BncFpj4z.js"),__vite__mapDeps([179,1,2,23,24,25,26,27,28,29,30,31,32,33,34,22,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,131,136,70,75,82,180,181,182,144,69,177,17,8,7,9,133])).then(t=>({default:t.AnalyticsTab}))),$ce=A.lazy(()=>Ys(()=>import("./cdn-tab-D_pbGC7l.js"),__vite__mapDeps([183,1,2,46,180,181,182,177,71,17,8,7,9,133,184,185])).then(t=>({default:t.CdnTab})));function Bce(){const t=U.c(2),e=GA();let s;return t[0]!==e?(s=e?o.jsx($F,{}):o.jsx(EF,{}),t[0]=e,t[1]=s):s=t[1],s}function zce({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const l=WA(),a=mm().monitorEnabled===!0||mm().auth.localMode===!0;if(t==="overview")return o.jsx(Bce,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(dJ,{})});if(hN(t))return o.jsx(U4,{virtualMcpId:e});if(t==="git")return o.jsx(YX,{virtualMcpId:e});if(t==="automations")return o.jsx(jae,{virtualMcpId:e});if(t==="site-editor")return o.jsx(vre,{virtualMcpId:e});const c=fm(t);if(c)return o.jsx(Lre,{openPath:c.path});if(t==="content")return o.jsx(Rle,{virtualMcpId:e});if(t==="assets")return o.jsx(Mle,{virtualMcpId:e});if(t==="hosting"&&l.hosting)return o.jsx(Mce,{virtualMcpId:e});if(t==="e2e"&&l.e2e)return o.jsx(Ice,{virtualMcpId:e});if(t==="analytics"&&l.analytics)return o.jsx(Oce,{virtualMcpId:e});if(t==="cdn"&&a&&l.monitor)return o.jsx($ce,{virtualMcpId:e});if(t==="files")return o.jsx(Dce,{});if(t==="reports")return o.jsx(Eae,{});if(t==="discover")return o.jsx(Fae,{});if(t==="connect-sources")return o.jsx(Tae,{});if(r)return o.jsx(Lae,{tabId:t});const d=My(t);if(d)return o.jsx(nce,{path:d.path},d.path);const u=Dy(t);if(u)return o.jsx(Nae,{fileKey:u.key,taskId:s});const h=Iy(t);if(h)return o.jsx(lce,{path:h.path},h.path);const f=fN(t);if(f){const p=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(ki,{children:o.jsx(hv,{connectionId:f.connectionId,toolName:f.toolName,args:p?.args},t)})}const m=n.find(p=>p.id===t);return m?o.jsx(ki,{children:o.jsx(hv,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},t)}):o.jsx(U4,{virtualMcpId:e})}function Fce(t){const e=U.c(13),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:r,layoutTabs:l,expandedTools:a,automationTabParsed:c}=Ag(i);let d;e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==s||e[8]!==n?(d=o.jsx(ki,{children:o.jsx(zce,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[3]=r,e[4]=c,e[5]=a,e[6]=l,e[7]=s,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==d?(u=o.jsx(rn,{children:d},r),e[10]=r,e[11]=d,e[12]=u):u=e[12],u}const Uce=new Set(["site-editor","content"]);function Hce(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Uce.has(t.mainTab)}const Cl="setup";function Kce(t){const e=U.c(57),s=ce();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=v=>!t.scriptTabs.includes(v),e[3]=t.scriptTabs,e[4]=L):L=e[4],n=t.scripts.filter(L),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let r;e[5]!==t?(r=()=>{t.active===Cl?t.onToggle():t.onSelectTab(Cl)},e[5]=t,e[6]=r):r=e[6];const l=r;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(Ls,{className:"size-4"}):o.jsx(f6,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(d=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=o.jsx(Ke,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=o.jsxs(We,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===Cl;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(Wce,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(L=>o.jsx(Gce,{active:t.active===L,onClick:()=>{t.active===L?t.onToggle():t.onSelectTab(L)},onClose:()=>t.onCloseScript(L),t:s,children:L},L)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(Yce,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let y;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(y=t.showScriptControls?o.jsx(Jce,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(qce,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=y):y=e[52];let _;return e[53]!==b||e[54]!==y||e[55]!==f?(_=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,y]}),e[53]=b,e[54]=y,e[55]=f,e[56]=_):_=e[56],_}function Wce(t){const e=U.c(11),{active:s,open:n,onClick:i,t:r}=t,l=s&&n,a=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=ae("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(GP,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==r?(h=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function qce(t){const e=U.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Tl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Tl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx($n,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=ae(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(Ke,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(We,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ht,{children:[o.jsx(Kt,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(Ls,{className:"size-3"})})}),o.jsx(Wt,{align:"end",children:o.jsxs(Ze,{onClick:r,children:[o.jsx($n,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let y;return e[37]!==x||e[38]!==b?(y=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=y):y=e[39],y}return null}function Gce(t){const e=U.c(17),{active:s,onClick:n,onClose:i,children:r,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ae("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=ae("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==h?(f=o.jsx("button",{type:"button",onClick:n,className:h,children:r}),e[5]=r,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==l?(m=i&&o.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(Ws,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function Yce(t){const e=U.c(27),{scripts:s,onRun:n}=t,i=ce(),[r,l]=A.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Yt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(He,{asChild:!0,children:o.jsx(ds,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(Ke,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=o.jsxs(We,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(y=>o.jsxs("button",{type:"button",onClick:()=>{l(!1),n(y)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",y]},y)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=o.jsxs(hs,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(fs,{open:r,onOpenChange:l,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function Jce(t){const e=U.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(st,{className:"size-3.5"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(fe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Tl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=o.jsx(He,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(We,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==r||e[21]!==a?(c=o.jsx(He,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:r,children:a})}),e[20]=r,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let u;e[25]!==d?(u=o.jsx(Ke,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=o.jsxs(We,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var ij=Object.defineProperty,Xce=Object.getOwnPropertyDescriptor,Qce=(t,e)=>{for(var s in e)ij(t,s,{get:e[s],enumerable:!0})},Ts=(t,e,s,n)=>{for(var i=n>1?void 0:n?Xce(e,s):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&ij(e,s,i),i},Xe=(t,e)=>(s,n)=>e(s,n,t),fv="Terminal input",vp={get:()=>fv,set:t=>fv=t},mv="Too much output to announce, navigate to rows manually to read",yp={get:()=>mv,set:t=>mv=t};function Zce(t){return t.replace(/\r?\n/g,"\r")}function ede(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function tde(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function sde(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");rj(i,e,s,n)}}function rj(t,e,s,n){t=Zce(t),t=ede(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function oj(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,r=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function pv(t,e,s,n,i){oj(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function No(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function D9(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let r=t[i];r>65535?(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):n+=String.fromCharCode(r)}return n}var nde=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let r=t.charCodeAt(i++);56320<=r&&r<=57343?e[n++]=(this._interim-55296)*1024+r-56320+65536:(e[n++]=this._interim,e[n++]=r),this._interim=0}for(let r=i;r<s;++r){let l=t.charCodeAt(r);if(55296<=l&&l<=56319){if(++r>=s)return this._interim=l,n;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},ide=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,r,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((r=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(c=(i&31)<<6|r&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(r&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},lj="",Do=" ",g0=class aj{constructor(){this.fg=0,this.bg=0,this.extended=new vf}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new aj;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},vf=class cj{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new cj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oi=class dj extends g0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new vf,this.combinedData=""}static fromCharData(e){let s=new dj;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?No(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gv="di$target",_p="di$dependencies",W1=new Map;function rde(t){return t[_p]||[]}function cn(t){if(W1.has(t))return W1.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ode(e,s,i)};return e._id=t,W1.set(t,e),e}function ode(t,e,s){e[gv]===e?e[_p].push({id:t,index:s}):(e[_p]=[{id:t,index:s}],e[gv]=e)}var Dn=cn("BufferService"),uj=cn("CoreMouseService"),oa=cn("CoreService"),lde=cn("CharsetService"),sx=cn("InstantiationService"),hj=cn("LogService"),Mn=cn("OptionsService"),fj=cn("OscLinkService"),ade=cn("UnicodeService"),x0=cn("DecorationService"),Lp=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,r=new oi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=u,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):cde(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=u,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};Lp=Ts([Xe(0,Dn),Xe(1,Mn),Xe(2,fj)],Lp);function cde(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
805
805
|
|
|
806
806
|
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var M9=cn("CharSizeService"),no=cn("CoreBrowserService"),nx=cn("MouseService"),io=cn("RenderService"),dde=cn("SelectionService"),mj=cn("CharacterJoinerService"),gd=cn("ThemeService"),pj=cn("LinkProviderService"),ude=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?xv.isErrorNoTelemetry(t)?new xv(t.message+`
|
|
807
807
|
|