decocms 4.192.6 → 4.192.7
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-CC6WuMyY.js → AlertCircle-CrPTg7No.js} +1 -1
- package/dist/client/assets/{AreaChart-BIvWM64r.js → AreaChart-tiBy2zpY.js} +1 -1
- package/dist/client/assets/{ArrowUp-B8XrQdGk.js → ArrowUp-CIA12Ft8.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CjW4sHOs.js → ArrowUpRight-BXb5bWZv.js} +1 -1
- package/dist/client/assets/{Check-CejMvUcw.js → Check-BnRBTd85.js} +1 -1
- package/dist/client/assets/{CheckCircle-D2RIJKvE.js → CheckCircle-CBgF5Rm2.js} +1 -1
- package/dist/client/assets/{ChevronDown-CB6pac0E.js → ChevronDown-Cy4TAhau.js} +1 -1
- package/dist/client/assets/{ChevronRight-BGrjcSGZ.js → ChevronRight-De_XPs2J.js} +1 -1
- package/dist/client/assets/{ChevronUp-D7VYP4DZ.js → ChevronUp-MtxRwI_P.js} +1 -1
- package/dist/client/assets/{Copy01-27d3V8OC.js → Copy01-Cna9zOFE.js} +1 -1
- package/dist/client/assets/{CpuChip01-2CZ4E8x_.js → CpuChip01-BTs5EmAK.js} +1 -1
- package/dist/client/assets/{CreditCard01-Wvo70t25.js → CreditCard01-D5vSzbnW.js} +1 -1
- package/dist/client/assets/{DotsVertical-CfMaJvMJ.js → DotsVertical-D1sFRI3y.js} +1 -1
- package/dist/client/assets/{Eye-BRvryj4A.js → Eye-D3Qlftta.js} +1 -1
- package/dist/client/assets/{FilterLines-B5YJZpPf.js → FilterLines-BWJyLICS.js} +1 -1
- package/dist/client/assets/{HardDrive-edJf181G.js → HardDrive-CnGIgAcW.js} +1 -1
- package/dist/client/assets/{Key01-B8eidy4t.js → Key01-BtzimodV.js} +1 -1
- package/dist/client/assets/{LayoutLeft-bi-w97cc.js → LayoutLeft-Bok-19yc.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CJsD8Eth.js → LinkExternal01-DRRE-MEW.js} +1 -1
- package/dist/client/assets/{LogOut01-Bu0FUBZO.js → LogOut01-XC88FbH6.js} +1 -1
- package/dist/client/assets/{Monitor01-77evGNwP.js → Monitor01-C0_dBUR9.js} +1 -1
- package/dist/client/assets/{Palette-Bae_zfJY.js → Palette-Ct5N9Uum.js} +1 -1
- package/dist/client/assets/{Play-553HzbAq.js → Play-B9tb-IAb.js} +1 -1
- package/dist/client/assets/{Plus-Bu2wVyXl.js → Plus-cYmSDHgU.js} +1 -1
- package/dist/client/assets/{SearchLg-zcM_vHoW.js → SearchLg-Be_T2R0D.js} +1 -1
- package/dist/client/assets/{SearchMd-AEGclR0U.js → SearchMd-CIqlXmg-.js} +1 -1
- package/dist/client/assets/{Settings02-BIVo11Gy.js → Settings02-Cd96ZcWx.js} +1 -1
- package/dist/client/assets/{Shield01-gQAqY2oA.js → Shield01-g9Pmi2fz.js} +1 -1
- package/dist/client/assets/{Star01-kWCwtAUZ.js → Star01-BdbwBCs_.js} +1 -1
- package/dist/client/assets/{Stars01-DkpfACxY.js → Stars01-4Xp1dlQa.js} +1 -1
- package/dist/client/assets/{Stars02-DBNzLakh.js → Stars02-B4nh6_6J.js} +1 -1
- package/dist/client/assets/{Sun-L-KGB8pi.js → Sun-C1gnjPxJ.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-9ZVNLkWy.js → SwitchHorizontal01-BQASu3Ld.js} +1 -1
- package/dist/client/assets/{Tool01-CBcFn1a8.js → Tool01-BQBlAfKK.js} +1 -1
- package/dist/client/assets/{Tool02-BScrpshz.js → Tool02-EfT7Aj_N.js} +1 -1
- package/dist/client/assets/{Trash01-BQf9RXw-.js → Trash01-qhWeifH9.js} +1 -1
- package/dist/client/assets/{TrendUp01-B6B0eVOg.js → TrendUp01--l5g3LV7.js} +1 -1
- package/dist/client/assets/{Upload01-1PihHomx.js → Upload01-DB8t6fYP.js} +1 -1
- package/dist/client/assets/{User01-Bh8V2VLD.js → User01-PQ_zrkhy.js} +1 -1
- package/dist/client/assets/{Users01-B1hNhUwK.js → Users01-D0oW6faK.js} +1 -1
- package/dist/client/assets/{Users03-BVcrCTnQ.js → Users03-89bzO49O.js} +1 -1
- package/dist/client/assets/{X-ccOOjw8a.js → X-XOpfjAzX.js} +1 -1
- package/dist/client/assets/{XCircle-CaNBKSQn.js → XCircle-CPiaBR9U.js} +1 -1
- package/dist/client/assets/{XClose-D3kjyn-S.js → XClose-BBgkL7xx.js} +1 -1
- package/dist/client/assets/{Zap-dI07O5YB.js → Zap-B3YPgxSD.js} +1 -1
- package/dist/client/assets/{ZapSquare-CZfmoR5W.js → ZapSquare-p78bcJrZ.js} +1 -1
- package/dist/client/assets/{access-gate-Bmd3KAlL.js → access-gate-CSs0hmqm.js} +1 -1
- package/dist/client/assets/{agent-icon-hsmzsW08.js → agent-icon-IchZk8Sr.js} +1 -1
- package/dist/client/assets/{agents-list-DFfH3AtT.js → agents-list-BELa4Qbi.js} +1 -1
- package/dist/client/assets/{ai-providers-CQIWzjI5.js → ai-providers-BIzKRt3u.js} +1 -1
- package/dist/client/assets/{alert-BCn0-wjr.js → alert-STtEcxfy.js} +1 -1
- package/dist/client/assets/{alert-dialog-BtD8tGXA.js → alert-dialog-DNVAKC3E.js} +1 -1
- package/dist/client/assets/{app-editor-CoeeWDoR.js → app-editor-FaPWiBOg.js} +1 -1
- package/dist/client/assets/{auth-QjoIpGCe.js → auth-RIRzVJ_F.js} +1 -1
- package/dist/client/assets/{auth-catchall-DsLn4TJN.js → auth-catchall-Vhmd-pZb.js} +1 -1
- package/dist/client/assets/{auth-entry-DhBjbdUS.js → auth-entry-DqnrlknX.js} +1 -1
- package/dist/client/assets/{auth-split-layout-CpQuYysb.js → auth-split-layout-CQFaIdTr.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BslFoSuW.js → authenticate-and-persist-oauth-DTJQ2RW5.js} +1 -1
- package/dist/client/assets/{automation-list-row-REtW7All.js → automation-list-row-LBe18aeG.js} +1 -1
- package/dist/client/assets/{automation-runs-DhG3axBL.js → automation-runs-rqNz0rC6.js} +1 -1
- package/dist/client/assets/{automations-BzdKbr9P.js → automations-DsxhOqDQ.js} +1 -1
- package/dist/client/assets/{avatar-CGd4ACXv.js → avatar-DTYC3n17.js} +1 -1
- package/dist/client/assets/{badge-miuIV-nD.js → badge-7qIblq2m.js} +1 -1
- package/dist/client/assets/{billing-DARX12-c.js → billing-kPnkyznO.js} +1 -1
- package/dist/client/assets/{block-document-RumkV8lh.js → block-document-BELebIgi.js} +1 -1
- package/dist/client/assets/{brand-context-BfLPuCqy.js → brand-context-DgWSLLc-.js} +1 -1
- package/dist/client/assets/{buckets-BEvCi-Dp.js → buckets-t7lL_JmS.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-AUMFMltr.js → bulk-category-panel-BT_WoOli.js} +1 -1
- package/dist/client/assets/{capability-load-error-BG-8hm52.js → capability-load-error-B_2iPv1g.js} +1 -1
- package/dist/client/assets/{card-CkSWH859.js → card-BM5YAxhc.js} +1 -1
- package/dist/client/assets/{category-editor-DBmpWkQa.js → category-editor--8nv-lbZ.js} +1 -1
- package/dist/client/assets/{chat-context-C53gHqxV.js → chat-context-C2dsySEt.js} +1 -1
- package/dist/client/assets/{checkbox-DjVwvC6w.js → checkbox-DUTZPi5Z.js} +1 -1
- package/dist/client/assets/{cli-auth-success-fHYZbkSU.js → cli-auth-success-Cb5YaOny.js} +1 -1
- package/dist/client/assets/{collection-detail-BgVgF8vH.js → collection-detail-D-0eec2n.js} +1 -1
- package/dist/client/assets/{collection-display-button-Ba6gq1z1.js → collection-display-button-C85sEykc.js} +1 -1
- package/dist/client/assets/{collection-search-CZl2paTA.js → collection-search-B4aAzdt3.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CJQbM3xq.js → collection-table-wrapper-BJL7k6gA.js} +1 -1
- package/dist/client/assets/{collection-tabs-B6sL5lVt.js → collection-tabs-E2Di7cti.js} +1 -1
- package/dist/client/assets/{command-pkgw77Sm.js → command-DLmCdwW8.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-DJaRXg9W.js → commerce-onboarding-CleoeHM2.js} +1 -1
- package/dist/client/assets/{connect-BbzBZICH.js → connect-BgaWoDo0.js} +1 -1
- package/dist/client/assets/{connection-DvTmJzhM.js → connection-BFRX1eza.js} +1 -1
- package/dist/client/assets/{connection-card-DYRSdNDT.js → connection-card-CcOb_S6j.js} +1 -1
- package/dist/client/assets/{connection-detail-DGKmmaQ4.js → connection-detail-Dx1OplZ2.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BPv4lhhW.js → connection-form-helpers-CN2A1A9y.js} +1 -1
- package/dist/client/assets/{connections-DJkN_MDw.js → connections-DTn_S2co.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-CnVY_FmU.js → decopilot-sse-pool-YrN0OqM2.js} +1 -1
- package/dist/client/assets/{dialog-Bxxddwgk.js → dialog-C14SMLwt.js} +1 -1
- package/dist/client/assets/{domain-settings-MSowgsFf.js → domain-settings-Cktoj9Pg.js} +1 -1
- package/dist/client/assets/{drawer-nQyRE5sv.js → drawer-BlwkhsOh.js} +1 -1
- package/dist/client/assets/{dropdown-menu-B_yNRNXk.js → dropdown-menu-Cza4sblW.js} +1 -1
- package/dist/client/assets/{empty-state-Cw6pPXNX.js → empty-state-BT3eZ3t6.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BD28YLkz.js → extract-connection-data-DAdthAVN.js} +1 -1
- package/dist/client/assets/{file-explorer-DfuHOOLl.js → file-explorer-BDrfu6vK.js} +1 -1
- package/dist/client/assets/{form-DmhJu8z0.js → form-CDwptF3_.js} +1 -1
- package/dist/client/assets/{general-8iTBc1VC.js → general-DS05-Sgj.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BTjkCuB-.js → github-repo-picker-CscDiobR.js} +1 -1
- package/dist/client/assets/{hooks-Bn4H1MeP.js → hooks-DF_D3yjz.js} +1 -1
- package/dist/client/assets/{index-D5w9GEB7.js → index-B7idRLgU.js} +1 -1
- package/dist/client/assets/{index-sEzl_zv7.js → index-BLQzaBqp.js} +3 -3
- package/dist/client/assets/{index-tLuEN9At.js → index-BTG8kyya.js} +1 -1
- package/dist/client/assets/{index-0HQoltAy.js → index-C-jc6NUA.js} +1 -1
- package/dist/client/assets/{index-BHw3X87s.js → index-CkTN0St6.js} +1 -1
- package/dist/client/assets/{index-BlCKv6k6.js → index-CqgMAdZ1.js} +1 -1
- package/dist/client/assets/{index-DAs7Zn12.js → index-DK6z4kxh.js} +1 -1
- package/dist/client/assets/{index-BOF-P9aA.js → index-DZO0tTUF.js} +1 -1
- package/dist/client/assets/{index-D1gtXbFQ.js → index-TC3tVDwp.js} +1 -1
- package/dist/client/assets/{index-CUHL41UB.js → index-YBcH-y-a.js} +6 -6
- package/dist/client/assets/{index-DhtuBPFR.js → index-a4eq1Xeg.js} +1 -1
- package/dist/client/assets/{index-redirect-BsCBpSfp.js → index-redirect-taDw4dpf.js} +1 -1
- package/dist/client/assets/{input-d1MQNcC_.js → input-DqRWUg_X.js} +1 -1
- package/dist/client/assets/{integration-icon-8nMqdCBS.js → integration-icon-MYUnDpsF.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-cxQTEtwq.js → invite-member-dialog-DoErhEvL.js} +1 -1
- package/dist/client/assets/{label-DuNLnS9E.js → label-BshhAzRV.js} +1 -1
- package/dist/client/assets/{layout-BfS26Qm1.js → layout-JxE1Xnl7.js} +1 -1
- package/dist/client/assets/{login-B93g-Q_F.js → login-BfN-zR0E.js} +1 -1
- package/dist/client/assets/{mcp-oauth-UqrR4ntT.js → mcp-oauth-4WKZZaaI.js} +1 -1
- package/dist/client/assets/{members-Ee2GPTAD.js → members-BZgTmgnG.js} +1 -1
- package/dist/client/assets/{monaco-editor-LYqg4Auw.js → monaco-editor-B_CX8Zr7.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DrK890ub.js → monitoring-stats-row-BoGfdehq.js} +1 -1
- package/dist/client/assets/{multi-select-D7GK66rk.js → multi-select-CrbmnexR.js} +1 -1
- package/dist/client/assets/{oauth-callback-CoDaB2Zv.js → oauth-callback-D6V30oFQ.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-bqL15XKF.js → oauth-callback-ai-provider-CSJnTXv_.js} +1 -1
- package/dist/client/assets/{onboarding-BurjBCgQ.js → onboarding-BCNCpvpq.js} +1 -1
- package/dist/client/assets/{org-layout-ZmcS_jTd.js → org-layout-E2gRJphB.js} +1 -1
- package/dist/client/assets/{organization-choice-CzqgfwfE.js → organization-choice-0J5xCyfo.js} +1 -1
- package/dist/client/assets/{orgs-vpj6AW1J.js → orgs-0Df2rFZM.js} +1 -1
- package/dist/client/assets/{page-seo-form-D480FI6_.js → page-seo-form-CqPX9GFP.js} +1 -1
- package/dist/client/assets/{popover-D7vdkL5N.js → popover-Bx5oqEx8.js} +1 -1
- package/dist/client/assets/{post-editor-DWPT6Z4F.js → post-editor-CRsA4SKG.js} +1 -1
- package/dist/client/assets/{primitives-KicCAgg8.js → primitives-BZta1p6M.js} +1 -1
- package/dist/client/assets/{profile-CvxQOn_D.js → profile-BXdbUd2R.js} +1 -1
- package/dist/client/assets/{project-app-view-CUPxbLM7.js → project-app-view-Bupj8bfK.js} +1 -1
- package/dist/client/assets/record-editor-D99pxZjJ.js +1 -0
- package/dist/client/assets/{redirect-editor-B9KcZF24.js → redirect-editor-BpmIW6_k.js} +1 -1
- package/dist/client/assets/registry-CO9d81wl.js +2 -0
- package/dist/client/assets/{registry-layout-D8PLLpgl.js → registry-layout-DcjX7Zlv.js} +1 -1
- package/dist/client/assets/{reports-BMS_z1_w.js → reports-GWHHYvKk.js} +1 -1
- package/dist/client/assets/{require-capability-c0ICSVhx.js → require-capability-Di-8DrsT.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DfnECP_T.js → required-auth-layout-COsg3fQu.js} +1 -1
- package/dist/client/assets/{reset-password-CAJI_l6M.js → reset-password-B1YEx0OV.js} +1 -1
- package/dist/client/assets/{roles-Dn5uxhal.js → roles-EDxWkorY.js} +1 -1
- package/dist/client/assets/{search-input-Dz5taKp2.js → search-input-p8Zj-yoq.js} +1 -1
- package/dist/client/assets/{secrets-CCK9LAoE.js → secrets-CG9MVAhj.js} +1 -1
- package/dist/client/assets/{sections-editor-BZXWTjdM.js → sections-editor-3J6fiIE3.js} +1 -1
- package/dist/client/assets/{select-BRrtrkRB.js → select-BnjaOaK4.js} +1 -1
- package/dist/client/assets/{select-model-CCdrUOoC.js → select-model-bGvPj-Yy.js} +1 -1
- package/dist/client/assets/{self-tool-result-DPTHewI8.js → self-tool-result-DY6Cs88K.js} +1 -1
- package/dist/client/assets/{seo-editor-CVxqqAo5.js → seo-editor-DlrMfO0C.js} +1 -1
- package/dist/client/assets/{settings-layout-CmTdcfXk.js → settings-layout-Jq8ewdvX.js} +1 -1
- package/dist/client/assets/{settings-section-CENPUvQ6.js → settings-section-dCOi8NXz.js} +1 -1
- package/dist/client/assets/{shell-controls-Q6CcFZhH.js → shell-controls-sNNpK9Ox.js} +1 -1
- package/dist/client/assets/{shell-layout-C36M_3fB.js → shell-layout-D674F3MK.js} +1 -1
- package/dist/client/assets/{sidebar-J8QisJPf.js → sidebar-CYolSc7W.js} +1 -1
- package/dist/client/assets/{skeleton-B546ddO9.js → skeleton-kylkRkJL.js} +1 -1
- package/dist/client/assets/{spinner-BtzPaeUR.js → spinner-Cpm_FgXI.js} +1 -1
- package/dist/client/assets/{sso-PuXqz3k2.js → sso-UnfAzoNH.js} +1 -1
- package/dist/client/assets/{store-D7m0SDJd.js → store-qsxuMwFM.js} +1 -1
- package/dist/client/assets/store-registry-DXsP6g0C.js +2 -0
- package/dist/client/assets/{studio-tools-Cn9_CMce.js → studio-tools-CqkAaE56.js} +1 -1
- package/dist/client/assets/{switch-Hh5SHdMo.js → switch-2Gbfs8A3.js} +1 -1
- package/dist/client/assets/{tab-id-Dd0ktpka.js → tab-id-C_Nz879h.js} +1 -1
- package/dist/client/assets/{table-DRZ2Vw8H.js → table--uMbezaR.js} +1 -1
- package/dist/client/assets/{tabs-DRpM2T3L.js → tabs-AF9xbuOq.js} +1 -1
- package/dist/client/assets/{textarea-Daxg-NQZ.js → textarea-CaGR5BSW.js} +1 -1
- package/dist/client/assets/{toggle-group-D5Oxt1U0.js → toggle-group-Cz-Qz3yI.js} +1 -1
- package/dist/client/assets/{toolbar-BnLVTKG_.js → toolbar-7SzUuTow.js} +1 -1
- package/dist/client/assets/{tooltip-CAI2R3n7.js → tooltip-pEMnAu2z.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CPOvlqk4.js → use-ai-providers-CF0wvQRN.js} +1 -1
- package/dist/client/assets/{use-automations-B8jfonBV.js → use-automations-BnYeuFV5.js} +1 -1
- package/dist/client/assets/{use-autosave-Bi3Mn9We.js → use-autosave-GVMngDQ5.js} +1 -1
- package/dist/client/assets/{use-capability-C0WK-fCD.js → use-capability-Mrgv-isI.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CfAGTx4t.js → use-clock-tick-CaQwC1ct.js} +1 -1
- package/dist/client/assets/{use-connection-Dk7324zC.js → use-connection-Bpd3SbKJ.js} +1 -1
- package/dist/client/assets/{use-copy-DvgpoHC3.js → use-copy-CCO4IbpG.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CN8qjAPb.js → use-create-virtual-mcp-CAlERGk1.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CgDervO5.js → use-debounced-autosave-ZN-fh-JT.js} +1 -1
- package/dist/client/assets/{use-debounced-value-DiMsbOYG.js → use-debounced-value-DRt9VufC.js} +1 -1
- package/dist/client/assets/{use-deco-credits-ZPoAlAp0.js → use-deco-credits-ia60QQ_5.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CvX1r2f8.js → use-decopilot-events-Ba_nm49q.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CdrgU__e.js → use-delete-connection-BOH-auJ7.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-Cuq3LiVT.js → use-deployment-admin-ClfKO8-6.js} +1 -1
- package/dist/client/assets/{use-file-configs-BuljSOYJ.js → use-file-configs-CK7ilKFm.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CMHIYRZy.js → use-infinite-scroll-COkSGeCQ.js} +1 -1
- package/dist/client/assets/{use-join-requests-BmPV8Tar.js → use-join-requests-BMbGlLA1.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DgyfKljR.js → use-mcp-client-D3_O582k.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-8a02UHlY.js → use-mcp-tools-CYCyBiDo.js} +1 -1
- package/dist/client/assets/{use-members-D97Nv08t.js → use-members-DpL8h_63.js} +1 -1
- package/dist/client/assets/{use-mobile-BUmKpXkj.js → use-mobile-8cBnDbFR.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-Cs9gJqRl.js → use-navigate-to-agent-Cajm0dwo.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-vBG_MH58.js → use-open-billing-url-BY0R7rhj.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CNo64rH8.js → use-org-auth-client-c30FIVxP.js} +1 -1
- package/dist/client/assets/{use-org-sso-DecXm8GD.js → use-org-sso-CqyBFPOS.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BX4tIOKh.js → use-organization-roles-B6qTwsCe.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DeI2l9C1.js → use-organization-settings-DTbPHIkP.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CWkG869M.js → use-registry-connections-CIDSY_R4.js} +1 -1
- package/dist/client/assets/{use-secrets-BWrPVn6F.js → use-secrets-C9EtgdjO.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-wK3M-8ov.js → use-section-preview-base-B5R928ud.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DADKScSS.js → use-status-sounds-CU1P-DAS.js} +1 -1
- package/dist/client/assets/{use-tags-BY3EsLiI.js → use-tags-CvxWwuAD.js} +1 -1
- package/dist/client/assets/{use-view-mode-CpZC220k.js → use-view-mode-CNZOuy-V.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-D_7nVBoS.js → use-virtual-mcp-uyaNdGW1.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CeMD7BLn.js +1 -0
- package/dist/client/assets/{useRouterState-B4mp8jwq.js → useRouterState-CEV2fYj5.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Dvl3BS-i.js +1 -0
- package/dist/client/assets/{users-Ct6dfnRc.js → users-DdICln4m.js} +1 -1
- package/dist/client/assets/{variant-calendar-BNSYoLxT.js → variant-calendar-DW0WI87W.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CE1Fm5uP.js → view-mode-toggle-DJEb-NoL.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/record-editor-DTL4fK9u.js +0 -1
- package/dist/client/assets/registry-84vz_vQA.js +0 -2
- package/dist/client/assets/store-registry-C-0zAKpU.js +0 -2
- package/dist/client/assets/useInfiniteQuery-D6kAWcDr.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-funWf8hb.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{o as Qt,r as V,X as rL,Y as oL,c as z,F as Me,m as ie,j as r,E as Fs,b as se,t as me,Z as ei,_ as lL,$ as Gs,a0 as Xf,G as Jf,B as ae,a1 as Zf,a2 as h4,a3 as aL,a4 as cL,v as mr,a5 as Ss,a6 as uo,a7 as zp,d as It,e as Rt,p as Je,a8 as dL,z as Do,a9 as uL,aa as f4,ab as hL,ac as vi,ad as p9,ae as bn,af as fL,ag as g9,ah as mL,ai as pL,aj as gL,ak as xL,x as e1,K as Fe,al as bL,am as vL,an as yL,ao as _L,ap as m4,aq as Ga,n as xt,k as it,a as Ui,y as Bc,ar as hc,u as qr,f as r0,I as p4,as as LL,L as wL,at as g4,au as x4,av as vn,aw as pt,ax as b4,ay as v4,az as y4,aA as _4,aB as L4,aC as w4,aD as S4,aE as k4,aF as j4,aG as Sn,aH as C4,aI as SL,aJ as kL,aK as N4,aL as jL,aM as CL,aN as NL,aO as VL,aP as Aa,aQ as TL,W as EL}from"./index-sEzl_zv7.js";import{i as o0,n as AL}from"./ArrowUp-B8XrQdGk.js";import{u as Gr,a as qn,b as Qs,c as V4,s as PL,d as RL,e as DL,f as IL,g as ML,h as $L,i as OL,j as t1,k as zl,A as BL,l as zL,m as FL,p as T4,V as UL,E as l0,S as E4,n as Tl,t as KL,o as HL,q as a0,r as Xt,v as El,H as fc,w as mc,x as ll,y as A4,z as P4,B as WL}from"./chat-context-C53gHqxV.js";import{c as c0,s as Fl,g as Ni,P as pc,d as s1,t as yo,a as qL,M as GL,i as YL,b as hr,e as d0,f as QL,D as XL,h as JL,j as ZL,k as Al,l as ew,m as tw,u as n1,E as sw,n as zc,o as nw,F as iw,p as i1,q as r1,r as R4,S as rw,v as ow,w as lw,x as aw,y as Fp,z as cw,A as D4,O as dw,B as yn,C as Yr,G as _i,H as uw,T as I4,I as x9,J as Pa,K as hw,L as fw,N as M4,Q as mw,R as Ki,U as pw,V as gw,W as $4,X as Zi,Y as xw,Z as ha,_ as bw,$ as O4,a0 as B4,a1 as o1,a2 as z4,a3 as vw,a4 as yw,a5 as _w,a6 as Qr,a7 as l1,a8 as Lw,a9 as ww,aa as F4,ab as Sw,ac as kw,ad as jw,ae as Cw,af as Nw,ag as Vw,ah as Tw,ai as Ew,aj as U4,ak as Aw}from"./automation-runs-DhG3axBL.js";import{S as _o}from"./spinner-BtzPaeUR.js";import{b as Lo,T as We,a as qe,c as Ge}from"./tooltip-CAI2R3n7.js";import{a as os,b as At,d as jt,e as Ct,h as _n,c as In,i as K4}from"./dialog-Bxxddwgk.js";import{c as Pw,b as u0,a as h0,D as f0,d as H4,e as Rw,f as Dw}from"./drawer-nQyRE5sv.js";import{C as Iw}from"./collection-search-CZl2paTA.js";import{u as Xr}from"./use-mobile-BUmKpXkj.js";import{a as Ul,u as Pt,i as vu,S as Io,b as Mw,c as $w,W as a1,d as Ow,C as yu,g as gc,e as W4,m as bh,f as Up,h as Bw,Q as zw,j as Fw,k as Uw,l as Kw}from"./use-mcp-client-DgyfKljR.js";import{u as q4,g as Fc,l as vh,X as Hw,C as Ww,a as qw,A as Gw,b as Yw,c as Qw}from"./AreaChart-BIvWM64r.js";import{t as fs}from"./ChevronDown-CB6pac0E.js";import{i as hs}from"./X-ccOOjw8a.js";import{t as Xw,z as Jw,s as G4,b as Uc,c as c1,a as Zw,u as Y4}from"./hooks-Bn4H1MeP.js";import{K as eS,i as Q4,u as Kl,a as X4,m as tS}from"./shell-layout-C36M_3fB.js";import{w as J4,A as sS,r as Ya,a as nS,p as Z4,f as Qa,b as e5,c as t5,d as s5,e as iS,F as rS,g as oS,h as lS,j as aS,k as cS,l as dS,O as uS,m as hS,n as fS}from"./tab-id-Dd0ktpka.js";import{n as Pl,b as n5}from"./ZapSquare-CZfmoR5W.js";import{i as Ut}from"./Check-CejMvUcw.js";import{s as Vi}from"./Star01-kWCwtAUZ.js";import{a as Pi,i as m0,b as mS,c as d1,d as u1}from"./Tool01-CBcFn1a8.js";import{t as p0,h as i5,j as h1,k as Jr,l as r5,m as f1,n as o5,A as zr,o as l5,p as a5,q as pS,r as gS,c as c5,u as Kp,v as Hl,w as yd,x as xS,y as Ri,z as Di,B as Jn,C as bS,D as d5,E as vS,F as g0,G as Mo,H as yS,I as m1,J as u5,K as h5,L as yh,M as b9,N as Hp,g as p1,O as _S,P as LS,Q as wS,R as SS,S as kS,T as jS,U as g1,V as f5,W as Hi,X as x1,Y as b1,e as v1,Z as Kc,_ as m5,$ as p5,a0 as g5,a1 as $o,a2 as CS,a3 as y1,a4 as NS,d as x5,a5 as _1,a6 as x0,a7 as VS,a8 as TS,a9 as Xa,aa as ar,ab as L1,i as w1,ac as ES,ad as AS,ae as PS,af as RS,ag as or,ah as b5,ai as S1,aj as DS,ak as Wp,al as IS,am as MS,an as $S,ao as v5,ap as _u,aq as OS,ar as BS,as as zS,at as FS,au as qp,av as y5,aw as US,ax as KS,ay as HS,az as WS,aA as qS,aB as GS,aC as YS,aD as _5,aE as QS,aF as XS,aG as k1}from"./agent-icon-hsmzsW08.js";import{i as Wn}from"./Upload01-1PihHomx.js";import{i as fn}from"./AlertCircle-CC6WuMyY.js";import{a as on}from"./Copy01-27d3V8OC.js";import{F as _h,a as j1,b as C1,c as N1,d as L5}from"./form-DmhJu8z0.js";import{d as kt,S as xs,a as bs,b as js,c as vs}from"./select-BRrtrkRB.js";import{i as b0,a as JS,b as ZS}from"./Settings02-BIVo11Gy.js";import{i as Zr,b as V1,a as ek}from"./XCircle-CaNBKSQn.js";import{T as go,a as Wl,b as Ti,c as Hc}from"./tabs-DRpM2T3L.js";import{t as Lh,i as kn,n as wo}from"./Tool02-BScrpshz.js";import{a as T1,T as xc}from"./toggle-group-D5Oxt1U0.js";import{I as rt}from"./input-d1MQNcC_.js";import{u as E1,b as A1,C as P1,a as tk,A as sk,N as nk}from"./use-deco-credits-ZPoAlAp0.js";import{u as Cs}from"./studio-tools-Cn9_CMce.js";import{u as w5}from"./use-open-billing-url-vBG_MH58.js";import{s as ti}from"./XClose-D3kjyn-S.js";import{M as ik,a as rk,m as v0,i as ok,g as S5,b as lk,N as ak,c as ck}from"./select-model-CCdrUOoC.js";import{a as us,b as ys,P as _s}from"./popover-D7vdkL5N.js";import{t as cr}from"./Stars01-DkpfACxY.js";import{b as dk,a as Wc,c as k5,d as j5,u as Gp}from"./use-organization-settings-DeI2l9C1.js";import{u as y0,a as uk}from"./use-ai-providers-CPOvlqk4.js";import{a as qc,u as Hs,b as R1,c as hk}from"./use-virtual-mcp-D_7nVBoS.js";import{a as D1,g as Gc,b as C5,c as Ln,r as fk,f as mk,d as pk}from"./agent-capabilities-cXfbMfjV.js";import{c as qt,D as Gt,b as Yt,a as Ze,d as Li,e as wi,f as Si,g as wh,h as bc,i as ki,j as _d}from"./dropdown-menu-B_yNRNXk.js";import{s as Nt}from"./Plus-Bu2wVyXl.js";import{p as gk,q as xk}from"./question-004-sINsf4GQ.js";import{i as wn}from"./ChevronRight-BGrjcSGZ.js";import{u as _0}from"./use-is-desktop-app-BNujXJc_.js";import{i as Gn}from"./CheckCircle-D2RIJKvE.js";import{I as ai}from"./integration-icon-8nMqdCBS.js";import{e as Yc}from"./backoff-CrEUbyZT.js";import{u as bk}from"./use-status-sounds-DADKScSS.js";import{E as Fr}from"./empty-state-Cw6pPXNX.js";import{T as Ra,a as vk}from"./toolbar-BnLVTKG_.js";import{i as N5}from"./Monitor01-77evGNwP.js";import{u as Ii,a as I1,b as M1}from"./use-connection-Dk7324zC.js";import{u as ql,a as $1,b as V5}from"./use-mcp-tools-8a02UHlY.js";import{g as L0,M as yk}from"./index-BlCKv6k6.js";import{s as w0,p as _k}from"./deco-site-production-url-CaKZ7xBn.js";import{u as Lk}from"./use-capability-C0WK-fCD.js";import{c as O1,s as S0,d as wk,b as Sk}from"./TrendUp01-B6B0eVOg.js";import{n as hn}from"./LinkExternal01-CJsD8Eth.js";import{S as at}from"./skeleton-B546ddO9.js";import{l as T5,w as kk,M as Qc,F as jk}from"./monaco-editor-LYqg4Auw.js";import{i as E5}from"./LayoutLeft-bi-w97cc.js";import{i as Xc}from"./Key01-B8eidy4t.js";import{p as Ck,f as Nk}from"./pt-BR-CLy76QW2.js";import{g as Vk,e as Tk}from"./extract-connection-data-BD28YLkz.js";import{A as Us}from"./avatar-CGd4ACXv.js";import{a as Ek,i as Yp}from"./mcp-oauth-UqrR4ntT.js";import{g as vc,f as yc,b as _c,A as Lc,a as wc,e as Sc,c as kc,d as jc}from"./alert-dialog-BtD8tGXA.js";import{C as Lu,a as ho}from"./card-CkSWH859.js";import{L as Et}from"./label-DuNLnS9E.js";import{S as Mi}from"./switch-Hh5SHdMo.js";import{T as Ur}from"./textarea-Daxg-NQZ.js";import{i as So}from"./Play-553HzbAq.js";import{s as Ks}from"./Trash01-BQf9RXw-.js";import{u as wu}from"./use-debounced-autosave-CgDervO5.js";import{i as Cc}from"./SearchMd-AEGclR0U.js";import{P as Zn}from"./index-D1gtXbFQ.js";import{C as Gl}from"./checkbox-DjVwvC6w.js";import{S as B1}from"./search-input-Dz5taKp2.js";import{C as A5}from"./collection-tabs-B6sL5lVt.js";import{T as P5,u as R5,I as Ak,R as Pk,a as Rk}from"./index-tLuEN9At.js";import{g as Dk,s as D5}from"./connection-slug-eyAPH6o3.js";import{d as Yl}from"./delay-CnY5UFtP.js";import{G as Kr,a as z1,u as Ik}from"./github-repo-picker-BTjkCuB-.js";import{s as Su}from"./User01-Bh8V2VLD.js";import{t as F1}from"./Users01-B1hNhUwK.js";import{u as I5,a as M5}from"./use-secrets-BWrPVn6F.js";import{i as $5,a as k0}from"./DotsVertical-CfMaJvMJ.js";import{u as Sh,b as kh,C as Mk,c as $k,p as Ok,a as Bk}from"./self-tool-result-DPTHewI8.js";import{a as Jc}from"./format-time-BnbuEtat.js";import{i as O5}from"./ArrowUpRight-CjW4sHOs.js";import{f as B5,g as zk,a as Fk}from"./provision-repo-scoped-github-connection-ufuvpGD9.js";import{a as Uk}from"./authenticate-and-persist-oauth-BslFoSuW.js";import{u as j0,a as Kk}from"./use-members-D97Nv08t.js";import{m as Hk,n as Wk,o as qk,p as Gk,q as Yk,u as Qk}from"./sidebar-J8QisJPf.js";import{t as Xk,T as Jk,R as Zk,i as Nc,a as ej,S as cs,b as z5}from"./decopilot-sse-pool-CnVY_FmU.js";import{u as tj}from"./use-decopilot-events-CvX1r2f8.js";import{s as Zc}from"./Eye-BRvryj4A.js";import{u as sj}from"./use-copy-DvgpoHC3.js";import{i as U1,c as F5}from"./SwitchHorizontal01-9ZVNLkWy.js";import{u as U5,a as nj,b as ij}from"./use-tags-BY3EsLiI.js";import{g as Rn}from"./get-initials-D-f_fDFw.js";import{d as Wi,a as si,c as Jt,b as ks,C as qi,e as pr,f as rj,g as Qp}from"./command-pkgw77Sm.js";import{i as K1}from"./FilterLines-B5YJZpPf.js";import{i as C0}from"./SearchLg-zcM_vHoW.js";import{i as $i}from"./Zap-dI07O5YB.js";import{a as ku}from"./Palette-Bae_zfJY.js";import{u as K5}from"./use-debounced-value-DiMsbOYG.js";import{u as oj,a as H5}from"./use-file-configs-BuljSOYJ.js";import{u as W5}from"./useInfiniteQuery-D6kAWcDr.js";import{B as lj}from"./badge-miuIV-nD.js";import{u as ed,a as aj,b as cj,c as dj,d as uj}from"./use-automations-B8jfonBV.js";import{s as Ja}from"./Stars02-DBNzLakh.js";import{A as hj}from"./automation-list-row-REtW7All.js";import{n as q5}from"./ChevronUp-D7VYP4DZ.js";function fj(t,e){const s=Qt(e);return mj({filters:{...t,status:"pending"}},s).length}function Xp(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function mj(t={},e){const s=Qt(e).getMutationCache(),n=V.useRef(t),i=V.useRef(null);return i.current===null&&(i.current=Xp(s,t)),V.useEffect(()=>{n.current=t}),V.useSyncExternalStore(V.useCallback(o=>s.subscribe(()=>{const l=rL(i.current,Xp(s,n.current));i.current!==l&&(i.current=l,oL.schedule(o))}),[s]),()=>i.current,()=>i.current)}const Jp=3,G5="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",pj="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Y5(t){const e=z.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:o,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 S=Ni(c._meta);d=c.title??s1(c.name,S),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 S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=o||i,j=i&&"bg-accent/40",T=(o||i)&&"cursor-not-allowed opacity-50";let N;e[7]!==j||e[8]!==T?(N=ie(pj,"hover:bg-accent/60 text-foreground",j,T),e[7]=j,e[8]=T,e[9]=N):N=e[9];let C;e[10]!==u?(C=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=C):C=e[11];let A;e[12]!==i?(A=i&&r.jsx(_o,{size:"xs"}),e[12]=i,e[13]=A):A=e[13];let P;e[14]!==C||e[15]!==A?(P=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,A]}),e[14]=C,e[15]=A,e[16]=P):P=e[16];let R;e[17]!==h?(R=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=R):R=e[18];let E;return e[19]!==P||e[20]!==R||e[21]!==S||e[22]!==k||e[23]!==N?(E=r.jsxs("button",{type:"button",onClick:S,disabled:k,className:N,children:[P,R]}),e[19]=P,e[20]=R,e[21]=S,e[22]=k,e[23]=N,e[24]=E):E=e[24],E}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=o||i,p=i&&"bg-muted/50",g=(o||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(G5,"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=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(_o,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let y;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(y=r.jsx(We,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=y):y=e[40];const _=h??u;let L;e[41]!==_?(L=r.jsx(qe,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:_})}),e[41]=_,e[42]=L):L=e[42];let w;return e[43]!==y||e[44]!==L?(w=r.jsxs(Ge,{delayDuration:400,children:[y,L]}),e[43]=y,e[44]=L,e[45]=w):w=e[45],w}function gj(t){const e=z.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=se(),[c,d]=V.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(C=>{const A=c.toLowerCase();return C.prompt.name.toLowerCase().includes(A)||(C.prompt.title??"").toLowerCase().includes(A)||(C.prompt.description??"").toLowerCase().includes(A)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Xr();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&r.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]!==o){let C;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==o?(C=A=>r.jsx(Y5,{item:A,variant:"card",onSelect:P=>{i(!1),o(P)},isLoading:l?.name===A.prompt.name,isDisabled:u&&l?.name!==A.prompt.name},A.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=o,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.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 v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=C=>{C.key==="Escape"&&d("")},e[23]=y):y=e[23];let _;e[24]!==c||e[25]!==v?(_=r.jsx(Iw,{value:c,onChange:d,placeholder:v,onKeyDown:y}),e[24]=c,e[25]=v,e[26]=_):_=e[26];const L=_;if(m){let C;e[27]!==a?(C=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=C):C=e[28];let A;e[29]!==C?(A=r.jsx(Pw,{className:"sr-only",children:r.jsx(u0,{children:C})}),e[29]=C,e[30]=A):A=e[30];let P;e[31]!==a?(P=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=P):P=e[32];let R;e[33]!==P?(R=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:P})}),e[33]=P,e[34]=R):R=e[34];let E;e[35]!==b||e[36]!==L||e[37]!==R||e[38]!==A?(E=r.jsxs(h0,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[A,R,L,b]}),e[35]=b,e[36]=L,e[37]=R,e[38]=A,e[39]=E):E=e[39];let M;return e[40]!==i||e[41]!==n||e[42]!==E?(M=r.jsx(Lo,{delayDuration:400,children:r.jsx(f0,{open:n,onOpenChange:i,children:E})}),e[40]=i,e[41]=n,e[42]=E,e[43]=M):M=e[43],M}let w;e[44]!==a?(w=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=w):w=e[45];let S;e[46]!==w?(S=r.jsx(os,{className:"sr-only",children:r.jsx(At,{children:w})}),e[46]=w,e[47]=S):S=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=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let T;e[52]!==b||e[53]!==L||e[54]!==j||e[55]!==S?(T=r.jsxs(jt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,L,b]}),e[52]=b,e[53]=L,e[54]=j,e[55]=S,e[56]=T):T=e[56];let N;return e[57]!==i||e[58]!==n||e[59]!==T?(N=r.jsx(Lo,{delayDuration:400,children:r.jsx(Ct,{open:n,onOpenChange:i,children:T})}),e[57]=i,e[58]=n,e[59]=T,e[60]=N):N=e[60],N}function xj(t){const e=z.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=se(),[a,c]=V.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,Jp),v=s.slice(Jp),y=!!i;let _;e[10]!==y||e[11]!==i?.name||e[12]!==n?(_=w=>r.jsx(Y5,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:y&&i?.name!==w.prompt.name},w.prompt.name),e[10]=y,e[11]=i?.name,e[12]=n,e[13]=_):_=e[13];const L=b.map(_);d=Lo,m=400,e[14]!==o?(u=ie("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=u):u=e[15],h=L,f=v.length>0&&r.jsx("button",{type:"button",disabled:y,onClick:()=>c(!0),className:ie(G5,"hover:bg-muted/70 hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=o,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=r.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=r.jsx(gj,{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=r.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 bj(){return null}function vj(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 yj(t){const e=z.c(31),{connectionId:s}=t,n=se(),{sendMessage:i}=qn(),{org:o}=Me();let l;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(l={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=l):l=e[3];const a=Pt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=q4(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(_j),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]=V.useReducer(vj,p),[b,v]=V.useState(null);let y;e[11]!==a||e[12]!==i||e[13]!==n?(y=async(P,R)=>{if(!a){me.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const E=await Fc(a,P.name,R);x({type:"RESET"});const M={type:"doc",content:[{type:"paragraph",content:[c0({id:P.name,name:Fl(P.name,Ni(P._meta)),metadata:E.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await i(M)}catch(E){console.error("[ice-breakers] Failed to fetch prompt:",E),me.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=y):y=e[14];const _=y;let L;e[15]!==_?(L=async P=>{if(P.arguments&&P.arguments.length>0){x({type:"SELECT_PROMPT",prompt:P}),v(P);return}x({type:"START_LOADING",prompt:P}),await _(P)},e[15]=_,e[16]=L):L=e[16];const w=L;let S;e[17]!==b||e[18]!==_?(S=async P=>{b&&(x({type:"START_LOADING",prompt:b,arguments:P}),v(null),await _(b,P))},e[17]=b,e[18]=_,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let T;e[20]!==w||e[21]!==m||e[22]!==j?(T=r.jsx(xj,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=T):T=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{v(null),x({type:"RESET"})},e[24]=N):N=e[24];let C;e[25]!==b||e[26]!==k?(C=r.jsx(pc,{prompt:b,setPrompt:N,onSubmit:k}),e[25]=b,e[26]=k,e[27]=C):C=e[27];let A;return e[28]!==T||e[29]!==C?(A=r.jsxs(r.Fragment,{children:[T,C]}),e[28]=T,e[29]=C,e[30]=A):A=e[30],A}function _j(t){return{prompt:t}}function Lj(t){const e=z.c(13),{className:s}=t,{selectedVirtualMcp:n}=Gr(),{org:i}=Me();let o;e[0]!==i.id?(o=Ul(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=o.id,a=n?.id??l;let c;e[2]!==s?(c=ie("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=r.jsx(bj,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=r.jsx(yj,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Fs,{fallback:null,children:r.jsx(V.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=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const v9="cubic-bezier(0.645, 0.045, 0.355, 1)",wj=44,Sj={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"},kj={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},jj={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Hr(t){const e=z.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=se(),[p,g]=V.useState(d),[x,b]=V.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const y=v;if(x)return null;const _=kj[f],L=Sj[f];let w;e[2]!==_||e[3]!==L?(w=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",_,L),e[2]=_,e[3]=L,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(Cj),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let T;e[6]!==k||e[7]!==j?(T=ie("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]=T):T=e[8];const N=jj[f];let C;e[9]!==N?(C=ie("shrink-0",N),e[9]=N,e[10]=C):C=e[10];let A;e[11]!==s||e[12]!==C?(A=r.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=A):A=e[13];let P;e[14]!==n?(P=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=P):P=e[15];let R;e[16]!==i?(R=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=R):R=e[17];const E=p?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==E?(M=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(fs,{size:16,style:{transform:E,transition:`transform 180ms ${v9}`}})}),e[18]=E,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 $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let O,D;e[24]!==y?(O=te=>{te.stopPropagation(),y()},D=te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),te.stopPropagation(),y())},e[24]=y,e[25]=O,e[26]=D):(O=e[25],D=e[26]);let B;e[27]===Symbol.for("react.memo_cache_sentinel")?(B=r.jsx(hs,{size:16}),e[27]=B):B=e[27];let F;e[28]!==I||e[29]!==$||e[30]!==O||e[31]!==D?(F=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":I,title:$,onClick:O,onKeyDown:D,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]=$,e[30]=O,e[31]=D,e[32]=F):F=e[32];let U;e[33]!==p||e[34]!==A||e[35]!==P||e[36]!==R||e[37]!==M||e[38]!==F||e[39]!==T?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:T,children:[A,P,R,M,F]}),e[33]=p,e[34]=A,e[35]=P,e[36]=R,e[37]=M,e[38]=F,e[39]=T,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${v9}`},e[41]=H,e[42]=W):W=e[42];let q;e[43]===Symbol.for("react.memo_cache_sentinel")?(q={overflow:"hidden",minHeight:0},e[43]=q):q=e[43];const ee=p?1:0;let X;e[44]!==ee?(X={opacity:ee,transition:`opacity 120ms ${v9}`,maxHeight:"60vh"},e[44]=ee,e[45]=X):X=e[45];let Y;e[46]!==o?(Y=o?r.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:o})}):r.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=o,e[47]=Y):Y=e[47];let G;e[48]!==c||e[49]!==o?(G=c?r.jsx("div",{className:ie("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=G):G=e[50];let J;e[51]!==Y||e[52]!==G?(J=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[Y,G]}),e[51]=Y,e[52]=G,e[53]=J):J=e[53];let oe;e[54]!==l||e[55]!==a?(oe=l||a?r.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:l}),r.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=oe):oe=e[56];let le;e[57]!==X||e[58]!==J||e[59]!==oe?(le=r.jsx("div",{style:q,children:r.jsxs("div",{className:"flex flex-col",style:X,children:[J,oe]})}),e[57]=X,e[58]=J,e[59]=oe,e[60]=le):le=e[60];let Q;e[61]!==W||e[62]!==le?(Q=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:le}),e[61]=W,e[62]=le,e[63]=Q):Q=e[63];let K;return e[64]!==U||e[65]!==Q||e[66]!==w||e[67]!==f?(K=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:w,children:[U,Q]}),e[64]=U,e[65]=Q,e[66]=w,e[67]=f,e[68]=K):K=e[68],K}function Cj(t){return!t}const Nj=ei({content:Gs().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Xf(["pending","in_progress","completed"]),activeForm:Gs().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),Q5=ei({todos:lL(Nj)}),Vj="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.";Xw({description:Vj,inputSchema:Jw(Q5),execute:async({todos:t})=>({ok:!0,count:t.length})});const Tj="tool-todo_write",Ej=new Set(["input-available","output-available"]);function Aj(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 o=n[i];if(o.type!==Tj||typeof o.state!="string"||!Ej.has(o.state))continue;const l=Q5.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function X5(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:yo(qL(n)),input:s.input})}return e}function J5(t){return t.at(-1)}function Z5(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 Pj(t){return t?t.message.startsWith("[CREDITS]"):!1}const Rj="[SUBSCRIPTION_REQUIRED]";function eb(t){return t?.message.startsWith(Rj)?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 Dj={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function Ij(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&Pj(s))return{...Dj,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(_=>_.type==="tool-user_ask").filter(_=>_.state!=="output-available").length,h=Z5(a),f=X5(c),m=Aj(e),p=i?null:eb(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=h.length>0,y=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:y,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function tb(){const t=z.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=qn(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==o||t[2]!==e||t[3]!==l||t[4]!==a?(c=Ij({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:o}),t[0]=i,t[1]=o,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function Mj(){const t=tb();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 sb(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 $j="__home__";function H1(t,e){return Jf.chatDraft(t,e)}function Oj(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 nb(t,e,s,n,i){const o=H1(e,s);if(sb(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(zj(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Zp(t,e,s){const n=H1(e,s),i=t.getItem(n),o=Oj(i);return i!==null&&o===null&&t.removeItem(n),o}function Bj(t,e,s){t.removeItem(H1(e,s))}function zj(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Fj(t){const e=z.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=se();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=ie("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=r.jsx(b0,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=r.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=r.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 v;e[16]!==b?(v=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let y;e[18]!==l?(y=l("chat.pagination.nextLabel"),e[18]=l,e[19]=y):y=e[19];let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(Zr,{size:14}),e[20]=_):_=e[20];let L;e[21]!==o||e[22]!==x||e[23]!==v||e[24]!==y?(L=r.jsx("button",{type:"button",onClick:o,disabled:x,className:v,"aria-label":y,children:_}),e[21]=o,e[22]=x,e[23]=v,e[24]=y,e[25]=L):L=e[25];let w;return e[26]!==L||e[27]!==f||e[28]!==g?(w=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,L]}),e[26]=L,e[27]=f,e[28]=g,e[29]=w):w=e[29],w}function ib(t){const e=z.c(8),{currentIndex:s,total:n,onPrev:i,onNext:o,extraLeft:l}=t;let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a=r.jsx(Fj,{current:s,total:n,onPrev:i,onNext:o}),e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=r.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 Uj(t){const e=z.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,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]!==o?(m=()=>{h||o()},e[0]=h,e[1]=o,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("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=r.jsx(ae,{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 v;e[10]!==b?(v=r.jsx(We,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(qe,{children:f}),e[12]=f,e[13]=y):y=e[13];let _;return e[14]!==v||e[15]!==y?(_=r.jsxs(Ge,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=_):_=e[16],_}function rb(t,e,s){return t.findIndex(n=>e(n)===s)}function e2(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function t2(t,e,s,n,i){if(t.length===0)return null;const o=rb(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(o+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function Kj(t){return!t.isStreaming&&t.allAnswered}function ob(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=V.useState(c),[h,f]=V.useState(!1),m=Zf({resolver:h4(n),defaultValues:i}),p=m.watch(),g=rb(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=e2(e,s,p,l),y=Kj({isStreaming:o,allAnswered:v}),_=()=>{if(g>0){const N=e[g-1];N&&u(s(N))}},L=()=>{if(g>=0&&g<e.length-1){const N=e[g+1];N&&u(s(N))}},w=()=>{const N=m.getValues(),C=t2(e,s,N,l,d);C&&u(C)},S=()=>{m.handleSubmit(N=>{const C=N;for(const A of e)a(A,C[s(A)])})()},k=V.useRef(S);k.current=S;const j=()=>{y&&(f(!1),k.current())},T=()=>{const N=m.getValues();if(e2(e,s,N,l)){if(o){f(!0);return}f(!1),k.current()}else{const C=t2(e,s,N,l,d);C&&u(C)}};return V.useEffect(()=>{if(h&&!o){if(!v){f(!1);return}f(!1),k.current()}},[h,o,v]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:y,goPrev:_,goNext:L,advanceToNextUnanswered:w,submit:j,submitOrAdvance:T}}const lb="chat.approval.defaultDenyReason";function ab(t){const e=z.c(36),{onYolo:s}=t,n=se(),[i,o]=mr();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const _=uo.find(S=>S.value===i.toolApprovalLevel)??uo[0];let L;e[13]!==s||e[14]!==i||e[15]!==o?(L=S=>{const k=S,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=L):L=e[16];const w=L;c=xs,m=i.toolApprovalLevel,p=w,a=bs,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=Hj,l=js,d=n(_.shortKey),e[0]=s,e[1]=i,e[2]=o,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=r.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=r.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=uo.map(_=>r.jsx(kt,{value:_.value,children:n(_.labelKey)},_.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=r.jsx(vs,{children:b}),e[28]=b,e[29]=v):v=e[29];let y;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(y=r.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=y):y=e[35],y}function Hj(t){return t.stopPropagation()}function cb(t){const e=z.c(8),{input:s}=t,n=se();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=r.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 o;return e[6]!==i?(o=r.jsx("div",{className:"px-4",children:r.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]=o):o=e[7],o}function Wj(t){const e=z.c(38),{approval:s,onRespond:n}=t,i=se(),[o]=mr(),l=o.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(lb),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=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(ab,{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=r.jsx(ae,{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 v;e[21]!==u||e[22]!==b?(v=r.jsx(ae,{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]=v):v=e[23];let y;e[24]!==x||e[25]!==v?(y=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=y):y=e[26];const _=y;let L;e[27]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(p0,{size:14}),e[27]=L):L=e[27];let w;e[28]!==i?(w=i("chat.approval.needsApproval"),e[28]=i,e[29]=w):w=e[29];let S;e[30]!==s.input?(S=r.jsx(cb,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==_||e[35]!==w||e[36]!==S?(k=r.jsx(Hr,{icon:L,label:w,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:_,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=_,e[35]=w,e[36]=S,e[37]=k):k=e[37],k}const qj=aL(Gs(),ei({approved:cL().optional(),levelOverride:Xf(["auto","readonly"]).optional()}));function Gj(t){const e=z.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=se(),[l]=mr(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(Xj)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==o?(u=(C,A)=>{const P=A;typeof P?.approved=="boolean"&&i(C.approvalId,P.approved,P.approved===!1?o(lb):void 0,P.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:Qj,schema:qj,defaultValues:d,isStreaming:n,hasAnswer:Yj,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=ob(h);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(A=>[A.approvalId,{approved:!0,levelOverride:C}]))),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=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(p0,{size:14}),e[16]=v):v=e[16];let y;e[17]!==s.length||e[18]!==o?(y=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=y):y=e[19];const _=g?.friendlyName??"";let L;e[20]!==p?(L=r.jsx(ab,{onYolo:p}),e[20]=p,e[21]=L):L=e[21];let w;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==L?(w=r.jsx(ib,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:L}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=L,e[27]=w):w=e[27];let S;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(S=g?r.jsx(Jj,{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]=S):S=e[31];let k;e[32]!==g?(k=g?r.jsx(cb,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==w||e[35]!==S||e[36]!==k||e[37]!==y||e[38]!==_?(j=r.jsx(Hr,{icon:v,label:y,title:_,defaultExpanded:!0,footerLeft:w,footerRight:S,children:k}),e[34]=w,e[35]=S,e[36]=k,e[37]=y,e[38]=_,e[39]=j):j=e[39];let T;e[40]!==j||e[41]!==b?(T=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=T):T=e[42];let N;return e[43]!==f.form||e[44]!==T?(N=r.jsx(_h,{...x,children:T}),e[43]=f.form,e[44]=T,e[45]=N):N=e[45],N}function Yj(t){return typeof t?.approved=="boolean"}function Qj(t){return t.approvalId}function Xj(t){return[t.approvalId,{approved:void 0}]}function Jj(t){const e=z.c(7),{approvalId:s,control:n,onChange:i}=t,o=se(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(ae,{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:o("chat.approval.denyButton")}),r.jsx(ae,{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:o("chat.approval.acceptButton")})]})},e[0]=i,e[1]=o,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=r.jsx(Ss,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function Zj(){const t=z.c(5),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(p0,{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=r.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,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function eC(t){const e=z.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=r.jsx(Zj,{}),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=r.jsx(Wj,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let o;return e[4]!==s||e[5]!==n||e[6]!==i?(o=r.jsx(Gj,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function tC(t){const e=z.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=se();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]!==o?(c=o("chat.proposePlan.keepIterating"),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=r.jsx(ae,{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]!==o?(u=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=r.jsx(ae,{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=r.jsxs(r.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=r.jsx(i5,{size:14}),e[16]=p):p=e[16];let g;e[17]!==o?(g=o("chat.proposePlan.planReady"),e[17]=o,e[18]=g):g=e[18];let x;e[19]!==o?(x=o("chat.proposePlan.implementationPlan"),e[19]=o,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=r.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:r.jsx(GL,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=r.jsx(Hr,{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]=v):v=e[27],v}function sC(t){const e=z.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=J5(s),e[0]=s,e[1]=o):o=e[1];const l=o;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=r.jsx(tC,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function db(t){return t?"response"in t?t.response:t.option??t.draft:""}const s2=ei({response:Gs().min(1,"Response is required")}),nC=ei({option:Gs().nullable(),draft:Gs()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),iC=ei({response:Xf(["yes","no"])});function rC(t){switch(t.type){case"text":return s2;case"choice":return nC;case"confirm":return iC;default:return s2}}function oC(t){const e={};for(const s of t)e[s.toolCallId]=rC(s.input);return ei(e)}function lC(t){const e=z.c(7),{control:s,name:n,placeholder:i}=t,o=se();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,u=d.value??"";return r.jsxs(j1,{children:[r.jsx(C1,{children:r.jsx("div",{className:"px-2",children:r.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(h1,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:u,type:"text",placeholder:i||o("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":o("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(N1,{})]})},e[0]=i,e[1]=o,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=r.jsx(L5,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function ub(t,e){const s=z.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const o=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",o),()=>document.removeEventListener("keydown",o)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),V.useEffect(n,i)}function aC(t){const e=z.c(51),{control:s,name:n,options:i}=t,o=se(),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}=zp(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}=zp(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=E=>{const M=i[E];M!=null&&c.onChange(M)},e[6]=c,e[7]=i,e[8]=p):p=e[8],ub(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==o?(x=o("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=o,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==o){let E;e[16]!==c||e[17]!==f||e[18]!==o?(E=(M,I)=>{const $=f===M;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(M),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",$&&"bg-accent/50",!$&&"hover:bg-accent/30"),"aria-label":o("chat.userAskQuestion.selectOption",{option:M}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",$?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${I}-${M}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=E):E=e[19],b=i.map(E),e[11]=c,e[12]=f,e[13]=i,e[14]=o,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",y=!g&&"hover:bg-accent/30";let _;e[20]!==v||e[21]!==y?(_=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,y),e[20]=v,e[21]=y,e[22]=_):_=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(h1,{size:16,className:"text-muted-foreground"})}),e[23]=L):L=e[23];const w=g?m:"";let S;e[24]!==h||e[25]!==c||e[26]!==f?(S=E=>{h.onChange(E.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=S):S=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]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let T;e[33]!==o?(T=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=T):T=e[34];let N;e[35]!==w||e[36]!==S||e[37]!==k||e[38]!==j||e[39]!==T?(N=r.jsx("input",{type:"text",value:w,onChange:S,onFocus:k,placeholder:j,"aria-label":T,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=w,e[36]=S,e[37]=k,e[38]=j,e[39]=T,e[40]=N):N=e[40];let C;e[41]!==_||e[42]!==N?(C=r.jsxs("label",{className:_,children:[L,N]}),e[41]=_,e[42]=N,e[43]=C):C=e[43];let A;e[44]!==C||e[45]!==x||e[46]!==b?(A=r.jsx(C1,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=A):A=e[47];let P;e[48]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(N1,{}),e[48]=P):P=e[48];let R;return e[49]!==A?(R=r.jsxs(j1,{children:[A,P]}),e[49]=A,e[50]=R):R=e[50],R}function cC(t){const e=z.c(8),{control:s,name:n}=t,i=se();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=V.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],ub(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,r.jsxs(j1,{children:[r.jsx(C1,{children:r.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 r.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ie("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:[r.jsx("span",{className:ie("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}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),r.jsx(N1,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=r.jsx(L5,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}function n2(t){const e=z.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const o=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==o?(l=r.jsx(lC,{control:n,name:o,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=o,e[3]=l):l=e[3],l}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const l=o;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=r.jsx(aC,{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 o=`${i}.response`;let l;return e[10]!==n||e[11]!==o?(l=r.jsx(cC,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function dC(t){const e=z.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=oC(s.map(mC)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(fC)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(D,B)=>{const F=db(B);F&&i(D,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:hC,schema:l,defaultValues:c,isStreaming:n,hasAnswer:uC,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=ob(u),f=h.currentPart,m=se();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const D=f;if(!D)return;const B=m("chat.userAskQuestion.skipMessage"),F=D.toolCallId;D.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=r.jsx(ib,{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 v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let y;e[23]!==g||e[24]!==v?(y=r.jsx(ae,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=y):y=e[25];let _;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(_=r.jsx(Uj,{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]=_):_=e[30];let L;e[31]!==y||e[32]!==_?(L=r.jsxs(r.Fragment,{children:[y,_]}),e[31]=y,e[32]=_,e[33]=L):L=e[33];const w=L;if(s.length===1){const D=s[0];if(!D?.input)return null;const B=h.form;let F;e[34]!==h?(F=J=>{J.preventDefault(),h.submit()},e[34]=h,e[35]=F):F=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(Lh,{size:14}),e[36]=U):U=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let W;e[39]!==D.input?.prompt||e[40]!==m?(W=D.input?.prompt??m("chat.userAskQuestion.question"),e[39]=D.input?.prompt,e[40]=m,e[41]=W):W=e[41];const q=D.input;let ee;e[42]!==h.form.control||e[43]!==D.toolCallId||e[44]!==q?(ee=r.jsx(n2,{input:q,control:h.form.control,toolCallId:D.toolCallId}),e[42]=h.form.control,e[43]=D.toolCallId,e[44]=q,e[45]=ee):ee=e[45];let X;e[46]!==w||e[47]!==H||e[48]!==W||e[49]!==ee?(X=r.jsx(Hr,{icon:U,label:H,title:W,defaultExpanded:!0,footerRight:w,children:ee}),e[46]=w,e[47]=H,e[48]=W,e[49]=ee,e[50]=X):X=e[50];let Y;e[51]!==F||e[52]!==X?(Y=r.jsx("form",{onSubmit:F,autoComplete:"off",children:X}),e[51]=F,e[52]=X,e[53]=Y):Y=e[53];let G;return e[54]!==h.form||e[55]!==Y?(G=r.jsx(_h,{...B,children:Y}),e[54]=h.form,e[55]=Y,e[56]=G):G=e[56],G}const S=h.form;let k;e[57]!==h?(k=D=>{D.preventDefault(),h.submit()},e[57]=h,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(Lh,{size:14}),e[59]=j):j=e[59];let T;e[60]!==m?(T=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=T):T=e[61];const N=h.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==N?(C=m("chat.userAskQuestion.questionCount",{current:N,total:s.length}),e[62]=s.length,e[63]=m,e[64]=N,e[65]=C):C=e[65];let A;e[66]!==f?.input?.prompt||e[67]!==m?(A=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=A):A=e[68];const P=h.activeKey,R=h.setActiveKey;let E;if(e[69]!==h.form||e[70]!==s){let D;e[72]!==h.form?(D=B=>r.jsx(go,{value:B.toolCallId,className:"mt-0",children:r.jsx(n2,{input:B.input,control:h.form.control,toolCallId:B.toolCallId})},B.toolCallId),e[72]=h.form,e[73]=D):D=e[73],E=s.map(D),e[69]=h.form,e[70]=s,e[71]=E}else E=e[71];let M;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==E?(M=r.jsx(Wl,{value:P,onValueChange:R,children:E}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=E,e[77]=M):M=e[77];let I;e[78]!==b||e[79]!==w||e[80]!==T||e[81]!==C||e[82]!==A||e[83]!==M?(I=r.jsx(Hr,{icon:j,label:T,count:C,title:A,defaultExpanded:!0,footerLeft:b,footerRight:w,children:M}),e[78]=b,e[79]=w,e[80]=T,e[81]=C,e[82]=A,e[83]=M,e[84]=I):I=e[84];let $;e[85]!==k||e[86]!==I?($=r.jsx("form",{onSubmit:k,autoComplete:"off",children:I}),e[85]=k,e[86]=I,e[87]=$):$=e[87];let O;return e[88]!==h.form||e[89]!==$?(O=r.jsx(_h,{...S,children:$}),e[88]=h.form,e[89]=$,e[90]=O):O=e[90],O}function uC(t){return!!db(t)}function hC(t){return t.toolCallId}function fC(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function mC(t){return{toolCallId:t.toolCallId,input:t.input}}function pC(){const t=z.c(5),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Lh,{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=r.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,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function hb(t){const e=z.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(gC),e[0]=s,e[1]=o):o=e[1];const l=o;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(pC,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(dC,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function gC(t){return t.state==="input-available"}function xC(t){const e=t.filter(o=>o.status==="in_progress"),s=t.filter(o=>o.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 bC(t){const e=z.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=xC(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx(LC,{status:i.icon}),e[2]=i.icon,e[3]=o):o=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(vC),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=r.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]!==o||e[11]!==d?(u=r.jsx(Hr,{icon:o,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=o,e[11]=d,e[12]=u):u=e[12],u}function vC(t,e){return r.jsx(yC,{todo:t},e)}function yC(t){const e=z.c(14),{todo:s}=t,n=s.status==="completed",o=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=r.jsx(_C,{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=ie("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=r.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]!==o||e[8]!==c||e[9]!==h?(f=r.jsxs("span",{className:c,children:[o,h]}),e[7]=o,e[8]=c,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=r.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 _C(t){const e=z.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("svg",{viewBox:"0 0 21 21",children:r.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]=o):o=e[0];let l;return e[1]!==n||e[2]!==i?(l=r.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:o}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function LC(t){const e=z.c(13),{status:s}=t,n=se();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=r.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:r.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=r.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=r.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 o;return e[11]!==i?(o=r.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]=o):o=e[12],o}const wC={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"}]},SC=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function fb(t){const e=z.c(65),{onDismiss:s}=t,{org:n}=Me(),i=It(),{decoKeyId:o}=E1(),l=Cs(),a=se(),[c,d]=V.useState(""),[u,h]=V.useState(!1),[f,m]=V.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Je("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]),V.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async q=>{const{url:ee}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:q,currency:f});return ee},e[3]=f,e[4]=l,e[5]=b):b=e[5];let v;e[6]!==s?(v=q=>{q&&window.open(q,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let y;e[8]!==a?(y=q=>{me.error(a("chat.creditsExhaustedBanner.topupError",{error:q.message}))},e[8]=a,e[9]=y):y=e[9];let _;e[10]!==b||e[11]!==v||e[12]!==y?(_={mutationFn:b,onSuccess:v,onError:y},e[10]=b,e[11]=v,e[12]=y,e[13]=_):_=e[13];const{mutate:L,isPending:w}=Rt(_),S=parseFloat(c),k=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=q=>!q&&s?.(),e[14]=s,e[15]=j):j=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=["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]=T):T=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:T.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=N):N=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=r.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]=C):C=e[18];let A;e[19]!==a?(A=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=A):A=e[20];let P;e[21]!==A?(P=r.jsx(At,{className:"text-xl font-semibold tracking-tight",children:A}),e[21]=A,e[22]=P):P=e[22];let R;e[23]!==a?(R=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=R):R=e[24];let E;e[25]!==R?(E=r.jsx(_n,{className:"mt-1.5 text-sm leading-relaxed",children:R}),e[25]=R,e[26]=E):E=e[26];let M;e[27]!==P||e[28]!==E?(M=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,r.jsxs(os,{className:"relative gap-4",children:[C,r.jsxs("div",{children:[P,E]})]})]}),e[27]=P,e[28]=E,e[29]=M):M=e[29];let I;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==o||e[35]!==k||e[36]!==w||e[37]!==u||e[38]!==a||e[39]!==L?(I=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(T1,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:q=>{q&&m(q)},children:[r.jsx(xc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(xc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsxs("div",{className:"rounded-xl border border-border p-5",children:[r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:wC[f].map(q=>{const{dollars:ee,labelKey:X}=q;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:ee*100,currency:f,tier_label:X,source:"exhausted_banner"}),L(ee*100)},className:ie("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:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,ee]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:a(X)})]},ee)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(rt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:q=>d(q.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(ae,{className:"h-10",disabled:!k||w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),L(Math.round(S*100))},children:a(w?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):r.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")})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:SC.map(q=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:r.jsx(Ut,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:a(q)})]},q))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=S,e[34]=o,e[35]=k,e[36]=w,e[37]=u,e[38]=a,e[39]=L,e[40]=I):I=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let O;e[43]!==s||e[44]!==$?(O=r.jsx(ae,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=O):O=e[45];let D;e[46]!==i||e[47]!==s||e[48]!==n.slug?(D=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=D):D=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]!==D||e[53]!==B?(F=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:D,children:B}),e[52]=D,e[53]=B,e[54]=F):F=e[54];let U;e[55]!==O||e[56]!==F?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[O,F]}),e[55]=O,e[56]=F,e[57]=U):U=e[57];let H;e[58]!==M||e[59]!==I||e[60]!==U?(H=r.jsxs(jt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:kC,children:[M,I,U]}),e[58]=M,e[59]=I,e[60]=U,e[61]=H):H=e[61];let W;return e[62]!==H||e[63]!==j?(W=r.jsx(Ct,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=W):W=e[64],W}function kC(t){return t.preventDefault()}const jC={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 CC(t){const e=z.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=se(),{label:l,title:a}=jC[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Jr,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==o?(d=o(l),e[1]=l,e[2]=o,e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==a?(u=o(a),e[4]=o,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==o?(h=s==="trial_exhausted"?r.jsx(ae,{size:"sm",onClick:i,className:"h-7 text-xs",children:o("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=o,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=r.jsx(Hr,{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 NC(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),o=/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}:o?{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 VC={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function ju(t){const e=z.c(29),s=se(),{variant:n,onDismiss:i}=t,o=n==="error";let l;e[0]!==o||e[1]!==s?(l=s(o?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=o,e[1]=s,e[2]=l):l=e[2];const a=l,c=o?fn:Do;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 v=VC[t.finishReason];return v?s(v):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]!==o||e[9]!==u?(h=o?NC(u):{summary:u,rawDetails:null},e[8]=o,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;let p;e[11]!==c?(p=r.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==o||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=o?r.jsx(ae,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(ae,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=o,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?r.jsxs("details",{className:"group mx-4",children:[r.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:[r.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:r.jsx("path",{d:"m4.5 3 3 3-3 3"})}),r.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),r.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>me.success(s("chat.highlight.copiedToClipboard"))).catch(()=>me.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:r.jsx(on,{className:"size-3.5"})}),r.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=r.jsx(Hr,{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 N0(){const t=z.c(73),e=se(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=qn(),[u,h]=mr(),{virtualMcpId:f,createTaskWithMessage:m}=Qs(),{chatMode:p,simpleModeTier:g}=Gr(),{mutate:x}=w5("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let y;t[2]!==p||t[3]!==g||t[4]!==f?(y=ne=>({tier:g,mode:p,toolApprovalLevel:ne,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=y):y=t[5];const _=y;let L;t[6]!==u.toolApprovalLevel?(L=u.toolApprovalLevel??dL(),t[6]=u.toolApprovalLevel,t[7]=L):L=t[7];const w=L,S=l.at(-1),k=S?.role==="assistant"?S.parts:[],j=k.filter(PC),T=Z5(k),N=X5(k);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(re)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const A=C;let P;t[12]!==d||t[13]!==e?(P=()=>{const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(ne)},t[12]=d,t[13]=e,t[14]=P):P=t[14];const R=P;let E;t[15]!==_||t[16]!==w||t[17]!==c?(E=(ne,re)=>{c({kind:"toolOutput",toolCallId:ne.toolCallId,output:{response:re}},_(w))},t[15]=_,t[16]=w,t[17]=c,t[18]=E):E=t[18];const M=E;let I;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(I=ne=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:ne})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=I):I=t[24];const $=I,O=AC;let D;t[25]!==_||t[26]!==c?(D=(ne,re,he,pe)=>{c({kind:"approval",approvalId:ne,approved:re,...he?{reason:he}:{}},_(pe))},t[25]=_,t[26]=c,t[27]=D):D=t[27];const B=D,F=tb();if(F.isCreditExhausted){let ne;return t[28]!==n?(ne=r.jsx(fb,{onDismiss:n}),t[28]=n,t[29]=ne):ne=t[29],ne}const{showError:U,showWarning:H,hasApprovals:W}=F,q=j.map(EC).join("|"),ee=J5(T)?.toolCallId??"",X=N.map(TC).join("|");let Y;t[30]!==F.todos?(Y=r.jsx(bC,{todos:F.todos}),t[30]=F.todos,t[31]=Y):Y=t[31];let G;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==v?(G=F.subscriptionErrorKind&&r.jsx(CC,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=v,t[35]=G):G=t[35];let J;t[36]!==n||t[37]!==s||t[38]!==A||t[39]!==U?(J=U&&r.jsx(ju,{variant:"error",error:s,onDismiss:n,onFixInChat:A}),t[36]=n,t[37]=s,t[38]=A,t[39]=U,t[40]=J):J=t[40];let oe;t[41]!==o||t[42]!==i||t[43]!==R||t[44]!==H?(oe=H&&r.jsx(ju,{variant:"warning",finishReason:i,onDismiss:o,onContinue:R}),t[41]=o,t[42]=i,t[43]=R,t[44]=H,t[45]=oe):oe=t[45];let le;t[46]!==X||t[47]!==B||t[48]!==W||t[49]!==a||t[50]!==N?(le=W&&r.jsx(eC,{approvals:N,isStreaming:a,onRespond:B},X),t[46]=X,t[47]=B,t[48]=W,t[49]=a,t[50]=N,t[51]=le):le=t[51];let Q;t[52]!==F.hasPlans||t[53]!==$||t[54]!==O||t[55]!==a||t[56]!==T||t[57]!==ee?(Q=F.hasPlans&&r.jsx(sC,{plans:T,isStreaming:a,onApprove:$,onDismiss:O},ee),t[52]=F.hasPlans,t[53]=$,t[54]=O,t[55]=a,t[56]=T,t[57]=ee,t[58]=Q):Q=t[58];let K;t[59]!==F.isWaitingForUserInput||t[60]!==M||t[61]!==a||t[62]!==q||t[63]!==j?(K=F.isWaitingForUserInput&&r.jsx(hb,{userAskParts:j,isStreaming:a,onSubmit:M},q),t[59]=F.isWaitingForUserInput,t[60]=M,t[61]=a,t[62]=q,t[63]=j,t[64]=K):K=t[64];let te;return t[65]!==J||t[66]!==oe||t[67]!==le||t[68]!==Q||t[69]!==K||t[70]!==Y||t[71]!==G?(te=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[Y,G,J,oe,le,Q,K]}),t[65]=J,t[66]=oe,t[67]=le,t[68]=Q,t[69]=K,t[70]=Y,t[71]=G,t[72]=te):te=t[72],te}function TC(t){return t.approvalId}function EC(t){return t.toolCallId}function AC(){document.querySelector("[data-chat-input]")?.focus()}function PC(t){return t.type==="tool-user_ask"}N0.Error=function(e){return r.jsx(ju,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};N0.Warning=function(e){return r.jsx(ju,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};N0.UserAskQuestion=hb;function RC(t){const e=z.c(20),{taskId:s}=t,n=se(),i=V4(s),o=PL(i),l=RL(),{stop:a,removeLocalMessage:c}=qn();if(o.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=r.jsx(o0,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=r.jsx(We,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{side:"top",children:r.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=r.jsxs(Ge,{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,v)=>r.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[r.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:v+1}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover/queuerow:opacity-100",children:r.jsx(ae,{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(y=>{y&&(DL(s,b.messageId),c(b.messageId))})},children:r.jsx(ti,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],r.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[r.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:[r.jsx("span",{children:n(o.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:o.length})}),g]}),o.map(x)]})}function DC(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 IC={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function MC(t){const e=z.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=se(),u=y0(),h=new Set(u.map($C)),f=IL([i,n,o],h),m=f?.keyId??null,[p,g]=V.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,v="flex h-[70vh] max-h-[460px] w-full flex-col",y=IC[s];let _;e[0]!==d||e[1]!==y?(_=d(y),e[0]=d,e[1]=y,e[2]=_):_=e[2];let L;e[3]!==_?(L=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:_}),e[3]=_,e[4]=L):L=e[4];let w;e[5]!==a||e[6]!==d||e[7]!==i?(w=i&&r.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]=w):w=e[8];let S;e[9]!==L||e[10]!==w?(S=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[L,w]}),e[9]=L,e[10]=w,e[11]=S):S=e[11];const k="flex-1 min-h-0",j=V.Suspense;let T;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(rk,{}),e[12]=T):T=e[12];const N=ik,C=!0,A=DC(m?f:null,b?.providerId??"deco");let P;e[13]!==x||e[14]!==l||e[15]!==g?(P=I=>{const $=I.keyId??x??"";g($),l({keyId:$,modelId:I.modelId,title:I.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=P):P=e[16];let R;e[17]!==N||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==A||e[22]!==P?(R=r.jsx(N,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:A,onModelChange:P}),e[17]=N,e[18]=x,e[19]=c,e[20]=g,e[21]=A,e[22]=P,e[23]=R):R=e[23];let E;e[24]!==j||e[25]!==R||e[26]!==T?(E=r.jsx("div",{className:k,children:r.jsx(j,{fallback:T,children:R})}),e[24]=j,e[25]=R,e[26]=T,e[27]=E):E=e[27];let M;return e[28]!==E||e[29]!==S?(M=r.jsxs("div",{className:v,children:[S,E]}),e[28]=E,e[29]=S,e[30]=M):M=e[30],M}function $C(t){return t.id}const OC=["fast","smart","thinking"];function mb(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const BC={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function zC(t){const e=z.c(28),{tier:s,pillIcon:n,groups:i}=t,o=se();let l;e[0]!==o?(l=mb(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=V.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=ie("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=ie("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=r.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=r.jsx(fs,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=r.jsx(We,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(us,{asChild:!0,children:r.jsxs(ae,{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]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(qe,{children:f}),e[12]=f,e[13]=y):y=e[13];let _;e[14]!==v||e[15]!==y?(_=r.jsxs(Ge,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=_):_=e[16];let L;if(e[17]!==i||e[18]!==o){let k;e[20]!==o?(k=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(T=>r.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[r.jsxs("button",{type:"button",role:"menuitem","aria-label":T.title,onClick:()=>h(T),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",T.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[T.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:T.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:T.title}),T.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle})]}),T.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(Ut,{size:14,className:"text-foreground mt-0.5"})})]}),T.modelOverride&&r.jsx(UC,{label:T.title,render:T.modelOverride})]},T.key))},j.key),e[20]=o,e[21]=k):k=e[21],L=i.map(k),e[17]=i,e[18]=o,e[19]=L}else L=e[19];let w;e[22]!==L?(w=r.jsx(ys,{align:"end",className:"p-1 w-64",onOpenAutoFocus:FC,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:L})}),e[22]=L,e[23]=w):w=e[23];let S;return e[24]!==c||e[25]!==_||e[26]!==w?(S=r.jsxs(_s,{open:c,onOpenChange:d,children:[_,w]}),e[24]=c,e[25]=_,e[26]=w,e[27]=S):S=e[27],S}function FC(t){return t.preventDefault()}function UC(t){const e=z.c(38),{label:s,render:n}=t,i=se(),o=Xr(),[l,a]=V.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=ie("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=r.jsx(f1,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=r.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(o){let _;e[10]!==g?(_=r.jsx(H4,{asChild:!0,children:g}),e[10]=g,e[11]=_):_=e[11];let L;e[12]!==s||e[13]!==i?(L=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=L):L=e[14];let w;e[15]!==L?(w=r.jsx(u0,{className:"sr-only",children:L}),e[15]=L,e[16]=w):w=e[16];let S;e[17]!==l||e[18]!==n?(S=l&&n(d),e[17]=l,e[18]=n,e[19]=S):S=e[19];let k;e[20]!==S||e[21]!==w?(k=r.jsxs(h0,{className:"p-0 flex flex-col max-h-[95vh]",children:[w,S]}),e[20]=S,e[21]=w,e[22]=k):k=e[22];let j;return e[23]!==l||e[24]!==k||e[25]!==_?(j=r.jsxs(f0,{open:l,onOpenChange:a,children:[_,k]}),e[23]=l,e[24]=k,e[25]=_,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(us,{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 v;e[32]!==b?(v=r.jsx(ys,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let y;return e[34]!==l||e[35]!==x||e[36]!==v?(y=r.jsxs(_s,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=y):y=e[37],y}function i2(t){return t==="fast"?r.jsx(Jr,{size:16}):t==="thinking"?r.jsx(r5,{size:16}):r.jsx(cr,{size:16})}function KC(t){const e=z.c(13),s=OL();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 o;e[3]!==i?(o=i("fast"),e[3]=i,e[4]=o):o=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]!==o||e[10]!==l||e[11]!==a?(c={fast:o,smart:l,thinking:a},e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function HC(){const t=z.c(22),e=se(),{simpleModeTier:s,setSimpleModeTier:n}=Gr(),i=dk(),o=y0(),l=uk(o),a=KC(l),{data:c,error:d}=ML();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=$L();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 y=mb(e);m="decopilot",p=OC.map(_=>{const L=a[_],w=h.tiers[_];return{key:`decopilot-${_}`,icon:i2(_),title:y[_],subtitle:L??e(BC[_]),active:s===_,onSelect:()=>n(_),modelOverride:S=>r.jsxs(r.Fragment,{children:[d&&r.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),r.jsx(MC,{tier:_,orgSlot:i.tiers[_],userSlot:w,autoSlot:l.chat[_],onClose:S,onPick:k=>f.mutate({tier:_,slot:k}),onReset:()=>f.mutate({tier:_,slot:null})},`${_}:${w?.keyId??"org"}:${w?.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=i2(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=r.jsx(zC,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function W1(t,e,s,n,i,o){if(!v0(e)){me.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!ok(l,e)){const c=S5(e).parts.map(u=>o(u)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):me.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){me.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};YL(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),me.error(`Failed to load file "${s.name}"`)}}function WC(t){const e=z.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=se(),l=V.useRef(GC);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(h,f)=>{await W1(s,n,h,f,i,o)}},c=[s,n,i,o],e[0]=s,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=c):(a=e[4],c=e[5]),V.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new hr("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new d0({key:h,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const y=p.posAtCoords({left:g.clientX,top:g.clientY});if(!y)return!1;const _=Array.from(v);return(async()=>{let L=y.pos;for(const w of _)await l.current?.(w,L),L=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(qC);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const y of b){const _=y.getAsFile();_&&(await l.current?.(_,v),v=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]),V.useEffect(d,u),null}function qC(t){return t.kind==="file"}function GC(){return Promise.resolve()}function YC(t){const e=z.c(43),{info:s,onClose:n}=t,i=se(),o=s!==null;let l;e[0]!==n?(l=C=>!C&&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=r.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=r.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:r.jsx(Do,{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=r.jsx(At,{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=r.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=r.jsxs(_n,{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=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(os,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==i||e[20]!==b?(v=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==v?(y=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=y):y=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(o5,{size:14,className:"text-muted-foreground"}),e[24]=_):_=e[24];const L=s?.accepted;let w;e[25]!==L?(w=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[_,r.jsx("span",{className:"capitalize",children:L})]}),e[25]=L,e[26]=w):w=e[26];let S;e[27]!==y||e[28]!==w?(S=r.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:r.jsxs("div",{className:"rounded-xl border border-border p-4",children:[y,w]})}),e[27]=y,e[28]=w,e[29]=S):S=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=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(ae,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let T;e[35]!==x||e[36]!==S||e[37]!==j?(T=r.jsxs(jt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:QC,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=T):T=e[38];let N;return e[39]!==o||e[40]!==l||e[41]!==T?(N=r.jsx(Ct,{open:o,onOpenChange:l,children:T}),e[39]=o,e[40]=l,e[41]=T,e[42]=N):N=e[42],N}function QC(t){return t.preventDefault()}function XC(){const t=z.c(3),[e,s]=V.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 pb=QL;var JC=["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] *)"],jh=JC.join(","),gb=typeof Element>"u",Vc=gb?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Cu=!gb&&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},Nu=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"),o=i===""||i==="true",l=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Nu(e.parentNode));return l},ZC=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},eN=function(e,s,n){if(Nu(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(jh));return s&&Vc.call(e,jh)&&i.unshift(e),i=i.filter(n),i},Ch=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!Nu(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=Ch(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=Vc.call(l,jh);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!Nu(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=Ch(h===!0?l.children:h.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else o.unshift.apply(o,l.children)}}return i},xb=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},bb=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||ZC(e))&&!xb(e)?0:e.tabIndex},tN=function(e,s){var n=bb(e);return n<0&&s&&!xb(e)?0:n},sN=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},vb=function(e){return e.tagName==="INPUT"},nN=function(e){return vb(e)&&e.type==="hidden"},iN=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},rN=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},oN=function(e){if(!e.name)return!0;var s=e.form||Cu(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 o=rN(i,e.form);return!o||o===e},lN=function(e){return vb(e)&&e.type==="radio"},aN=function(e){return lN(e)&&!oN(e)},cN=function(e){var s,n=e&&Cu(e),i=(s=n)===null||s===void 0?void 0:s.host,o=!1;if(n&&n!==e){var l,a,c;for(o=!!((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));!o&&i;){var d,u,h;n=Cu(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return o},r2=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},dN=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Vc.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Vc.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=Cu(e);if(d&&!d.shadowRoot&&i(d)===!0)return r2(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(cN(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return r2(e);return!1},uN=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 Vc.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},hN=function(e,s){return!(s.disabled||nN(s)||dN(s,e)||iN(s)||uN(s))},o2=function(e,s){return!(aN(s)||bb(s)<0||!hN(e,s))},fN=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},yb=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=tN(a,l),d=l?yb(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:o,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(sN).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},_b=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Ch([e],s.includeContainer,{filter:o2.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:fN}):n=eN(e,s.includeContainer,o2.bind(null,s)),yb(n)};function mN(){return/apple/i.test(navigator.vendor)}const l2="data-floating-ui-focusable";function pN(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 Nh(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&uL(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function fa(t){return"composedPath"in t?t.composedPath()[0]:t.target}function y9(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 gN(t){return t.matches("html,body")}function Tc(t){return t?.ownerDocument||document}function xN(t){return t?t.hasAttribute(l2)?t:t.querySelector("["+l2+"]")||t:null}function ou(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var o;return i.parentId===e&&(!s||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...ou(t,i.id,s)])}function bN(t){return"nativeEvent"in t}var vN=typeof document<"u",yN=function(){},xo=vN?V.useLayoutEffect:yN;const _N={...f4},LN=_N.useInsertionEffect,wN=LN||(t=>t());function pl(t){const e=V.useRef(()=>{});return wN(()=>{e.current=t}),V.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 Lb=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function wb(t,e){const s=_b(t,Lb()),n=s.length;if(n===0)return;const i=pN(Tc(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function SN(t){return wb(Tc(t).body,1)||t}function kN(t){return wb(Tc(t).body,-1)||t}function _9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Nh(s,n)}function jN(t){_b(t,Lb()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function a2(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 CN="data-floating-ui-focusable",c2="active",d2="selected",NN={...f4};let u2=!1,VN=0;const h2=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+VN++;function TN(){const[t,e]=V.useState(()=>u2?h2():void 0);return xo(()=>{t==null&&e(h2())},[]),V.useEffect(()=>{u2=!0},[]),t}const EN=NN.useId,q1=EN||TN;function AN(){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 PN=V.createContext(null),RN=V.createContext(null),Sb=()=>{var t;return((t=V.useContext(PN))==null?void 0:t.id)||null},kb=()=>V.useContext(RN);function G1(t){return"data-floating-ui-"+t}const DN={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},f2=V.forwardRef(function(e,s){const[n,i]=V.useState();xo(()=>{mN()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[G1("focus-guard")]:"",style:DN};return r.jsx("span",{...e,...o})}),IN={clipPath:"inset(50%)",position:"fixed",top:0,left:0},jb=V.createContext(null),m2=G1("portal");function MN(t){t===void 0&&(t={});const{id:e,root:s}=t,n=q1(),i=ON(),[o,l]=V.useState(null),a=V.useRef(null);return xo(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),xo(()=>{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(m2,""),c.appendChild(d),a.current=d,l(d)},[e,n]),xo(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!xL(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(m2,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),o}function $N(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=MN({id:s,root:n}),[l,a]=V.useState(null),c=V.useRef(null),d=V.useRef(null),u=V.useRef(null),h=V.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return V.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&_9(x)&&(x.type==="focusin"?a2:jN)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,i,f]),V.useEffect(()=>{o&&(m||a2(o))},[m,o]),r.jsxs(jb.Provider,{value:V.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(f2,{"data-type":"outside",ref:c,onFocus:g=>{if(_9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=kN(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:IN}),o&&bn.createPortal(e,o),p&&o&&r.jsx(f2,{"data-type":"outside",ref:d,onFocus:g=>{if(_9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=SN(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const ON=()=>V.useContext(jb),BN={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},zN={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},p2=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 FN(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:o}=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=kb(),x=pl(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=V.useRef(!1),{escapeKey:y,outsidePress:_}=p2(m),{escapeKey:L,outsidePress:w}=p2(p),S=V.useRef(!1),k=pl(P=>{var R;if(!s||!l||!a||P.key!=="Escape"||S.current)return;const E=(R=o.current.floatingContext)==null?void 0:R.nodeId,M=g?ou(g.nodesRef.current,E):[];if(!y&&(P.stopPropagation(),M.length>0)){let I=!0;if(M.forEach($=>{var O;if((O=$.context)!=null&&O.open&&!$.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}n(!1,bN(P)?P.nativeEvent:P,"escape-key")}),j=pl(P=>{var R;const E=()=>{var M;k(P),(M=fa(P))==null||M.removeEventListener("keydown",E)};(R=fa(P))==null||R.addEventListener("keydown",E)}),T=pl(P=>{var R;const E=o.current.insideReactTree;o.current.insideReactTree=!1;const M=v.current;if(v.current=!1,d==="click"&&M||E||typeof b=="function"&&!b(P))return;const I=fa(P),$="["+G1("inert")+"]",O=Tc(i.floating).querySelectorAll($);let D=vi(I)?I:null;for(;D&&!g9(D);){const H=mL(D);if(g9(H)||!vi(H))break;D=H}if(O.length&&vi(I)&&!gN(I)&&!Nh(I,i.floating)&&Array.from(O).every(H=>!Nh(D,H)))return;if(pL(I)&&A){const H=g9(I),W=gL(I),q=/auto|scroll/,ee=H||q.test(W.overflowX),X=H||q.test(W.overflowY),Y=ee&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,G=X&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,J=W.direction==="rtl",oe=G&&(J?P.offsetX<=I.offsetWidth-I.clientWidth:P.offsetX>I.clientWidth),le=Y&&P.offsetY>I.clientHeight;if(oe||le)return}const B=(R=o.current.floatingContext)==null?void 0:R.nodeId,F=g&&ou(g.nodesRef.current,B).some(H=>{var W;return y9(P,(W=H.context)==null?void 0:W.elements.floating)});if(y9(P,i.floating)||y9(P,i.domReference)||F)return;const U=g?ou(g.nodesRef.current,B):[];if(U.length>0){let H=!0;if(U.forEach(W=>{var q;if((q=W.context)!=null&&q.open&&!W.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,P,"outside-press")}),N=pl(P=>{var R;const E=()=>{var M;T(P),(M=fa(P))==null||M.removeEventListener(d,E)};(R=fa(P))==null||R.addEventListener(d,E)});V.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=y,o.current.__outsidePressBubbles=_;let P=-1;function R(O){n(!1,O,"ancestor-scroll")}function E(){window.clearTimeout(P),S.current=!0}function M(){P=window.setTimeout(()=>{S.current=!1},fL()?5:0)}const I=Tc(i.floating);a&&(I.addEventListener("keydown",L?j:k,L),I.addEventListener("compositionstart",E),I.addEventListener("compositionend",M)),b&&I.addEventListener(d,w?N:T,w);let $=[];return f&&(vi(i.domReference)&&($=p9(i.domReference)),vi(i.floating)&&($=$.concat(p9(i.floating))),!vi(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(p9(i.reference.contextElement)))),$=$.filter(O=>{var D;return O!==((D=I.defaultView)==null?void 0:D.visualViewport)}),$.forEach(O=>{O.addEventListener("scroll",R,{passive:!0})}),()=>{a&&(I.removeEventListener("keydown",L?j:k,L),I.removeEventListener("compositionstart",E),I.removeEventListener("compositionend",M)),b&&I.removeEventListener(d,w?N:T,w),$.forEach(O=>{O.removeEventListener("scroll",R)}),window.clearTimeout(P)}},[o,i,a,b,d,s,n,f,l,y,_,k,L,j,T,w,N]),V.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const C=V.useMemo(()=>({onKeyDown:k,...u&&{[BN[h]]:P=>{n(!1,P.nativeEvent,"reference-press")},...h!=="click"&&{onClick(P){n(!1,P.nativeEvent,"reference-press")}}}}),[k,n,u,h]),A=V.useMemo(()=>{function P(R){R.button===0&&(v.current=!0)}return{onKeyDown:k,onMouseDown:P,onMouseUp:P,[zN[d]]:()=>{o.current.insideReactTree=!0}}},[k,d,o]);return V.useMemo(()=>l?{reference:C,floating:A}:{},[l,C,A])}function UN(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=q1(),o=V.useRef({}),[l]=V.useState(()=>AN()),a=Sb()!=null,[c,d]=V.useState(n.reference),u=pl((m,p,g)=>{o.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),h=V.useMemo(()=>({setPositionReference:d}),[]),f=V.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return V.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function KN(t){t===void 0&&(t={});const{nodeId:e}=t,s=UN({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=V.useState(null),[a,c]=V.useState(null),u=i?.domReference||o,h=V.useRef(null),f=kb();xo(()=>{u&&(h.current=u)},[u]);const m=hL({...t,elements:{...i,...a&&{reference:a}}}),p=V.useCallback(y=>{const _=vi(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),getClientRects:()=>y.getClientRects(),contextElement:y}:y;c(_),m.refs.setReference(_)},[m.refs]),g=V.useCallback(y=>{(vi(y)||y===null)&&(h.current=y,l(y)),(vi(m.refs.reference.current)||m.refs.reference.current===null||y!==null&&!vi(y))&&m.refs.setReference(y)},[m.refs]),x=V.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=V.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=V.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return xo(()=>{n.dataRef.current.floatingContext=v;const y=f?.nodesRef.current.find(_=>_.id===e);y&&(y.context=v)}),V.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function L9(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[c2]:l,[d2]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[CN]:""},...o,...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&&[c2,d2].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 HN(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=V.useCallback(a=>L9(a,t,"reference"),e),o=V.useCallback(a=>L9(a,t,"floating"),s),l=V.useCallback(a=>L9(a,t,"item"),n);return V.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const WN=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function qN(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:o,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=q1(),u=((s=o.domReference)==null?void 0:s.id)||d,h=V.useMemo(()=>{var v;return((v=xN(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=WN.get(c))!=null?n:c,p=Sb()!=null,g=V.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=V.useMemo(()=>{const v={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=V.useCallback(v=>{let{active:y,selected:_}=v;const L={role:"option",...y&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...L,"aria-selected":_}}return{}},[h,c]);return V.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function GN(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=ZL(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?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),v=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!v)return null;const y=g+x.index;let _=y+x[0].length;return c&&u.test(p.slice(_-1,_+1))&&(x[0]+=" ",_+=1),y<a.pos&&_>=a.pos?{range:{from:y,to:_},query:x[0].slice(s.length),text:x[0]}:null}var YN=new hr("suggestion");function QN({pluginKey:t=YN,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=GN,shouldShow:x}){let b;const v=m?.(),y=()=>{const S=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(S),{top:j,right:T,bottom:N,left:C}=k;try{return new DOMRect(C,j,T-C,N-j)}catch{return null}},_=(S,k)=>k?()=>{const j=t.getState(e.state),T=j?.decorationId,N=S.dom.querySelector(`[data-decoration-id="${T}"]`);return N?.getBoundingClientRect()||null}:y;function L(S,k){var j;try{const N=t.getState(S.state),C=N?.decorationId?S.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,A={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:P=>h({editor:e,range:N?.range||{from:0,to:0},props:P}),decorationNode:C,clientRect:_(S,C)};(j=v?.onExit)==null||j.call(v,A)}catch{}const T=S.state.tr.setMeta(k,{exit:!0});S.dispatch(T)}const w=new d0({key:t,view(){return{update:async(S,k)=>{var j,T,N,C,A,P,R;const E=(j=this.key)==null?void 0:j.getState(k),M=(T=this.key)==null?void 0:T.getState(S.state),I=E.active&&M.active&&E.range.from!==M.range.from,$=!E.active&&M.active,O=E.active&&!M.active,D=!$&&!O&&E.query!==M.query,B=$||I&&D,F=D||I,U=O||I&&D;if(!B&&!F&&!U)return;const H=U&&!B?E:M,W=S.dom.querySelector(`[data-decoration-id="${H.decorationId}"]`);b={editor:e,range:H.range,query:H.query,text:H.text,items:[],command:q=>h({editor:e,range:H.range,props:q}),decorationNode:W,clientRect:_(S,W)},B&&((N=v?.onBeforeStart)==null||N.call(v,b)),F&&((C=v?.onBeforeUpdate)==null||C.call(v,b)),(F||B)&&(b.items=await f({editor:e,query:H.query})),U&&((A=v?.onExit)==null||A.call(v,b)),F&&((P=v?.onUpdate)==null||P.call(v,b)),B&&((R=v?.onStart)==null||R.call(v,b))},destroy:()=>{var S;b&&((S=v?.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,k,j,T){const{isEditable:N}=e,{composing:C}=e.view,{selection:A}=S,{empty:P,from:R}=A,E={...k},M=S.getMeta(t);if(M&&M.exit)return E.active=!1,E.decorationId=null,E.range={from:0,to:0},E.query=null,E.text=null,E;if(E.composing=C,N&&(P||e.view.composing)){(R<k.range.from||R>k.range.to)&&!C&&!k.composing&&(E.active=!1);const I=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:A.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;I&&p({editor:e,state:T,range:I.range,isActive:k.active})&&(!x||x({editor:e,range:I.range,query:I.query,text:I.text,transaction:S}))?(E.active=!0,E.decorationId=k.decorationId?k.decorationId:$,E.range=I.range,E.query=I.query,E.text=I.text):E.active=!1}else E.active=!1;return E.active||(E.decorationId=null,E.range={from:0,to:0},E.query=null,E.text=null),E}},props:{handleKeyDown(S,k){var j,T,N,C;const{active:A,range:P}=w.getState(S.state);if(!A)return!1;if(k.key==="Escape"||k.key==="Esc"){const E=w.getState(S.state),M=(j=b?.decorationNode)!=null?j:null,I=M??(E?.decorationId?S.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`):null);if(((T=v?.onKeyDown)==null?void 0:T.call(v,{view:S,event:k,range:E.range}))||!1)return!0;const O={editor:e,range:E.range,query:E.query,text:E.text,items:[],command:D=>h({editor:e,range:E.range,props:D}),decorationNode:I,clientRect:I?()=>I.getBoundingClientRect()||null:null};return(N=v?.onExit)==null||N.call(v,O),L(S,t),!0}return((C=v?.onKeyDown)==null?void 0:C.call(v,{view:S,event:k,range:P}))||!1},decorations(S){const{active:k,range:j,decorationId:T,query:N}=w.getState(S);if(!k)return null;const C=!N?.length,A=[c];return C&&A.push(u),XL.create(S.doc,[JL.inline(j.from,j.to,{nodeName:a,class:A.join(" "),"data-decoration-id":T,"data-decoration-content":d})])}}});return w}function XN(t){const e=z.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=V.useState(0),d=V.useRef(i),u=V.useRef(a),h=V.useRef(o),f=V.useRef(l),m=V.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],V.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]),V.useEffect(x,b);let v,y;e[7]!==i?(v=()=>{d.current=i},y=[i],e[7]=i,e[8]=v,e[9]=y):(v=e[8],y=e[9]),V.useEffect(v,y);let _,L;e[10]!==a?(_=()=>{u.current=a},L=[a],e[10]=a,e[11]=_,e[12]=L):(_=e[11],L=e[12]),V.useEffect(_,L);let w,S;e[13]!==o?(S=()=>{h.current=o},w=[o],e[13]=o,e[14]=w,e[15]=S):(w=e[14],S=e[15]),V.useEffect(S,w);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]),V.useEffect(k,j);let T,N;e[19]!==s?(T=()=>{if(s?.isDestroyed)return;let P;try{P=s.view.dom}catch{return}if(!P)return;const R=M=>{const I=d.current;if(!I.length)return!1;const $=()=>c(D=>(D+1)%I.length),O=()=>c(D=>(D-1+I.length)%I.length);switch(M.key){case"ArrowUp":return M.preventDefault(),O(),!0;case"ArrowDown":return M.preventDefault(),$(),!0;case"Tab":return M.preventDefault(),M.shiftKey?O():$(),!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 D=u.current;return D!==-1&&I[D]&&h.current?.(I[D],D),!0}case"Escape":return M.preventDefault(),f.current?.(),!0;default:return!1}},E=M=>{R(M)};return P.addEventListener("keydown",E,!0),()=>{P?.removeEventListener("keydown",E,!0)}},N=[s],e[19]=s,e[20]=T,e[21]=N):(T=e[20],N=e[21]),V.useEffect(T,N);const C=i.length?a:void 0;let A;return e[22]!==C?(A={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=A):A=e[23],A}function JN(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 Cb=V.createContext(void 0);function Nb(){const t=V.useContext(Cb);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function ZN(t){const e=z.c(16),{editor:s,char:n,pluginKey:i,allow:o,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]=V.useReducer(JN,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=V.useEffectEvent(u);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof hr?i:new hr(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=QN({pluginKey:g,editor:s,char:n,allow(v){const y=s.state.doc.resolve(v.range.from);for(let _=y.depth;_>0;_--)if(y.node(_).type.name==="image")return!1;return!(o&&!o(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),h(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),h(!1)}}),items:eV});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=h,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==o||e[11]!==s||e[12]!==i?(m=[s,i,n,d,o],e[9]=n,e[10]=o,e[11]=s,e[12]=i,e[13]=m):m=e[13],V.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 eV(){return[]}function tV({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=Nb(),l=V.useDeferredValue(i.query),{data:a}=e1({queryKey:Fe.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){o({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?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=XN({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function sV({children:t}){const{state:e,dispatch:s}=Nb(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=KN({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[bL(10),vL(),yL()],whileElementsMounted:_L}),d=FN(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=qN(c,{role:"listbox"}),{getFloatingProps:h}=HN([d,u]);return n?r.jsx($N,{children:r.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 nV=t=>{const e=z.c(29),{item:s,isSelected:n,onSelect:i,isLoading:o,ref:l}=t;let a;if(e[0]!==s){const w=Ni(s._meta);a=s.title||s1(s.name,w),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=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=ie("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&&r.jsx(zr,{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=r.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]!==o?(x=o&&r.jsx(_o,{size:"xs"}),e[10]=o,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=r.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 v;e[15]!==d?(v=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let y;e[17]!==b||e[18]!==v?(y=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=y):y=e[19];let _;e[20]!==s.drillable?(_=s.drillable&&r.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]=_):_=e[21];let L;return e[22]!==i||e[23]!==l||e[24]!==y||e[25]!==_||e[26]!==m||e[27]!==p?(L=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,y,_]}),e[22]=i,e[23]=l,e[24]=y,e[25]=_,e[26]=m,e[27]=p,e[28]=L):L=e[28],L},iV=t=>{const e=z.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=se();let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:o},e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:h}=tV(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=r.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)=>r.jsx(nV,{item:x,isSelected:b===d,ref:b===d?lV: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=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:r.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function rV(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(oV)}),t[0]=e):e=t[0],e}function oV(t,e){return r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[r.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),r.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Vb(t){const e=z.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,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}=ZN(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=r.jsx(rV,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(sV,{children:r.jsx(V.Suspense,{fallback:p,children:r.jsx(iV,{editor:s,queryKey:o,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=o,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=r.jsx(Cb.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function lV(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const aV=t=>{const e=z.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=se(),l=Qt(),{org:a}=Me(),c=qc();let d;e[0]!==c?(d=D1(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=Pt(h);let m;e[6]!==a.id||e[7]!==n?(m=Fe.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=V.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=V.useEffectEvent(b),y=V.useRef(null),_=V.useRef(!1),L=n??"default";let w;e[11]!==g||e[12]!==a.id||e[13]!==L?(w=["at-mention",a.id,L,g],e[11]=g,e[12]=a.id,e[13]=L,e[14]=w):w=e[14];const S=w;let k;e[15]!==o?(k=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=k):k=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let T;e[19]!==k||e[20]!==j?(T={name:"agents",title:k,description:j,kind:"category",drillable:!0},e[19]=k,e[20]=j,e[21]=T):T=e[21];let N;e[22]!==o?(N=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=N):N=e[23];let C;e[24]!==o?(C=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=C):C=e[25];let A;e[26]!==N||e[27]!==C?(A={name:"resources",title:N,description:C,kind:"category",drillable:!0},e[26]=N,e[27]=C,e[28]=A):A=e[28];let P;e[29]!==A||e[30]!==T?(P=[T,A],e[29]=A,e[30]=T,e[31]=P):P=e[31];const R=P;let E;e[32]!==f||e[33]!==s||e[34]!==o?(E=async F=>{const{item:U,range:H}=F;if(Je("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(_.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){Al(s,H,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&f){try{const W=await m4(f,U.uri);Al(s,H,{id:U.uri,name:U.uri,metadata:W.contents,char:"@"})}catch(W){console.error("[at-mention] Failed to fetch resource:",W),me.error(o("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=o,e[35]=E):E=e[35];const M=E;let I;e[36]!==c||e[37]!==R||e[38]!==f||e[39]!==u||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(I=async F=>{const{query:U}=F,H=v();if(H==="categories"){if(!U.trim())return R;const ee=U.toLowerCase(),X=c.filter(G=>G.status==="active"&&(!G.id||!vu(G.id))&&!u.has(G.id)&&G.id!==n&&(G.title.toLowerCase().includes(ee)||G.description?.toLowerCase().includes(ee))).map(cV),Y=await(async()=>{if(!f)return[];let G=l.getQueryData(p);return G||(G=await l.fetchQuery({queryKey:p,queryFn:()=>Ga(f),staleTime:6e4})),(G?.resources??[]).filter(J=>J.uri.toLowerCase().includes(ee)||J.name?.toLowerCase().includes(ee)||J.description?.toLowerCase().includes(ee)).map(dV)})();return[...X,...Y]}if(H==="agents"){let ee=c.filter(X=>X.status==="active"&&(!X.id||!vu(X.id))&&!u.has(X.id)&&X.id!==n);if(U.trim()){const X=U.toLowerCase();ee=ee.filter(Y=>Y.title.toLowerCase().includes(X)||Y.description?.toLowerCase().includes(X))}return ee.map(uV)}if(!f)return[];let W=l.getQueryData(p);W?l.fetchQuery({queryKey:p,queryFn:()=>Ga(f),staleTime:6e4}).catch(hV):W=await l.fetchQuery({queryKey:p,queryFn:()=>Ga(f),staleTime:6e4});let q=W?.resources??[];if(U.trim()){const ee=U.toLowerCase();q=q.filter(X=>X.uri.toLowerCase().includes(ee)||X.name?.toLowerCase().includes(ee)||X.description?.toLowerCase().includes(ee))}return q.map(fV)},e[36]=c,e[37]=R,e[38]=f,e[39]=u,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=I):I=e[44];const $=I;let O;e[45]!==i?(O=F=>{if(i&&(i.current=F),F)y.current=Date.now(),_.current=!1,Je("chat_picker_opened",{picker:"@"});else{const U=y.current;Je("chat_picker_closed",{picker:"@",outcome:_.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),y.current=null,x("categories")}},e[45]=i,e[46]=O):O=e[46];const D=O;let B;return e[47]!==s||e[48]!==$||e[49]!==M||e[50]!==D||e[51]!==S?(B=r.jsx(Vb,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:S,queryFn:$,onSelect:M,onOpenChange:D}),e[47]=s,e[48]=$,e[49]=M,e[50]=D,e[51]=S,e[52]=B):B=e[52],B};function cV(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function dV(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function uV(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function hV(){}function fV(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function Y1(t){return t.contentHash??`${t.size}-${t.updatedAt}`}function An(t,e,s,n){const i=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(t)}/fs/${encodeURIComponent(e)}/${s}${i?`?${i}`:""}`}async function rn(t,e,s){const n=await fetch(t,e);if(n.ok||s?.allow404&&n.status===404)return n;let i="";try{i=(await n.json()).error??""}catch{}throw new Error(i||`HTTP ${n.status}`)}function Q1(t,e){const s=z.c(15),{org:n}=Me();let i;s[0]!==n.id||s[1]!==e||s[2]!==t?(i=Fe.orgFsList(n.id,t,e),s[0]=n.id,s[1]=e,s[2]=t,s[3]=i):i=s[3];let o;s[4]!==n.id||s[5]!==t?(o=(c,d)=>d?.queryKey[1]===n.id&&d.queryKey[2]===t?c:void 0,s[4]=n.id,s[5]=t,s[6]=o):o=s[6];let l;s[7]!==n.slug||s[8]!==e||s[9]!==t?(l=async()=>(await(await rn(An(n.slug,t,"list",{path:e}))).json()).entries.toSorted(mV),s[7]=n.slug,s[8]=e,s[9]=t,s[10]=l):l=s[10];let a;return s[11]!==i||s[12]!==o||s[13]!==l?(a={queryKey:i,placeholderData:o,queryFn:l},s[11]=i,s[12]=o,s[13]=l,s[14]=a):a=s[14],xt(a)}function mV(t,e){return t.kind!==e.kind?t.kind==="dir"?-1:1:t.path.localeCompare(e.path)}function X1(t,e,s){const n=z.c(15),{org:i}=Me();let o;n[0]!==i.id||n[1]!==e||n[2]!==t?(o=Fe.orgFsStat(i.id,t??"",e),n[0]=i.id,n[1]=e,n[2]=t,n[3]=o):o=n[3];const l=t!==null;let a;n[4]!==s?(a=s?.refetchIntervalWhenAbsent?u=>u.state.data?!1:s.refetchIntervalWhenAbsent??!1:void 0,n[4]=s,n[5]=a):a=n[5];let c;n[6]!==i.slug||n[7]!==e||n[8]!==t?(c=async()=>{const u=await rn(An(i.slug,t??"","stat",{path:e}),void 0,{allow404:!0});return u.status===404?null:(await u.json()).entry},n[6]=i.slug,n[7]=e,n[8]=t,n[9]=c):c=n[9];let d;return n[10]!==o||n[11]!==l||n[12]!==a||n[13]!==c?(d={queryKey:o,enabled:l,refetchInterval:a,queryFn:c},n[10]=o,n[11]=l,n[12]=a,n[13]=c,n[14]=d):d=n[14],xt(d)}function pV(t){const e=z.c(9),{org:s}=Me();let n;e[0]!==s.id||e[1]!==t?(n=Fe.orgFsUsage(s.id,t),e[0]=s.id,e[1]=t,e[2]=n):n=e[2];let i;e[3]!==s.slug||e[4]!==t?(i=async()=>await(await rn(An(s.slug,t,"usage"))).json(),e[3]=s.slug,e[4]=t,e[5]=i):i=e[5];let o;return e[6]!==n||e[7]!==i?(o={queryKey:n,queryFn:i},e[6]=n,e[7]=i,e[8]=o):o=e[8],xt(o)}function Tb(t,e){const s=z.c(9),n=t===void 0?60:t,{org:i}=Me();let o;s[0]!==i.id?(o=Fe.orgFsRecent(i.id),s[0]=i.id,s[1]=o):o=s[1];const l=e?.enabled;let a;s[2]!==n||s[3]!==i.slug?(a=async()=>(await(await rn(`/api/${encodeURIComponent(i.slug)}/fs/recent?limit=${n}`)).json()).entries,s[2]=n,s[3]=i.slug,s[4]=a):a=s[4];let c;return s[5]!==o||s[6]!==l||s[7]!==a?(c={queryKey:o,enabled:l,queryFn:a},s[5]=o,s[6]=l,s[7]=a,s[8]=c):c=s[8],xt(c)}const gV=50;function xV(t,e){const s=z.c(16),{org:n}=Me();let i;s[0]!==n.id||s[1]!==t||s[2]!==e?.prefix||s[3]!==e?.volume?(i=Fe.orgFsSearch(n.id,t,e?.volume??"",e?.prefix??""),s[0]=n.id,s[1]=t,s[2]=e?.prefix,s[3]=e?.volume,s[4]=i):i=s[4];const o=t.length>0;let l;s[5]!==n.id?(l=(d,u)=>u?.queryKey[1]===n.id?d:void 0,s[5]=n.id,s[6]=l):l=s[6];let a;s[7]!==n.slug||s[8]!==t||s[9]!==e?(a=async()=>{const d=new URLSearchParams({q:t,limit:String(gV)});return e&&(d.set("volume",e.volume),e.prefix&&d.set("prefix",e.prefix)),(await(await rn(`/api/${encodeURIComponent(n.slug)}/fs/search?${d}`)).json()).entries},s[7]=n.slug,s[8]=t,s[9]=e,s[10]=a):a=s[10];let c;return s[11]!==i||s[12]!==o||s[13]!==l||s[14]!==a?(c={queryKey:i,enabled:o,placeholderData:l,queryFn:a},s[11]=i,s[12]=o,s[13]=l,s[14]=a,s[15]=c):c=s[15],xt(c)}function bV(t){const e=z.c(8),{org:s}=Me();let n;e[0]!==s.id?(n=Fe.orgFsSkills(s.id),e[0]=s.id,e[1]=n):n=e[1];const i=t?.enabled;let o;e[2]!==s.slug?(o=async()=>{const a=await rn(`/api/${encodeURIComponent(s.slug)}/fs/skills`),{skills:c}=await a.json();return c.map(vV)},e[2]=s.slug,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==i||e[6]!==o?(l={queryKey:n,enabled:i,queryFn:o},e[4]=n,e[5]=i,e[6]=o,e[7]=l):l=e[7],xt(l)}function vV(t){return{volume:t.volume,path:t.path}}async function yV(t){const e=await rn(`/api/${encodeURIComponent(t)}/fs/skills`),{skills:s}=await e.json();return s}async function _V(t,e,s){return(await rn(An(t,e,"read",{path:s}))).text()}function Oi(t,e){const s=z.c(8);let n;s[0]!==t?(n=Fe.fileText(t),s[0]=t,s[1]=n):n=s[1];const i=e?.enabled!==!1&&t!=="";let o;s[2]!==t?(o=async()=>{const a=await fetch(t,{credentials:"include"});return a.ok?await a.text():null},s[2]=t,s[3]=o):o=s[3];let l;return s[4]!==n||s[5]!==i||s[6]!==o?(l={queryKey:n,enabled:i,staleTime:6e4,retry:!1,queryFn:o},s[4]=n,s[5]=i,s[6]=o,s[7]=l):l=s[7],xt(l)}const LV=new Set(["md","mdx","markdown","txt","text"]),wV=25,SV=64*1024,kV=256*1024,jV=4;function CV(t){const e=t.lastIndexOf(".");return e===-1?!1:LV.has(t.slice(e+1).toLowerCase())}async function NV(t,e,s){const n=s?`${s}/`:"",i=h=>h.startsWith(n)?h.slice(n.length):h,o=[],l=[],a=[{path:s,depth:0}];for(;a.length>0;){const h=a.shift();if(!h)break;let f;try{f=(await(await rn(An(t,e,"list",{path:h.path}))).json()).entries}catch{continue}for(const m of[...f].sort((p,g)=>p.path.localeCompare(g.path))){if(m.kind==="dir"){h.depth<jV&&a.push({path:m.path,depth:h.depth+1});continue}CV(m.path)&&m.size<=SV&&o.length<wV?o.push(m.path):l.push(i(m.path))}}const c=await Promise.all(o.map(h=>_V(t,e,h).catch(()=>null))),d=[];let u=0;return o.forEach((h,f)=>{const m=c[f];if(m==null||u+m.length>kV){l.push(i(h));return}u+=m.length,d.push({relPath:i(h),content:m})}),d.sort((h,f)=>h.relPath==="SKILL.md"?-1:f.relPath==="SKILL.md"?1:h.relPath.localeCompare(f.relPath)),l.sort(),{files:d,omittedPaths:l}}function Eb(){const t=z.c(7),{org:e}=Me();let s;t[0]!==e.id?(s=Fe.orgFsPublicSets(e.id),t[0]=e.id,t[1]=s):s=t[1];let n;t[2]!==e.slug?(n=async()=>(await(await rn(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,t[2]=e.slug,t[3]=n):n=t[3];let i;return t[4]!==s||t[5]!==n?(i={queryKey:s,staleTime:3e5,queryFn:n},t[4]=s,t[5]=n,t[6]=i):i=t[6],xt(i)}function J1(t){const e=z.c(3),{org:s}=Me();let n;return e[0]!==s.slug||e[1]!==t?(n=i=>An(s.slug,t,"read",{path:i}),e[0]=s.slug,e[1]=t,e[2]=n):n=e[2],n}function Ql(){const t=z.c(2),{org:e}=Me();let s;return t[0]!==e.slug?(s=(n,i)=>An(e.slug,n,"read",{path:i}),t[0]=e.slug,t[1]=s):s=t[1],s}function Ab(t){const e=z.c(3),{org:s}=Me();let n;return e[0]!==s||e[1]!==t?(n={mutationFn:async i=>(await(await rn(An(s.slug,t,"file",{path:i.path}),{method:"PUT",headers:{"content-type":i.contentType??"text/html; charset=utf-8"},body:i.body})).json()).entry},e[0]=s,e[1]=t,e[2]=n):n=e[2],Rt(n)}function VV(t){const e=z.c(18),{org:s}=Me(),n=Qt();let i;e[0]!==s||e[1]!==t?(i=async d=>(await(await rn(An(s.slug,t,"public",{path:d.path}),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({mode:d.mode,password:d.password})})).json()).entry,e[0]=s,e[1]=t,e[2]=i):i=e[2];let o;e[3]!==s||e[4]!==n||e[5]!==t?(o=async d=>{const u=Fe.orgFsStat(s.id,t,d.path);await n.cancelQueries({queryKey:u});const h=n.getQueryData(u),f=d.mode!=="private";return n.setQueryData(u,m=>m&&{...m,readPublic:f,effectivePublic:f,shareMode:d.mode}),{key:u,previous:h}},e[3]=s,e[4]=n,e[5]=t,e[6]=o):o=e[6];let l;e[7]!==n?(l=(d,u,h)=>{h&&n.setQueryData(h.key,h.previous)},e[7]=n,e[8]=l):l=e[8];let a;e[9]!==s||e[10]!==n||e[11]!==t?(a=(d,u,h)=>{n.invalidateQueries({queryKey:Fe.orgFsStat(s.id,t,h.path)}),n.invalidateQueries({queryKey:Fe.orgFsVolume(s.id,t)}),n.invalidateQueries({queryKey:Fe.orgFsRecent(s.id)}),n.invalidateQueries({queryKey:Fe.orgFsSearchRoot(s.id)})},e[9]=s,e[10]=n,e[11]=t,e[12]=a):a=e[12];let c;return e[13]!==i||e[14]!==o||e[15]!==l||e[16]!==a?(c={mutationFn:i,onMutate:o,onError:l,onSettled:a},e[13]=i,e[14]=o,e[15]=l,e[16]=a,e[17]=c):c=e[17],Rt(c)}function Ec(t){const e=z.c(33),{org:s}=Me(),n=Qt();let i;e[0]!==s||e[1]!==n||e[2]!==t?(i=()=>{n.invalidateQueries({queryKey:Fe.orgFsVolume(s.id,t)}),n.invalidateQueries({queryKey:Fe.orgFsRecent(s.id)}),n.invalidateQueries({queryKey:Fe.orgFsSearchRoot(s.id)})},e[0]=s,e[1]=n,e[2]=t,e[3]=i):i=e[3];const o=i;let l;e[4]!==s||e[5]!==t?(l=async y=>{const L=(await Promise.allSettled(y.files.map(w=>{const S=y.dir?`${y.dir}/${w.name}`:w.name;return rn(An(s.slug,t,"file",{path:S}),{method:"PUT",headers:{"content-type":w.type||"application/octet-stream"},body:w})}))).find(TV);if(L)throw L.reason},e[4]=s,e[5]=t,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==l?(a={mutationFn:l,onSettled:o},e[7]=o,e[8]=l,e[9]=a):a=e[9];const c=Rt(a);let d;e[10]!==s||e[11]!==t?(d=async y=>{await rn(An(s.slug,t,"dir",{path:y}),{method:"POST"})},e[10]=s,e[11]=t,e[12]=d):d=e[12];let u;e[13]!==o||e[14]!==d?(u={mutationFn:d,onSuccess:o},e[13]=o,e[14]=d,e[15]=u):u=e[15];const h=Rt(u);let f;e[16]!==s||e[17]!==t?(f=async y=>{await rn(An(s.slug,t,"file",{path:y}),{method:"DELETE"})},e[16]=s,e[17]=t,e[18]=f):f=e[18];let m;e[19]!==o||e[20]!==f?(m={mutationFn:f,onSuccess:o},e[19]=o,e[20]=f,e[21]=m):m=e[21];const p=Rt(m);let g;e[22]!==s||e[23]!==t?(g=async y=>{await rn(An(s.slug,t,"move"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(y)})},e[22]=s,e[23]=t,e[24]=g):g=e[24];let x;e[25]!==o||e[26]!==g?(x={mutationFn:g,onSuccess:o},e[25]=o,e[26]=g,e[27]=x):x=e[27];const b=Rt(x);let v;return e[28]!==h||e[29]!==b||e[30]!==p||e[31]!==c?(v={upload:c,mkdir:h,remove:p,move:b},e[28]=h,e[29]=b,e[30]=p,e[31]=c,e[32]=v):v=e[32],v}function TV(t){return t.status==="rejected"}async function g2(t,e,s,n,i,o,l){try{const a=await Fc(s,n,o);Al(t,e,{id:n,name:Fl(n,i),metadata:a.messages,char:"/",kind:"prompt",args:o})}catch(a){console.error("[slash] Failed to fetch prompt:",a),me.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function EV(t,e,s,n,i){try{const o=await m4(s,n);Al(t,e,{id:n,name:n,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),me.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function AV(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await NV(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};Al(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),me.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const PV=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=se(),i=Qt(),{org:o}=Me(),l=Pt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=Fe.virtualMcpPrompts(e,o.id),c=Fe.virtualMcpResources(e,o.id),d=Fe.slashSkills(o.id),u=["slash-mention",o.id,e??"default"],[h,f]=V.useState(null),[m,p]=V.useState(null),g=ew(t);g&&(g.onEditChip=async S=>{if(l)try{const j=(await x2(i,a,l)).find(T=>T.name===S.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...S,prompt:j})}catch(k){console.error("[slash] Failed to load prompt for editing:",k),me.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=V.useRef(null),b=V.useRef(!1),v=async({item:S,range:k})=>{if(Je("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),b.current=!0,!!l)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){f({range:k,item:S});return}const j=Ni(S._meta);await g2(t,k,l,S.name,j,void 0,{t:n})}else S.kind==="skill"?S.skill&&await AV(t,k,o.slug,S.skill,{t:n}):S.uri&&await EV(t,k,l,S.uri,{t:n})},y=async S=>{if(!h||!l)return;const{range:k,item:j}=h,T=Ni(j._meta);await g2(t,k,l,j.name,T,S,{t:n}),f(null)},_=async S=>{if(!(!m||!l)){if(!tw(t,m.pos,m.promptId)){me.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const k=await Fc(l,m.promptId,S),j=Ni(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,c0({id:m.promptId,name:Fl(m.promptId,j),metadata:k.messages,char:"/",kind:"prompt",args:S})).run(),Je("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(k){console.error("[slash] Failed to update prompt:",k),me.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},L=async S=>{const{query:k}=S;if(!l)return[];const[j,T,N]=await Promise.all([x2(i,a,l),DV(i,c,l),RV(i,d,o.slug)]),C=k.trim().toLowerCase(),A=(j??[]).filter(E=>!C||E.name.toLowerCase().includes(C)||E.title?.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name,title:E.title,description:E.description,kind:"prompt",arguments:E.arguments,_meta:E._meta})),P=(T??[]).filter(E=>!C||E.uri.toLowerCase().includes(C)||E.name?.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name??E.uri,title:E.name,description:E.description,kind:"resource",uri:E.uri})),R=(N??[]).filter(E=>!C||E.name.toLowerCase().includes(C)||E.id.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name,title:E.name,description:E.description??void 0,kind:"skill",skill:E}));return[...A,...P,...R]},w=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 r.jsxs(r.Fragment,{children:[r.jsx(Vb,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:L,onSelect:v,onOpenChange:S=>{if(s&&(s.current=S),S)x.current=Date.now(),b.current=!1,Je("chat_picker_opened",{picker:"/"});else{const k=x.current;Je("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:k?Date.now()-k:null}),x.current=null}}}),r.jsx(pc,{prompt:w,setPrompt:()=>f(null),onSubmit:y}),r.jsx(pc,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:_,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function x2(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>vh(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>vh(s),staleTime:6e4}),n?.prompts??[]}async function RV(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>yV(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function DV(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>Ga(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>Ga(s),staleTime:6e4}),n?.resources??[]}function IV(t){return[i1.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),pb.configure({placeholder:()=>t.current??"Ask anything, / for prompts & skills, @ for agents & resources...",showOnlyWhenEditable:!1}),nw,iw]}function Pb({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=V.useRef(o),d=V.useRef(e),u=V.useRef(n),h=V.useRef(i),f=n1({extensions:IV(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",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 V.useEffect(()=>{f?.setEditable(!s)},[f,s]),V.useEffect(()=>{c.current=o},[o]),V.useEffect(()=>{d.current=e},[e]),V.useEffect(()=>{u.current=n},[n]),V.useEffect(()=>{h.current=i},[i]),V.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]),r.jsx(sw.Provider,{value:{editor:f},children:a})}function Rb(t){const e=z.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=zc();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const T=f.state.doc.textContent.trim()==="";f.commands.focus("end"),T||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,T)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),T)){f.commands.focus("end");const N=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:N?" "+T:T})}},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]),V.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=ie("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 v;e[7]!==f||e[8]!==b?(v=r.jsx(r1,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const y=n??null;let _;e[10]!==f||e[11]!==a||e[12]!==y?(_=r.jsx(V.Suspense,{fallback:null,children:r.jsx(PV,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=y,e[13]=_):_=e[13];const L=n??null;let w;e[14]!==f||e[15]!==a||e[16]!==L?(w=r.jsx(V.Suspense,{fallback:null,children:r.jsx(aV,{editor:f,virtualMcpId:L,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=L,e[17]=w):w=e[17];let S;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==h?(S=h&&o&&!u?r.jsx(WC,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=o,e[22]=h,e[23]=S):S=e[23];let k;return e[24]!==_||e[25]!==w||e[26]!==S||e[27]!==v?(k=r.jsxs(r.Fragment,{children:[v,_,w,S]}),e[24]=_,e[25]=w,e[26]=S,e[27]=v,e[28]=k):k=e[28],k}function Db(t){const e=z.c(3),[s]=mr();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&gk(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const MV={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"},$V=eS.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),OV=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function BV(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1.5",children:OV.map(zV)}),t[0]=e):e=t[0],e}function zV(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function FV({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=se(),[a,c]=V.useState(!1),d=Db(MV),{org:u}=Me(),{editor:h}=zc(),f=V.useRef(null),m=v0(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async q=>{const ee=q.target.files;if(!ee||ee.length===0||!h)return;const X=Array.from(ee);try{let Y=h.state.selection.from;for(const G of X)await W1(h,n??null,G,Y,o,l),Y=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=Pt({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=Fe.virtualMcpPrompts(s,u.id),{data:v,isLoading:y}=xt({queryKey:b,queryFn:()=>vh(x),staleTime:6e4,enabled:a&&!!x}),_=v?.prompts??[],[L,w]=V.useState(null),{chatMode:S,setChatMode:k}=Gr(),[j,T]=mr(),N=uo.find(q=>q.value===j.toolApprovalLevel)??uo[0],C=l(N.shortKey),A=q=>{const ee=uo.find(X=>X.value===q);if(ee){if(ee.value===j.toolApprovalLevel){c(!1);return}d(),Je("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:ee.value,source:"tools_popover"}),T({...j,toolApprovalLevel:ee.value}),c(!1)}},P=S==="plan",R=()=>{d();const q=P?"default":"plan";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},E=()=>{e(),c(!1)},M=async(q,ee)=>{if(!h||!x)return;const X=Ni(q._meta),Y={from:h.state.selection.from,to:h.state.selection.to};try{const G=await Fc(x,q.name,ee);Al(h,Y,{id:q.name,name:Fl(q.name,X),metadata:G.messages,char:"/",kind:"prompt",args:ee})}catch{me.error(l("chat.toolsPopover.failedLoadPrompt"))}},I=async q=>{c(!1);const ee=!!(q.arguments&&q.arguments.length>0);if(Je("chat_prompt_inserted",{prompt_name:q.name,with_arguments:ee}),ee){w(q);return}await M(q)},$=async q=>{L&&(await M(L,q),w(null))},O=()=>{d();const q=S==="gen-image"?"default":"gen-image";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},D=()=>{d();const q=S==="web-search"?"default":"web-search";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},B=()=>{d();const q=S==="deep-research"?"default":"deep-research";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},F=S==="gen-image",U=S==="web-search",H=S==="deep-research",W=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:lk(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[W,r.jsxs(qt,{open:a,onOpenChange:q=>{q&&!a&&Je("chat_tools_popover_opened",{chat_mode:S}),c(q)},children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(ae,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[r.jsx(l5,{size:14}),r.jsx("span",{className:ie("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")})]})}),r.jsxs(Yt,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(Ze,{onClick:p,disabled:i,children:[r.jsx(Nt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsxs(Ze,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:q=>q.preventDefault(),children:[r.jsx(Nt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(qe,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(Ze,{onClick:R,className:ie(P&&"text-special"),children:[r.jsx(Pl,{size:16,className:ie(P&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:ie("text-xs text-muted-foreground",P&&"text-special font-medium"),children:$V})]}),r.jsxs(Ze,{onClick:O,className:ie(F&&"text-special"),children:[r.jsx(Pi,{size:16,className:ie(F&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),F&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Ze,{onClick:D,className:ie(U&&"text-special"),children:[r.jsx(Vi,{size:16,className:ie(U&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Ze,{onClick:B,className:ie(H&&"text-special"),children:[r.jsx(a5,{size:16,className:ie(H&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),H&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Li,{children:[r.jsxs(wi,{className:"gap-2",children:[r.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.prompts")})]}),r.jsx(Si,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:y?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(it,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):_.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):_.map(q=>r.jsxs(Ze,{onClick:()=>I(q),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:q.title||s1(q.name,Ni(q._meta))}),q.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:q.description})]},q.name))})]}),r.jsxs(Li,{children:[r.jsxs(wi,{className:"gap-2",children:[r.jsx(p0,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Si,{className:"w-48 p-1.5",children:r.jsx(wh,{value:j.toolApprovalLevel,onValueChange:A,children:uo.map(q=>r.jsx(bc,{value:q.value,children:l(q.labelKey)},q.value))})})]}),r.jsxs(Ze,{onClick:E,children:[r.jsx(V1,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(V.Suspense,{children:r.jsx(BV,{})})]})]})]}),r.jsx(pc,{prompt:L,setPrompt:w,onSubmit:$})]})}const UV=[{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 KV(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1",children:UV.map(HV)}),t[0]=e):e=t[0],e}function HV(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function WV(t){const e=z.c(10),{onClick:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("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 o;e[1]!==n?(o=n("chat.connectionsBanner.description"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:o}),e[3]=o,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(KV,{}),c=r.jsx(wn,{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=r.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 Da=48;function qV(){const t=z.c(9),[e,s]=V.useState("idle"),[n,i]=V.useState(""),[o,l]=V.useState(""),[a,c]=V.useState(QV),d=V.useRef(null),u=V.useRef(null),h=V.useRef(null),f=V.useRef(null),m=V.useRef(0),p=V.useRef(!1),g=V.useRef(""),x=V.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),u.current?.close().catch(YV),f.current?.getTracks().forEach(GV),h.current=null,u.current=null,f.current=null},t[0]=v):v=t[0];const y=v;let _;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=C=>{f.current=C;const A=new AudioContext;u.current=A;const P=A.createMediaStreamSource(C),R=A.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,P.connect(R),h.current=R;const E=new Uint8Array(R.frequencyBinCount),M=()=>{if(!h.current)return;h.current.getByteFrequencyData(E);const I=[];for(let $=0;$<Da;$++){const O=Math.floor($/Da*E.length);I.push(Math.max(.04,(E[O]??0)/255))}c(I),m.current=requestAnimationFrame(M)};M()};_=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let A;try{A=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),N(A);const P=new C;d.current=P,P.interimResults=!0,P.continuous=!0,P.lang=navigator.language||"en-US",P.onresult=R=>{let E="",M="";for(let I=R.resultIndex;I<R.results.length;I++){const $=R.results[I],O=$?.[0]?.transcript??"";$?.isFinal?M=M+O:E=E+O}M&&(g.current=g.current+M,i(g.current)),x.current=E,l(E)},P.onend=()=>{if(p.current)try{P.start()}catch{}};try{P.start()}catch{return p.current=!1,d.current=null,y(),s("idle"),"idle"}return"recording"},t[1]=_}else _=t[1];const L=_;let w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.stop(),y(),s("idle"),c(Array(Da).fill(.05)),l("");const N=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",N},t[2]=w):w=t[2];const S=w;let k;t[3]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.abort(),y(),s("idle"),i(""),l(""),c(Array(Da).fill(.05)),g.current="",x.current=""},t[3]=k):k=t[3];const j=k;let T;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(T={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:L,stopRecording:S,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=T):T=t[8],T}function GV(t){return t.stop()}function YV(){}function QV(){return Array(Da).fill(.05)}function XV(t){const e=z.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(JV),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.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 JV(t,e){return r.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 ZV(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function w9(t){const e=z.c(3),{message:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(Bc,{size:14,className:"shrink-0"}),e[0]=n):n=e[0];const i=s??"";let o;return e[1]!==i?(o=r.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:[n,r.jsx("span",{className:"text-sm",children:i})]}),e[1]=i,e[2]=o):o=e[2],o}function eT(t,e,s){const n=z.c(7),{editor:i}=zc(),o=se(),[l,a]=V.useState(!1),c=V.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(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=tT,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!v0(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=i.state.selection.from;for(const y of b)await W1(i,t,y,v,e,o),v=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,o,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=o,n[5]=d,n[6]=u):(d=n[5],u=n[6]),V.useEffect(d,u),l}function tT(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function sT(t){const e=z.c(14),{selectedModel:s}=t,n=se();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=S5(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Wn,{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],o=n("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[8]!==i||e[9]!==o?(a=r.jsx("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function nT(){const t=z.c(5),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Bc,{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=r.jsxs(r.Fragment,{children:[s,r.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function iT(t){const e=z.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=eT(s,n,i);let l;e[0]!==s?(l=v0(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o?"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=ie("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?r.jsx(sT,{selectedModel:s}):r.jsx(nT,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function Ld(t){const e=z.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=ie("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",o),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("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=r.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=r.jsx(hs,{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=r.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 rT(){const t=z.c(6),e=It(),{org:s,locator:n}=Me(),{create:i}=Uc();let o;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(o=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),u=c?.id??Ul(s.id).id;J4(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:sS};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]=o):o=t[5],o}function oT({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=se(),n=t1(),i=zl(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||$j,h=rT(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:y,setChatMode:_}=Gr(),{data:L}=Ui.useSession(),w=L?.user?.id,{org:S,locator:k}=Me(),j=Ul(S.id).id,T=Db(xk),[N,C]=V.useState(!1),{unsupportedFile:A,onUnsupportedFile:P,clearUnsupportedFile:R}=XC(),E=qV(),M=V.useRef(void 0),I=async()=>{M.current=U;const de=await E.startRecording();Je("chat_voice_started",{thread_id:d,outcome:de==="recording"?"started":de==="unsupported"?"unsupported":de==="permission-denied"?"permission_denied":"unknown"})},$=()=>{Je("chat_voice_confirmed",{thread_id:d});const de=E.stopRecording();Y.current?.syncVoiceText(M.current,de),Y.current?.focus()},O=()=>{Je("chat_voice_cancelled",{thread_id:d}),E.cancelRecording(),Y.current?.restoreContent(M.current)};V.useEffect(()=>{if(E.status!=="recording")return;const de=(E.transcript+(E.interimTranscript?" "+E.interimTranscript:"")).trim();Y.current?.syncVoiceText(M.current,de)},[E.transcript,E.interimTranscript,E.status]);const D=i?.activeTask??null,B=_0(),F=G4({isDesktopApp:B,harnessId:D?.harness_id,sandboxProviderKind:D?.sandbox_provider_kind}),[U,H]=V.useState(()=>Zp(sessionStorage,k,u)??void 0),W=de=>{H(de),g.current=de,nb(sessionStorage,k,u,de,{onQuotaExceeded:({docSizeBytes:Z})=>{Je("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Z}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},q=V.useRef(d);if(q.current!==d){q.current=d;const de=Zp(sessionStorage,k,u)??void 0;H(de),g.current=de}const X=[...o].reverse().find(de=>de.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,Y=V.useRef(null),G=V.useRef(!1),J=y==="plan",oe=de=>{T(),Je("chat_mode_changed",{from_mode:de,to_mode:"default",source:"pill_dismiss"}),_("default")};V.useEffect(()=>{const de=Z=>{Q4(Z)&&Z.code==="KeyL"&&(Z.preventDefault(),Z.shiftKey&&_(y==="plan"?"default":"plan"),Y.current?.focus())};return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[y,_]);const le=R4(o),K=[...o].reverse().find(de=>de.role==="assistant"&&de.metadata?.usage)?.metadata?.usage?.contextTokens??0,te=!p&&!sb(U),ne=ZV({hasDraft:te,isStreaming:l,isRunInProgress:a}),re=ne==="send",he=ne==="stop",pe=de=>{if(de?.preventDefault(),ne==="send"&&U){if(Je("chat_message_sent",{thread_id:d||null,mode:y,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:de?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){me.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(U)}else h({tiptapDoc:U,virtualMcp:m});Bj(sessionStorage,k,u),W(void 0)}else ne==="stop"&&(Je("chat_message_stopped",{thread_id:d}),c())};return w&&D?.created_by&&D.created_by!==w?r.jsx(w9,{message:s("chat.input.readOnlyOthersChat")}):D?.metadata?.read_only?r.jsx(w9,{message:s("chat.input.readOnlyThread")}):F?r.jsx(w9,{message:s("chat.input.codingAgentRequiresDesktop")}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-col w-full justify-end",children:r.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&r.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&i&&r.jsx(N0,{}),n&&i&&d?r.jsx(RC,{taskId:d}):null,r.jsx(Pb,{tiptapDoc:U,setTiptapDoc:W,disabled:E.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:pe,suggestionOpenRef:G,children:r.jsxs("form",{onSubmit:pe,className:ie("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:[r.jsx(iT,{selectedModel:f,onUnsupportedFile:P,disabled:E.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(Rb,{ref:Y,disabled:E.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:P,suggestionOpenRef:G})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:E.status==="recording"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx(XV,{data:E.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:O,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:r.jsx(hs,{size:16})}),r.jsx("button",{type:"button",onClick:$,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:r.jsx(Ut,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(FV,{disabled:!1,onOpenConnections:()=>{Je("connections_dialog_opened",{source:"tools_popover",mode:"add"}),C(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:P}),J&&r.jsx(Ld,{onClick:()=>oe("plan"),label:s("chat.input.planMode"),icon:r.jsx(Pl,{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"}),y==="gen-image"&&x&&r.jsx(Ld,{onClick:()=>oe("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(Pi,{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]"}),y==="web-search"&&b&&r.jsx(Ld,{onClick:()=>oe("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Vi,{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]"}),y==="deep-research"&&v&&r.jsx(Ld,{onClick:()=>oe("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(a5,{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]"}),X&&K>0&&r.jsx(rw,{usage:le,totalTokens:K,contextWindow:X,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(HC,{}),E.isSupported&&r.jsx(ae,{type:"button",onClick:I,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",E.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:E.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":E.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(pS,{size:18})}),r.jsx(ae,{type:he?"button":"submit",onClick:de=>{he&&(de.preventDefault(),de.stopPropagation(),c())},variant:re||he?"default":"ghost",size:"icon",disabled:!re&&!he,className:ie("size-8 rounded-lg transition-all",!re&&!he&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(ne==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(ne==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:he?r.jsx(gS,{size:20}):r.jsx(o0,{size:20})})]})]})})]})},d),e&&r.jsx(WV,{onClick:()=>{Je("connections_banner_clicked",{source:"home_chat_input"}),Je("connections_dialog_opened",{source:"home_banner",mode:"add"}),C(!0)}})]})}),r.jsx(A1,{mode:"browse",open:N,onOpenChange:C,defaultTab:"all"}),r.jsx(YC,{info:A,onClose:R})]})}function lT(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 aT(){const t=z.c(8),e=It(),s=c1(),n=t1()?.messages??[],i=zl()?.taskId??null;let o;t[0]!==n?(o=lT(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=V.useRef(null),c=V.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({to:".",search:cT,replace:!0}))},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]),V.useEffect(d,u)}function cT(t){return{...t,main:"preview"}}const dT={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 Ib(t){return`deco-credits-empty-dismissed:${t}`}function uT(t){try{return localStorage.getItem(Ib(t))==="1"}catch{return!1}}function hT(){const t=z.c(68),e=se(),{org:s}=Me(),n=It(),{decoKeyId:i}=E1(),o=Cs(),[l,a]=V.useState(!0),[c,d]=V.useState(""),[u,h]=V.useState(!1),[f,m]=V.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Je("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(Ib(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==l||t[3]!==s.id?(b=()=>{l&&Je("credits_empty_state_shown",{organization_id:s.id})},v=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),V.useEffect(b,v);let y;t[6]!==f||t[7]!==o?(y=async X=>{const{url:Y}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:X,currency:f});return Y},t[6]=f,t[7]=o,t[8]=y):y=t[8];let _;t[9]!==x?(_=X=>{X&&window.open(X,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=_):_=t[10];let L;t[11]!==e?(L=X=>{me.error(e("chat.creditsEmptyState.topUpFailed",{message:X.message}))},t[11]=e,t[12]=L):L=t[12];let w;t[13]!==y||t[14]!==_||t[15]!==L?(w={mutationFn:y,onSuccess:_,onError:L},t[13]=y,t[14]=_,t[15]=L,t[16]=w):w=t[16];const{mutate:S,isPending:k}=Rt(w),j=parseFloat(c),T=!isNaN(j)&&j>=1;if(!l)return null;let N;t[17]!==x?(N=X=>!X&&x(),t[17]=x,t[18]=N):N=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=r.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]=C):C=t[19];let A;t[20]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(c5,{size:20,className:"text-warning"})}),t[20]=A):A=t[20];let P;t[21]!==e?(P=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=P):P=t[22];let R;t[23]!==P?(R=r.jsx(At,{className:"text-lg font-semibold",children:P}),t[23]=P,t[24]=R):R=t[24];let E;t[25]!==e?(E=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=E):E=t[26];let M;t[27]!==E?(M=r.jsx(_n,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:E}),t[27]=E,t[28]=M):M=t[28];let I;t[29]!==R||t[30]!==M?(I=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,r.jsxs(os,{className:"relative gap-3",children:[A,r.jsxs("div",{className:"text-center",children:[R,M]})]})]}),t[29]=R,t[30]=M,t[31]=I):I=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==T||t[38]!==k||t[39]!==u||t[40]!==e||t[41]!==S?($=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(T1,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:X=>{X&&m(X)},children:[r.jsx(xc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(xc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:dT[f].map(X=>{const{dollars:Y,labelKey:G}=X;return r.jsxs("button",{type:"button",disabled:k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Y*100,currency:f,tier_label:G,source:"empty_state"}),S(Y*100)},className:ie("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:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,Y]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(G)})]},Y)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(rt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:X=>d(X.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(ae,{className:"h-10",disabled:!T||k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),S(Math.round(j*100))},children:e(k?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):r.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]=T,t[38]=k,t[39]=u,t[40]=e,t[41]=S,t[42]=$):$=t[42];let O;t[43]!==x||t[44]!==n||t[45]!==s.slug?(O=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=O):O=t[46];let D;t[47]!==e?(D=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=D):D=t[48];let B;t[49]===Symbol.for("react.memo_cache_sentinel")?(B=r.jsx(Zr,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=B):B=t[49];let F;t[50]!==O||t[51]!==D?(F=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:O,children:[D,B]}),t[50]=O,t[51]=D,t[52]=F):F=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let H;t[55]!==x||t[56]!==U?(H=r.jsx(ae,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=H):H=t[57];let W;t[58]!==F||t[59]!==H?(W=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,H]}),t[58]=F,t[59]=H,t[60]=W):W=t[60];let q;t[61]!==I||t[62]!==$||t[63]!==W?(q=r.jsxs(jt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:fT,children:[I,$,W]}),t[61]=I,t[62]=$,t[63]=W,t[64]=q):q=t[64];let ee;return t[65]!==q||t[66]!==N?(ee=r.jsx(Ct,{open:!0,onOpenChange:N,children:q}),t[65]=q,t[66]=N,t[67]=ee):ee=t[67],ee}function fT(t){return t.preventDefault()}function mT(t){const e=z.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 o,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ie("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=r.jsx(c5,{size:13,className:"text-success"}),e[2]=o,e[3]=l):(o=e[2],l=e[3]);let a;return e[4]!==i?(a=r.jsxs("div",{className:o,children:[l,r.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 pT(){const t=z.c(8),{org:e}=Me(),s=It();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,o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("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"),o=r.jsx(fn,{size:13,className:"text-warning"}),l=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=o,t[5]=l):(i=t[3],o=t[4],l=t[5]);let a;return t[6]!==n?(a=r.jsxs("button",{type:"button",onClick:n,className:i,children:[o,l]}),t[6]=n,t[7]=a):a=t[7],a}function gT(t){const e=z.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[i,r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),r.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=o):o=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),r.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[r.jsx(wd,{align:"right",width:"w-3/4"}),r.jsx(wd,{align:"left",width:"w-full",lines:3}),r.jsx(wd,{align:"right",width:"w-2/3"}),r.jsx(wd,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:r.jsx("div",{className:"relative flex-1",children:r.jsxs("div",{className:"space-y-2 p-2",children:[r.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),r.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"px-4 py-4",children:r.jsx("div",{className:"mx-auto w-full max-w-2xl",children:r.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[c,r.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),r.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=u):u=e[8];let h;return e[9]!==n?(h=r.jsxs("div",{className:n,children:[l,a,u]}),e[9]=n,e[10]=h):h=e[10],h}function wd(t){const e=z.c(22),{align:s,width:n,lines:i}=t,o=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,e[1]=c):c=e[1];const d=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let u;e[2]!==d?(u=ie("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=h):h=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=ie("min-w-0 rounded-2xl p-4",f,o),e[5]=f,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((y,_)=>r.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",_===l-1?"w-3/4":"w-full"),style:{animationDelay:`${_*.1}s`}},_))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==u?(b=r.jsxs("div",{className:u,children:[h,x]}),e[16]=x,e[17]=u,e[18]=b):b=e[18];let v;return e[19]!==b||e[20]!==c?(v=r.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=v):v=e[21],v}function xT(t){const e=z.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:o,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==o||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||o||!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,o,l],e[0]=l,e[1]=i,e[2]=o,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),V.useEffect(a,c)}function bT(t){const e=z.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=r.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function vT(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function yT(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.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 _T(){const t=se(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=qn(),{taskId:l}=Qs();aT();const a=V4(l??""),c=FL(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),u=ow(d),h=u.at(-1),m=Mj()*wj+16,p=V.useRef(null),g=V.useRef(null);xT({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=lw({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(aw,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.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:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&r.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((v,y)=>r.jsx(Fp,{pair:v,isLastPair:!1,status:y===u.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),h&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(Fp,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(ae,{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:r.jsx(AL,{size:14})})]})})}function LT(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("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 o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}const is=Object.assign(bT,{Main:vT,Messages:_T,EmptyState:yT,Footer:LT,Input:oT,Provider:zL,ActiveTaskProvider:BL,Skeleton:gT,IceBreakers:Lj,NoAiProviderEmptyState:ak,CreditsEmptyState:hT,CreditsEyebrow:mT,NoCreditsEyebrow:pT,CreditsExhaustedBanner:fb});function wT({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function ST(){const t=z.c(3),e=y0(),n=zl()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=wT({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function ma(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function S9(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 kT(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function jT(t){const e=z.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(CT),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.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 CT(t){return r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),r.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function NT(t){const e=z.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=se(),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&&r.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&&r.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&&r.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=r.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=r.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]!==o||e[12]!==a?(g=o("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=o,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[p,r.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=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==o?(v=o("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=o,e[19]=v):v=e[19];let y;e[20]!==v?(y=r.jsxs("div",{className:"flex items-center gap-1.5",children:[b,r.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=y):y=e[21];let _;e[22]!==d||e[23]!==i||e[24]!==o?(_=i>0&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=o,e[25]=_):_=e[25];let L;e[26]!==y||e[27]!==_||e[28]!==x?(L=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,y,_]}),e[26]=y,e[27]=_,e[28]=x,e[29]=L):L=e[29];let w;return e[30]!==L||e[31]!==m?(w=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,L]}),e[30]=L,e[31]=m,e[32]=w):w=e[32],w}function VT(t){const e=z.c(14),{agentId:s,isError:n}=t,i=Hs(s),o=se();let l;e[0]!==i?.title||e[1]!==o?(l=i?.title??o("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=o,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=r.jsx(ai,{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=ie("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=r.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=r.jsxs(r.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function TT(t){const e=z.c(12),{isError:s}=t,n=se();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const o=i;let l;e[2]!==o?(l=r.jsx(ai,{icon:null,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=o,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=r.jsx("span",{className:c,children:o}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function ET(t){const e=z.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,o=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==o?(a=r.jsx(TT,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(VT,{agentId:n,isError:o}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=r.jsx(V.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&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-muted-foreground/50",children:"·"}),r.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]!==o||e[12]!==i?(h=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(it,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(ek,{size:12,className:"text-destructive"}):l?r.jsx(fn,{size:12,className:"text-warning"}):r.jsx(Gn,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=r.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 AT(t){const e=z.c(78),{onClose:s,back:n,className:i}=t,o=se(),[l,a]=V.useState(null),{messages:c}=qn(),{activeTask:d}=Qs(),{selectedModel:u,selectedVirtualMcp:h}=Gr();let f,m,p,g,x,b,v,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]!==o){y=Symbol.for("react.early_return_sentinel");e:{const w=R4(c),S=[...c].reverse().find(UT),k=S?.metadata?.usage,j=S?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,T=k?.contextTokens??0,N=j&&j>0?(T/j*100).toFixed(1):null,C=c;let A;e[17]!==C?(A=C.filter(FT).reduce(zT,0),e[17]=C,e[18]=A):A=e[18];const P=A,R=c;let E;e[19]!==R?(E=R.filter(BT).reduce(OT,0),e[19]=R,e[20]=E):E=e[20];const M=E,I=Math.max(0,w.totalTokens-P-M),$=c[0],O=c.at(-1),D=$?.metadata?.created_at??d?.created_at,B=O?.metadata?.created_at??d?.updated_at,F=c.filter($T),U=c.flatMap(IT),H=u?.modelId?kT(u.modelId):"—",W=h?.title??"Super Agent",q=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:F.length},{label:o("chat.contextPanel.agentLabel"),value:W},{label:o("chat.contextPanel.modelLabel"),value:H},{label:o("chat.contextPanel.contextLimitLabel"),value:j?ma(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:w.totalTokens>0?ma(w.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:N!==null?`${N}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:w.inputTokens>0?ma(w.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:w.outputTokens>0?ma(w.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:w.reasoningTokens>0?ma(w.reasoningTokens):"0"},{label:o("chat.contextPanel.costLabel"),value:w.cost>0?`$${w.cost<.001?w.cost.toFixed(6):w.cost.toFixed(4)}`:"$0.00"},{label:o("chat.contextPanel.sessionCreatedLabel"),value:S9(D)},{label:o("chat.contextPanel.lastActivityLabel"),value:S9(B)}];if(!d&&F.length===0){let Q;e[21]!==i?(Q=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=Q):Q=e[22];let K;e[23]!==o?(K=o("chat.contextPanel.title"),e[23]=o,e[24]=K):K=e[24];let te;e[25]!==K?(te=r.jsx("span",{className:"text-sm font-medium text-foreground",children:K}),e[25]=K,e[26]=te):te=e[26];let ne;e[27]!==n?(ne=n?r.jsx(Kp,{size:14,className:"text-muted-foreground"}):r.jsx(ti,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=ne):ne=e[28];let re;e[29]!==s||e[30]!==ne?(re=r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ne}),e[29]=s,e[30]=ne,e[31]=re):re=e[31];let he;e[32]!==te||e[33]!==re?(he=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[te,re]}),e[32]=te,e[33]=re,e[34]=he):he=e[34];let pe;e[35]!==o?(pe=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=pe):pe=e[36];let de;e[37]!==pe?(de=r.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:r.jsx("p",{className:"text-xs text-muted-foreground",children:pe})}),e[37]=pe,e[38]=de):de=e[38];let Z;e[39]!==Q||e[40]!==he||e[41]!==de?(Z=r.jsxs("div",{className:Q,children:[he,de]}),e[39]=Q,e[40]=he,e[41]=de,e[42]=Z):Z=e[42],y=Z;break e}e[43]!==i?(b=ie("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 ee;e[45]!==o?(ee=o("chat.contextPanel.title"),e[45]=o,e[46]=ee):ee=e[46];let X;e[47]!==ee?(X=r.jsx("span",{className:"text-sm font-medium text-foreground",children:ee}),e[47]=ee,e[48]=X):X=e[48];let Y;e[49]!==n?(Y=n?r.jsx(Kp,{size:14}):r.jsx(ti,{size:14}),e[49]=n,e[50]=Y):Y=e[50];let G;e[51]!==s||e[52]!==Y?(G=r.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:Y}),e[51]=s,e[52]=Y,e[53]=G):G=e[53],e[54]!==X||e[55]!==G?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[X,G]}),e[54]=X,e[55]=G,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=U.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.subtasksSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:U.map(DT)})]}),p=r.jsx(jT,{items:q});let J;e[57]!==o?(J=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=J):J=e[58];let oe;e[59]!==J?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:J}),e[59]=J,e[60]=oe):oe=e[60];let le;e[61]!==M||e[62]!==I||e[63]!==P?(le=r.jsx(NT,{userTokens:P,assistantTokens:M,otherTokens:I}),e[61]=M,e[62]=I,e[63]=P,e[64]=le):le=e[64],e[65]!==oe||e[66]!==le?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[oe,le]}),e[65]=oe,e[66]=le,e[67]=g):g=e[67],x=F.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.rawMessagesSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:F.map(Q=>{const K=Q.metadata?.created_at,te=l?.id===Q.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(te?null:Q),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:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:ie("shrink-0 font-medium",Q.role==="user"?"text-chart-1":"text-chart-2"),children:Q.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Q.id})]}),K&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:S9(K)})]}),te&&r.jsxs(r.Fragment,{children:[Q.role==="assistant"&&(()=>{const ne=Q.metadata?._request;if(!ne)return null;const re=ne.systemSections??[],he=Math.max(1,...re.map(RT)),pe=re.reduce(PT,0);return r.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-foreground",children:o("chat.contextPanel.requestLabel")}),r.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ne.activeTools??0," / ",ne.tools??0," ",o("chat.contextPanel.toolsActive")]})]}),re.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"text-muted-foreground",children:[o("chat.contextPanel.systemPromptLabel")," ",r.jsxs("span",{className:"tabular-nums",children:["~",Math.round(pe/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),re.map((de,Z)=>{const fe=de.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${Z}`,ue=de.chars/he*100,ye=Math.round(de.chars/4);return r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-mono text-foreground truncate",children:fe}),r.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ye.toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),r.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${ue}%`}})})]},Z)})]})]})})(),r.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(Q,null,2)})]})]},Q.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]=o,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=y}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let _;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(_=r.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]=_):_=e[73];let L;return e[74]!==b||e[75]!==v||e[76]!==_?(L=r.jsxs("div",{className:b,children:[v,_]}),e[74]=b,e[75]=v,e[76]=_,e[77]=L):L=e[77],L}function PT(t,e){return t+e.chars}function RT(t){return t.chars}function DT(t,e){return r.jsx(ET,{part:t},e)}function IT(t){return(t.parts??[]).filter(MT)}function MT(t){return t.type==="tool-subtask"}function $T(t){return t.role!=="system"}function OT(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function BT(t){return t.role==="assistant"}function zT(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function FT(t){return t.role==="user"}function UT(t){return t.role==="assistant"&&t.metadata?.usage}function KT(t){const e=z.c(21),{onOpenContextPanel:s}=t,{org:n}=Me(),{selectedVirtualMcp:i}=Gr();let o;e[0]!==n.id?(o=Ul(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Hs(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=r.jsx(zr,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=r.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?r.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=r.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=r.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 v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(is.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let y;e[16]!==s?(y=r.jsxs(is.Footer,{children:[v,r.jsx(is.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=y):y=e[17];let _;return e[18]!==b||e[19]!==y?(_=r.jsxs(r.Fragment,{children:[b,y]}),e[18]=b,e[19]=y,e[20]=_):_=e[20],_}function b2(t){const e=z.c(17),{outputs:s,collapsed:n,onToggle:i,variant:o}=t,l=o==="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=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.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=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=r.jsx(fs,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(f=r.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&&r.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(HT)}),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=r.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function HT(t){return r.jsx(dw,{file:t},t.key)}function WT(){const t=z.c(13),e=zl()?.taskId??null,s=cw();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=D4(e,n),[o,l]=V.useState(!1),[a,c]=V.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(GT),t[2]=d):d=t[2];let u;t[3]!==o||t[4]!==i?(u=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(b2,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(qT),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(b2,{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=r.jsxs(r.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function qT(t){return!t}function GT(t){return!t}function YT(){const t=z.c(30),{org:e}=Me(),{isChatEmpty:s}=qn(),[n,i]=V.useState("chat"),o=E1();if(ST()){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(is,{className:"animate-in fade-in-0 duration-200",children:r.jsx(is.Main,{className:"flex flex-col items-center",children:r.jsx(is.EmptyState,{children:r.jsx(is.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let a;t[1]!==o.hasDecoKey||t[2]!==o.hasOnlyDecoProvider||t[3]!==o.isLoading||t[4]!==o.isZeroBalance||t[5]!==s||t[6]!==e?(a=o.hasDecoKey&&o.isZeroBalance&&o.hasOnlyDecoProvider&&!o.isLoading&&s&&!uT(e.id),t[1]=o.hasDecoKey,t[2]=o.hasOnlyDecoProvider,t[3]=o.isLoading,t[4]=o.isZeroBalance,t[5]=s,t[6]=e,t[7]=a):a=t[7];const c=a;let d;t[8]!==c?(d=c&&r.jsx(is.CreditsEmptyState,{}),t[8]=c,t[9]=d):d=t[9];const u=n!=="chat"?!0:void 0,h=n!=="chat",f=n!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;t[10]!==f?(m=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[10]=f,t[11]=m):m=t[11];let p;t[12]!==s?(p=s?r.jsx(KT,{onOpenContextPanel:()=>i("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(is.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(WT,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(is.Messages,{})})]}),r.jsx(is.Footer,{children:r.jsx(is.Input,{onOpenContextPanel:()=>i("context")})})]}),t[12]=s,t[13]=p):p=t[13];let g;t[14]!==u||t[15]!==h||t[16]!==m||t[17]!==p?(g=r.jsx("div",{inert:u,"aria-hidden":h,className:m,children:p}),t[14]=u,t[15]=h,t[16]=m,t[17]=p,t[18]=g):g=t[18];const x=n!=="context"?!0:void 0,b=n!=="context",v=n==="context"?"opacity-100":"opacity-0 pointer-events-none";let y;t[19]!==v?(y=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[19]=v,t[20]=y):y=t[20];let _;t[21]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(AT,{back:!0,onClose:()=>i("chat")}),t[21]=_):_=t[21];let L;t[22]!==y||t[23]!==x||t[24]!==b?(L=r.jsx("div",{inert:x,"aria-hidden":b,className:y,children:_}),t[22]=y,t[23]=x,t[24]=b,t[25]=L):L=t[25];let w;return t[26]!==d||t[27]!==L||t[28]!==g?(w=r.jsxs(is,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[d,g,L]}),t[26]=d,t[27]=L,t[28]=g,t[29]=w):w=t[29],w}function Mb(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(is.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Fs,{fallback:e,children:r.jsx(V.Suspense,{fallback:r.jsx(is.Skeleton,{}),children:r.jsx(YT,{})})}),t[1]=s):s=t[1],s}function QT(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function $b(t){return t?.name||t?.email?.split("@")[0]||void 0}function Z1(t){const e=QT(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function XT(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 Ob=["SANDBOX_START"],Sd=new Map,JT=t=>`${t.virtualMcpId}::${t.branch??""}`,ZT=t=>t.message.includes("retry shortly"),k9=new Set,Vh={mark:(t,e)=>k9.add(`${t}::${e}`),clear:(t,e)=>k9.delete(`${t}::${e}`),isStopped:(t,e)=>k9.has(`${t}::${e}`)};function Bb(t,e){const s=Qt();return Rt({mutationKey:Ob,retry:(n,i)=>ZT(i)&&n<6,retryDelay:n=>Yc(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&Vh.clear(n.virtualMcpId,n.branch);const i=JT(n),o=Sd.get(i);if(o)return o;const l=(async()=>(await XT(t,"SANDBOX_START",n)).structuredContent)();Sd.set(i,l);try{return await l}finally{Sd.get(i)===l&&Sd.delete(i)}},onSuccess:()=>{hc(s),e?.onStarted?.()}})}function eE(t,e){const s=z.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:Ob,predicate:o=>{if(!t)return!1;const l=o.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],fj(n)>0}function v2(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function tE(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function sE(t){const e=t.mainParamValue===0?"0":t.mainParamValue,s=t.entityMetadata?.defaultMainView??null,n=s==null||s.type==="chat",i=t.mainParamPresent?e!=="0":!n,o=n||t.entityMetadata?.chatDefaultOpen?"chat":null,l=t.sidePanelParamPresent?t.sidePanelParamValue===0?null:t.sidePanelParamValue??null:o;return tE({sidePanel:l,mainOpen:i})}function j9(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?v2("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?v2("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function nE(t){return t.sidePanel!==null&&t.mainOpen?{side:33,main:67}:t.sidePanel!==null?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function iE(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function rE(t,e){const s=It(),n=qr({strict:!1}),i=r0({strict:!1}),{create:o}=Uc(),{threads:l}=Zw(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,u=n.main===0?"0":n.main,{sidePanel:h,mainOpen:f}=sE({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:u,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:h,mainOpen:f},p=V.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=N=>({org:c,taskId:N}),v=d?{virtualmcpid:a}:{},y=(N,C)=>{s({to:x,params:b(g),search:A=>({...A,...N}),replace:C?.replace??!1})};return{taskId:g,sidePanel:h,mainOpen:f,mainParam:u,setTaskId:(N,C)=>{s({to:x,params:b(N),search:A=>{const P={};return C?P.virtualmcpid=C:d&&(P.virtualmcpid=a),P}})},toggleMain:()=>{const N=j9({type:"toggleMain",openMainValue:Ya(t)},m);N&&y(N,{replace:!0})},toggleSidePanel:N=>{const C=j9({type:"toggleSidePanel",sidePanel:N},m);C&&y(C,{replace:!0})},setMobileSurface:N=>{const C=u&&u!=="0"?u:Ya(t);y(iE(N,C),{replace:!0})},openSidePanel:N=>{const C=j9({type:"openSidePanel",sidePanel:N},m);C&&y(C,{replace:!0})},createNewTask:async()=>{const N=crypto.randomUUID(),C=l.find(A=>A.id===g)?.branch??null;try{await o({id:N,virtual_mcp_id:a,...C?{branch:C}:{}})}catch{}s({to:x,params:b(N),search:A=>({...v})})},openTab:N=>{y({main:N==="0"?0:N},{replace:!0})}}}function oE(t){const e=z.c(10),{org:s}=Me(),n=c1(),{data:i}=Ui.useSession(),o=i?.user?.id,l=t?.id??null,a=!!t&&!!o&&!!t.created_by&&t.created_by!==o;let c;e[0]!==s.id||e[1]!==l?(c=Fe.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],xt(h)}function lE(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function aE(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function cE(t){return t/100*window.innerHeight}function dE(t){return t/100*window.innerWidth}function uE(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 Ia({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=uE(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=aE(e,i);break}case"em":{n=lE(e,i);break}case"vh":{n=cE(i);break}case"vw":{n=dE(i);break}}return n}function dn(t){return parseFloat(t.toFixed(3))}function Rl({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 Th(t){const{panels:e}=t,s=Rl({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:o}=n;let l=0;if(o.collapsedSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=dn(u/s*100)}let a;if(o.defaultSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=dn(u/s*100)}let c=0;if(o.minSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.minSize});c=dn(u/s*100)}let d=100;if(o.maxSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.maxSize});d=dn(u/s*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Ot(t,e="Assertion error"){if(!t)throw Error(e)}function Eh(t,e){return Array.from(e).sort(t==="horizontal"?hE:fE)}function hE(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function fE(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function zb(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function Fb(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 mE({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,o=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=Fb(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Ot(i,"No rect found"),i}let kd;function pE(){return kd===void 0&&(typeof matchMedia=="function"?kd=!!matchMedia("(pointer:coarse)").matches:kd=!1),kd}function Ub(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=Eh(s,Array.from(e.children).filter(zb).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 o)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 o)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let y;if(c){const _=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),L=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{y=[_,L];break}case 1:{const w=m[0],S=mE({orientation:s,rects:[b,v],targetRect:w.element.getBoundingClientRect()});y=[w,S===b?L:_];break}default:{y=m;break}}}else m.length?y=m:y=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const _ of y){let L="width"in _?_:_.element.getBoundingClientRect();const w=pE()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(L.width<w){const k=w-L.width;L=new DOMRect(L.x-k/2,L.y,L.width+k,L.height)}if(L.height<w){const k=w-L.height;L=new DOMRect(L.x,L.y-k/2,L.width,L.height+k)}const S=p<=d||p>u;!a&&!S&&l.push({group:t,groupSize:Rl({group:t}),panels:[f,x],separator:"width"in _?void 0:_,rect:L}),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 Kb=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,o=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){o===null&&(i=!0,o=d)}}if(i)throw o}}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)}}},wl={cursorFlags:0,state:"inactive"};const em=new Kb;function ko(){return wl}function gE(t){return em.addListener("change",t)}function xE(t){const e=wl,s={...wl};s.cursorFlags=t,wl=s,em.emit("change",{prev:e,next:s})}function Sl(t){const e=wl;wl=t,em.emit("change",{prev:e,next:t})}const bE=t=>t,C9=()=>{},Hb=1,Wb=2,qb=4,Gb=8,y2=3,_2=12;let jd;function L2(){return jd===void 0&&(jd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(jd=!0)),jd}function vE({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&L2()){const o=(t&Hb)!==0,l=(t&Wb)!==0,a=(t&qb)!==0,c=(t&Gb)!==0;if(o)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 L2()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const w2=new WeakMap;function tm(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=w2.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=ko();switch(n.state){case"active":case"hover":{const i=vE({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(e===o)return;e=o,i?s.cssRules.length===0?s.insertRule(o):s.replaceSync(o):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}w2.set(t,{prevStyle:e,styleSheet:s})}let ji=new Map;const Yb=new Kb;function yE(t){ji=new Map(ji),ji.delete(t)}function S2(t,e){for(const[s]of ji)if(s.id===t)return s}function Mr(t,e){for(const[s,n]of ji)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function Oo(){return ji}function sm(t,e){return Yb.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function fr(t,e,s){const n=ji.get(t);ji=new Map(ji),ji.set(t,e),Yb.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function Qb(t){const e=ko();let s=!1;return e.state==="active"&&(Sl({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(tm(t),s=!0,e.hitRegions.forEach(n=>{const i=Mr(n.group.id,!0);fr(n.group,i,{isUserInteraction:!0})}))),s}function k2(t){t.defaultPrevented||Qb(t.currentTarget)}function _E(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=Fb(s,o.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=o,i=l);break}case"vertical":{l.y<=i.y&&(n=o,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function LE(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function wE(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:N2(t),b:N2(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Ot(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:C2(j2(s.a)),b:C2(j2(s.b))};if(i.a===i.b){const o=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=o.length;for(;a--;){const c=o[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const SE=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function kE(t){const e=getComputedStyle(Xb(t)??t).display;return e==="flex"||e==="inline-flex"}function jE(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||kE(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"||SE.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function j2(t){let e=t.length;for(;e--;){const s=t[e];if(Ot(s,"Missing node"),jE(s))return s}return null}function C2(t){return t&&Number(getComputedStyle(t).zIndex)||0}function N2(t){const e=[];for(;t;)e.push(t),t=Xb(t);return e}function Xb(t){const{parentNode:e}=t;return LE(e)?e.host:e}function CE(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 NE({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!zb(s)||s.contains(t)||t.contains(s))return!0;if(wE(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(CE(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function nm(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=Ub(i),l=_E(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&NE({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function VE(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 nn(t,e,s=0){return Math.abs(dn(t)-dn(e))<=s}function bi(t,e){return nn(t,e)?0:t>e?1:-1}function vl({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(bi(n,c)<0)if(o){const d=(i+c)/2;bi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=dn(n),n}function Ac({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(nn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Ot(u!=null,"Invalid first pivot index"),Ot(h!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?h:u,x=s[g];Ot(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const _=a[g];if(Ot(_!=null,`Previous layout not found for panel index ${g}`),nn(_,b)){const L=y-_;bi(L,Math.abs(t))>0&&(t=t<0?0-L:L)}}}{const g=t<0?u:h,x=s[g];Ot(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const _=a[g];if(Ot(_!=null,`Previous layout not found for panel index ${g}`),nn(_,y)){const L=_-b;bi(L,Math.abs(t))>0&&(t=t<0?0-L:L)}}}break}default:{const g=t<0?h:u,x=s[g];Ot(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:y,minSize:_}=x;if(v&&bi(b,_)<0)if(t>0){const L=_-y,w=L/2,S=b+t;bi(S,_)<0&&(t=bi(t,w)<=0?0:L)}else{const L=_-y,w=100-L/2,S=b-t;bi(S,_)<0&&(t=bi(100+t,w)>0?0:-L)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const y=a[x];Ot(y!=null,`Previous layout not found for panel index ${x}`);const _=vl({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:y,size:100})-y;if(b+=_,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Ot(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,y=vl({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!nn(b,y)&&(f+=b-y,d[g]=y,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(VE(c,d))return i;{const g=t<0?h:u,x=a[g];Ot(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=vl({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!nn(v,b)){let y=b-v,_=t<0?h:u;for(;_>=0&&_<s.length;){const L=d[_];Ot(L!=null,`Previous layout not found for panel index ${_}`);const w=L+y,S=vl({overrideDisabledPanels:l,panelConstraints:s[_],prevSize:L,size:w});if(nn(L,S)||(y-=S-L,d[_]=S),nn(y,0))break;t>0?_--:_++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!nn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function jo(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||bi(t[s],e[s])!==0)return!1;return!0}function Co({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(!nn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Ot(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let o=0;for(let a=0;a<e.length;a++){const c=s[a];Ot(c!=null,`No layout data found for index ${a}`);const d=n[a];Ot(d!=null,`No layout data found for index ${a}`);const u=vl({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(o+=d-u,n[a]=u)}if(!nn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Ot(c!=null,`No layout data found for index ${a}`);const d=c+o,u=vl({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(o-=u-c,n[a]=u,nn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function Jb({groupId:t,panelId:e}){const s=()=>{const c=Oo();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}`)},o=()=>{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=o(),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 v=h[b];return v?.collapsible&&nn(v.collapsedSize,u[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+u[v.id],0);return{...u,[e]:dn(100-x)}}return Ac({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=o();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=Co({layout:x,panelConstraints:h});jo(p,b)||fr(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=o();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=o();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=o();return c&&nn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=Rl({group:d}),f=Ia({groupSize:h,panelElement:u,styleProp:c}),m=dn(f/h*100);a(m)}}}function V2(t){if(t.defaultPrevented)return;const e=Oo();nm(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,o=Jb({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function lu(t){const e=Oo();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 Zb({groupId:t}){const e=()=>{const s=Oo();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:o,groupSize:l,layout:a,separatorToPanels:c}=e(),d=Co({layout:s,panelConstraints:i});return n?a:(jo(a,d)||fr(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function no(t,e){const s=lu(t),n=Mr(s.id,!0),i=s.separators.find(u=>u.element===t);Ot(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Ot(o,"Matching panels not found");const l=o.map(u=>s.panels.indexOf(u)),a=Zb({groupId:s.id}).getLayout(),c=Ac({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=Co({layout:c,panelConstraints:n.derivedPanelConstraints});jo(a,d)||fr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function T2(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=lu(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&no(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&no(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&no(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&no(e,-5);break}case"End":{t.preventDefault(),no(e,100);break}case"Enter":{t.preventDefault();const n=lu(e),i=Mr(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Ot(c,"Matching separator not found");const d=a.get(c);Ot(d,"Matching panels not found");const u=d[0],h=o.find(f=>f.panelId===u.id);if(Ot(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;no(e,m-f)}break}case"F6":{t.preventDefault();const n=lu(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Ot(i!==null,"Index not found");const o=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[o].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),no(e,-100);break}}}function E2(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=Oo(),s=nm(t,e),n=new Map;let i=!1;s.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(o.group);l&&n.set(o.group,l.layout)}),Sl({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function ev({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,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;o?f==="horizontal"?g=(e.clientX-o.x)/h*100:g=(e.clientY-o.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:v,derivedPanelConstraints:y,groupSize:_,layout:L,separatorToPanels:w}=b;if(y&&L&&w){const S=Ac({delta:g,initialLayout:x,panelConstraints:y,pivotIndices:d.panels.map(k=>m.indexOf(k)),prevLayout:L,trigger:"mouse-or-touch"});if(jo(S,L)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?Hb:Wb;break}case"vertical":{a|=g<0?qb:Gb;break}}}else fr(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:y,groupSize:_,layout:S,separatorToPanels:w})}});let c=0;e.movementX===0?c|=l&y2:c|=a&y2,e.movementY===0?c|=l&_2:c|=a&_2,xE(c),tm(t)}function A2(t){const e=Oo(),s=ko();s.state==="active"&&ev({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function P2(t){if(t.defaultPrevented)return;const e=ko(),s=Oo();switch(e.state){case"active":{if(t.buttons===0){Sl({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=Mr(n.group.id,!0);fr(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)}ev({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=nm(t,s);n.length===0?e.state!=="inactive"&&Sl({cursorFlags:0,state:"inactive"}):Sl({cursorFlags:0,hitRegions:n,state:"hover"}),tm(t.currentTarget);break}}}function R2(t){t.relatedTarget instanceof HTMLIFrameElement&&ko().state==="hover"&&Sl({cursorFlags:0,state:"inactive"})}function D2(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||Qb(t.currentTarget)&&t.preventDefault()}function I2(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=dn(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=dn((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=o)}return n}function TE(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Rl({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:dn(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function EE(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 AE({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,o=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=dn(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),o+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),o>0)for(const h of c){const f=n[h]??0;u[h]=dn(f/o*d)}else{const h=dn(d/c.length);for(const f of c)u[f]=h}return u}function PE(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 al=new Map;function RE(t){let e=!0;Ot(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,o=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Rl({group:t});if(v===0)return;const y=Mr(t.id);if(!y)return;const _=Th(t),L=y.defaultLayoutDeferred?I2(_):y.layout,w=AE({group:t,nextGroupSize:v,prevGroupSize:y.groupSize,prevLayout:L}),S=Co({layout:w,panelConstraints:_});if(!y.defaultLayoutDeferred&&jo(y.layout,S)&&EE(y.derivedPanelConstraints,_)&&y.groupSize===v)return;fr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:_,groupSize:v,layout:S,separatorToPanels:y.separatorToPanels})}}else TE(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Ot(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&o.observe(p.element)});const l=Rl({group:t}),a=Th(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(PE(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??I2(a),h=Co({layout:u,panelConstraints:a}),f=t.element.ownerDocument;al.set(f,(al.get(f)??0)+1);const m=new Map;return Ub(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),fr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Ot(!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",T2)}),al.get(f)===1&&(f.addEventListener("contextmenu",k2,!0),f.addEventListener("dblclick",V2,!0),f.addEventListener("pointerdown",E2,!0),f.addEventListener("pointerleave",A2),f.addEventListener("pointermove",P2),f.addEventListener("pointerout",R2),f.addEventListener("pointerup",D2,!0)),function(){e=!1,al.set(f,Math.max(0,(al.get(f)??0)-1)),yE(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",T2)}),al.get(f)||(f.removeEventListener("contextmenu",k2,!0),f.removeEventListener("dblclick",V2,!0),f.removeEventListener("pointerdown",E2,!0),f.removeEventListener("pointerleave",A2),f.removeEventListener("pointermove",P2),f.removeEventListener("pointerout",R2),f.removeEventListener("pointerup",D2,!0)),o.disconnect()}}function DE(){const[t,e]=V.useState({}),s=V.useCallback(()=>e({}),[]);return[t,s]}function im(t){const e=V.useId();return`${t??e}`}const Bo=typeof window<"u"?V.useLayoutEffect:V.useEffect;function Za(t){const e=V.useRef(t);return Bo(()=>{e.current=t},[t]),V.useCallback((...s)=>e.current?.(...s),[e])}function rm(...t){return Za(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function om(t){const e=V.useRef({...t});return Bo(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const tv=V.createContext(null);function IE(t,e){const s=V.useRef({getLayout:()=>({}),setLayout:bE});V.useImperativeHandle(e,()=>s.current,[]),Bo(()=>{Object.assign(s.current,Zb({groupId:t}))})}function sv({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=V.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Za(N=>{jo(p.current.onLayoutChange,N)||(p.current.onLayoutChange=N,c?.(N))}),x=Za((N,C)=>{jo(p.current.onLayoutChanged,N)||(p.current.onLayoutChanged=N,d?.(N,{isUserInteraction:C}))}),b=im(a),v=V.useRef(null),[y,_]=DE(),L=V.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),w=rm(v,o);IE(b,l);const S=Za((N,C)=>{const A=ko(),P=S2(N),R=Mr(N);if(R){let E=!1;return A.state==="active"&&(E=A.hitRegions.some(M=>M.group===P)),{flexGrow:R.layout[C]??1,pointerEvents:E?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),k=om({defaultLayout:s,disableCursor:n}),j=V.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:S,id:b,orientation:u,registerPanel:N=>{const C=L.current;return C.panels=Eh(u,[...C.panels,N]),_(),()=>{C.panels=C.panels.filter(A=>A!==N),_()}},registerSeparator:N=>{const C=L.current;return C.separators=Eh(u,[...C.separators,N]),_(),()=>{C.separators=C.separators.filter(A=>A!==N),_()}},updatePanelProps:(N,{disabled:C})=>{const A=L.current.panels.find(E=>E.id===N);A&&(A.panelConstraints.disabled=C);const P=S2(b),R=Mr(b);P&&R&&fr(P,{...R,derivedPanelConstraints:Th(P)})},updateSeparatorProps:(N,{disabled:C,disableDoubleClick:A})=>{const P=L.current.separators.find(R=>R.id===N);P&&(P.disabled=C,P.disableDoubleClick=A)}}),[S,b,_,u,k]),T=V.useRef(null);return Bo(()=>{const N=v.current;if(N===null)return;const C=L.current;let A;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===C.panels.length){A={};for(const O of C.panels){const D=k.defaultLayout[O.id];D!==void 0&&(A[O.id]=D)}}const P={disabled:!!i,element:N,id:b,mutableState:{defaultLayout:A,disableCursor:!!k.disableCursor,expandedPanelSizes:L.current.lastExpandedPanelSizes,layouts:L.current.layouts},orientation:u,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};T.current=P;const R=RE(P),{defaultLayoutDeferred:E,derivedPanelConstraints:M,layout:I}=Mr(P.id,!0);!E&&M.length>0&&(g(I),x(I,!1));const $=sm(b,O=>{const{defaultLayoutDeferred:D,derivedPanelConstraints:B,layout:F}=O.next;if(D||B.length===0)return;const U=P.panels.map(({id:W})=>W).join(",");P.mutableState.layouts[U]=F,B.forEach(W=>{if(W.collapsible){const{layout:q}=O.prev??{};if(q){const ee=nn(W.collapsedSize,F[W.panelId]),X=nn(W.collapsedSize,q[W.panelId]);ee&&!X&&(P.mutableState.expandedPanelSizes[W.panelId]=q[W.panelId])}}});const H=ko().state!=="active";g(F),H&&x(F,O.isUserInteraction)});return()=>{T.current=null,R(),$()}},[i,b,x,g,u,y,k]),V.useEffect(()=>{const N=T.current;N&&(N.mutableState.defaultLayout=s,N.mutableState.disableCursor=!!n)}),r.jsx(tv.Provider,{value:j,children:r.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:w,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})})}sv.displayName="Group";function lm(){const t=V.useContext(tv);return Ot(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function ME(t,e){const{id:s}=lm(),n=V.useRef({collapse:C9,expand:C9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:C9});V.useImperativeHandle(e,()=>n.current,[]),Bo(()=>{Object.assign(n.current,Jb({groupId:s,panelId:t}))})}function nv({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:o,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=im(c),b=om({disabled:o}),v=V.useRef(null),y=rm(v,l),{getPanelStyles:_,id:L,orientation:w,registerPanel:S,updatePanelProps:k}=lm(),j=h!==null,T=Za((P,R,E)=>{h?.(P,c,E)});Bo(()=>{const P=v.current;if(P!==null){const R={element:P,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?T:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return S(R)}},[a,s,n,i,j,x,g,d,u,T,S,b]),V.useEffect(()=>{k(x,{disabled:o})},[o,x,k]),ME(x,f);const N=()=>{const P=_(L,x);if(P)return JSON.stringify(P)},C=V.useSyncExternalStore(P=>sm(L,P),N,N);let A;return C?A=JSON.parse(C):i!==void 0?A={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:A={flexGrow:1},r.jsx("div",{...p,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:y,style:{...$E,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...A},children:r.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:w==="horizontal"?"pan-y":"pan-x"},children:t})})}nv.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 OE({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,o;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];o=Co({layout:Ac({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=Co({layout:Ac({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function iv({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=im(o),d=om({disabled:s,disableDoubleClick:n}),[u,h]=V.useState({}),[f,m]=V.useState("inactive"),[p,g]=V.useState(!1),x=V.useRef(null),b=rm(x,i),{disableCursor:v,id:y,orientation:_,registerSeparator:L,updateSeparatorProps:w}=lm(),S=_==="horizontal"?"vertical":"horizontal";Bo(()=>{const T=x.current;if(T!==null){const N={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:T,id:c},C=L(N),A=gE(R=>{m(R.next.state!=="inactive"&&R.next.hitRegions.some(E=>E.separator===N)?R.next.state:"inactive")}),P=sm(y,R=>{const{derivedPanelConstraints:E,layout:M,separatorToPanels:I}=R.next,$=I.get(N);if($){const O=$[0],D=$.indexOf(O);h(OE({layout:M,panelConstraints:E,panelId:O.id,panelIndex:D}))}});return()=>{A(),P(),C()}}},[y,c,L,d]),V.useEffect(()=>{w(c,{disabled:s,disableDoubleClick:n})},[s,n,c,w]);let k;s&&!v&&(k="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":S,"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})}iv.displayName="Separator";function rv(t){const e=z.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 o;e[4]!==s?(o=ie("flex h-full w-full",s),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==o?(l=r.jsx(sv,{groupRef:i,"data-slot":"resizable-panel-group",className:o,...n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function Vu(t){const e=z.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 o;e[4]!==i?(o={overflow:"hidden",...i},e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==o?(l=r.jsx(nv,{panelRef:n,"data-slot":"resizable-panel",style:o,...s}),e[6]=s,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function ov(t){const e=z.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 o;e[4]!==s?(o=ie("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]=o):o=e[5];let l;e[6]!==i?(l=i&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(Hl,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==o||e[10]!==l?(a=r.jsx(iv,{"data-slot":"resizable-handle",className:o,...n,children:l}),e[8]=n,e[9]=o,e[10]=l,e[11]=a):a=e[11],a}function M2(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function BE(t,e){const s=z.c(8);let n;s[0]!==e?(n=c=>M2(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=p4(t,n);let l;s[2]!==e||s[3]!==i?(l=M2(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==o||s[6]!==l?(a=[l,o],s[5]=o,s[6]=l,s[7]=a):a=s[7],a}const zE=33;function FE(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Jf.sidePanelWidth(),t[0]=e):e=t[0],BE(e,zE)}function $2(){const t=z.c(3),[e,s]=V.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 o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function lv(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function zo(t){const e=lv(t);if(e)throw new Error(e)}function UE(t){try{return JSON.parse(t)}catch{return null}}function KE(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,n=s?UE(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function eo(t){const e=KE(t);return e===null?null:e}function av(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function HE(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=av(s);return!n||!s?null:{number:n,htmlUrl:s}}function O2(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const B2=/[\r\n<>]/,WE=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function td(t){const e=t?.userName?.trim();if(!e||B2.test(e))return null;const s=t?.userEmail?.trim();return!s||B2.test(s)?{userName:e}:WE.test(s)?{userName:e,userEmail:s}:{userName:e}}function qE(t){return t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-3J6fiIE3.js","assets/index-BLQzaBqp.js","assets/index-CkfEv7OJ.css","assets/ChevronDown-Cy4TAhau.js","assets/agent-icon-IchZk8Sr.js","assets/AlertCircle-CrPTg7No.js","assets/Tool01-BQBlAfKK.js","assets/ArrowUp-CIA12Ft8.js","assets/Settings02-Cd96ZcWx.js","assets/Tool02-EfT7Aj_N.js","assets/XCircle-CPiaBR9U.js","assets/ArrowUpRight-BXb5bWZv.js","assets/TrendUp01--l5g3LV7.js","assets/ZapSquare-p78bcJrZ.js","assets/Users03-89bzO49O.js","assets/CheckCircle-CBgF5Rm2.js","assets/Check-BnRBTd85.js","assets/ChevronRight-De_XPs2J.js","assets/ChevronUp-MtxRwI_P.js","assets/DotsVertical-D1sFRI3y.js","assets/Stars02-B4nh6_6J.js","assets/Copy01-Cna9zOFE.js","assets/CpuChip01-BTs5EmAK.js","assets/CreditCard01-D5vSzbnW.js","assets/Eye-D3Qlftta.js","assets/FilterLines-BWJyLICS.js","assets/Star01-BdbwBCs_.js","assets/Palette-Ct5N9Uum.js","assets/SwitchHorizontal01-BQASu3Ld.js","assets/HardDrive-CnGIgAcW.js","assets/Key01-BtzimodV.js","assets/LayoutLeft-Bok-19yc.js","assets/LinkExternal01-DRRE-MEW.js","assets/LogOut01-XC88FbH6.js","assets/Monitor01-C0_dBUR9.js","assets/Sun-C1gnjPxJ.js","assets/Play-B9tb-IAb.js","assets/Plus-cYmSDHgU.js","assets/SearchLg-Be_T2R0D.js","assets/SearchMd-CIqlXmg-.js","assets/Shield01-g9Pmi2fz.js","assets/Stars01-4Xp1dlQa.js","assets/Trash01-qhWeifH9.js","assets/Upload01-DB8t6fYP.js","assets/User01-PQ_zrkhy.js","assets/Users01-D0oW6faK.js","assets/XClose-BBgkL7xx.js","assets/X-XOpfjAzX.js","assets/Zap-B3YPgxSD.js","assets/automation-runs-rqNz0rC6.js","assets/select-BnjaOaK4.js","assets/tooltip-pEMnAu2z.js","assets/useInfiniteQuery-CeMD7BLn.js","assets/use-infinite-scroll-COkSGeCQ.js","assets/use-connection-Bpd3SbKJ.js","assets/use-mcp-client-D3_O582k.js","assets/auth-RIRzVJ_F.js","assets/use-virtual-mcp-uyaNdGW1.js","assets/card-BM5YAxhc.js","assets/sidebar-CYolSc7W.js","assets/use-mobile-8cBnDbFR.js","assets/table--uMbezaR.js","assets/empty-state-BT3eZ3t6.js","assets/use-members-DpL8h_63.js","assets/use-org-auth-client-c30FIVxP.js","assets/use-clock-tick-CaQwC1ct.js","assets/use-automations-BnYeuFV5.js","assets/studio-tools-CqkAaE56.js","assets/useSuspenseInfiniteQuery-Dvl3BS-i.js","assets/avatar-DTYC3n17.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-CCO4IbpG.js","assets/dialog-C14SMLwt.js","assets/tab-id-C_Nz879h.js","assets/hooks-DF_D3yjz.js","assets/decopilot-sse-pool-YrN0OqM2.js","assets/backoff-CrEUbyZT.js","assets/delay-CnY5UFtP.js","assets/chat-context-C2dsySEt.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-ai-providers-CF0wvQRN.js","assets/use-decopilot-events-Ba_nm49q.js","assets/use-organization-settings-DTbPHIkP.js","assets/monaco-editor-B_CX8Zr7.js","assets/spinner-Cpm_FgXI.js","assets/index-CqgMAdZ1.js","assets/shell-layout-D674F3MK.js","assets/required-auth-layout-COsg3fQu.js","assets/use-org-sso-CqyBFPOS.js","assets/integration-icon-MYUnDpsF.js","assets/use-navigate-to-agent-Cajm0dwo.js","assets/reusable-new-chat-CouMjkYR.js","assets/AreaChart-tiBy2zpY.js","assets/form-CDwptF3_.js","assets/label-BshhAzRV.js","assets/input-DqRWUg_X.js","assets/dropdown-menu-Cza4sblW.js","assets/page-seo-form-CqPX9GFP.js","assets/switch-2Gbfs8A3.js","assets/use-section-preview-base-B5R928ud.js","assets/drawer-BlwkhsOh.js","assets/collection-search-B4aAzdt3.js","assets/tabs-AF9xbuOq.js","assets/toggle-group-Cz-Qz3yI.js","assets/use-deco-credits-ia60QQ_5.js","assets/popover-Bx5oqEx8.js","assets/alert-dialog-DNVAKC3E.js","assets/toolbar-7SzUuTow.js","assets/skeleton-kylkRkJL.js","assets/github-repo-picker-CscDiobR.js","assets/use-debounced-value-DRt9VufC.js","assets/authenticate-and-persist-oauth-DTJQ2RW5.js","assets/mcp-oauth-4WKZZaaI.js","assets/use-mcp-tools-CYCyBiDo.js","assets/extract-connection-data-DAdthAVN.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-ufuvpGD9.js","assets/agent-capabilities-cXfbMfjV.js","assets/connection-card-CcOb_S6j.js","assets/use-registry-connections-CIDSY_R4.js","assets/retry-CErkP7V6.js","assets/connection-slug-eyAPH6o3.js","assets/textarea-CaGR5BSW.js","assets/connection-form-helpers-CN2A1A9y.js","assets/collection-tabs-E2Di7cti.js","assets/badge-7qIblq2m.js","assets/use-open-billing-url-BY0R7rhj.js","assets/select-model-bGvPj-Yy.js","assets/checkbox-DUTZPi5Z.js","assets/ai-providers-logos-DD3qZ33J.js","assets/settings-section-dCOi8NXz.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-CU1P-DAS.js","assets/deco-site-production-url-CaKZ7xBn.js","assets/use-capability-Mrgv-isI.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-ZN-fh-JT.js","assets/index-TC3tVDwp.js","assets/search-input-p8Zj-yoq.js","assets/index-BTG8kyya.js","assets/use-secrets-C9EtgdjO.js","assets/self-tool-result-DY6Cs88K.js","assets/use-tags-CvxWwuAD.js","assets/get-initials-D-f_fDFw.js","assets/command-DLmCdwW8.js","assets/index-DZO0tTUF.js","assets/use-file-configs-CK7ilKFm.js","assets/automation-list-row-LBe18aeG.js","assets/file-explorer-BDrfu6vK.js","assets/app-editor-FaPWiBOg.js","assets/post-editor-CRsA4SKG.js","assets/multi-select-CrbmnexR.js","assets/block-document-BELebIgi.js","assets/primitives-BZta1p6M.js","assets/use-autosave-GVMngDQ5.js","assets/record-editor-D99pxZjJ.js","assets/category-editor--8nv-lbZ.js","assets/bulk-category-panel-BT_WoOli.js","assets/seo-editor-DlrMfO0C.js","assets/variant-calendar-DW0WI87W.js","assets/view-mode-toggle-DJEb-NoL.js","assets/redirect-editor-BpmIW6_k.js","assets/project-app-view-Bupj8bfK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as Qt,r as V,X as rL,Y as oL,c as z,F as Me,m as ie,j as r,E as Fs,b as se,t as me,Z as ei,_ as lL,$ as Gs,a0 as Xf,G as Jf,B as ae,a1 as Zf,a2 as h4,a3 as aL,a4 as cL,v as mr,a5 as Ss,a6 as uo,a7 as zp,d as It,e as Rt,p as Je,a8 as dL,z as Do,a9 as uL,aa as f4,ab as hL,ac as vi,ad as p9,ae as bn,af as fL,ag as g9,ah as mL,ai as pL,aj as gL,ak as xL,x as e1,K as Fe,al as bL,am as vL,an as yL,ao as _L,ap as m4,aq as Ga,n as xt,k as it,a as Ui,y as Bc,ar as hc,u as qr,f as r0,I as p4,as as LL,L as wL,at as g4,au as x4,av as vn,aw as pt,ax as b4,ay as v4,az as y4,aA as _4,aB as L4,aC as w4,aD as S4,aE as k4,aF as j4,aG as Sn,aH as C4,aI as SL,aJ as kL,aK as N4,aL as jL,aM as CL,aN as NL,aO as VL,aP as Aa,aQ as TL,W as EL}from"./index-BLQzaBqp.js";import{i as o0,n as AL}from"./ArrowUp-CIA12Ft8.js";import{u as Gr,a as qn,b as Qs,c as V4,s as PL,d as RL,e as DL,f as IL,g as ML,h as $L,i as OL,j as t1,k as zl,A as BL,l as zL,m as FL,p as T4,V as UL,E as l0,S as E4,n as Tl,t as KL,o as HL,q as a0,r as Xt,v as El,H as fc,w as mc,x as ll,y as A4,z as P4,B as WL}from"./chat-context-C2dsySEt.js";import{c as c0,s as Fl,g as Ni,P as pc,d as s1,t as yo,a as qL,M as GL,i as YL,b as hr,e as d0,f as QL,D as XL,h as JL,j as ZL,k as Al,l as ew,m as tw,u as n1,E as sw,n as zc,o as nw,F as iw,p as i1,q as r1,r as R4,S as rw,v as ow,w as lw,x as aw,y as Fp,z as cw,A as D4,O as dw,B as yn,C as Yr,G as _i,H as uw,T as I4,I as x9,J as Pa,K as hw,L as fw,N as M4,Q as mw,R as Ki,U as pw,V as gw,W as $4,X as Zi,Y as xw,Z as ha,_ as bw,$ as O4,a0 as B4,a1 as o1,a2 as z4,a3 as vw,a4 as yw,a5 as _w,a6 as Qr,a7 as l1,a8 as Lw,a9 as ww,aa as F4,ab as Sw,ac as kw,ad as jw,ae as Cw,af as Nw,ag as Vw,ah as Tw,ai as Ew,aj as U4,ak as Aw}from"./automation-runs-rqNz0rC6.js";import{S as _o}from"./spinner-Cpm_FgXI.js";import{b as Lo,T as We,a as qe,c as Ge}from"./tooltip-pEMnAu2z.js";import{a as os,b as At,d as jt,e as Ct,h as _n,c as In,i as K4}from"./dialog-C14SMLwt.js";import{c as Pw,b as u0,a as h0,D as f0,d as H4,e as Rw,f as Dw}from"./drawer-BlwkhsOh.js";import{C as Iw}from"./collection-search-B4aAzdt3.js";import{u as Xr}from"./use-mobile-8cBnDbFR.js";import{a as Ul,u as Pt,i as vu,S as Io,b as Mw,c as $w,W as a1,d as Ow,C as yu,g as gc,e as W4,m as bh,f as Up,h as Bw,Q as zw,j as Fw,k as Uw,l as Kw}from"./use-mcp-client-D3_O582k.js";import{u as q4,g as Fc,l as vh,X as Hw,C as Ww,a as qw,A as Gw,b as Yw,c as Qw}from"./AreaChart-tiBy2zpY.js";import{t as fs}from"./ChevronDown-Cy4TAhau.js";import{i as hs}from"./X-XOpfjAzX.js";import{t as Xw,z as Jw,s as G4,b as Uc,c as c1,a as Zw,u as Y4}from"./hooks-DF_D3yjz.js";import{K as eS,i as Q4,u as Kl,a as X4,m as tS}from"./shell-layout-D674F3MK.js";import{w as J4,A as sS,r as Ya,a as nS,p as Z4,f as Qa,b as e5,c as t5,d as s5,e as iS,F as rS,g as oS,h as lS,j as aS,k as cS,l as dS,O as uS,m as hS,n as fS}from"./tab-id-C_Nz879h.js";import{n as Pl,b as n5}from"./ZapSquare-p78bcJrZ.js";import{i as Ut}from"./Check-BnRBTd85.js";import{s as Vi}from"./Star01-BdbwBCs_.js";import{a as Pi,i as m0,b as mS,c as d1,d as u1}from"./Tool01-BQBlAfKK.js";import{t as p0,h as i5,j as h1,k as Jr,l as r5,m as f1,n as o5,A as zr,o as l5,p as a5,q as pS,r as gS,c as c5,u as Kp,v as Hl,w as yd,x as xS,y as Ri,z as Di,B as Jn,C as bS,D as d5,E as vS,F as g0,G as Mo,H as yS,I as m1,J as u5,K as h5,L as yh,M as b9,N as Hp,g as p1,O as _S,P as LS,Q as wS,R as SS,S as kS,T as jS,U as g1,V as f5,W as Hi,X as x1,Y as b1,e as v1,Z as Kc,_ as m5,$ as p5,a0 as g5,a1 as $o,a2 as CS,a3 as y1,a4 as NS,d as x5,a5 as _1,a6 as x0,a7 as VS,a8 as TS,a9 as Xa,aa as ar,ab as L1,i as w1,ac as ES,ad as AS,ae as PS,af as RS,ag as or,ah as b5,ai as S1,aj as DS,ak as Wp,al as IS,am as MS,an as $S,ao as v5,ap as _u,aq as OS,ar as BS,as as zS,at as FS,au as qp,av as y5,aw as US,ax as KS,ay as HS,az as WS,aA as qS,aB as GS,aC as YS,aD as _5,aE as QS,aF as XS,aG as k1}from"./agent-icon-IchZk8Sr.js";import{i as Wn}from"./Upload01-DB8t6fYP.js";import{i as fn}from"./AlertCircle-CrPTg7No.js";import{a as on}from"./Copy01-Cna9zOFE.js";import{F as _h,a as j1,b as C1,c as N1,d as L5}from"./form-CDwptF3_.js";import{d as kt,S as xs,a as bs,b as js,c as vs}from"./select-BnjaOaK4.js";import{i as b0,a as JS,b as ZS}from"./Settings02-Cd96ZcWx.js";import{i as Zr,b as V1,a as ek}from"./XCircle-CPiaBR9U.js";import{T as go,a as Wl,b as Ti,c as Hc}from"./tabs-AF9xbuOq.js";import{t as Lh,i as kn,n as wo}from"./Tool02-EfT7Aj_N.js";import{a as T1,T as xc}from"./toggle-group-Cz-Qz3yI.js";import{I as rt}from"./input-DqRWUg_X.js";import{u as E1,b as A1,C as P1,a as tk,A as sk,N as nk}from"./use-deco-credits-ia60QQ_5.js";import{u as Cs}from"./studio-tools-CqkAaE56.js";import{u as w5}from"./use-open-billing-url-BY0R7rhj.js";import{s as ti}from"./XClose-BBgkL7xx.js";import{M as ik,a as rk,m as v0,i as ok,g as S5,b as lk,N as ak,c as ck}from"./select-model-bGvPj-Yy.js";import{a as us,b as ys,P as _s}from"./popover-Bx5oqEx8.js";import{t as cr}from"./Stars01-4Xp1dlQa.js";import{b as dk,a as Wc,c as k5,d as j5,u as Gp}from"./use-organization-settings-DTbPHIkP.js";import{u as y0,a as uk}from"./use-ai-providers-CF0wvQRN.js";import{a as qc,u as Hs,b as R1,c as hk}from"./use-virtual-mcp-uyaNdGW1.js";import{a as D1,g as Gc,b as C5,c as Ln,r as fk,f as mk,d as pk}from"./agent-capabilities-cXfbMfjV.js";import{c as qt,D as Gt,b as Yt,a as Ze,d as Li,e as wi,f as Si,g as wh,h as bc,i as ki,j as _d}from"./dropdown-menu-Cza4sblW.js";import{s as Nt}from"./Plus-cYmSDHgU.js";import{p as gk,q as xk}from"./question-004-sINsf4GQ.js";import{i as wn}from"./ChevronRight-De_XPs2J.js";import{u as _0}from"./use-is-desktop-app-BNujXJc_.js";import{i as Gn}from"./CheckCircle-CBgF5Rm2.js";import{I as ai}from"./integration-icon-MYUnDpsF.js";import{e as Yc}from"./backoff-CrEUbyZT.js";import{u as bk}from"./use-status-sounds-CU1P-DAS.js";import{E as Fr}from"./empty-state-BT3eZ3t6.js";import{T as Ra,a as vk}from"./toolbar-7SzUuTow.js";import{i as N5}from"./Monitor01-C0_dBUR9.js";import{u as Ii,a as I1,b as M1}from"./use-connection-Bpd3SbKJ.js";import{u as ql,a as $1,b as V5}from"./use-mcp-tools-CYCyBiDo.js";import{g as L0,M as yk}from"./index-CqgMAdZ1.js";import{s as w0,p as _k}from"./deco-site-production-url-CaKZ7xBn.js";import{u as Lk}from"./use-capability-Mrgv-isI.js";import{c as O1,s as S0,d as wk,b as Sk}from"./TrendUp01--l5g3LV7.js";import{n as hn}from"./LinkExternal01-DRRE-MEW.js";import{S as at}from"./skeleton-kylkRkJL.js";import{l as T5,w as kk,M as Qc,F as jk}from"./monaco-editor-B_CX8Zr7.js";import{i as E5}from"./LayoutLeft-Bok-19yc.js";import{i as Xc}from"./Key01-BtzimodV.js";import{p as Ck,f as Nk}from"./pt-BR-CLy76QW2.js";import{g as Vk,e as Tk}from"./extract-connection-data-DAdthAVN.js";import{A as Us}from"./avatar-DTYC3n17.js";import{a as Ek,i as Yp}from"./mcp-oauth-4WKZZaaI.js";import{g as vc,f as yc,b as _c,A as Lc,a as wc,e as Sc,c as kc,d as jc}from"./alert-dialog-DNVAKC3E.js";import{C as Lu,a as ho}from"./card-BM5YAxhc.js";import{L as Et}from"./label-BshhAzRV.js";import{S as Mi}from"./switch-2Gbfs8A3.js";import{T as Ur}from"./textarea-CaGR5BSW.js";import{i as So}from"./Play-B9tb-IAb.js";import{s as Ks}from"./Trash01-qhWeifH9.js";import{u as wu}from"./use-debounced-autosave-ZN-fh-JT.js";import{i as Cc}from"./SearchMd-CIqlXmg-.js";import{P as Zn}from"./index-TC3tVDwp.js";import{C as Gl}from"./checkbox-DUTZPi5Z.js";import{S as B1}from"./search-input-p8Zj-yoq.js";import{C as A5}from"./collection-tabs-E2Di7cti.js";import{T as P5,u as R5,I as Ak,R as Pk,a as Rk}from"./index-BTG8kyya.js";import{g as Dk,s as D5}from"./connection-slug-eyAPH6o3.js";import{d as Yl}from"./delay-CnY5UFtP.js";import{G as Kr,a as z1,u as Ik}from"./github-repo-picker-CscDiobR.js";import{s as Su}from"./User01-PQ_zrkhy.js";import{t as F1}from"./Users01-D0oW6faK.js";import{u as I5,a as M5}from"./use-secrets-C9EtgdjO.js";import{i as $5,a as k0}from"./DotsVertical-D1sFRI3y.js";import{u as Sh,b as kh,C as Mk,c as $k,p as Ok,a as Bk}from"./self-tool-result-DY6Cs88K.js";import{a as Jc}from"./format-time-BnbuEtat.js";import{i as O5}from"./ArrowUpRight-BXb5bWZv.js";import{f as B5,g as zk,a as Fk}from"./provision-repo-scoped-github-connection-ufuvpGD9.js";import{a as Uk}from"./authenticate-and-persist-oauth-DTJQ2RW5.js";import{u as j0,a as Kk}from"./use-members-DpL8h_63.js";import{m as Hk,n as Wk,o as qk,p as Gk,q as Yk,u as Qk}from"./sidebar-CYolSc7W.js";import{t as Xk,T as Jk,R as Zk,i as Nc,a as ej,S as cs,b as z5}from"./decopilot-sse-pool-YrN0OqM2.js";import{u as tj}from"./use-decopilot-events-Ba_nm49q.js";import{s as Zc}from"./Eye-D3Qlftta.js";import{u as sj}from"./use-copy-CCO4IbpG.js";import{i as U1,c as F5}from"./SwitchHorizontal01-BQASu3Ld.js";import{u as U5,a as nj,b as ij}from"./use-tags-CvxWwuAD.js";import{g as Rn}from"./get-initials-D-f_fDFw.js";import{d as Wi,a as si,c as Jt,b as ks,C as qi,e as pr,f as rj,g as Qp}from"./command-DLmCdwW8.js";import{i as K1}from"./FilterLines-BWJyLICS.js";import{i as C0}from"./SearchLg-Be_T2R0D.js";import{i as $i}from"./Zap-B3YPgxSD.js";import{a as ku}from"./Palette-Ct5N9Uum.js";import{u as K5}from"./use-debounced-value-DRt9VufC.js";import{u as oj,a as H5}from"./use-file-configs-CK7ilKFm.js";import{u as W5}from"./useInfiniteQuery-CeMD7BLn.js";import{B as lj}from"./badge-7qIblq2m.js";import{u as ed,a as aj,b as cj,c as dj,d as uj}from"./use-automations-BnYeuFV5.js";import{s as Ja}from"./Stars02-B4nh6_6J.js";import{A as hj}from"./automation-list-row-LBe18aeG.js";import{n as q5}from"./ChevronUp-MtxRwI_P.js";function fj(t,e){const s=Qt(e);return mj({filters:{...t,status:"pending"}},s).length}function Xp(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function mj(t={},e){const s=Qt(e).getMutationCache(),n=V.useRef(t),i=V.useRef(null);return i.current===null&&(i.current=Xp(s,t)),V.useEffect(()=>{n.current=t}),V.useSyncExternalStore(V.useCallback(o=>s.subscribe(()=>{const l=rL(i.current,Xp(s,n.current));i.current!==l&&(i.current=l,oL.schedule(o))}),[s]),()=>i.current,()=>i.current)}const Jp=3,G5="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",pj="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Y5(t){const e=z.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:o,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 S=Ni(c._meta);d=c.title??s1(c.name,S),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 S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=o||i,j=i&&"bg-accent/40",T=(o||i)&&"cursor-not-allowed opacity-50";let N;e[7]!==j||e[8]!==T?(N=ie(pj,"hover:bg-accent/60 text-foreground",j,T),e[7]=j,e[8]=T,e[9]=N):N=e[9];let C;e[10]!==u?(C=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=C):C=e[11];let A;e[12]!==i?(A=i&&r.jsx(_o,{size:"xs"}),e[12]=i,e[13]=A):A=e[13];let P;e[14]!==C||e[15]!==A?(P=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,A]}),e[14]=C,e[15]=A,e[16]=P):P=e[16];let R;e[17]!==h?(R=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=R):R=e[18];let E;return e[19]!==P||e[20]!==R||e[21]!==S||e[22]!==k||e[23]!==N?(E=r.jsxs("button",{type:"button",onClick:S,disabled:k,className:N,children:[P,R]}),e[19]=P,e[20]=R,e[21]=S,e[22]=k,e[23]=N,e[24]=E):E=e[24],E}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=o||i,p=i&&"bg-muted/50",g=(o||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(G5,"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=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(_o,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let y;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(y=r.jsx(We,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=y):y=e[40];const _=h??u;let L;e[41]!==_?(L=r.jsx(qe,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:_})}),e[41]=_,e[42]=L):L=e[42];let w;return e[43]!==y||e[44]!==L?(w=r.jsxs(Ge,{delayDuration:400,children:[y,L]}),e[43]=y,e[44]=L,e[45]=w):w=e[45],w}function gj(t){const e=z.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=se(),[c,d]=V.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(C=>{const A=c.toLowerCase();return C.prompt.name.toLowerCase().includes(A)||(C.prompt.title??"").toLowerCase().includes(A)||(C.prompt.description??"").toLowerCase().includes(A)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Xr();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&r.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]!==o){let C;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==o?(C=A=>r.jsx(Y5,{item:A,variant:"card",onSelect:P=>{i(!1),o(P)},isLoading:l?.name===A.prompt.name,isDisabled:u&&l?.name!==A.prompt.name},A.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=o,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.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 v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=C=>{C.key==="Escape"&&d("")},e[23]=y):y=e[23];let _;e[24]!==c||e[25]!==v?(_=r.jsx(Iw,{value:c,onChange:d,placeholder:v,onKeyDown:y}),e[24]=c,e[25]=v,e[26]=_):_=e[26];const L=_;if(m){let C;e[27]!==a?(C=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=C):C=e[28];let A;e[29]!==C?(A=r.jsx(Pw,{className:"sr-only",children:r.jsx(u0,{children:C})}),e[29]=C,e[30]=A):A=e[30];let P;e[31]!==a?(P=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=P):P=e[32];let R;e[33]!==P?(R=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:P})}),e[33]=P,e[34]=R):R=e[34];let E;e[35]!==b||e[36]!==L||e[37]!==R||e[38]!==A?(E=r.jsxs(h0,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[A,R,L,b]}),e[35]=b,e[36]=L,e[37]=R,e[38]=A,e[39]=E):E=e[39];let M;return e[40]!==i||e[41]!==n||e[42]!==E?(M=r.jsx(Lo,{delayDuration:400,children:r.jsx(f0,{open:n,onOpenChange:i,children:E})}),e[40]=i,e[41]=n,e[42]=E,e[43]=M):M=e[43],M}let w;e[44]!==a?(w=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=w):w=e[45];let S;e[46]!==w?(S=r.jsx(os,{className:"sr-only",children:r.jsx(At,{children:w})}),e[46]=w,e[47]=S):S=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=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let T;e[52]!==b||e[53]!==L||e[54]!==j||e[55]!==S?(T=r.jsxs(jt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,L,b]}),e[52]=b,e[53]=L,e[54]=j,e[55]=S,e[56]=T):T=e[56];let N;return e[57]!==i||e[58]!==n||e[59]!==T?(N=r.jsx(Lo,{delayDuration:400,children:r.jsx(Ct,{open:n,onOpenChange:i,children:T})}),e[57]=i,e[58]=n,e[59]=T,e[60]=N):N=e[60],N}function xj(t){const e=z.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=se(),[a,c]=V.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,Jp),v=s.slice(Jp),y=!!i;let _;e[10]!==y||e[11]!==i?.name||e[12]!==n?(_=w=>r.jsx(Y5,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:y&&i?.name!==w.prompt.name},w.prompt.name),e[10]=y,e[11]=i?.name,e[12]=n,e[13]=_):_=e[13];const L=b.map(_);d=Lo,m=400,e[14]!==o?(u=ie("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=u):u=e[15],h=L,f=v.length>0&&r.jsx("button",{type:"button",disabled:y,onClick:()=>c(!0),className:ie(G5,"hover:bg-muted/70 hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=o,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=r.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=r.jsx(gj,{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=r.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 bj(){return null}function vj(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 yj(t){const e=z.c(31),{connectionId:s}=t,n=se(),{sendMessage:i}=qn(),{org:o}=Me();let l;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(l={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=l):l=e[3];const a=Pt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=q4(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(_j),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]=V.useReducer(vj,p),[b,v]=V.useState(null);let y;e[11]!==a||e[12]!==i||e[13]!==n?(y=async(P,R)=>{if(!a){me.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const E=await Fc(a,P.name,R);x({type:"RESET"});const M={type:"doc",content:[{type:"paragraph",content:[c0({id:P.name,name:Fl(P.name,Ni(P._meta)),metadata:E.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await i(M)}catch(E){console.error("[ice-breakers] Failed to fetch prompt:",E),me.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=y):y=e[14];const _=y;let L;e[15]!==_?(L=async P=>{if(P.arguments&&P.arguments.length>0){x({type:"SELECT_PROMPT",prompt:P}),v(P);return}x({type:"START_LOADING",prompt:P}),await _(P)},e[15]=_,e[16]=L):L=e[16];const w=L;let S;e[17]!==b||e[18]!==_?(S=async P=>{b&&(x({type:"START_LOADING",prompt:b,arguments:P}),v(null),await _(b,P))},e[17]=b,e[18]=_,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let T;e[20]!==w||e[21]!==m||e[22]!==j?(T=r.jsx(xj,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=T):T=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{v(null),x({type:"RESET"})},e[24]=N):N=e[24];let C;e[25]!==b||e[26]!==k?(C=r.jsx(pc,{prompt:b,setPrompt:N,onSubmit:k}),e[25]=b,e[26]=k,e[27]=C):C=e[27];let A;return e[28]!==T||e[29]!==C?(A=r.jsxs(r.Fragment,{children:[T,C]}),e[28]=T,e[29]=C,e[30]=A):A=e[30],A}function _j(t){return{prompt:t}}function Lj(t){const e=z.c(13),{className:s}=t,{selectedVirtualMcp:n}=Gr(),{org:i}=Me();let o;e[0]!==i.id?(o=Ul(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=o.id,a=n?.id??l;let c;e[2]!==s?(c=ie("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=r.jsx(bj,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=r.jsx(yj,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Fs,{fallback:null,children:r.jsx(V.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=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const v9="cubic-bezier(0.645, 0.045, 0.355, 1)",wj=44,Sj={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"},kj={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},jj={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Hr(t){const e=z.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=se(),[p,g]=V.useState(d),[x,b]=V.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const y=v;if(x)return null;const _=kj[f],L=Sj[f];let w;e[2]!==_||e[3]!==L?(w=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",_,L),e[2]=_,e[3]=L,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(Cj),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let T;e[6]!==k||e[7]!==j?(T=ie("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]=T):T=e[8];const N=jj[f];let C;e[9]!==N?(C=ie("shrink-0",N),e[9]=N,e[10]=C):C=e[10];let A;e[11]!==s||e[12]!==C?(A=r.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=A):A=e[13];let P;e[14]!==n?(P=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=P):P=e[15];let R;e[16]!==i?(R=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=R):R=e[17];const E=p?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==E?(M=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(fs,{size:16,style:{transform:E,transition:`transform 180ms ${v9}`}})}),e[18]=E,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 $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let O,D;e[24]!==y?(O=te=>{te.stopPropagation(),y()},D=te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),te.stopPropagation(),y())},e[24]=y,e[25]=O,e[26]=D):(O=e[25],D=e[26]);let B;e[27]===Symbol.for("react.memo_cache_sentinel")?(B=r.jsx(hs,{size:16}),e[27]=B):B=e[27];let F;e[28]!==I||e[29]!==$||e[30]!==O||e[31]!==D?(F=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":I,title:$,onClick:O,onKeyDown:D,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]=$,e[30]=O,e[31]=D,e[32]=F):F=e[32];let U;e[33]!==p||e[34]!==A||e[35]!==P||e[36]!==R||e[37]!==M||e[38]!==F||e[39]!==T?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:T,children:[A,P,R,M,F]}),e[33]=p,e[34]=A,e[35]=P,e[36]=R,e[37]=M,e[38]=F,e[39]=T,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${v9}`},e[41]=H,e[42]=W):W=e[42];let q;e[43]===Symbol.for("react.memo_cache_sentinel")?(q={overflow:"hidden",minHeight:0},e[43]=q):q=e[43];const ee=p?1:0;let X;e[44]!==ee?(X={opacity:ee,transition:`opacity 120ms ${v9}`,maxHeight:"60vh"},e[44]=ee,e[45]=X):X=e[45];let Y;e[46]!==o?(Y=o?r.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:o})}):r.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=o,e[47]=Y):Y=e[47];let G;e[48]!==c||e[49]!==o?(G=c?r.jsx("div",{className:ie("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=G):G=e[50];let J;e[51]!==Y||e[52]!==G?(J=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[Y,G]}),e[51]=Y,e[52]=G,e[53]=J):J=e[53];let oe;e[54]!==l||e[55]!==a?(oe=l||a?r.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:l}),r.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=oe):oe=e[56];let le;e[57]!==X||e[58]!==J||e[59]!==oe?(le=r.jsx("div",{style:q,children:r.jsxs("div",{className:"flex flex-col",style:X,children:[J,oe]})}),e[57]=X,e[58]=J,e[59]=oe,e[60]=le):le=e[60];let Q;e[61]!==W||e[62]!==le?(Q=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:le}),e[61]=W,e[62]=le,e[63]=Q):Q=e[63];let K;return e[64]!==U||e[65]!==Q||e[66]!==w||e[67]!==f?(K=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:w,children:[U,Q]}),e[64]=U,e[65]=Q,e[66]=w,e[67]=f,e[68]=K):K=e[68],K}function Cj(t){return!t}const Nj=ei({content:Gs().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Xf(["pending","in_progress","completed"]),activeForm:Gs().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),Q5=ei({todos:lL(Nj)}),Vj="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.";Xw({description:Vj,inputSchema:Jw(Q5),execute:async({todos:t})=>({ok:!0,count:t.length})});const Tj="tool-todo_write",Ej=new Set(["input-available","output-available"]);function Aj(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 o=n[i];if(o.type!==Tj||typeof o.state!="string"||!Ej.has(o.state))continue;const l=Q5.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function X5(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:yo(qL(n)),input:s.input})}return e}function J5(t){return t.at(-1)}function Z5(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 Pj(t){return t?t.message.startsWith("[CREDITS]"):!1}const Rj="[SUBSCRIPTION_REQUIRED]";function eb(t){return t?.message.startsWith(Rj)?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 Dj={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function Ij(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&Pj(s))return{...Dj,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(_=>_.type==="tool-user_ask").filter(_=>_.state!=="output-available").length,h=Z5(a),f=X5(c),m=Aj(e),p=i?null:eb(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=h.length>0,y=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:y,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function tb(){const t=z.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=qn(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==o||t[2]!==e||t[3]!==l||t[4]!==a?(c=Ij({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:o}),t[0]=i,t[1]=o,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function Mj(){const t=tb();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 sb(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 $j="__home__";function H1(t,e){return Jf.chatDraft(t,e)}function Oj(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 nb(t,e,s,n,i){const o=H1(e,s);if(sb(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(zj(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Zp(t,e,s){const n=H1(e,s),i=t.getItem(n),o=Oj(i);return i!==null&&o===null&&t.removeItem(n),o}function Bj(t,e,s){t.removeItem(H1(e,s))}function zj(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Fj(t){const e=z.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=se();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=ie("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=r.jsx(b0,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=r.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=r.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 v;e[16]!==b?(v=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let y;e[18]!==l?(y=l("chat.pagination.nextLabel"),e[18]=l,e[19]=y):y=e[19];let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(Zr,{size:14}),e[20]=_):_=e[20];let L;e[21]!==o||e[22]!==x||e[23]!==v||e[24]!==y?(L=r.jsx("button",{type:"button",onClick:o,disabled:x,className:v,"aria-label":y,children:_}),e[21]=o,e[22]=x,e[23]=v,e[24]=y,e[25]=L):L=e[25];let w;return e[26]!==L||e[27]!==f||e[28]!==g?(w=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,L]}),e[26]=L,e[27]=f,e[28]=g,e[29]=w):w=e[29],w}function ib(t){const e=z.c(8),{currentIndex:s,total:n,onPrev:i,onNext:o,extraLeft:l}=t;let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a=r.jsx(Fj,{current:s,total:n,onPrev:i,onNext:o}),e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=r.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 Uj(t){const e=z.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,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]!==o?(m=()=>{h||o()},e[0]=h,e[1]=o,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("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=r.jsx(ae,{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 v;e[10]!==b?(v=r.jsx(We,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(qe,{children:f}),e[12]=f,e[13]=y):y=e[13];let _;return e[14]!==v||e[15]!==y?(_=r.jsxs(Ge,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=_):_=e[16],_}function rb(t,e,s){return t.findIndex(n=>e(n)===s)}function e2(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function t2(t,e,s,n,i){if(t.length===0)return null;const o=rb(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(o+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function Kj(t){return!t.isStreaming&&t.allAnswered}function ob(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=V.useState(c),[h,f]=V.useState(!1),m=Zf({resolver:h4(n),defaultValues:i}),p=m.watch(),g=rb(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=e2(e,s,p,l),y=Kj({isStreaming:o,allAnswered:v}),_=()=>{if(g>0){const N=e[g-1];N&&u(s(N))}},L=()=>{if(g>=0&&g<e.length-1){const N=e[g+1];N&&u(s(N))}},w=()=>{const N=m.getValues(),C=t2(e,s,N,l,d);C&&u(C)},S=()=>{m.handleSubmit(N=>{const C=N;for(const A of e)a(A,C[s(A)])})()},k=V.useRef(S);k.current=S;const j=()=>{y&&(f(!1),k.current())},T=()=>{const N=m.getValues();if(e2(e,s,N,l)){if(o){f(!0);return}f(!1),k.current()}else{const C=t2(e,s,N,l,d);C&&u(C)}};return V.useEffect(()=>{if(h&&!o){if(!v){f(!1);return}f(!1),k.current()}},[h,o,v]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:y,goPrev:_,goNext:L,advanceToNextUnanswered:w,submit:j,submitOrAdvance:T}}const lb="chat.approval.defaultDenyReason";function ab(t){const e=z.c(36),{onYolo:s}=t,n=se(),[i,o]=mr();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const _=uo.find(S=>S.value===i.toolApprovalLevel)??uo[0];let L;e[13]!==s||e[14]!==i||e[15]!==o?(L=S=>{const k=S,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=L):L=e[16];const w=L;c=xs,m=i.toolApprovalLevel,p=w,a=bs,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=Hj,l=js,d=n(_.shortKey),e[0]=s,e[1]=i,e[2]=o,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=r.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=r.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=uo.map(_=>r.jsx(kt,{value:_.value,children:n(_.labelKey)},_.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=r.jsx(vs,{children:b}),e[28]=b,e[29]=v):v=e[29];let y;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(y=r.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=y):y=e[35],y}function Hj(t){return t.stopPropagation()}function cb(t){const e=z.c(8),{input:s}=t,n=se();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=r.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 o;return e[6]!==i?(o=r.jsx("div",{className:"px-4",children:r.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]=o):o=e[7],o}function Wj(t){const e=z.c(38),{approval:s,onRespond:n}=t,i=se(),[o]=mr(),l=o.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(lb),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=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(ab,{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=r.jsx(ae,{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 v;e[21]!==u||e[22]!==b?(v=r.jsx(ae,{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]=v):v=e[23];let y;e[24]!==x||e[25]!==v?(y=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=y):y=e[26];const _=y;let L;e[27]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(p0,{size:14}),e[27]=L):L=e[27];let w;e[28]!==i?(w=i("chat.approval.needsApproval"),e[28]=i,e[29]=w):w=e[29];let S;e[30]!==s.input?(S=r.jsx(cb,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==_||e[35]!==w||e[36]!==S?(k=r.jsx(Hr,{icon:L,label:w,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:_,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=_,e[35]=w,e[36]=S,e[37]=k):k=e[37],k}const qj=aL(Gs(),ei({approved:cL().optional(),levelOverride:Xf(["auto","readonly"]).optional()}));function Gj(t){const e=z.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=se(),[l]=mr(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(Xj)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==o?(u=(C,A)=>{const P=A;typeof P?.approved=="boolean"&&i(C.approvalId,P.approved,P.approved===!1?o(lb):void 0,P.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:Qj,schema:qj,defaultValues:d,isStreaming:n,hasAnswer:Yj,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=ob(h);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(A=>[A.approvalId,{approved:!0,levelOverride:C}]))),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=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(p0,{size:14}),e[16]=v):v=e[16];let y;e[17]!==s.length||e[18]!==o?(y=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=y):y=e[19];const _=g?.friendlyName??"";let L;e[20]!==p?(L=r.jsx(ab,{onYolo:p}),e[20]=p,e[21]=L):L=e[21];let w;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==L?(w=r.jsx(ib,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:L}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=L,e[27]=w):w=e[27];let S;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(S=g?r.jsx(Jj,{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]=S):S=e[31];let k;e[32]!==g?(k=g?r.jsx(cb,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==w||e[35]!==S||e[36]!==k||e[37]!==y||e[38]!==_?(j=r.jsx(Hr,{icon:v,label:y,title:_,defaultExpanded:!0,footerLeft:w,footerRight:S,children:k}),e[34]=w,e[35]=S,e[36]=k,e[37]=y,e[38]=_,e[39]=j):j=e[39];let T;e[40]!==j||e[41]!==b?(T=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=T):T=e[42];let N;return e[43]!==f.form||e[44]!==T?(N=r.jsx(_h,{...x,children:T}),e[43]=f.form,e[44]=T,e[45]=N):N=e[45],N}function Yj(t){return typeof t?.approved=="boolean"}function Qj(t){return t.approvalId}function Xj(t){return[t.approvalId,{approved:void 0}]}function Jj(t){const e=z.c(7),{approvalId:s,control:n,onChange:i}=t,o=se(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(ae,{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:o("chat.approval.denyButton")}),r.jsx(ae,{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:o("chat.approval.acceptButton")})]})},e[0]=i,e[1]=o,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=r.jsx(Ss,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function Zj(){const t=z.c(5),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(p0,{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=r.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,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function eC(t){const e=z.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=r.jsx(Zj,{}),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=r.jsx(Wj,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let o;return e[4]!==s||e[5]!==n||e[6]!==i?(o=r.jsx(Gj,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function tC(t){const e=z.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=se();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]!==o?(c=o("chat.proposePlan.keepIterating"),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=r.jsx(ae,{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]!==o?(u=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=r.jsx(ae,{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=r.jsxs(r.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=r.jsx(i5,{size:14}),e[16]=p):p=e[16];let g;e[17]!==o?(g=o("chat.proposePlan.planReady"),e[17]=o,e[18]=g):g=e[18];let x;e[19]!==o?(x=o("chat.proposePlan.implementationPlan"),e[19]=o,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=r.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:r.jsx(GL,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=r.jsx(Hr,{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]=v):v=e[27],v}function sC(t){const e=z.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=J5(s),e[0]=s,e[1]=o):o=e[1];const l=o;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=r.jsx(tC,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function db(t){return t?"response"in t?t.response:t.option??t.draft:""}const s2=ei({response:Gs().min(1,"Response is required")}),nC=ei({option:Gs().nullable(),draft:Gs()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),iC=ei({response:Xf(["yes","no"])});function rC(t){switch(t.type){case"text":return s2;case"choice":return nC;case"confirm":return iC;default:return s2}}function oC(t){const e={};for(const s of t)e[s.toolCallId]=rC(s.input);return ei(e)}function lC(t){const e=z.c(7),{control:s,name:n,placeholder:i}=t,o=se();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,u=d.value??"";return r.jsxs(j1,{children:[r.jsx(C1,{children:r.jsx("div",{className:"px-2",children:r.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(h1,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:u,type:"text",placeholder:i||o("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":o("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(N1,{})]})},e[0]=i,e[1]=o,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=r.jsx(L5,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function ub(t,e){const s=z.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const o=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",o),()=>document.removeEventListener("keydown",o)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),V.useEffect(n,i)}function aC(t){const e=z.c(51),{control:s,name:n,options:i}=t,o=se(),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}=zp(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}=zp(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=E=>{const M=i[E];M!=null&&c.onChange(M)},e[6]=c,e[7]=i,e[8]=p):p=e[8],ub(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==o?(x=o("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=o,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==o){let E;e[16]!==c||e[17]!==f||e[18]!==o?(E=(M,I)=>{const $=f===M;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(M),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",$&&"bg-accent/50",!$&&"hover:bg-accent/30"),"aria-label":o("chat.userAskQuestion.selectOption",{option:M}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",$?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${I}-${M}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=E):E=e[19],b=i.map(E),e[11]=c,e[12]=f,e[13]=i,e[14]=o,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",y=!g&&"hover:bg-accent/30";let _;e[20]!==v||e[21]!==y?(_=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,y),e[20]=v,e[21]=y,e[22]=_):_=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(h1,{size:16,className:"text-muted-foreground"})}),e[23]=L):L=e[23];const w=g?m:"";let S;e[24]!==h||e[25]!==c||e[26]!==f?(S=E=>{h.onChange(E.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=S):S=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]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let T;e[33]!==o?(T=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=T):T=e[34];let N;e[35]!==w||e[36]!==S||e[37]!==k||e[38]!==j||e[39]!==T?(N=r.jsx("input",{type:"text",value:w,onChange:S,onFocus:k,placeholder:j,"aria-label":T,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=w,e[36]=S,e[37]=k,e[38]=j,e[39]=T,e[40]=N):N=e[40];let C;e[41]!==_||e[42]!==N?(C=r.jsxs("label",{className:_,children:[L,N]}),e[41]=_,e[42]=N,e[43]=C):C=e[43];let A;e[44]!==C||e[45]!==x||e[46]!==b?(A=r.jsx(C1,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=A):A=e[47];let P;e[48]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(N1,{}),e[48]=P):P=e[48];let R;return e[49]!==A?(R=r.jsxs(j1,{children:[A,P]}),e[49]=A,e[50]=R):R=e[50],R}function cC(t){const e=z.c(8),{control:s,name:n}=t,i=se();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=V.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],ub(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,r.jsxs(j1,{children:[r.jsx(C1,{children:r.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 r.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ie("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:[r.jsx("span",{className:ie("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}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),r.jsx(N1,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=r.jsx(L5,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}function n2(t){const e=z.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const o=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==o?(l=r.jsx(lC,{control:n,name:o,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=o,e[3]=l):l=e[3],l}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const l=o;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=r.jsx(aC,{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 o=`${i}.response`;let l;return e[10]!==n||e[11]!==o?(l=r.jsx(cC,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function dC(t){const e=z.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=oC(s.map(mC)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(fC)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(D,B)=>{const F=db(B);F&&i(D,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:hC,schema:l,defaultValues:c,isStreaming:n,hasAnswer:uC,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=ob(u),f=h.currentPart,m=se();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const D=f;if(!D)return;const B=m("chat.userAskQuestion.skipMessage"),F=D.toolCallId;D.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=r.jsx(ib,{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 v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let y;e[23]!==g||e[24]!==v?(y=r.jsx(ae,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=y):y=e[25];let _;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(_=r.jsx(Uj,{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]=_):_=e[30];let L;e[31]!==y||e[32]!==_?(L=r.jsxs(r.Fragment,{children:[y,_]}),e[31]=y,e[32]=_,e[33]=L):L=e[33];const w=L;if(s.length===1){const D=s[0];if(!D?.input)return null;const B=h.form;let F;e[34]!==h?(F=J=>{J.preventDefault(),h.submit()},e[34]=h,e[35]=F):F=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(Lh,{size:14}),e[36]=U):U=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let W;e[39]!==D.input?.prompt||e[40]!==m?(W=D.input?.prompt??m("chat.userAskQuestion.question"),e[39]=D.input?.prompt,e[40]=m,e[41]=W):W=e[41];const q=D.input;let ee;e[42]!==h.form.control||e[43]!==D.toolCallId||e[44]!==q?(ee=r.jsx(n2,{input:q,control:h.form.control,toolCallId:D.toolCallId}),e[42]=h.form.control,e[43]=D.toolCallId,e[44]=q,e[45]=ee):ee=e[45];let X;e[46]!==w||e[47]!==H||e[48]!==W||e[49]!==ee?(X=r.jsx(Hr,{icon:U,label:H,title:W,defaultExpanded:!0,footerRight:w,children:ee}),e[46]=w,e[47]=H,e[48]=W,e[49]=ee,e[50]=X):X=e[50];let Y;e[51]!==F||e[52]!==X?(Y=r.jsx("form",{onSubmit:F,autoComplete:"off",children:X}),e[51]=F,e[52]=X,e[53]=Y):Y=e[53];let G;return e[54]!==h.form||e[55]!==Y?(G=r.jsx(_h,{...B,children:Y}),e[54]=h.form,e[55]=Y,e[56]=G):G=e[56],G}const S=h.form;let k;e[57]!==h?(k=D=>{D.preventDefault(),h.submit()},e[57]=h,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(Lh,{size:14}),e[59]=j):j=e[59];let T;e[60]!==m?(T=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=T):T=e[61];const N=h.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==N?(C=m("chat.userAskQuestion.questionCount",{current:N,total:s.length}),e[62]=s.length,e[63]=m,e[64]=N,e[65]=C):C=e[65];let A;e[66]!==f?.input?.prompt||e[67]!==m?(A=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=A):A=e[68];const P=h.activeKey,R=h.setActiveKey;let E;if(e[69]!==h.form||e[70]!==s){let D;e[72]!==h.form?(D=B=>r.jsx(go,{value:B.toolCallId,className:"mt-0",children:r.jsx(n2,{input:B.input,control:h.form.control,toolCallId:B.toolCallId})},B.toolCallId),e[72]=h.form,e[73]=D):D=e[73],E=s.map(D),e[69]=h.form,e[70]=s,e[71]=E}else E=e[71];let M;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==E?(M=r.jsx(Wl,{value:P,onValueChange:R,children:E}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=E,e[77]=M):M=e[77];let I;e[78]!==b||e[79]!==w||e[80]!==T||e[81]!==C||e[82]!==A||e[83]!==M?(I=r.jsx(Hr,{icon:j,label:T,count:C,title:A,defaultExpanded:!0,footerLeft:b,footerRight:w,children:M}),e[78]=b,e[79]=w,e[80]=T,e[81]=C,e[82]=A,e[83]=M,e[84]=I):I=e[84];let $;e[85]!==k||e[86]!==I?($=r.jsx("form",{onSubmit:k,autoComplete:"off",children:I}),e[85]=k,e[86]=I,e[87]=$):$=e[87];let O;return e[88]!==h.form||e[89]!==$?(O=r.jsx(_h,{...S,children:$}),e[88]=h.form,e[89]=$,e[90]=O):O=e[90],O}function uC(t){return!!db(t)}function hC(t){return t.toolCallId}function fC(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function mC(t){return{toolCallId:t.toolCallId,input:t.input}}function pC(){const t=z.c(5),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Lh,{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=r.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,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function hb(t){const e=z.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(gC),e[0]=s,e[1]=o):o=e[1];const l=o;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(pC,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(dC,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function gC(t){return t.state==="input-available"}function xC(t){const e=t.filter(o=>o.status==="in_progress"),s=t.filter(o=>o.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 bC(t){const e=z.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=xC(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx(LC,{status:i.icon}),e[2]=i.icon,e[3]=o):o=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(vC),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=r.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]!==o||e[11]!==d?(u=r.jsx(Hr,{icon:o,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=o,e[11]=d,e[12]=u):u=e[12],u}function vC(t,e){return r.jsx(yC,{todo:t},e)}function yC(t){const e=z.c(14),{todo:s}=t,n=s.status==="completed",o=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=r.jsx(_C,{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=ie("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=r.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]!==o||e[8]!==c||e[9]!==h?(f=r.jsxs("span",{className:c,children:[o,h]}),e[7]=o,e[8]=c,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=r.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 _C(t){const e=z.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("svg",{viewBox:"0 0 21 21",children:r.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]=o):o=e[0];let l;return e[1]!==n||e[2]!==i?(l=r.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:o}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function LC(t){const e=z.c(13),{status:s}=t,n=se();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=r.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:r.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=r.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=r.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 o;return e[11]!==i?(o=r.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]=o):o=e[12],o}const wC={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"}]},SC=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function fb(t){const e=z.c(65),{onDismiss:s}=t,{org:n}=Me(),i=It(),{decoKeyId:o}=E1(),l=Cs(),a=se(),[c,d]=V.useState(""),[u,h]=V.useState(!1),[f,m]=V.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Je("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]),V.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async q=>{const{url:ee}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:q,currency:f});return ee},e[3]=f,e[4]=l,e[5]=b):b=e[5];let v;e[6]!==s?(v=q=>{q&&window.open(q,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let y;e[8]!==a?(y=q=>{me.error(a("chat.creditsExhaustedBanner.topupError",{error:q.message}))},e[8]=a,e[9]=y):y=e[9];let _;e[10]!==b||e[11]!==v||e[12]!==y?(_={mutationFn:b,onSuccess:v,onError:y},e[10]=b,e[11]=v,e[12]=y,e[13]=_):_=e[13];const{mutate:L,isPending:w}=Rt(_),S=parseFloat(c),k=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=q=>!q&&s?.(),e[14]=s,e[15]=j):j=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=["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]=T):T=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:T.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=N):N=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=r.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]=C):C=e[18];let A;e[19]!==a?(A=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=A):A=e[20];let P;e[21]!==A?(P=r.jsx(At,{className:"text-xl font-semibold tracking-tight",children:A}),e[21]=A,e[22]=P):P=e[22];let R;e[23]!==a?(R=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=R):R=e[24];let E;e[25]!==R?(E=r.jsx(_n,{className:"mt-1.5 text-sm leading-relaxed",children:R}),e[25]=R,e[26]=E):E=e[26];let M;e[27]!==P||e[28]!==E?(M=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,r.jsxs(os,{className:"relative gap-4",children:[C,r.jsxs("div",{children:[P,E]})]})]}),e[27]=P,e[28]=E,e[29]=M):M=e[29];let I;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==o||e[35]!==k||e[36]!==w||e[37]!==u||e[38]!==a||e[39]!==L?(I=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(T1,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:q=>{q&&m(q)},children:[r.jsx(xc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(xc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsxs("div",{className:"rounded-xl border border-border p-5",children:[r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:wC[f].map(q=>{const{dollars:ee,labelKey:X}=q;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:ee*100,currency:f,tier_label:X,source:"exhausted_banner"}),L(ee*100)},className:ie("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:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,ee]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:a(X)})]},ee)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(rt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:q=>d(q.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(ae,{className:"h-10",disabled:!k||w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),L(Math.round(S*100))},children:a(w?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):r.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")})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:SC.map(q=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:r.jsx(Ut,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:a(q)})]},q))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=S,e[34]=o,e[35]=k,e[36]=w,e[37]=u,e[38]=a,e[39]=L,e[40]=I):I=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let O;e[43]!==s||e[44]!==$?(O=r.jsx(ae,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=O):O=e[45];let D;e[46]!==i||e[47]!==s||e[48]!==n.slug?(D=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=D):D=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]!==D||e[53]!==B?(F=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:D,children:B}),e[52]=D,e[53]=B,e[54]=F):F=e[54];let U;e[55]!==O||e[56]!==F?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[O,F]}),e[55]=O,e[56]=F,e[57]=U):U=e[57];let H;e[58]!==M||e[59]!==I||e[60]!==U?(H=r.jsxs(jt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:kC,children:[M,I,U]}),e[58]=M,e[59]=I,e[60]=U,e[61]=H):H=e[61];let W;return e[62]!==H||e[63]!==j?(W=r.jsx(Ct,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=W):W=e[64],W}function kC(t){return t.preventDefault()}const jC={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 CC(t){const e=z.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=se(),{label:l,title:a}=jC[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Jr,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==o?(d=o(l),e[1]=l,e[2]=o,e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==a?(u=o(a),e[4]=o,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==o?(h=s==="trial_exhausted"?r.jsx(ae,{size:"sm",onClick:i,className:"h-7 text-xs",children:o("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=o,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=r.jsx(Hr,{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 NC(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),o=/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}:o?{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 VC={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function ju(t){const e=z.c(29),s=se(),{variant:n,onDismiss:i}=t,o=n==="error";let l;e[0]!==o||e[1]!==s?(l=s(o?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=o,e[1]=s,e[2]=l):l=e[2];const a=l,c=o?fn:Do;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 v=VC[t.finishReason];return v?s(v):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]!==o||e[9]!==u?(h=o?NC(u):{summary:u,rawDetails:null},e[8]=o,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;let p;e[11]!==c?(p=r.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==o||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=o?r.jsx(ae,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(ae,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=o,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?r.jsxs("details",{className:"group mx-4",children:[r.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:[r.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:r.jsx("path",{d:"m4.5 3 3 3-3 3"})}),r.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),r.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>me.success(s("chat.highlight.copiedToClipboard"))).catch(()=>me.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:r.jsx(on,{className:"size-3.5"})}),r.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=r.jsx(Hr,{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 N0(){const t=z.c(73),e=se(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=qn(),[u,h]=mr(),{virtualMcpId:f,createTaskWithMessage:m}=Qs(),{chatMode:p,simpleModeTier:g}=Gr(),{mutate:x}=w5("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let y;t[2]!==p||t[3]!==g||t[4]!==f?(y=ne=>({tier:g,mode:p,toolApprovalLevel:ne,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=y):y=t[5];const _=y;let L;t[6]!==u.toolApprovalLevel?(L=u.toolApprovalLevel??dL(),t[6]=u.toolApprovalLevel,t[7]=L):L=t[7];const w=L,S=l.at(-1),k=S?.role==="assistant"?S.parts:[],j=k.filter(PC),T=Z5(k),N=X5(k);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(re)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const A=C;let P;t[12]!==d||t[13]!==e?(P=()=>{const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(ne)},t[12]=d,t[13]=e,t[14]=P):P=t[14];const R=P;let E;t[15]!==_||t[16]!==w||t[17]!==c?(E=(ne,re)=>{c({kind:"toolOutput",toolCallId:ne.toolCallId,output:{response:re}},_(w))},t[15]=_,t[16]=w,t[17]=c,t[18]=E):E=t[18];const M=E;let I;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(I=ne=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:ne})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=I):I=t[24];const $=I,O=AC;let D;t[25]!==_||t[26]!==c?(D=(ne,re,he,pe)=>{c({kind:"approval",approvalId:ne,approved:re,...he?{reason:he}:{}},_(pe))},t[25]=_,t[26]=c,t[27]=D):D=t[27];const B=D,F=tb();if(F.isCreditExhausted){let ne;return t[28]!==n?(ne=r.jsx(fb,{onDismiss:n}),t[28]=n,t[29]=ne):ne=t[29],ne}const{showError:U,showWarning:H,hasApprovals:W}=F,q=j.map(EC).join("|"),ee=J5(T)?.toolCallId??"",X=N.map(TC).join("|");let Y;t[30]!==F.todos?(Y=r.jsx(bC,{todos:F.todos}),t[30]=F.todos,t[31]=Y):Y=t[31];let G;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==v?(G=F.subscriptionErrorKind&&r.jsx(CC,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=v,t[35]=G):G=t[35];let J;t[36]!==n||t[37]!==s||t[38]!==A||t[39]!==U?(J=U&&r.jsx(ju,{variant:"error",error:s,onDismiss:n,onFixInChat:A}),t[36]=n,t[37]=s,t[38]=A,t[39]=U,t[40]=J):J=t[40];let oe;t[41]!==o||t[42]!==i||t[43]!==R||t[44]!==H?(oe=H&&r.jsx(ju,{variant:"warning",finishReason:i,onDismiss:o,onContinue:R}),t[41]=o,t[42]=i,t[43]=R,t[44]=H,t[45]=oe):oe=t[45];let le;t[46]!==X||t[47]!==B||t[48]!==W||t[49]!==a||t[50]!==N?(le=W&&r.jsx(eC,{approvals:N,isStreaming:a,onRespond:B},X),t[46]=X,t[47]=B,t[48]=W,t[49]=a,t[50]=N,t[51]=le):le=t[51];let Q;t[52]!==F.hasPlans||t[53]!==$||t[54]!==O||t[55]!==a||t[56]!==T||t[57]!==ee?(Q=F.hasPlans&&r.jsx(sC,{plans:T,isStreaming:a,onApprove:$,onDismiss:O},ee),t[52]=F.hasPlans,t[53]=$,t[54]=O,t[55]=a,t[56]=T,t[57]=ee,t[58]=Q):Q=t[58];let K;t[59]!==F.isWaitingForUserInput||t[60]!==M||t[61]!==a||t[62]!==q||t[63]!==j?(K=F.isWaitingForUserInput&&r.jsx(hb,{userAskParts:j,isStreaming:a,onSubmit:M},q),t[59]=F.isWaitingForUserInput,t[60]=M,t[61]=a,t[62]=q,t[63]=j,t[64]=K):K=t[64];let te;return t[65]!==J||t[66]!==oe||t[67]!==le||t[68]!==Q||t[69]!==K||t[70]!==Y||t[71]!==G?(te=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[Y,G,J,oe,le,Q,K]}),t[65]=J,t[66]=oe,t[67]=le,t[68]=Q,t[69]=K,t[70]=Y,t[71]=G,t[72]=te):te=t[72],te}function TC(t){return t.approvalId}function EC(t){return t.toolCallId}function AC(){document.querySelector("[data-chat-input]")?.focus()}function PC(t){return t.type==="tool-user_ask"}N0.Error=function(e){return r.jsx(ju,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};N0.Warning=function(e){return r.jsx(ju,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};N0.UserAskQuestion=hb;function RC(t){const e=z.c(20),{taskId:s}=t,n=se(),i=V4(s),o=PL(i),l=RL(),{stop:a,removeLocalMessage:c}=qn();if(o.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=r.jsx(o0,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=r.jsx(We,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{side:"top",children:r.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=r.jsxs(Ge,{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,v)=>r.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[r.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:v+1}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover/queuerow:opacity-100",children:r.jsx(ae,{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(y=>{y&&(DL(s,b.messageId),c(b.messageId))})},children:r.jsx(ti,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],r.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[r.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:[r.jsx("span",{children:n(o.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:o.length})}),g]}),o.map(x)]})}function DC(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 IC={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function MC(t){const e=z.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=se(),u=y0(),h=new Set(u.map($C)),f=IL([i,n,o],h),m=f?.keyId??null,[p,g]=V.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,v="flex h-[70vh] max-h-[460px] w-full flex-col",y=IC[s];let _;e[0]!==d||e[1]!==y?(_=d(y),e[0]=d,e[1]=y,e[2]=_):_=e[2];let L;e[3]!==_?(L=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:_}),e[3]=_,e[4]=L):L=e[4];let w;e[5]!==a||e[6]!==d||e[7]!==i?(w=i&&r.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]=w):w=e[8];let S;e[9]!==L||e[10]!==w?(S=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[L,w]}),e[9]=L,e[10]=w,e[11]=S):S=e[11];const k="flex-1 min-h-0",j=V.Suspense;let T;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(rk,{}),e[12]=T):T=e[12];const N=ik,C=!0,A=DC(m?f:null,b?.providerId??"deco");let P;e[13]!==x||e[14]!==l||e[15]!==g?(P=I=>{const $=I.keyId??x??"";g($),l({keyId:$,modelId:I.modelId,title:I.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=P):P=e[16];let R;e[17]!==N||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==A||e[22]!==P?(R=r.jsx(N,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:A,onModelChange:P}),e[17]=N,e[18]=x,e[19]=c,e[20]=g,e[21]=A,e[22]=P,e[23]=R):R=e[23];let E;e[24]!==j||e[25]!==R||e[26]!==T?(E=r.jsx("div",{className:k,children:r.jsx(j,{fallback:T,children:R})}),e[24]=j,e[25]=R,e[26]=T,e[27]=E):E=e[27];let M;return e[28]!==E||e[29]!==S?(M=r.jsxs("div",{className:v,children:[S,E]}),e[28]=E,e[29]=S,e[30]=M):M=e[30],M}function $C(t){return t.id}const OC=["fast","smart","thinking"];function mb(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const BC={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function zC(t){const e=z.c(28),{tier:s,pillIcon:n,groups:i}=t,o=se();let l;e[0]!==o?(l=mb(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=V.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=ie("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=ie("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=r.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=r.jsx(fs,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=r.jsx(We,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(us,{asChild:!0,children:r.jsxs(ae,{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]=v):v=e[11];let y;e[12]!==f?(y=r.jsx(qe,{children:f}),e[12]=f,e[13]=y):y=e[13];let _;e[14]!==v||e[15]!==y?(_=r.jsxs(Ge,{children:[v,y]}),e[14]=v,e[15]=y,e[16]=_):_=e[16];let L;if(e[17]!==i||e[18]!==o){let k;e[20]!==o?(k=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(T=>r.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[r.jsxs("button",{type:"button",role:"menuitem","aria-label":T.title,onClick:()=>h(T),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",T.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[T.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:T.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:T.title}),T.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle})]}),T.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(Ut,{size:14,className:"text-foreground mt-0.5"})})]}),T.modelOverride&&r.jsx(UC,{label:T.title,render:T.modelOverride})]},T.key))},j.key),e[20]=o,e[21]=k):k=e[21],L=i.map(k),e[17]=i,e[18]=o,e[19]=L}else L=e[19];let w;e[22]!==L?(w=r.jsx(ys,{align:"end",className:"p-1 w-64",onOpenAutoFocus:FC,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:L})}),e[22]=L,e[23]=w):w=e[23];let S;return e[24]!==c||e[25]!==_||e[26]!==w?(S=r.jsxs(_s,{open:c,onOpenChange:d,children:[_,w]}),e[24]=c,e[25]=_,e[26]=w,e[27]=S):S=e[27],S}function FC(t){return t.preventDefault()}function UC(t){const e=z.c(38),{label:s,render:n}=t,i=se(),o=Xr(),[l,a]=V.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=ie("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=r.jsx(f1,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=r.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(o){let _;e[10]!==g?(_=r.jsx(H4,{asChild:!0,children:g}),e[10]=g,e[11]=_):_=e[11];let L;e[12]!==s||e[13]!==i?(L=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=L):L=e[14];let w;e[15]!==L?(w=r.jsx(u0,{className:"sr-only",children:L}),e[15]=L,e[16]=w):w=e[16];let S;e[17]!==l||e[18]!==n?(S=l&&n(d),e[17]=l,e[18]=n,e[19]=S):S=e[19];let k;e[20]!==S||e[21]!==w?(k=r.jsxs(h0,{className:"p-0 flex flex-col max-h-[95vh]",children:[w,S]}),e[20]=S,e[21]=w,e[22]=k):k=e[22];let j;return e[23]!==l||e[24]!==k||e[25]!==_?(j=r.jsxs(f0,{open:l,onOpenChange:a,children:[_,k]}),e[23]=l,e[24]=k,e[25]=_,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(us,{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 v;e[32]!==b?(v=r.jsx(ys,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let y;return e[34]!==l||e[35]!==x||e[36]!==v?(y=r.jsxs(_s,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=y):y=e[37],y}function i2(t){return t==="fast"?r.jsx(Jr,{size:16}):t==="thinking"?r.jsx(r5,{size:16}):r.jsx(cr,{size:16})}function KC(t){const e=z.c(13),s=OL();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 o;e[3]!==i?(o=i("fast"),e[3]=i,e[4]=o):o=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]!==o||e[10]!==l||e[11]!==a?(c={fast:o,smart:l,thinking:a},e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function HC(){const t=z.c(22),e=se(),{simpleModeTier:s,setSimpleModeTier:n}=Gr(),i=dk(),o=y0(),l=uk(o),a=KC(l),{data:c,error:d}=ML();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=$L();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 y=mb(e);m="decopilot",p=OC.map(_=>{const L=a[_],w=h.tiers[_];return{key:`decopilot-${_}`,icon:i2(_),title:y[_],subtitle:L??e(BC[_]),active:s===_,onSelect:()=>n(_),modelOverride:S=>r.jsxs(r.Fragment,{children:[d&&r.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),r.jsx(MC,{tier:_,orgSlot:i.tiers[_],userSlot:w,autoSlot:l.chat[_],onClose:S,onPick:k=>f.mutate({tier:_,slot:k}),onReset:()=>f.mutate({tier:_,slot:null})},`${_}:${w?.keyId??"org"}:${w?.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=i2(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=r.jsx(zC,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function W1(t,e,s,n,i,o){if(!v0(e)){me.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!ok(l,e)){const c=S5(e).parts.map(u=>o(u)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):me.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){me.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};YL(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),me.error(`Failed to load file "${s.name}"`)}}function WC(t){const e=z.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=se(),l=V.useRef(GC);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(h,f)=>{await W1(s,n,h,f,i,o)}},c=[s,n,i,o],e[0]=s,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=c):(a=e[4],c=e[5]),V.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new hr("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new d0({key:h,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const y=p.posAtCoords({left:g.clientX,top:g.clientY});if(!y)return!1;const _=Array.from(v);return(async()=>{let L=y.pos;for(const w of _)await l.current?.(w,L),L=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(qC);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const y of b){const _=y.getAsFile();_&&(await l.current?.(_,v),v=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]),V.useEffect(d,u),null}function qC(t){return t.kind==="file"}function GC(){return Promise.resolve()}function YC(t){const e=z.c(43),{info:s,onClose:n}=t,i=se(),o=s!==null;let l;e[0]!==n?(l=C=>!C&&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=r.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=r.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:r.jsx(Do,{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=r.jsx(At,{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=r.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=r.jsxs(_n,{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=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(os,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==i||e[20]!==b?(v=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==v?(y=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=y):y=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(o5,{size:14,className:"text-muted-foreground"}),e[24]=_):_=e[24];const L=s?.accepted;let w;e[25]!==L?(w=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[_,r.jsx("span",{className:"capitalize",children:L})]}),e[25]=L,e[26]=w):w=e[26];let S;e[27]!==y||e[28]!==w?(S=r.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:r.jsxs("div",{className:"rounded-xl border border-border p-4",children:[y,w]})}),e[27]=y,e[28]=w,e[29]=S):S=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=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(ae,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let T;e[35]!==x||e[36]!==S||e[37]!==j?(T=r.jsxs(jt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:QC,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=T):T=e[38];let N;return e[39]!==o||e[40]!==l||e[41]!==T?(N=r.jsx(Ct,{open:o,onOpenChange:l,children:T}),e[39]=o,e[40]=l,e[41]=T,e[42]=N):N=e[42],N}function QC(t){return t.preventDefault()}function XC(){const t=z.c(3),[e,s]=V.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 pb=QL;var JC=["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] *)"],jh=JC.join(","),gb=typeof Element>"u",Vc=gb?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Cu=!gb&&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},Nu=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"),o=i===""||i==="true",l=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Nu(e.parentNode));return l},ZC=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},eN=function(e,s,n){if(Nu(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(jh));return s&&Vc.call(e,jh)&&i.unshift(e),i=i.filter(n),i},Ch=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!Nu(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=Ch(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=Vc.call(l,jh);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!Nu(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=Ch(h===!0?l.children:h.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else o.unshift.apply(o,l.children)}}return i},xb=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},bb=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||ZC(e))&&!xb(e)?0:e.tabIndex},tN=function(e,s){var n=bb(e);return n<0&&s&&!xb(e)?0:n},sN=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},vb=function(e){return e.tagName==="INPUT"},nN=function(e){return vb(e)&&e.type==="hidden"},iN=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},rN=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},oN=function(e){if(!e.name)return!0;var s=e.form||Cu(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 o=rN(i,e.form);return!o||o===e},lN=function(e){return vb(e)&&e.type==="radio"},aN=function(e){return lN(e)&&!oN(e)},cN=function(e){var s,n=e&&Cu(e),i=(s=n)===null||s===void 0?void 0:s.host,o=!1;if(n&&n!==e){var l,a,c;for(o=!!((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));!o&&i;){var d,u,h;n=Cu(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return o},r2=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},dN=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Vc.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Vc.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=Cu(e);if(d&&!d.shadowRoot&&i(d)===!0)return r2(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(cN(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return r2(e);return!1},uN=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 Vc.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},hN=function(e,s){return!(s.disabled||nN(s)||dN(s,e)||iN(s)||uN(s))},o2=function(e,s){return!(aN(s)||bb(s)<0||!hN(e,s))},fN=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},yb=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=tN(a,l),d=l?yb(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:o,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(sN).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},_b=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Ch([e],s.includeContainer,{filter:o2.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:fN}):n=eN(e,s.includeContainer,o2.bind(null,s)),yb(n)};function mN(){return/apple/i.test(navigator.vendor)}const l2="data-floating-ui-focusable";function pN(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 Nh(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&uL(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function fa(t){return"composedPath"in t?t.composedPath()[0]:t.target}function y9(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 gN(t){return t.matches("html,body")}function Tc(t){return t?.ownerDocument||document}function xN(t){return t?t.hasAttribute(l2)?t:t.querySelector("["+l2+"]")||t:null}function ou(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var o;return i.parentId===e&&(!s||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...ou(t,i.id,s)])}function bN(t){return"nativeEvent"in t}var vN=typeof document<"u",yN=function(){},xo=vN?V.useLayoutEffect:yN;const _N={...f4},LN=_N.useInsertionEffect,wN=LN||(t=>t());function pl(t){const e=V.useRef(()=>{});return wN(()=>{e.current=t}),V.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 Lb=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function wb(t,e){const s=_b(t,Lb()),n=s.length;if(n===0)return;const i=pN(Tc(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function SN(t){return wb(Tc(t).body,1)||t}function kN(t){return wb(Tc(t).body,-1)||t}function _9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Nh(s,n)}function jN(t){_b(t,Lb()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function a2(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 CN="data-floating-ui-focusable",c2="active",d2="selected",NN={...f4};let u2=!1,VN=0;const h2=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+VN++;function TN(){const[t,e]=V.useState(()=>u2?h2():void 0);return xo(()=>{t==null&&e(h2())},[]),V.useEffect(()=>{u2=!0},[]),t}const EN=NN.useId,q1=EN||TN;function AN(){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 PN=V.createContext(null),RN=V.createContext(null),Sb=()=>{var t;return((t=V.useContext(PN))==null?void 0:t.id)||null},kb=()=>V.useContext(RN);function G1(t){return"data-floating-ui-"+t}const DN={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},f2=V.forwardRef(function(e,s){const[n,i]=V.useState();xo(()=>{mN()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[G1("focus-guard")]:"",style:DN};return r.jsx("span",{...e,...o})}),IN={clipPath:"inset(50%)",position:"fixed",top:0,left:0},jb=V.createContext(null),m2=G1("portal");function MN(t){t===void 0&&(t={});const{id:e,root:s}=t,n=q1(),i=ON(),[o,l]=V.useState(null),a=V.useRef(null);return xo(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),xo(()=>{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(m2,""),c.appendChild(d),a.current=d,l(d)},[e,n]),xo(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!xL(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(m2,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),o}function $N(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=MN({id:s,root:n}),[l,a]=V.useState(null),c=V.useRef(null),d=V.useRef(null),u=V.useRef(null),h=V.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return V.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&_9(x)&&(x.type==="focusin"?a2:jN)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,i,f]),V.useEffect(()=>{o&&(m||a2(o))},[m,o]),r.jsxs(jb.Provider,{value:V.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(f2,{"data-type":"outside",ref:c,onFocus:g=>{if(_9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=kN(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:IN}),o&&bn.createPortal(e,o),p&&o&&r.jsx(f2,{"data-type":"outside",ref:d,onFocus:g=>{if(_9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=SN(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const ON=()=>V.useContext(jb),BN={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},zN={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},p2=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 FN(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:o}=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=kb(),x=pl(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=V.useRef(!1),{escapeKey:y,outsidePress:_}=p2(m),{escapeKey:L,outsidePress:w}=p2(p),S=V.useRef(!1),k=pl(P=>{var R;if(!s||!l||!a||P.key!=="Escape"||S.current)return;const E=(R=o.current.floatingContext)==null?void 0:R.nodeId,M=g?ou(g.nodesRef.current,E):[];if(!y&&(P.stopPropagation(),M.length>0)){let I=!0;if(M.forEach($=>{var O;if((O=$.context)!=null&&O.open&&!$.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}n(!1,bN(P)?P.nativeEvent:P,"escape-key")}),j=pl(P=>{var R;const E=()=>{var M;k(P),(M=fa(P))==null||M.removeEventListener("keydown",E)};(R=fa(P))==null||R.addEventListener("keydown",E)}),T=pl(P=>{var R;const E=o.current.insideReactTree;o.current.insideReactTree=!1;const M=v.current;if(v.current=!1,d==="click"&&M||E||typeof b=="function"&&!b(P))return;const I=fa(P),$="["+G1("inert")+"]",O=Tc(i.floating).querySelectorAll($);let D=vi(I)?I:null;for(;D&&!g9(D);){const H=mL(D);if(g9(H)||!vi(H))break;D=H}if(O.length&&vi(I)&&!gN(I)&&!Nh(I,i.floating)&&Array.from(O).every(H=>!Nh(D,H)))return;if(pL(I)&&A){const H=g9(I),W=gL(I),q=/auto|scroll/,ee=H||q.test(W.overflowX),X=H||q.test(W.overflowY),Y=ee&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,G=X&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,J=W.direction==="rtl",oe=G&&(J?P.offsetX<=I.offsetWidth-I.clientWidth:P.offsetX>I.clientWidth),le=Y&&P.offsetY>I.clientHeight;if(oe||le)return}const B=(R=o.current.floatingContext)==null?void 0:R.nodeId,F=g&&ou(g.nodesRef.current,B).some(H=>{var W;return y9(P,(W=H.context)==null?void 0:W.elements.floating)});if(y9(P,i.floating)||y9(P,i.domReference)||F)return;const U=g?ou(g.nodesRef.current,B):[];if(U.length>0){let H=!0;if(U.forEach(W=>{var q;if((q=W.context)!=null&&q.open&&!W.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,P,"outside-press")}),N=pl(P=>{var R;const E=()=>{var M;T(P),(M=fa(P))==null||M.removeEventListener(d,E)};(R=fa(P))==null||R.addEventListener(d,E)});V.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=y,o.current.__outsidePressBubbles=_;let P=-1;function R(O){n(!1,O,"ancestor-scroll")}function E(){window.clearTimeout(P),S.current=!0}function M(){P=window.setTimeout(()=>{S.current=!1},fL()?5:0)}const I=Tc(i.floating);a&&(I.addEventListener("keydown",L?j:k,L),I.addEventListener("compositionstart",E),I.addEventListener("compositionend",M)),b&&I.addEventListener(d,w?N:T,w);let $=[];return f&&(vi(i.domReference)&&($=p9(i.domReference)),vi(i.floating)&&($=$.concat(p9(i.floating))),!vi(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(p9(i.reference.contextElement)))),$=$.filter(O=>{var D;return O!==((D=I.defaultView)==null?void 0:D.visualViewport)}),$.forEach(O=>{O.addEventListener("scroll",R,{passive:!0})}),()=>{a&&(I.removeEventListener("keydown",L?j:k,L),I.removeEventListener("compositionstart",E),I.removeEventListener("compositionend",M)),b&&I.removeEventListener(d,w?N:T,w),$.forEach(O=>{O.removeEventListener("scroll",R)}),window.clearTimeout(P)}},[o,i,a,b,d,s,n,f,l,y,_,k,L,j,T,w,N]),V.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const C=V.useMemo(()=>({onKeyDown:k,...u&&{[BN[h]]:P=>{n(!1,P.nativeEvent,"reference-press")},...h!=="click"&&{onClick(P){n(!1,P.nativeEvent,"reference-press")}}}}),[k,n,u,h]),A=V.useMemo(()=>{function P(R){R.button===0&&(v.current=!0)}return{onKeyDown:k,onMouseDown:P,onMouseUp:P,[zN[d]]:()=>{o.current.insideReactTree=!0}}},[k,d,o]);return V.useMemo(()=>l?{reference:C,floating:A}:{},[l,C,A])}function UN(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=q1(),o=V.useRef({}),[l]=V.useState(()=>AN()),a=Sb()!=null,[c,d]=V.useState(n.reference),u=pl((m,p,g)=>{o.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),h=V.useMemo(()=>({setPositionReference:d}),[]),f=V.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return V.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function KN(t){t===void 0&&(t={});const{nodeId:e}=t,s=UN({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=V.useState(null),[a,c]=V.useState(null),u=i?.domReference||o,h=V.useRef(null),f=kb();xo(()=>{u&&(h.current=u)},[u]);const m=hL({...t,elements:{...i,...a&&{reference:a}}}),p=V.useCallback(y=>{const _=vi(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),getClientRects:()=>y.getClientRects(),contextElement:y}:y;c(_),m.refs.setReference(_)},[m.refs]),g=V.useCallback(y=>{(vi(y)||y===null)&&(h.current=y,l(y)),(vi(m.refs.reference.current)||m.refs.reference.current===null||y!==null&&!vi(y))&&m.refs.setReference(y)},[m.refs]),x=V.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=V.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=V.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return xo(()=>{n.dataRef.current.floatingContext=v;const y=f?.nodesRef.current.find(_=>_.id===e);y&&(y.context=v)}),V.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function L9(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[c2]:l,[d2]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[CN]:""},...o,...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&&[c2,d2].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 HN(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=V.useCallback(a=>L9(a,t,"reference"),e),o=V.useCallback(a=>L9(a,t,"floating"),s),l=V.useCallback(a=>L9(a,t,"item"),n);return V.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const WN=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function qN(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:o,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=q1(),u=((s=o.domReference)==null?void 0:s.id)||d,h=V.useMemo(()=>{var v;return((v=xN(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=WN.get(c))!=null?n:c,p=Sb()!=null,g=V.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=V.useMemo(()=>{const v={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=V.useCallback(v=>{let{active:y,selected:_}=v;const L={role:"option",...y&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...L,"aria-selected":_}}return{}},[h,c]);return V.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function GN(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=ZL(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?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),v=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!v)return null;const y=g+x.index;let _=y+x[0].length;return c&&u.test(p.slice(_-1,_+1))&&(x[0]+=" ",_+=1),y<a.pos&&_>=a.pos?{range:{from:y,to:_},query:x[0].slice(s.length),text:x[0]}:null}var YN=new hr("suggestion");function QN({pluginKey:t=YN,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=GN,shouldShow:x}){let b;const v=m?.(),y=()=>{const S=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(S),{top:j,right:T,bottom:N,left:C}=k;try{return new DOMRect(C,j,T-C,N-j)}catch{return null}},_=(S,k)=>k?()=>{const j=t.getState(e.state),T=j?.decorationId,N=S.dom.querySelector(`[data-decoration-id="${T}"]`);return N?.getBoundingClientRect()||null}:y;function L(S,k){var j;try{const N=t.getState(S.state),C=N?.decorationId?S.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,A={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:P=>h({editor:e,range:N?.range||{from:0,to:0},props:P}),decorationNode:C,clientRect:_(S,C)};(j=v?.onExit)==null||j.call(v,A)}catch{}const T=S.state.tr.setMeta(k,{exit:!0});S.dispatch(T)}const w=new d0({key:t,view(){return{update:async(S,k)=>{var j,T,N,C,A,P,R;const E=(j=this.key)==null?void 0:j.getState(k),M=(T=this.key)==null?void 0:T.getState(S.state),I=E.active&&M.active&&E.range.from!==M.range.from,$=!E.active&&M.active,O=E.active&&!M.active,D=!$&&!O&&E.query!==M.query,B=$||I&&D,F=D||I,U=O||I&&D;if(!B&&!F&&!U)return;const H=U&&!B?E:M,W=S.dom.querySelector(`[data-decoration-id="${H.decorationId}"]`);b={editor:e,range:H.range,query:H.query,text:H.text,items:[],command:q=>h({editor:e,range:H.range,props:q}),decorationNode:W,clientRect:_(S,W)},B&&((N=v?.onBeforeStart)==null||N.call(v,b)),F&&((C=v?.onBeforeUpdate)==null||C.call(v,b)),(F||B)&&(b.items=await f({editor:e,query:H.query})),U&&((A=v?.onExit)==null||A.call(v,b)),F&&((P=v?.onUpdate)==null||P.call(v,b)),B&&((R=v?.onStart)==null||R.call(v,b))},destroy:()=>{var S;b&&((S=v?.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,k,j,T){const{isEditable:N}=e,{composing:C}=e.view,{selection:A}=S,{empty:P,from:R}=A,E={...k},M=S.getMeta(t);if(M&&M.exit)return E.active=!1,E.decorationId=null,E.range={from:0,to:0},E.query=null,E.text=null,E;if(E.composing=C,N&&(P||e.view.composing)){(R<k.range.from||R>k.range.to)&&!C&&!k.composing&&(E.active=!1);const I=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:A.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;I&&p({editor:e,state:T,range:I.range,isActive:k.active})&&(!x||x({editor:e,range:I.range,query:I.query,text:I.text,transaction:S}))?(E.active=!0,E.decorationId=k.decorationId?k.decorationId:$,E.range=I.range,E.query=I.query,E.text=I.text):E.active=!1}else E.active=!1;return E.active||(E.decorationId=null,E.range={from:0,to:0},E.query=null,E.text=null),E}},props:{handleKeyDown(S,k){var j,T,N,C;const{active:A,range:P}=w.getState(S.state);if(!A)return!1;if(k.key==="Escape"||k.key==="Esc"){const E=w.getState(S.state),M=(j=b?.decorationNode)!=null?j:null,I=M??(E?.decorationId?S.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`):null);if(((T=v?.onKeyDown)==null?void 0:T.call(v,{view:S,event:k,range:E.range}))||!1)return!0;const O={editor:e,range:E.range,query:E.query,text:E.text,items:[],command:D=>h({editor:e,range:E.range,props:D}),decorationNode:I,clientRect:I?()=>I.getBoundingClientRect()||null:null};return(N=v?.onExit)==null||N.call(v,O),L(S,t),!0}return((C=v?.onKeyDown)==null?void 0:C.call(v,{view:S,event:k,range:P}))||!1},decorations(S){const{active:k,range:j,decorationId:T,query:N}=w.getState(S);if(!k)return null;const C=!N?.length,A=[c];return C&&A.push(u),XL.create(S.doc,[JL.inline(j.from,j.to,{nodeName:a,class:A.join(" "),"data-decoration-id":T,"data-decoration-content":d})])}}});return w}function XN(t){const e=z.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=V.useState(0),d=V.useRef(i),u=V.useRef(a),h=V.useRef(o),f=V.useRef(l),m=V.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],V.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]),V.useEffect(x,b);let v,y;e[7]!==i?(v=()=>{d.current=i},y=[i],e[7]=i,e[8]=v,e[9]=y):(v=e[8],y=e[9]),V.useEffect(v,y);let _,L;e[10]!==a?(_=()=>{u.current=a},L=[a],e[10]=a,e[11]=_,e[12]=L):(_=e[11],L=e[12]),V.useEffect(_,L);let w,S;e[13]!==o?(S=()=>{h.current=o},w=[o],e[13]=o,e[14]=w,e[15]=S):(w=e[14],S=e[15]),V.useEffect(S,w);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]),V.useEffect(k,j);let T,N;e[19]!==s?(T=()=>{if(s?.isDestroyed)return;let P;try{P=s.view.dom}catch{return}if(!P)return;const R=M=>{const I=d.current;if(!I.length)return!1;const $=()=>c(D=>(D+1)%I.length),O=()=>c(D=>(D-1+I.length)%I.length);switch(M.key){case"ArrowUp":return M.preventDefault(),O(),!0;case"ArrowDown":return M.preventDefault(),$(),!0;case"Tab":return M.preventDefault(),M.shiftKey?O():$(),!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 D=u.current;return D!==-1&&I[D]&&h.current?.(I[D],D),!0}case"Escape":return M.preventDefault(),f.current?.(),!0;default:return!1}},E=M=>{R(M)};return P.addEventListener("keydown",E,!0),()=>{P?.removeEventListener("keydown",E,!0)}},N=[s],e[19]=s,e[20]=T,e[21]=N):(T=e[20],N=e[21]),V.useEffect(T,N);const C=i.length?a:void 0;let A;return e[22]!==C?(A={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=A):A=e[23],A}function JN(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 Cb=V.createContext(void 0);function Nb(){const t=V.useContext(Cb);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function ZN(t){const e=z.c(16),{editor:s,char:n,pluginKey:i,allow:o,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]=V.useReducer(JN,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=V.useEffectEvent(u);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof hr?i:new hr(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=QN({pluginKey:g,editor:s,char:n,allow(v){const y=s.state.doc.resolve(v.range.from);for(let _=y.depth;_>0;_--)if(y.node(_).type.name==="image")return!1;return!(o&&!o(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),h(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),h(!1)}}),items:eV});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=h,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==o||e[11]!==s||e[12]!==i?(m=[s,i,n,d,o],e[9]=n,e[10]=o,e[11]=s,e[12]=i,e[13]=m):m=e[13],V.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 eV(){return[]}function tV({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=Nb(),l=V.useDeferredValue(i.query),{data:a}=e1({queryKey:Fe.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){o({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?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=XN({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function sV({children:t}){const{state:e,dispatch:s}=Nb(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=KN({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[bL(10),vL(),yL()],whileElementsMounted:_L}),d=FN(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=qN(c,{role:"listbox"}),{getFloatingProps:h}=HN([d,u]);return n?r.jsx($N,{children:r.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 nV=t=>{const e=z.c(29),{item:s,isSelected:n,onSelect:i,isLoading:o,ref:l}=t;let a;if(e[0]!==s){const w=Ni(s._meta);a=s.title||s1(s.name,w),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=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=ie("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&&r.jsx(zr,{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=r.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]!==o?(x=o&&r.jsx(_o,{size:"xs"}),e[10]=o,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=r.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 v;e[15]!==d?(v=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let y;e[17]!==b||e[18]!==v?(y=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=y):y=e[19];let _;e[20]!==s.drillable?(_=s.drillable&&r.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]=_):_=e[21];let L;return e[22]!==i||e[23]!==l||e[24]!==y||e[25]!==_||e[26]!==m||e[27]!==p?(L=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,y,_]}),e[22]=i,e[23]=l,e[24]=y,e[25]=_,e[26]=m,e[27]=p,e[28]=L):L=e[28],L},iV=t=>{const e=z.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=se();let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:o},e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:h}=tV(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=r.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)=>r.jsx(nV,{item:x,isSelected:b===d,ref:b===d?lV: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=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:r.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function rV(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(oV)}),t[0]=e):e=t[0],e}function oV(t,e){return r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[r.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),r.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Vb(t){const e=z.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,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}=ZN(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=r.jsx(rV,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(sV,{children:r.jsx(V.Suspense,{fallback:p,children:r.jsx(iV,{editor:s,queryKey:o,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=o,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=r.jsx(Cb.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function lV(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const aV=t=>{const e=z.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=se(),l=Qt(),{org:a}=Me(),c=qc();let d;e[0]!==c?(d=D1(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=Pt(h);let m;e[6]!==a.id||e[7]!==n?(m=Fe.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=V.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=V.useEffectEvent(b),y=V.useRef(null),_=V.useRef(!1),L=n??"default";let w;e[11]!==g||e[12]!==a.id||e[13]!==L?(w=["at-mention",a.id,L,g],e[11]=g,e[12]=a.id,e[13]=L,e[14]=w):w=e[14];const S=w;let k;e[15]!==o?(k=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=k):k=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let T;e[19]!==k||e[20]!==j?(T={name:"agents",title:k,description:j,kind:"category",drillable:!0},e[19]=k,e[20]=j,e[21]=T):T=e[21];let N;e[22]!==o?(N=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=N):N=e[23];let C;e[24]!==o?(C=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=C):C=e[25];let A;e[26]!==N||e[27]!==C?(A={name:"resources",title:N,description:C,kind:"category",drillable:!0},e[26]=N,e[27]=C,e[28]=A):A=e[28];let P;e[29]!==A||e[30]!==T?(P=[T,A],e[29]=A,e[30]=T,e[31]=P):P=e[31];const R=P;let E;e[32]!==f||e[33]!==s||e[34]!==o?(E=async F=>{const{item:U,range:H}=F;if(Je("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(_.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){Al(s,H,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&f){try{const W=await m4(f,U.uri);Al(s,H,{id:U.uri,name:U.uri,metadata:W.contents,char:"@"})}catch(W){console.error("[at-mention] Failed to fetch resource:",W),me.error(o("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=o,e[35]=E):E=e[35];const M=E;let I;e[36]!==c||e[37]!==R||e[38]!==f||e[39]!==u||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(I=async F=>{const{query:U}=F,H=v();if(H==="categories"){if(!U.trim())return R;const ee=U.toLowerCase(),X=c.filter(G=>G.status==="active"&&(!G.id||!vu(G.id))&&!u.has(G.id)&&G.id!==n&&(G.title.toLowerCase().includes(ee)||G.description?.toLowerCase().includes(ee))).map(cV),Y=await(async()=>{if(!f)return[];let G=l.getQueryData(p);return G||(G=await l.fetchQuery({queryKey:p,queryFn:()=>Ga(f),staleTime:6e4})),(G?.resources??[]).filter(J=>J.uri.toLowerCase().includes(ee)||J.name?.toLowerCase().includes(ee)||J.description?.toLowerCase().includes(ee)).map(dV)})();return[...X,...Y]}if(H==="agents"){let ee=c.filter(X=>X.status==="active"&&(!X.id||!vu(X.id))&&!u.has(X.id)&&X.id!==n);if(U.trim()){const X=U.toLowerCase();ee=ee.filter(Y=>Y.title.toLowerCase().includes(X)||Y.description?.toLowerCase().includes(X))}return ee.map(uV)}if(!f)return[];let W=l.getQueryData(p);W?l.fetchQuery({queryKey:p,queryFn:()=>Ga(f),staleTime:6e4}).catch(hV):W=await l.fetchQuery({queryKey:p,queryFn:()=>Ga(f),staleTime:6e4});let q=W?.resources??[];if(U.trim()){const ee=U.toLowerCase();q=q.filter(X=>X.uri.toLowerCase().includes(ee)||X.name?.toLowerCase().includes(ee)||X.description?.toLowerCase().includes(ee))}return q.map(fV)},e[36]=c,e[37]=R,e[38]=f,e[39]=u,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=I):I=e[44];const $=I;let O;e[45]!==i?(O=F=>{if(i&&(i.current=F),F)y.current=Date.now(),_.current=!1,Je("chat_picker_opened",{picker:"@"});else{const U=y.current;Je("chat_picker_closed",{picker:"@",outcome:_.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),y.current=null,x("categories")}},e[45]=i,e[46]=O):O=e[46];const D=O;let B;return e[47]!==s||e[48]!==$||e[49]!==M||e[50]!==D||e[51]!==S?(B=r.jsx(Vb,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:S,queryFn:$,onSelect:M,onOpenChange:D}),e[47]=s,e[48]=$,e[49]=M,e[50]=D,e[51]=S,e[52]=B):B=e[52],B};function cV(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function dV(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function uV(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function hV(){}function fV(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function Y1(t){return t.contentHash??`${t.size}-${t.updatedAt}`}function An(t,e,s,n){const i=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(t)}/fs/${encodeURIComponent(e)}/${s}${i?`?${i}`:""}`}async function rn(t,e,s){const n=await fetch(t,e);if(n.ok||s?.allow404&&n.status===404)return n;let i="";try{i=(await n.json()).error??""}catch{}throw new Error(i||`HTTP ${n.status}`)}function Q1(t,e){const s=z.c(15),{org:n}=Me();let i;s[0]!==n.id||s[1]!==e||s[2]!==t?(i=Fe.orgFsList(n.id,t,e),s[0]=n.id,s[1]=e,s[2]=t,s[3]=i):i=s[3];let o;s[4]!==n.id||s[5]!==t?(o=(c,d)=>d?.queryKey[1]===n.id&&d.queryKey[2]===t?c:void 0,s[4]=n.id,s[5]=t,s[6]=o):o=s[6];let l;s[7]!==n.slug||s[8]!==e||s[9]!==t?(l=async()=>(await(await rn(An(n.slug,t,"list",{path:e}))).json()).entries.toSorted(mV),s[7]=n.slug,s[8]=e,s[9]=t,s[10]=l):l=s[10];let a;return s[11]!==i||s[12]!==o||s[13]!==l?(a={queryKey:i,placeholderData:o,queryFn:l},s[11]=i,s[12]=o,s[13]=l,s[14]=a):a=s[14],xt(a)}function mV(t,e){return t.kind!==e.kind?t.kind==="dir"?-1:1:t.path.localeCompare(e.path)}function X1(t,e,s){const n=z.c(15),{org:i}=Me();let o;n[0]!==i.id||n[1]!==e||n[2]!==t?(o=Fe.orgFsStat(i.id,t??"",e),n[0]=i.id,n[1]=e,n[2]=t,n[3]=o):o=n[3];const l=t!==null;let a;n[4]!==s?(a=s?.refetchIntervalWhenAbsent?u=>u.state.data?!1:s.refetchIntervalWhenAbsent??!1:void 0,n[4]=s,n[5]=a):a=n[5];let c;n[6]!==i.slug||n[7]!==e||n[8]!==t?(c=async()=>{const u=await rn(An(i.slug,t??"","stat",{path:e}),void 0,{allow404:!0});return u.status===404?null:(await u.json()).entry},n[6]=i.slug,n[7]=e,n[8]=t,n[9]=c):c=n[9];let d;return n[10]!==o||n[11]!==l||n[12]!==a||n[13]!==c?(d={queryKey:o,enabled:l,refetchInterval:a,queryFn:c},n[10]=o,n[11]=l,n[12]=a,n[13]=c,n[14]=d):d=n[14],xt(d)}function pV(t){const e=z.c(9),{org:s}=Me();let n;e[0]!==s.id||e[1]!==t?(n=Fe.orgFsUsage(s.id,t),e[0]=s.id,e[1]=t,e[2]=n):n=e[2];let i;e[3]!==s.slug||e[4]!==t?(i=async()=>await(await rn(An(s.slug,t,"usage"))).json(),e[3]=s.slug,e[4]=t,e[5]=i):i=e[5];let o;return e[6]!==n||e[7]!==i?(o={queryKey:n,queryFn:i},e[6]=n,e[7]=i,e[8]=o):o=e[8],xt(o)}function Tb(t,e){const s=z.c(9),n=t===void 0?60:t,{org:i}=Me();let o;s[0]!==i.id?(o=Fe.orgFsRecent(i.id),s[0]=i.id,s[1]=o):o=s[1];const l=e?.enabled;let a;s[2]!==n||s[3]!==i.slug?(a=async()=>(await(await rn(`/api/${encodeURIComponent(i.slug)}/fs/recent?limit=${n}`)).json()).entries,s[2]=n,s[3]=i.slug,s[4]=a):a=s[4];let c;return s[5]!==o||s[6]!==l||s[7]!==a?(c={queryKey:o,enabled:l,queryFn:a},s[5]=o,s[6]=l,s[7]=a,s[8]=c):c=s[8],xt(c)}const gV=50;function xV(t,e){const s=z.c(16),{org:n}=Me();let i;s[0]!==n.id||s[1]!==t||s[2]!==e?.prefix||s[3]!==e?.volume?(i=Fe.orgFsSearch(n.id,t,e?.volume??"",e?.prefix??""),s[0]=n.id,s[1]=t,s[2]=e?.prefix,s[3]=e?.volume,s[4]=i):i=s[4];const o=t.length>0;let l;s[5]!==n.id?(l=(d,u)=>u?.queryKey[1]===n.id?d:void 0,s[5]=n.id,s[6]=l):l=s[6];let a;s[7]!==n.slug||s[8]!==t||s[9]!==e?(a=async()=>{const d=new URLSearchParams({q:t,limit:String(gV)});return e&&(d.set("volume",e.volume),e.prefix&&d.set("prefix",e.prefix)),(await(await rn(`/api/${encodeURIComponent(n.slug)}/fs/search?${d}`)).json()).entries},s[7]=n.slug,s[8]=t,s[9]=e,s[10]=a):a=s[10];let c;return s[11]!==i||s[12]!==o||s[13]!==l||s[14]!==a?(c={queryKey:i,enabled:o,placeholderData:l,queryFn:a},s[11]=i,s[12]=o,s[13]=l,s[14]=a,s[15]=c):c=s[15],xt(c)}function bV(t){const e=z.c(8),{org:s}=Me();let n;e[0]!==s.id?(n=Fe.orgFsSkills(s.id),e[0]=s.id,e[1]=n):n=e[1];const i=t?.enabled;let o;e[2]!==s.slug?(o=async()=>{const a=await rn(`/api/${encodeURIComponent(s.slug)}/fs/skills`),{skills:c}=await a.json();return c.map(vV)},e[2]=s.slug,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==i||e[6]!==o?(l={queryKey:n,enabled:i,queryFn:o},e[4]=n,e[5]=i,e[6]=o,e[7]=l):l=e[7],xt(l)}function vV(t){return{volume:t.volume,path:t.path}}async function yV(t){const e=await rn(`/api/${encodeURIComponent(t)}/fs/skills`),{skills:s}=await e.json();return s}async function _V(t,e,s){return(await rn(An(t,e,"read",{path:s}))).text()}function Oi(t,e){const s=z.c(8);let n;s[0]!==t?(n=Fe.fileText(t),s[0]=t,s[1]=n):n=s[1];const i=e?.enabled!==!1&&t!=="";let o;s[2]!==t?(o=async()=>{const a=await fetch(t,{credentials:"include"});return a.ok?await a.text():null},s[2]=t,s[3]=o):o=s[3];let l;return s[4]!==n||s[5]!==i||s[6]!==o?(l={queryKey:n,enabled:i,staleTime:6e4,retry:!1,queryFn:o},s[4]=n,s[5]=i,s[6]=o,s[7]=l):l=s[7],xt(l)}const LV=new Set(["md","mdx","markdown","txt","text"]),wV=25,SV=64*1024,kV=256*1024,jV=4;function CV(t){const e=t.lastIndexOf(".");return e===-1?!1:LV.has(t.slice(e+1).toLowerCase())}async function NV(t,e,s){const n=s?`${s}/`:"",i=h=>h.startsWith(n)?h.slice(n.length):h,o=[],l=[],a=[{path:s,depth:0}];for(;a.length>0;){const h=a.shift();if(!h)break;let f;try{f=(await(await rn(An(t,e,"list",{path:h.path}))).json()).entries}catch{continue}for(const m of[...f].sort((p,g)=>p.path.localeCompare(g.path))){if(m.kind==="dir"){h.depth<jV&&a.push({path:m.path,depth:h.depth+1});continue}CV(m.path)&&m.size<=SV&&o.length<wV?o.push(m.path):l.push(i(m.path))}}const c=await Promise.all(o.map(h=>_V(t,e,h).catch(()=>null))),d=[];let u=0;return o.forEach((h,f)=>{const m=c[f];if(m==null||u+m.length>kV){l.push(i(h));return}u+=m.length,d.push({relPath:i(h),content:m})}),d.sort((h,f)=>h.relPath==="SKILL.md"?-1:f.relPath==="SKILL.md"?1:h.relPath.localeCompare(f.relPath)),l.sort(),{files:d,omittedPaths:l}}function Eb(){const t=z.c(7),{org:e}=Me();let s;t[0]!==e.id?(s=Fe.orgFsPublicSets(e.id),t[0]=e.id,t[1]=s):s=t[1];let n;t[2]!==e.slug?(n=async()=>(await(await rn(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,t[2]=e.slug,t[3]=n):n=t[3];let i;return t[4]!==s||t[5]!==n?(i={queryKey:s,staleTime:3e5,queryFn:n},t[4]=s,t[5]=n,t[6]=i):i=t[6],xt(i)}function J1(t){const e=z.c(3),{org:s}=Me();let n;return e[0]!==s.slug||e[1]!==t?(n=i=>An(s.slug,t,"read",{path:i}),e[0]=s.slug,e[1]=t,e[2]=n):n=e[2],n}function Ql(){const t=z.c(2),{org:e}=Me();let s;return t[0]!==e.slug?(s=(n,i)=>An(e.slug,n,"read",{path:i}),t[0]=e.slug,t[1]=s):s=t[1],s}function Ab(t){const e=z.c(3),{org:s}=Me();let n;return e[0]!==s||e[1]!==t?(n={mutationFn:async i=>(await(await rn(An(s.slug,t,"file",{path:i.path}),{method:"PUT",headers:{"content-type":i.contentType??"text/html; charset=utf-8"},body:i.body})).json()).entry},e[0]=s,e[1]=t,e[2]=n):n=e[2],Rt(n)}function VV(t){const e=z.c(18),{org:s}=Me(),n=Qt();let i;e[0]!==s||e[1]!==t?(i=async d=>(await(await rn(An(s.slug,t,"public",{path:d.path}),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({mode:d.mode,password:d.password})})).json()).entry,e[0]=s,e[1]=t,e[2]=i):i=e[2];let o;e[3]!==s||e[4]!==n||e[5]!==t?(o=async d=>{const u=Fe.orgFsStat(s.id,t,d.path);await n.cancelQueries({queryKey:u});const h=n.getQueryData(u),f=d.mode!=="private";return n.setQueryData(u,m=>m&&{...m,readPublic:f,effectivePublic:f,shareMode:d.mode}),{key:u,previous:h}},e[3]=s,e[4]=n,e[5]=t,e[6]=o):o=e[6];let l;e[7]!==n?(l=(d,u,h)=>{h&&n.setQueryData(h.key,h.previous)},e[7]=n,e[8]=l):l=e[8];let a;e[9]!==s||e[10]!==n||e[11]!==t?(a=(d,u,h)=>{n.invalidateQueries({queryKey:Fe.orgFsStat(s.id,t,h.path)}),n.invalidateQueries({queryKey:Fe.orgFsVolume(s.id,t)}),n.invalidateQueries({queryKey:Fe.orgFsRecent(s.id)}),n.invalidateQueries({queryKey:Fe.orgFsSearchRoot(s.id)})},e[9]=s,e[10]=n,e[11]=t,e[12]=a):a=e[12];let c;return e[13]!==i||e[14]!==o||e[15]!==l||e[16]!==a?(c={mutationFn:i,onMutate:o,onError:l,onSettled:a},e[13]=i,e[14]=o,e[15]=l,e[16]=a,e[17]=c):c=e[17],Rt(c)}function Ec(t){const e=z.c(33),{org:s}=Me(),n=Qt();let i;e[0]!==s||e[1]!==n||e[2]!==t?(i=()=>{n.invalidateQueries({queryKey:Fe.orgFsVolume(s.id,t)}),n.invalidateQueries({queryKey:Fe.orgFsRecent(s.id)}),n.invalidateQueries({queryKey:Fe.orgFsSearchRoot(s.id)})},e[0]=s,e[1]=n,e[2]=t,e[3]=i):i=e[3];const o=i;let l;e[4]!==s||e[5]!==t?(l=async y=>{const L=(await Promise.allSettled(y.files.map(w=>{const S=y.dir?`${y.dir}/${w.name}`:w.name;return rn(An(s.slug,t,"file",{path:S}),{method:"PUT",headers:{"content-type":w.type||"application/octet-stream"},body:w})}))).find(TV);if(L)throw L.reason},e[4]=s,e[5]=t,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==l?(a={mutationFn:l,onSettled:o},e[7]=o,e[8]=l,e[9]=a):a=e[9];const c=Rt(a);let d;e[10]!==s||e[11]!==t?(d=async y=>{await rn(An(s.slug,t,"dir",{path:y}),{method:"POST"})},e[10]=s,e[11]=t,e[12]=d):d=e[12];let u;e[13]!==o||e[14]!==d?(u={mutationFn:d,onSuccess:o},e[13]=o,e[14]=d,e[15]=u):u=e[15];const h=Rt(u);let f;e[16]!==s||e[17]!==t?(f=async y=>{await rn(An(s.slug,t,"file",{path:y}),{method:"DELETE"})},e[16]=s,e[17]=t,e[18]=f):f=e[18];let m;e[19]!==o||e[20]!==f?(m={mutationFn:f,onSuccess:o},e[19]=o,e[20]=f,e[21]=m):m=e[21];const p=Rt(m);let g;e[22]!==s||e[23]!==t?(g=async y=>{await rn(An(s.slug,t,"move"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(y)})},e[22]=s,e[23]=t,e[24]=g):g=e[24];let x;e[25]!==o||e[26]!==g?(x={mutationFn:g,onSuccess:o},e[25]=o,e[26]=g,e[27]=x):x=e[27];const b=Rt(x);let v;return e[28]!==h||e[29]!==b||e[30]!==p||e[31]!==c?(v={upload:c,mkdir:h,remove:p,move:b},e[28]=h,e[29]=b,e[30]=p,e[31]=c,e[32]=v):v=e[32],v}function TV(t){return t.status==="rejected"}async function g2(t,e,s,n,i,o,l){try{const a=await Fc(s,n,o);Al(t,e,{id:n,name:Fl(n,i),metadata:a.messages,char:"/",kind:"prompt",args:o})}catch(a){console.error("[slash] Failed to fetch prompt:",a),me.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function EV(t,e,s,n,i){try{const o=await m4(s,n);Al(t,e,{id:n,name:n,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),me.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function AV(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await NV(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};Al(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),me.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const PV=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=se(),i=Qt(),{org:o}=Me(),l=Pt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=Fe.virtualMcpPrompts(e,o.id),c=Fe.virtualMcpResources(e,o.id),d=Fe.slashSkills(o.id),u=["slash-mention",o.id,e??"default"],[h,f]=V.useState(null),[m,p]=V.useState(null),g=ew(t);g&&(g.onEditChip=async S=>{if(l)try{const j=(await x2(i,a,l)).find(T=>T.name===S.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...S,prompt:j})}catch(k){console.error("[slash] Failed to load prompt for editing:",k),me.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=V.useRef(null),b=V.useRef(!1),v=async({item:S,range:k})=>{if(Je("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),b.current=!0,!!l)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){f({range:k,item:S});return}const j=Ni(S._meta);await g2(t,k,l,S.name,j,void 0,{t:n})}else S.kind==="skill"?S.skill&&await AV(t,k,o.slug,S.skill,{t:n}):S.uri&&await EV(t,k,l,S.uri,{t:n})},y=async S=>{if(!h||!l)return;const{range:k,item:j}=h,T=Ni(j._meta);await g2(t,k,l,j.name,T,S,{t:n}),f(null)},_=async S=>{if(!(!m||!l)){if(!tw(t,m.pos,m.promptId)){me.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const k=await Fc(l,m.promptId,S),j=Ni(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,c0({id:m.promptId,name:Fl(m.promptId,j),metadata:k.messages,char:"/",kind:"prompt",args:S})).run(),Je("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(k){console.error("[slash] Failed to update prompt:",k),me.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},L=async S=>{const{query:k}=S;if(!l)return[];const[j,T,N]=await Promise.all([x2(i,a,l),DV(i,c,l),RV(i,d,o.slug)]),C=k.trim().toLowerCase(),A=(j??[]).filter(E=>!C||E.name.toLowerCase().includes(C)||E.title?.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name,title:E.title,description:E.description,kind:"prompt",arguments:E.arguments,_meta:E._meta})),P=(T??[]).filter(E=>!C||E.uri.toLowerCase().includes(C)||E.name?.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name??E.uri,title:E.name,description:E.description,kind:"resource",uri:E.uri})),R=(N??[]).filter(E=>!C||E.name.toLowerCase().includes(C)||E.id.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name,title:E.name,description:E.description??void 0,kind:"skill",skill:E}));return[...A,...P,...R]},w=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 r.jsxs(r.Fragment,{children:[r.jsx(Vb,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:L,onSelect:v,onOpenChange:S=>{if(s&&(s.current=S),S)x.current=Date.now(),b.current=!1,Je("chat_picker_opened",{picker:"/"});else{const k=x.current;Je("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:k?Date.now()-k:null}),x.current=null}}}),r.jsx(pc,{prompt:w,setPrompt:()=>f(null),onSubmit:y}),r.jsx(pc,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:_,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function x2(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>vh(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>vh(s),staleTime:6e4}),n?.prompts??[]}async function RV(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>yV(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function DV(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>Ga(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>Ga(s),staleTime:6e4}),n?.resources??[]}function IV(t){return[i1.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),pb.configure({placeholder:()=>t.current??"Ask anything, / for prompts & skills, @ for agents & resources...",showOnlyWhenEditable:!1}),nw,iw]}function Pb({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=V.useRef(o),d=V.useRef(e),u=V.useRef(n),h=V.useRef(i),f=n1({extensions:IV(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",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 V.useEffect(()=>{f?.setEditable(!s)},[f,s]),V.useEffect(()=>{c.current=o},[o]),V.useEffect(()=>{d.current=e},[e]),V.useEffect(()=>{u.current=n},[n]),V.useEffect(()=>{h.current=i},[i]),V.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]),r.jsx(sw.Provider,{value:{editor:f},children:a})}function Rb(t){const e=z.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=zc();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const T=f.state.doc.textContent.trim()==="";f.commands.focus("end"),T||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,T)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),T)){f.commands.focus("end");const N=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:N?" "+T:T})}},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]),V.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=ie("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 v;e[7]!==f||e[8]!==b?(v=r.jsx(r1,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const y=n??null;let _;e[10]!==f||e[11]!==a||e[12]!==y?(_=r.jsx(V.Suspense,{fallback:null,children:r.jsx(PV,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=y,e[13]=_):_=e[13];const L=n??null;let w;e[14]!==f||e[15]!==a||e[16]!==L?(w=r.jsx(V.Suspense,{fallback:null,children:r.jsx(aV,{editor:f,virtualMcpId:L,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=L,e[17]=w):w=e[17];let S;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==h?(S=h&&o&&!u?r.jsx(WC,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=o,e[22]=h,e[23]=S):S=e[23];let k;return e[24]!==_||e[25]!==w||e[26]!==S||e[27]!==v?(k=r.jsxs(r.Fragment,{children:[v,_,w,S]}),e[24]=_,e[25]=w,e[26]=S,e[27]=v,e[28]=k):k=e[28],k}function Db(t){const e=z.c(3),[s]=mr();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&gk(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const MV={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"},$V=eS.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),OV=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function BV(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1.5",children:OV.map(zV)}),t[0]=e):e=t[0],e}function zV(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function FV({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=se(),[a,c]=V.useState(!1),d=Db(MV),{org:u}=Me(),{editor:h}=zc(),f=V.useRef(null),m=v0(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async q=>{const ee=q.target.files;if(!ee||ee.length===0||!h)return;const X=Array.from(ee);try{let Y=h.state.selection.from;for(const G of X)await W1(h,n??null,G,Y,o,l),Y=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=Pt({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=Fe.virtualMcpPrompts(s,u.id),{data:v,isLoading:y}=xt({queryKey:b,queryFn:()=>vh(x),staleTime:6e4,enabled:a&&!!x}),_=v?.prompts??[],[L,w]=V.useState(null),{chatMode:S,setChatMode:k}=Gr(),[j,T]=mr(),N=uo.find(q=>q.value===j.toolApprovalLevel)??uo[0],C=l(N.shortKey),A=q=>{const ee=uo.find(X=>X.value===q);if(ee){if(ee.value===j.toolApprovalLevel){c(!1);return}d(),Je("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:ee.value,source:"tools_popover"}),T({...j,toolApprovalLevel:ee.value}),c(!1)}},P=S==="plan",R=()=>{d();const q=P?"default":"plan";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},E=()=>{e(),c(!1)},M=async(q,ee)=>{if(!h||!x)return;const X=Ni(q._meta),Y={from:h.state.selection.from,to:h.state.selection.to};try{const G=await Fc(x,q.name,ee);Al(h,Y,{id:q.name,name:Fl(q.name,X),metadata:G.messages,char:"/",kind:"prompt",args:ee})}catch{me.error(l("chat.toolsPopover.failedLoadPrompt"))}},I=async q=>{c(!1);const ee=!!(q.arguments&&q.arguments.length>0);if(Je("chat_prompt_inserted",{prompt_name:q.name,with_arguments:ee}),ee){w(q);return}await M(q)},$=async q=>{L&&(await M(L,q),w(null))},O=()=>{d();const q=S==="gen-image"?"default":"gen-image";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},D=()=>{d();const q=S==="web-search"?"default":"web-search";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},B=()=>{d();const q=S==="deep-research"?"default":"deep-research";Je("chat_mode_changed",{from_mode:S,to_mode:q,source:"tools_popover"}),k(q),c(!1)},F=S==="gen-image",U=S==="web-search",H=S==="deep-research",W=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:lk(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[W,r.jsxs(qt,{open:a,onOpenChange:q=>{q&&!a&&Je("chat_tools_popover_opened",{chat_mode:S}),c(q)},children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(ae,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[r.jsx(l5,{size:14}),r.jsx("span",{className:ie("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")})]})}),r.jsxs(Yt,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(Ze,{onClick:p,disabled:i,children:[r.jsx(Nt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsxs(Ze,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:q=>q.preventDefault(),children:[r.jsx(Nt,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(qe,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(Ze,{onClick:R,className:ie(P&&"text-special"),children:[r.jsx(Pl,{size:16,className:ie(P&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:ie("text-xs text-muted-foreground",P&&"text-special font-medium"),children:$V})]}),r.jsxs(Ze,{onClick:O,className:ie(F&&"text-special"),children:[r.jsx(Pi,{size:16,className:ie(F&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),F&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Ze,{onClick:D,className:ie(U&&"text-special"),children:[r.jsx(Vi,{size:16,className:ie(U&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Ze,{onClick:B,className:ie(H&&"text-special"),children:[r.jsx(a5,{size:16,className:ie(H&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),H&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Li,{children:[r.jsxs(wi,{className:"gap-2",children:[r.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.prompts")})]}),r.jsx(Si,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:y?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(it,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):_.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):_.map(q=>r.jsxs(Ze,{onClick:()=>I(q),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:q.title||s1(q.name,Ni(q._meta))}),q.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:q.description})]},q.name))})]}),r.jsxs(Li,{children:[r.jsxs(wi,{className:"gap-2",children:[r.jsx(p0,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Si,{className:"w-48 p-1.5",children:r.jsx(wh,{value:j.toolApprovalLevel,onValueChange:A,children:uo.map(q=>r.jsx(bc,{value:q.value,children:l(q.labelKey)},q.value))})})]}),r.jsxs(Ze,{onClick:E,children:[r.jsx(V1,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(V.Suspense,{children:r.jsx(BV,{})})]})]})]}),r.jsx(pc,{prompt:L,setPrompt:w,onSubmit:$})]})}const UV=[{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 KV(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1",children:UV.map(HV)}),t[0]=e):e=t[0],e}function HV(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function WV(t){const e=z.c(10),{onClick:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("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 o;e[1]!==n?(o=n("chat.connectionsBanner.description"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:o}),e[3]=o,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(KV,{}),c=r.jsx(wn,{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=r.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 Da=48;function qV(){const t=z.c(9),[e,s]=V.useState("idle"),[n,i]=V.useState(""),[o,l]=V.useState(""),[a,c]=V.useState(QV),d=V.useRef(null),u=V.useRef(null),h=V.useRef(null),f=V.useRef(null),m=V.useRef(0),p=V.useRef(!1),g=V.useRef(""),x=V.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),u.current?.close().catch(YV),f.current?.getTracks().forEach(GV),h.current=null,u.current=null,f.current=null},t[0]=v):v=t[0];const y=v;let _;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=C=>{f.current=C;const A=new AudioContext;u.current=A;const P=A.createMediaStreamSource(C),R=A.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,P.connect(R),h.current=R;const E=new Uint8Array(R.frequencyBinCount),M=()=>{if(!h.current)return;h.current.getByteFrequencyData(E);const I=[];for(let $=0;$<Da;$++){const O=Math.floor($/Da*E.length);I.push(Math.max(.04,(E[O]??0)/255))}c(I),m.current=requestAnimationFrame(M)};M()};_=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let A;try{A=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),N(A);const P=new C;d.current=P,P.interimResults=!0,P.continuous=!0,P.lang=navigator.language||"en-US",P.onresult=R=>{let E="",M="";for(let I=R.resultIndex;I<R.results.length;I++){const $=R.results[I],O=$?.[0]?.transcript??"";$?.isFinal?M=M+O:E=E+O}M&&(g.current=g.current+M,i(g.current)),x.current=E,l(E)},P.onend=()=>{if(p.current)try{P.start()}catch{}};try{P.start()}catch{return p.current=!1,d.current=null,y(),s("idle"),"idle"}return"recording"},t[1]=_}else _=t[1];const L=_;let w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.stop(),y(),s("idle"),c(Array(Da).fill(.05)),l("");const N=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",N},t[2]=w):w=t[2];const S=w;let k;t[3]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.abort(),y(),s("idle"),i(""),l(""),c(Array(Da).fill(.05)),g.current="",x.current=""},t[3]=k):k=t[3];const j=k;let T;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(T={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:L,stopRecording:S,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=T):T=t[8],T}function GV(t){return t.stop()}function YV(){}function QV(){return Array(Da).fill(.05)}function XV(t){const e=z.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(JV),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.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 JV(t,e){return r.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 ZV(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function w9(t){const e=z.c(3),{message:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(Bc,{size:14,className:"shrink-0"}),e[0]=n):n=e[0];const i=s??"";let o;return e[1]!==i?(o=r.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:[n,r.jsx("span",{className:"text-sm",children:i})]}),e[1]=i,e[2]=o):o=e[2],o}function eT(t,e,s){const n=z.c(7),{editor:i}=zc(),o=se(),[l,a]=V.useState(!1),c=V.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(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=tT,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!v0(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=i.state.selection.from;for(const y of b)await W1(i,t,y,v,e,o),v=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,o,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=o,n[5]=d,n[6]=u):(d=n[5],u=n[6]),V.useEffect(d,u),l}function tT(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function sT(t){const e=z.c(14),{selectedModel:s}=t,n=se();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=S5(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Wn,{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],o=n("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[8]!==i||e[9]!==o?(a=r.jsx("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function nT(){const t=z.c(5),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Bc,{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=r.jsxs(r.Fragment,{children:[s,r.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function iT(t){const e=z.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=eT(s,n,i);let l;e[0]!==s?(l=v0(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o?"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=ie("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?r.jsx(sT,{selectedModel:s}):r.jsx(nT,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function Ld(t){const e=z.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=ie("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",o),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("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=r.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=r.jsx(hs,{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=r.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 rT(){const t=z.c(6),e=It(),{org:s,locator:n}=Me(),{create:i}=Uc();let o;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(o=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),u=c?.id??Ul(s.id).id;J4(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:sS};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]=o):o=t[5],o}function oT({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=se(),n=t1(),i=zl(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||$j,h=rT(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:y,setChatMode:_}=Gr(),{data:L}=Ui.useSession(),w=L?.user?.id,{org:S,locator:k}=Me(),j=Ul(S.id).id,T=Db(xk),[N,C]=V.useState(!1),{unsupportedFile:A,onUnsupportedFile:P,clearUnsupportedFile:R}=XC(),E=qV(),M=V.useRef(void 0),I=async()=>{M.current=U;const de=await E.startRecording();Je("chat_voice_started",{thread_id:d,outcome:de==="recording"?"started":de==="unsupported"?"unsupported":de==="permission-denied"?"permission_denied":"unknown"})},$=()=>{Je("chat_voice_confirmed",{thread_id:d});const de=E.stopRecording();Y.current?.syncVoiceText(M.current,de),Y.current?.focus()},O=()=>{Je("chat_voice_cancelled",{thread_id:d}),E.cancelRecording(),Y.current?.restoreContent(M.current)};V.useEffect(()=>{if(E.status!=="recording")return;const de=(E.transcript+(E.interimTranscript?" "+E.interimTranscript:"")).trim();Y.current?.syncVoiceText(M.current,de)},[E.transcript,E.interimTranscript,E.status]);const D=i?.activeTask??null,B=_0(),F=G4({isDesktopApp:B,harnessId:D?.harness_id,sandboxProviderKind:D?.sandbox_provider_kind}),[U,H]=V.useState(()=>Zp(sessionStorage,k,u)??void 0),W=de=>{H(de),g.current=de,nb(sessionStorage,k,u,de,{onQuotaExceeded:({docSizeBytes:Z})=>{Je("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Z}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},q=V.useRef(d);if(q.current!==d){q.current=d;const de=Zp(sessionStorage,k,u)??void 0;H(de),g.current=de}const X=[...o].reverse().find(de=>de.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,Y=V.useRef(null),G=V.useRef(!1),J=y==="plan",oe=de=>{T(),Je("chat_mode_changed",{from_mode:de,to_mode:"default",source:"pill_dismiss"}),_("default")};V.useEffect(()=>{const de=Z=>{Q4(Z)&&Z.code==="KeyL"&&(Z.preventDefault(),Z.shiftKey&&_(y==="plan"?"default":"plan"),Y.current?.focus())};return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[y,_]);const le=R4(o),K=[...o].reverse().find(de=>de.role==="assistant"&&de.metadata?.usage)?.metadata?.usage?.contextTokens??0,te=!p&&!sb(U),ne=ZV({hasDraft:te,isStreaming:l,isRunInProgress:a}),re=ne==="send",he=ne==="stop",pe=de=>{if(de?.preventDefault(),ne==="send"&&U){if(Je("chat_message_sent",{thread_id:d||null,mode:y,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:de?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){me.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(U)}else h({tiptapDoc:U,virtualMcp:m});Bj(sessionStorage,k,u),W(void 0)}else ne==="stop"&&(Je("chat_message_stopped",{thread_id:d}),c())};return w&&D?.created_by&&D.created_by!==w?r.jsx(w9,{message:s("chat.input.readOnlyOthersChat")}):D?.metadata?.read_only?r.jsx(w9,{message:s("chat.input.readOnlyThread")}):F?r.jsx(w9,{message:s("chat.input.codingAgentRequiresDesktop")}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-col w-full justify-end",children:r.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&r.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&i&&r.jsx(N0,{}),n&&i&&d?r.jsx(RC,{taskId:d}):null,r.jsx(Pb,{tiptapDoc:U,setTiptapDoc:W,disabled:E.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:pe,suggestionOpenRef:G,children:r.jsxs("form",{onSubmit:pe,className:ie("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:[r.jsx(iT,{selectedModel:f,onUnsupportedFile:P,disabled:E.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(Rb,{ref:Y,disabled:E.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:P,suggestionOpenRef:G})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:E.status==="recording"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx(XV,{data:E.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:O,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:r.jsx(hs,{size:16})}),r.jsx("button",{type:"button",onClick:$,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:r.jsx(Ut,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(FV,{disabled:!1,onOpenConnections:()=>{Je("connections_dialog_opened",{source:"tools_popover",mode:"add"}),C(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:P}),J&&r.jsx(Ld,{onClick:()=>oe("plan"),label:s("chat.input.planMode"),icon:r.jsx(Pl,{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"}),y==="gen-image"&&x&&r.jsx(Ld,{onClick:()=>oe("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(Pi,{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]"}),y==="web-search"&&b&&r.jsx(Ld,{onClick:()=>oe("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Vi,{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]"}),y==="deep-research"&&v&&r.jsx(Ld,{onClick:()=>oe("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(a5,{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]"}),X&&K>0&&r.jsx(rw,{usage:le,totalTokens:K,contextWindow:X,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(HC,{}),E.isSupported&&r.jsx(ae,{type:"button",onClick:I,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",E.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:E.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":E.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(pS,{size:18})}),r.jsx(ae,{type:he?"button":"submit",onClick:de=>{he&&(de.preventDefault(),de.stopPropagation(),c())},variant:re||he?"default":"ghost",size:"icon",disabled:!re&&!he,className:ie("size-8 rounded-lg transition-all",!re&&!he&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(ne==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(ne==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:he?r.jsx(gS,{size:20}):r.jsx(o0,{size:20})})]})]})})]})},d),e&&r.jsx(WV,{onClick:()=>{Je("connections_banner_clicked",{source:"home_chat_input"}),Je("connections_dialog_opened",{source:"home_banner",mode:"add"}),C(!0)}})]})}),r.jsx(A1,{mode:"browse",open:N,onOpenChange:C,defaultTab:"all"}),r.jsx(YC,{info:A,onClose:R})]})}function lT(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 aT(){const t=z.c(8),e=It(),s=c1(),n=t1()?.messages??[],i=zl()?.taskId??null;let o;t[0]!==n?(o=lT(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=V.useRef(null),c=V.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({to:".",search:cT,replace:!0}))},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]),V.useEffect(d,u)}function cT(t){return{...t,main:"preview"}}const dT={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 Ib(t){return`deco-credits-empty-dismissed:${t}`}function uT(t){try{return localStorage.getItem(Ib(t))==="1"}catch{return!1}}function hT(){const t=z.c(68),e=se(),{org:s}=Me(),n=It(),{decoKeyId:i}=E1(),o=Cs(),[l,a]=V.useState(!0),[c,d]=V.useState(""),[u,h]=V.useState(!1),[f,m]=V.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Je("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(Ib(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==l||t[3]!==s.id?(b=()=>{l&&Je("credits_empty_state_shown",{organization_id:s.id})},v=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),V.useEffect(b,v);let y;t[6]!==f||t[7]!==o?(y=async X=>{const{url:Y}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:X,currency:f});return Y},t[6]=f,t[7]=o,t[8]=y):y=t[8];let _;t[9]!==x?(_=X=>{X&&window.open(X,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=_):_=t[10];let L;t[11]!==e?(L=X=>{me.error(e("chat.creditsEmptyState.topUpFailed",{message:X.message}))},t[11]=e,t[12]=L):L=t[12];let w;t[13]!==y||t[14]!==_||t[15]!==L?(w={mutationFn:y,onSuccess:_,onError:L},t[13]=y,t[14]=_,t[15]=L,t[16]=w):w=t[16];const{mutate:S,isPending:k}=Rt(w),j=parseFloat(c),T=!isNaN(j)&&j>=1;if(!l)return null;let N;t[17]!==x?(N=X=>!X&&x(),t[17]=x,t[18]=N):N=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=r.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]=C):C=t[19];let A;t[20]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(c5,{size:20,className:"text-warning"})}),t[20]=A):A=t[20];let P;t[21]!==e?(P=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=P):P=t[22];let R;t[23]!==P?(R=r.jsx(At,{className:"text-lg font-semibold",children:P}),t[23]=P,t[24]=R):R=t[24];let E;t[25]!==e?(E=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=E):E=t[26];let M;t[27]!==E?(M=r.jsx(_n,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:E}),t[27]=E,t[28]=M):M=t[28];let I;t[29]!==R||t[30]!==M?(I=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,r.jsxs(os,{className:"relative gap-3",children:[A,r.jsxs("div",{className:"text-center",children:[R,M]})]})]}),t[29]=R,t[30]=M,t[31]=I):I=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==T||t[38]!==k||t[39]!==u||t[40]!==e||t[41]!==S?($=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(T1,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:X=>{X&&m(X)},children:[r.jsx(xc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(xc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:dT[f].map(X=>{const{dollars:Y,labelKey:G}=X;return r.jsxs("button",{type:"button",disabled:k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Y*100,currency:f,tier_label:G,source:"empty_state"}),S(Y*100)},className:ie("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:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,Y]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(G)})]},Y)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(rt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:X=>d(X.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(ae,{className:"h-10",disabled:!T||k,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),S(Math.round(j*100))},children:e(k?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):r.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]=T,t[38]=k,t[39]=u,t[40]=e,t[41]=S,t[42]=$):$=t[42];let O;t[43]!==x||t[44]!==n||t[45]!==s.slug?(O=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=O):O=t[46];let D;t[47]!==e?(D=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=D):D=t[48];let B;t[49]===Symbol.for("react.memo_cache_sentinel")?(B=r.jsx(Zr,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=B):B=t[49];let F;t[50]!==O||t[51]!==D?(F=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:O,children:[D,B]}),t[50]=O,t[51]=D,t[52]=F):F=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let H;t[55]!==x||t[56]!==U?(H=r.jsx(ae,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=H):H=t[57];let W;t[58]!==F||t[59]!==H?(W=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,H]}),t[58]=F,t[59]=H,t[60]=W):W=t[60];let q;t[61]!==I||t[62]!==$||t[63]!==W?(q=r.jsxs(jt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:fT,children:[I,$,W]}),t[61]=I,t[62]=$,t[63]=W,t[64]=q):q=t[64];let ee;return t[65]!==q||t[66]!==N?(ee=r.jsx(Ct,{open:!0,onOpenChange:N,children:q}),t[65]=q,t[66]=N,t[67]=ee):ee=t[67],ee}function fT(t){return t.preventDefault()}function mT(t){const e=z.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 o,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ie("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=r.jsx(c5,{size:13,className:"text-success"}),e[2]=o,e[3]=l):(o=e[2],l=e[3]);let a;return e[4]!==i?(a=r.jsxs("div",{className:o,children:[l,r.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 pT(){const t=z.c(8),{org:e}=Me(),s=It();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,o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("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"),o=r.jsx(fn,{size:13,className:"text-warning"}),l=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=o,t[5]=l):(i=t[3],o=t[4],l=t[5]);let a;return t[6]!==n?(a=r.jsxs("button",{type:"button",onClick:n,className:i,children:[o,l]}),t[6]=n,t[7]=a):a=t[7],a}function gT(t){const e=z.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[i,r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),r.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=o):o=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),r.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[r.jsx(wd,{align:"right",width:"w-3/4"}),r.jsx(wd,{align:"left",width:"w-full",lines:3}),r.jsx(wd,{align:"right",width:"w-2/3"}),r.jsx(wd,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:r.jsx("div",{className:"relative flex-1",children:r.jsxs("div",{className:"space-y-2 p-2",children:[r.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),r.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"px-4 py-4",children:r.jsx("div",{className:"mx-auto w-full max-w-2xl",children:r.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[c,r.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),r.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=u):u=e[8];let h;return e[9]!==n?(h=r.jsxs("div",{className:n,children:[l,a,u]}),e[9]=n,e[10]=h):h=e[10],h}function wd(t){const e=z.c(22),{align:s,width:n,lines:i}=t,o=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,e[1]=c):c=e[1];const d=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let u;e[2]!==d?(u=ie("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=h):h=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=ie("min-w-0 rounded-2xl p-4",f,o),e[5]=f,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((y,_)=>r.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",_===l-1?"w-3/4":"w-full"),style:{animationDelay:`${_*.1}s`}},_))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==u?(b=r.jsxs("div",{className:u,children:[h,x]}),e[16]=x,e[17]=u,e[18]=b):b=e[18];let v;return e[19]!==b||e[20]!==c?(v=r.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=v):v=e[21],v}function xT(t){const e=z.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:o,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==o||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||o||!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,o,l],e[0]=l,e[1]=i,e[2]=o,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),V.useEffect(a,c)}function bT(t){const e=z.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=r.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function vT(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function yT(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.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 _T(){const t=se(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=qn(),{taskId:l}=Qs();aT();const a=V4(l??""),c=FL(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),u=ow(d),h=u.at(-1),m=Mj()*wj+16,p=V.useRef(null),g=V.useRef(null);xT({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=lw({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(aw,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.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:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&r.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((v,y)=>r.jsx(Fp,{pair:v,isLastPair:!1,status:y===u.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),h&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(Fp,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(ae,{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:r.jsx(AL,{size:14})})]})})}function LT(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("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 o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}const is=Object.assign(bT,{Main:vT,Messages:_T,EmptyState:yT,Footer:LT,Input:oT,Provider:zL,ActiveTaskProvider:BL,Skeleton:gT,IceBreakers:Lj,NoAiProviderEmptyState:ak,CreditsEmptyState:hT,CreditsEyebrow:mT,NoCreditsEyebrow:pT,CreditsExhaustedBanner:fb});function wT({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function ST(){const t=z.c(3),e=y0(),n=zl()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=wT({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function ma(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function S9(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 kT(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function jT(t){const e=z.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(CT),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.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 CT(t){return r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),r.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function NT(t){const e=z.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=se(),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&&r.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&&r.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&&r.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=r.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=r.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]!==o||e[12]!==a?(g=o("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=o,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[p,r.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=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==o?(v=o("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=o,e[19]=v):v=e[19];let y;e[20]!==v?(y=r.jsxs("div",{className:"flex items-center gap-1.5",children:[b,r.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=y):y=e[21];let _;e[22]!==d||e[23]!==i||e[24]!==o?(_=i>0&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=o,e[25]=_):_=e[25];let L;e[26]!==y||e[27]!==_||e[28]!==x?(L=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,y,_]}),e[26]=y,e[27]=_,e[28]=x,e[29]=L):L=e[29];let w;return e[30]!==L||e[31]!==m?(w=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,L]}),e[30]=L,e[31]=m,e[32]=w):w=e[32],w}function VT(t){const e=z.c(14),{agentId:s,isError:n}=t,i=Hs(s),o=se();let l;e[0]!==i?.title||e[1]!==o?(l=i?.title??o("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=o,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=r.jsx(ai,{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=ie("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=r.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=r.jsxs(r.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function TT(t){const e=z.c(12),{isError:s}=t,n=se();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const o=i;let l;e[2]!==o?(l=r.jsx(ai,{icon:null,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=o,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=r.jsx("span",{className:c,children:o}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function ET(t){const e=z.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,o=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==o?(a=r.jsx(TT,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(VT,{agentId:n,isError:o}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=r.jsx(V.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&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-muted-foreground/50",children:"·"}),r.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]!==o||e[12]!==i?(h=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(it,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(ek,{size:12,className:"text-destructive"}):l?r.jsx(fn,{size:12,className:"text-warning"}):r.jsx(Gn,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=r.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 AT(t){const e=z.c(78),{onClose:s,back:n,className:i}=t,o=se(),[l,a]=V.useState(null),{messages:c}=qn(),{activeTask:d}=Qs(),{selectedModel:u,selectedVirtualMcp:h}=Gr();let f,m,p,g,x,b,v,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]!==o){y=Symbol.for("react.early_return_sentinel");e:{const w=R4(c),S=[...c].reverse().find(UT),k=S?.metadata?.usage,j=S?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,T=k?.contextTokens??0,N=j&&j>0?(T/j*100).toFixed(1):null,C=c;let A;e[17]!==C?(A=C.filter(FT).reduce(zT,0),e[17]=C,e[18]=A):A=e[18];const P=A,R=c;let E;e[19]!==R?(E=R.filter(BT).reduce(OT,0),e[19]=R,e[20]=E):E=e[20];const M=E,I=Math.max(0,w.totalTokens-P-M),$=c[0],O=c.at(-1),D=$?.metadata?.created_at??d?.created_at,B=O?.metadata?.created_at??d?.updated_at,F=c.filter($T),U=c.flatMap(IT),H=u?.modelId?kT(u.modelId):"—",W=h?.title??"Super Agent",q=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:F.length},{label:o("chat.contextPanel.agentLabel"),value:W},{label:o("chat.contextPanel.modelLabel"),value:H},{label:o("chat.contextPanel.contextLimitLabel"),value:j?ma(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:w.totalTokens>0?ma(w.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:N!==null?`${N}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:w.inputTokens>0?ma(w.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:w.outputTokens>0?ma(w.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:w.reasoningTokens>0?ma(w.reasoningTokens):"0"},{label:o("chat.contextPanel.costLabel"),value:w.cost>0?`$${w.cost<.001?w.cost.toFixed(6):w.cost.toFixed(4)}`:"$0.00"},{label:o("chat.contextPanel.sessionCreatedLabel"),value:S9(D)},{label:o("chat.contextPanel.lastActivityLabel"),value:S9(B)}];if(!d&&F.length===0){let Q;e[21]!==i?(Q=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=Q):Q=e[22];let K;e[23]!==o?(K=o("chat.contextPanel.title"),e[23]=o,e[24]=K):K=e[24];let te;e[25]!==K?(te=r.jsx("span",{className:"text-sm font-medium text-foreground",children:K}),e[25]=K,e[26]=te):te=e[26];let ne;e[27]!==n?(ne=n?r.jsx(Kp,{size:14,className:"text-muted-foreground"}):r.jsx(ti,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=ne):ne=e[28];let re;e[29]!==s||e[30]!==ne?(re=r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ne}),e[29]=s,e[30]=ne,e[31]=re):re=e[31];let he;e[32]!==te||e[33]!==re?(he=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[te,re]}),e[32]=te,e[33]=re,e[34]=he):he=e[34];let pe;e[35]!==o?(pe=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=pe):pe=e[36];let de;e[37]!==pe?(de=r.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:r.jsx("p",{className:"text-xs text-muted-foreground",children:pe})}),e[37]=pe,e[38]=de):de=e[38];let Z;e[39]!==Q||e[40]!==he||e[41]!==de?(Z=r.jsxs("div",{className:Q,children:[he,de]}),e[39]=Q,e[40]=he,e[41]=de,e[42]=Z):Z=e[42],y=Z;break e}e[43]!==i?(b=ie("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 ee;e[45]!==o?(ee=o("chat.contextPanel.title"),e[45]=o,e[46]=ee):ee=e[46];let X;e[47]!==ee?(X=r.jsx("span",{className:"text-sm font-medium text-foreground",children:ee}),e[47]=ee,e[48]=X):X=e[48];let Y;e[49]!==n?(Y=n?r.jsx(Kp,{size:14}):r.jsx(ti,{size:14}),e[49]=n,e[50]=Y):Y=e[50];let G;e[51]!==s||e[52]!==Y?(G=r.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:Y}),e[51]=s,e[52]=Y,e[53]=G):G=e[53],e[54]!==X||e[55]!==G?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[X,G]}),e[54]=X,e[55]=G,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=U.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.subtasksSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:U.map(DT)})]}),p=r.jsx(jT,{items:q});let J;e[57]!==o?(J=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=J):J=e[58];let oe;e[59]!==J?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:J}),e[59]=J,e[60]=oe):oe=e[60];let le;e[61]!==M||e[62]!==I||e[63]!==P?(le=r.jsx(NT,{userTokens:P,assistantTokens:M,otherTokens:I}),e[61]=M,e[62]=I,e[63]=P,e[64]=le):le=e[64],e[65]!==oe||e[66]!==le?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[oe,le]}),e[65]=oe,e[66]=le,e[67]=g):g=e[67],x=F.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.rawMessagesSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:F.map(Q=>{const K=Q.metadata?.created_at,te=l?.id===Q.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(te?null:Q),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:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:ie("shrink-0 font-medium",Q.role==="user"?"text-chart-1":"text-chart-2"),children:Q.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Q.id})]}),K&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:S9(K)})]}),te&&r.jsxs(r.Fragment,{children:[Q.role==="assistant"&&(()=>{const ne=Q.metadata?._request;if(!ne)return null;const re=ne.systemSections??[],he=Math.max(1,...re.map(RT)),pe=re.reduce(PT,0);return r.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-foreground",children:o("chat.contextPanel.requestLabel")}),r.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ne.activeTools??0," / ",ne.tools??0," ",o("chat.contextPanel.toolsActive")]})]}),re.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"text-muted-foreground",children:[o("chat.contextPanel.systemPromptLabel")," ",r.jsxs("span",{className:"tabular-nums",children:["~",Math.round(pe/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),re.map((de,Z)=>{const fe=de.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${Z}`,ue=de.chars/he*100,ye=Math.round(de.chars/4);return r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-mono text-foreground truncate",children:fe}),r.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ye.toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),r.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${ue}%`}})})]},Z)})]})]})})(),r.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(Q,null,2)})]})]},Q.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]=o,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=y}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let _;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(_=r.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]=_):_=e[73];let L;return e[74]!==b||e[75]!==v||e[76]!==_?(L=r.jsxs("div",{className:b,children:[v,_]}),e[74]=b,e[75]=v,e[76]=_,e[77]=L):L=e[77],L}function PT(t,e){return t+e.chars}function RT(t){return t.chars}function DT(t,e){return r.jsx(ET,{part:t},e)}function IT(t){return(t.parts??[]).filter(MT)}function MT(t){return t.type==="tool-subtask"}function $T(t){return t.role!=="system"}function OT(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function BT(t){return t.role==="assistant"}function zT(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function FT(t){return t.role==="user"}function UT(t){return t.role==="assistant"&&t.metadata?.usage}function KT(t){const e=z.c(21),{onOpenContextPanel:s}=t,{org:n}=Me(),{selectedVirtualMcp:i}=Gr();let o;e[0]!==n.id?(o=Ul(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Hs(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=r.jsx(zr,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=r.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?r.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=r.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=r.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 v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(is.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let y;e[16]!==s?(y=r.jsxs(is.Footer,{children:[v,r.jsx(is.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=y):y=e[17];let _;return e[18]!==b||e[19]!==y?(_=r.jsxs(r.Fragment,{children:[b,y]}),e[18]=b,e[19]=y,e[20]=_):_=e[20],_}function b2(t){const e=z.c(17),{outputs:s,collapsed:n,onToggle:i,variant:o}=t,l=o==="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=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.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=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=r.jsx(fs,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(f=r.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&&r.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(HT)}),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=r.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function HT(t){return r.jsx(dw,{file:t},t.key)}function WT(){const t=z.c(13),e=zl()?.taskId??null,s=cw();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=D4(e,n),[o,l]=V.useState(!1),[a,c]=V.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(GT),t[2]=d):d=t[2];let u;t[3]!==o||t[4]!==i?(u=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(b2,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(qT),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(b2,{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=r.jsxs(r.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function qT(t){return!t}function GT(t){return!t}function YT(){const t=z.c(30),{org:e}=Me(),{isChatEmpty:s}=qn(),[n,i]=V.useState("chat"),o=E1();if(ST()){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(is,{className:"animate-in fade-in-0 duration-200",children:r.jsx(is.Main,{className:"flex flex-col items-center",children:r.jsx(is.EmptyState,{children:r.jsx(is.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let a;t[1]!==o.hasDecoKey||t[2]!==o.hasOnlyDecoProvider||t[3]!==o.isLoading||t[4]!==o.isZeroBalance||t[5]!==s||t[6]!==e?(a=o.hasDecoKey&&o.isZeroBalance&&o.hasOnlyDecoProvider&&!o.isLoading&&s&&!uT(e.id),t[1]=o.hasDecoKey,t[2]=o.hasOnlyDecoProvider,t[3]=o.isLoading,t[4]=o.isZeroBalance,t[5]=s,t[6]=e,t[7]=a):a=t[7];const c=a;let d;t[8]!==c?(d=c&&r.jsx(is.CreditsEmptyState,{}),t[8]=c,t[9]=d):d=t[9];const u=n!=="chat"?!0:void 0,h=n!=="chat",f=n!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;t[10]!==f?(m=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[10]=f,t[11]=m):m=t[11];let p;t[12]!==s?(p=s?r.jsx(KT,{onOpenContextPanel:()=>i("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(is.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(WT,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(is.Messages,{})})]}),r.jsx(is.Footer,{children:r.jsx(is.Input,{onOpenContextPanel:()=>i("context")})})]}),t[12]=s,t[13]=p):p=t[13];let g;t[14]!==u||t[15]!==h||t[16]!==m||t[17]!==p?(g=r.jsx("div",{inert:u,"aria-hidden":h,className:m,children:p}),t[14]=u,t[15]=h,t[16]=m,t[17]=p,t[18]=g):g=t[18];const x=n!=="context"?!0:void 0,b=n!=="context",v=n==="context"?"opacity-100":"opacity-0 pointer-events-none";let y;t[19]!==v?(y=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[19]=v,t[20]=y):y=t[20];let _;t[21]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(AT,{back:!0,onClose:()=>i("chat")}),t[21]=_):_=t[21];let L;t[22]!==y||t[23]!==x||t[24]!==b?(L=r.jsx("div",{inert:x,"aria-hidden":b,className:y,children:_}),t[22]=y,t[23]=x,t[24]=b,t[25]=L):L=t[25];let w;return t[26]!==d||t[27]!==L||t[28]!==g?(w=r.jsxs(is,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[d,g,L]}),t[26]=d,t[27]=L,t[28]=g,t[29]=w):w=t[29],w}function Mb(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(is.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Fs,{fallback:e,children:r.jsx(V.Suspense,{fallback:r.jsx(is.Skeleton,{}),children:r.jsx(YT,{})})}),t[1]=s):s=t[1],s}function QT(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function $b(t){return t?.name||t?.email?.split("@")[0]||void 0}function Z1(t){const e=QT(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function XT(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 Ob=["SANDBOX_START"],Sd=new Map,JT=t=>`${t.virtualMcpId}::${t.branch??""}`,ZT=t=>t.message.includes("retry shortly"),k9=new Set,Vh={mark:(t,e)=>k9.add(`${t}::${e}`),clear:(t,e)=>k9.delete(`${t}::${e}`),isStopped:(t,e)=>k9.has(`${t}::${e}`)};function Bb(t,e){const s=Qt();return Rt({mutationKey:Ob,retry:(n,i)=>ZT(i)&&n<6,retryDelay:n=>Yc(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&Vh.clear(n.virtualMcpId,n.branch);const i=JT(n),o=Sd.get(i);if(o)return o;const l=(async()=>(await XT(t,"SANDBOX_START",n)).structuredContent)();Sd.set(i,l);try{return await l}finally{Sd.get(i)===l&&Sd.delete(i)}},onSuccess:()=>{hc(s),e?.onStarted?.()}})}function eE(t,e){const s=z.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:Ob,predicate:o=>{if(!t)return!1;const l=o.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],fj(n)>0}function v2(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function tE(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function sE(t){const e=t.mainParamValue===0?"0":t.mainParamValue,s=t.entityMetadata?.defaultMainView??null,n=s==null||s.type==="chat",i=t.mainParamPresent?e!=="0":!n,o=n||t.entityMetadata?.chatDefaultOpen?"chat":null,l=t.sidePanelParamPresent?t.sidePanelParamValue===0?null:t.sidePanelParamValue??null:o;return tE({sidePanel:l,mainOpen:i})}function j9(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?v2("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?v2("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function nE(t){return t.sidePanel!==null&&t.mainOpen?{side:33,main:67}:t.sidePanel!==null?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function iE(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function rE(t,e){const s=It(),n=qr({strict:!1}),i=r0({strict:!1}),{create:o}=Uc(),{threads:l}=Zw(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,u=n.main===0?"0":n.main,{sidePanel:h,mainOpen:f}=sE({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:u,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:h,mainOpen:f},p=V.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=N=>({org:c,taskId:N}),v=d?{virtualmcpid:a}:{},y=(N,C)=>{s({to:x,params:b(g),search:A=>({...A,...N}),replace:C?.replace??!1})};return{taskId:g,sidePanel:h,mainOpen:f,mainParam:u,setTaskId:(N,C)=>{s({to:x,params:b(N),search:A=>{const P={};return C?P.virtualmcpid=C:d&&(P.virtualmcpid=a),P}})},toggleMain:()=>{const N=j9({type:"toggleMain",openMainValue:Ya(t)},m);N&&y(N,{replace:!0})},toggleSidePanel:N=>{const C=j9({type:"toggleSidePanel",sidePanel:N},m);C&&y(C,{replace:!0})},setMobileSurface:N=>{const C=u&&u!=="0"?u:Ya(t);y(iE(N,C),{replace:!0})},openSidePanel:N=>{const C=j9({type:"openSidePanel",sidePanel:N},m);C&&y(C,{replace:!0})},createNewTask:async()=>{const N=crypto.randomUUID(),C=l.find(A=>A.id===g)?.branch??null;try{await o({id:N,virtual_mcp_id:a,...C?{branch:C}:{}})}catch{}s({to:x,params:b(N),search:A=>({...v})})},openTab:N=>{y({main:N==="0"?0:N},{replace:!0})}}}function oE(t){const e=z.c(10),{org:s}=Me(),n=c1(),{data:i}=Ui.useSession(),o=i?.user?.id,l=t?.id??null,a=!!t&&!!o&&!!t.created_by&&t.created_by!==o;let c;e[0]!==s.id||e[1]!==l?(c=Fe.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],xt(h)}function lE(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function aE(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function cE(t){return t/100*window.innerHeight}function dE(t){return t/100*window.innerWidth}function uE(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 Ia({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=uE(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=aE(e,i);break}case"em":{n=lE(e,i);break}case"vh":{n=cE(i);break}case"vw":{n=dE(i);break}}return n}function dn(t){return parseFloat(t.toFixed(3))}function Rl({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 Th(t){const{panels:e}=t,s=Rl({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:o}=n;let l=0;if(o.collapsedSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=dn(u/s*100)}let a;if(o.defaultSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=dn(u/s*100)}let c=0;if(o.minSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.minSize});c=dn(u/s*100)}let d=100;if(o.maxSize!==void 0){const u=Ia({groupSize:s,panelElement:i,styleProp:o.maxSize});d=dn(u/s*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Ot(t,e="Assertion error"){if(!t)throw Error(e)}function Eh(t,e){return Array.from(e).sort(t==="horizontal"?hE:fE)}function hE(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function fE(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function zb(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function Fb(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 mE({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,o=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=Fb(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Ot(i,"No rect found"),i}let kd;function pE(){return kd===void 0&&(typeof matchMedia=="function"?kd=!!matchMedia("(pointer:coarse)").matches:kd=!1),kd}function Ub(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=Eh(s,Array.from(e.children).filter(zb).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 o)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 o)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let y;if(c){const _=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),L=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{y=[_,L];break}case 1:{const w=m[0],S=mE({orientation:s,rects:[b,v],targetRect:w.element.getBoundingClientRect()});y=[w,S===b?L:_];break}default:{y=m;break}}}else m.length?y=m:y=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const _ of y){let L="width"in _?_:_.element.getBoundingClientRect();const w=pE()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(L.width<w){const k=w-L.width;L=new DOMRect(L.x-k/2,L.y,L.width+k,L.height)}if(L.height<w){const k=w-L.height;L=new DOMRect(L.x,L.y-k/2,L.width,L.height+k)}const S=p<=d||p>u;!a&&!S&&l.push({group:t,groupSize:Rl({group:t}),panels:[f,x],separator:"width"in _?void 0:_,rect:L}),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 Kb=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,o=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){o===null&&(i=!0,o=d)}}if(i)throw o}}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)}}},wl={cursorFlags:0,state:"inactive"};const em=new Kb;function ko(){return wl}function gE(t){return em.addListener("change",t)}function xE(t){const e=wl,s={...wl};s.cursorFlags=t,wl=s,em.emit("change",{prev:e,next:s})}function Sl(t){const e=wl;wl=t,em.emit("change",{prev:e,next:t})}const bE=t=>t,C9=()=>{},Hb=1,Wb=2,qb=4,Gb=8,y2=3,_2=12;let jd;function L2(){return jd===void 0&&(jd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(jd=!0)),jd}function vE({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&L2()){const o=(t&Hb)!==0,l=(t&Wb)!==0,a=(t&qb)!==0,c=(t&Gb)!==0;if(o)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 L2()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const w2=new WeakMap;function tm(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=w2.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=ko();switch(n.state){case"active":case"hover":{const i=vE({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(e===o)return;e=o,i?s.cssRules.length===0?s.insertRule(o):s.replaceSync(o):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}w2.set(t,{prevStyle:e,styleSheet:s})}let ji=new Map;const Yb=new Kb;function yE(t){ji=new Map(ji),ji.delete(t)}function S2(t,e){for(const[s]of ji)if(s.id===t)return s}function Mr(t,e){for(const[s,n]of ji)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function Oo(){return ji}function sm(t,e){return Yb.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function fr(t,e,s){const n=ji.get(t);ji=new Map(ji),ji.set(t,e),Yb.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function Qb(t){const e=ko();let s=!1;return e.state==="active"&&(Sl({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(tm(t),s=!0,e.hitRegions.forEach(n=>{const i=Mr(n.group.id,!0);fr(n.group,i,{isUserInteraction:!0})}))),s}function k2(t){t.defaultPrevented||Qb(t.currentTarget)}function _E(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=Fb(s,o.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=o,i=l);break}case"vertical":{l.y<=i.y&&(n=o,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function LE(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function wE(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:N2(t),b:N2(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Ot(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:C2(j2(s.a)),b:C2(j2(s.b))};if(i.a===i.b){const o=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=o.length;for(;a--;){const c=o[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const SE=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function kE(t){const e=getComputedStyle(Xb(t)??t).display;return e==="flex"||e==="inline-flex"}function jE(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||kE(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"||SE.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function j2(t){let e=t.length;for(;e--;){const s=t[e];if(Ot(s,"Missing node"),jE(s))return s}return null}function C2(t){return t&&Number(getComputedStyle(t).zIndex)||0}function N2(t){const e=[];for(;t;)e.push(t),t=Xb(t);return e}function Xb(t){const{parentNode:e}=t;return LE(e)?e.host:e}function CE(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 NE({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!zb(s)||s.contains(t)||t.contains(s))return!0;if(wE(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(CE(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function nm(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=Ub(i),l=_E(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&NE({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function VE(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 nn(t,e,s=0){return Math.abs(dn(t)-dn(e))<=s}function bi(t,e){return nn(t,e)?0:t>e?1:-1}function vl({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(bi(n,c)<0)if(o){const d=(i+c)/2;bi(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=dn(n),n}function Ac({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(nn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Ot(u!=null,"Invalid first pivot index"),Ot(h!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?h:u,x=s[g];Ot(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const _=a[g];if(Ot(_!=null,`Previous layout not found for panel index ${g}`),nn(_,b)){const L=y-_;bi(L,Math.abs(t))>0&&(t=t<0?0-L:L)}}}{const g=t<0?u:h,x=s[g];Ot(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:y=0}=x;if(v){const _=a[g];if(Ot(_!=null,`Previous layout not found for panel index ${g}`),nn(_,y)){const L=_-b;bi(L,Math.abs(t))>0&&(t=t<0?0-L:L)}}}break}default:{const g=t<0?h:u,x=s[g];Ot(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:y,minSize:_}=x;if(v&&bi(b,_)<0)if(t>0){const L=_-y,w=L/2,S=b+t;bi(S,_)<0&&(t=bi(t,w)<=0?0:L)}else{const L=_-y,w=100-L/2,S=b-t;bi(S,_)<0&&(t=bi(100+t,w)>0?0:-L)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const y=a[x];Ot(y!=null,`Previous layout not found for panel index ${x}`);const _=vl({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:y,size:100})-y;if(b+=_,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Ot(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,y=vl({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!nn(b,y)&&(f+=b-y,d[g]=y,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(VE(c,d))return i;{const g=t<0?h:u,x=a[g];Ot(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=vl({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!nn(v,b)){let y=b-v,_=t<0?h:u;for(;_>=0&&_<s.length;){const L=d[_];Ot(L!=null,`Previous layout not found for panel index ${_}`);const w=L+y,S=vl({overrideDisabledPanels:l,panelConstraints:s[_],prevSize:L,size:w});if(nn(L,S)||(y-=S-L,d[_]=S),nn(y,0))break;t>0?_--:_++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!nn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function jo(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||bi(t[s],e[s])!==0)return!1;return!0}function Co({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(!nn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Ot(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let o=0;for(let a=0;a<e.length;a++){const c=s[a];Ot(c!=null,`No layout data found for index ${a}`);const d=n[a];Ot(d!=null,`No layout data found for index ${a}`);const u=vl({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(o+=d-u,n[a]=u)}if(!nn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Ot(c!=null,`No layout data found for index ${a}`);const d=c+o,u=vl({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(o-=u-c,n[a]=u,nn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function Jb({groupId:t,panelId:e}){const s=()=>{const c=Oo();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}`)},o=()=>{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=o(),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 v=h[b];return v?.collapsible&&nn(v.collapsedSize,u[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+u[v.id],0);return{...u,[e]:dn(100-x)}}return Ac({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=o();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=Co({layout:x,panelConstraints:h});jo(p,b)||fr(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=o();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=o();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=o();return c&&nn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=Rl({group:d}),f=Ia({groupSize:h,panelElement:u,styleProp:c}),m=dn(f/h*100);a(m)}}}function V2(t){if(t.defaultPrevented)return;const e=Oo();nm(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,o=Jb({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function lu(t){const e=Oo();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 Zb({groupId:t}){const e=()=>{const s=Oo();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:o,groupSize:l,layout:a,separatorToPanels:c}=e(),d=Co({layout:s,panelConstraints:i});return n?a:(jo(a,d)||fr(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function no(t,e){const s=lu(t),n=Mr(s.id,!0),i=s.separators.find(u=>u.element===t);Ot(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Ot(o,"Matching panels not found");const l=o.map(u=>s.panels.indexOf(u)),a=Zb({groupId:s.id}).getLayout(),c=Ac({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=Co({layout:c,panelConstraints:n.derivedPanelConstraints});jo(a,d)||fr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function T2(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=lu(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&no(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&no(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&no(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&no(e,-5);break}case"End":{t.preventDefault(),no(e,100);break}case"Enter":{t.preventDefault();const n=lu(e),i=Mr(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Ot(c,"Matching separator not found");const d=a.get(c);Ot(d,"Matching panels not found");const u=d[0],h=o.find(f=>f.panelId===u.id);if(Ot(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;no(e,m-f)}break}case"F6":{t.preventDefault();const n=lu(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Ot(i!==null,"Index not found");const o=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[o].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),no(e,-100);break}}}function E2(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=Oo(),s=nm(t,e),n=new Map;let i=!1;s.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(o.group);l&&n.set(o.group,l.layout)}),Sl({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function ev({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,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;o?f==="horizontal"?g=(e.clientX-o.x)/h*100:g=(e.clientY-o.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:v,derivedPanelConstraints:y,groupSize:_,layout:L,separatorToPanels:w}=b;if(y&&L&&w){const S=Ac({delta:g,initialLayout:x,panelConstraints:y,pivotIndices:d.panels.map(k=>m.indexOf(k)),prevLayout:L,trigger:"mouse-or-touch"});if(jo(S,L)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?Hb:Wb;break}case"vertical":{a|=g<0?qb:Gb;break}}}else fr(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:y,groupSize:_,layout:S,separatorToPanels:w})}});let c=0;e.movementX===0?c|=l&y2:c|=a&y2,e.movementY===0?c|=l&_2:c|=a&_2,xE(c),tm(t)}function A2(t){const e=Oo(),s=ko();s.state==="active"&&ev({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function P2(t){if(t.defaultPrevented)return;const e=ko(),s=Oo();switch(e.state){case"active":{if(t.buttons===0){Sl({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=Mr(n.group.id,!0);fr(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)}ev({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=nm(t,s);n.length===0?e.state!=="inactive"&&Sl({cursorFlags:0,state:"inactive"}):Sl({cursorFlags:0,hitRegions:n,state:"hover"}),tm(t.currentTarget);break}}}function R2(t){t.relatedTarget instanceof HTMLIFrameElement&&ko().state==="hover"&&Sl({cursorFlags:0,state:"inactive"})}function D2(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||Qb(t.currentTarget)&&t.preventDefault()}function I2(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=dn(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=dn((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=o)}return n}function TE(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Rl({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:dn(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function EE(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 AE({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,o=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=dn(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),o+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),o>0)for(const h of c){const f=n[h]??0;u[h]=dn(f/o*d)}else{const h=dn(d/c.length);for(const f of c)u[f]=h}return u}function PE(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 al=new Map;function RE(t){let e=!0;Ot(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,o=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Rl({group:t});if(v===0)return;const y=Mr(t.id);if(!y)return;const _=Th(t),L=y.defaultLayoutDeferred?I2(_):y.layout,w=AE({group:t,nextGroupSize:v,prevGroupSize:y.groupSize,prevLayout:L}),S=Co({layout:w,panelConstraints:_});if(!y.defaultLayoutDeferred&&jo(y.layout,S)&&EE(y.derivedPanelConstraints,_)&&y.groupSize===v)return;fr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:_,groupSize:v,layout:S,separatorToPanels:y.separatorToPanels})}}else TE(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Ot(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&o.observe(p.element)});const l=Rl({group:t}),a=Th(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(PE(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??I2(a),h=Co({layout:u,panelConstraints:a}),f=t.element.ownerDocument;al.set(f,(al.get(f)??0)+1);const m=new Map;return Ub(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),fr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Ot(!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",T2)}),al.get(f)===1&&(f.addEventListener("contextmenu",k2,!0),f.addEventListener("dblclick",V2,!0),f.addEventListener("pointerdown",E2,!0),f.addEventListener("pointerleave",A2),f.addEventListener("pointermove",P2),f.addEventListener("pointerout",R2),f.addEventListener("pointerup",D2,!0)),function(){e=!1,al.set(f,Math.max(0,(al.get(f)??0)-1)),yE(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",T2)}),al.get(f)||(f.removeEventListener("contextmenu",k2,!0),f.removeEventListener("dblclick",V2,!0),f.removeEventListener("pointerdown",E2,!0),f.removeEventListener("pointerleave",A2),f.removeEventListener("pointermove",P2),f.removeEventListener("pointerout",R2),f.removeEventListener("pointerup",D2,!0)),o.disconnect()}}function DE(){const[t,e]=V.useState({}),s=V.useCallback(()=>e({}),[]);return[t,s]}function im(t){const e=V.useId();return`${t??e}`}const Bo=typeof window<"u"?V.useLayoutEffect:V.useEffect;function Za(t){const e=V.useRef(t);return Bo(()=>{e.current=t},[t]),V.useCallback((...s)=>e.current?.(...s),[e])}function rm(...t){return Za(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function om(t){const e=V.useRef({...t});return Bo(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const tv=V.createContext(null);function IE(t,e){const s=V.useRef({getLayout:()=>({}),setLayout:bE});V.useImperativeHandle(e,()=>s.current,[]),Bo(()=>{Object.assign(s.current,Zb({groupId:t}))})}function sv({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=V.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Za(N=>{jo(p.current.onLayoutChange,N)||(p.current.onLayoutChange=N,c?.(N))}),x=Za((N,C)=>{jo(p.current.onLayoutChanged,N)||(p.current.onLayoutChanged=N,d?.(N,{isUserInteraction:C}))}),b=im(a),v=V.useRef(null),[y,_]=DE(),L=V.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),w=rm(v,o);IE(b,l);const S=Za((N,C)=>{const A=ko(),P=S2(N),R=Mr(N);if(R){let E=!1;return A.state==="active"&&(E=A.hitRegions.some(M=>M.group===P)),{flexGrow:R.layout[C]??1,pointerEvents:E?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),k=om({defaultLayout:s,disableCursor:n}),j=V.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:S,id:b,orientation:u,registerPanel:N=>{const C=L.current;return C.panels=Eh(u,[...C.panels,N]),_(),()=>{C.panels=C.panels.filter(A=>A!==N),_()}},registerSeparator:N=>{const C=L.current;return C.separators=Eh(u,[...C.separators,N]),_(),()=>{C.separators=C.separators.filter(A=>A!==N),_()}},updatePanelProps:(N,{disabled:C})=>{const A=L.current.panels.find(E=>E.id===N);A&&(A.panelConstraints.disabled=C);const P=S2(b),R=Mr(b);P&&R&&fr(P,{...R,derivedPanelConstraints:Th(P)})},updateSeparatorProps:(N,{disabled:C,disableDoubleClick:A})=>{const P=L.current.separators.find(R=>R.id===N);P&&(P.disabled=C,P.disableDoubleClick=A)}}),[S,b,_,u,k]),T=V.useRef(null);return Bo(()=>{const N=v.current;if(N===null)return;const C=L.current;let A;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===C.panels.length){A={};for(const O of C.panels){const D=k.defaultLayout[O.id];D!==void 0&&(A[O.id]=D)}}const P={disabled:!!i,element:N,id:b,mutableState:{defaultLayout:A,disableCursor:!!k.disableCursor,expandedPanelSizes:L.current.lastExpandedPanelSizes,layouts:L.current.layouts},orientation:u,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};T.current=P;const R=RE(P),{defaultLayoutDeferred:E,derivedPanelConstraints:M,layout:I}=Mr(P.id,!0);!E&&M.length>0&&(g(I),x(I,!1));const $=sm(b,O=>{const{defaultLayoutDeferred:D,derivedPanelConstraints:B,layout:F}=O.next;if(D||B.length===0)return;const U=P.panels.map(({id:W})=>W).join(",");P.mutableState.layouts[U]=F,B.forEach(W=>{if(W.collapsible){const{layout:q}=O.prev??{};if(q){const ee=nn(W.collapsedSize,F[W.panelId]),X=nn(W.collapsedSize,q[W.panelId]);ee&&!X&&(P.mutableState.expandedPanelSizes[W.panelId]=q[W.panelId])}}});const H=ko().state!=="active";g(F),H&&x(F,O.isUserInteraction)});return()=>{T.current=null,R(),$()}},[i,b,x,g,u,y,k]),V.useEffect(()=>{const N=T.current;N&&(N.mutableState.defaultLayout=s,N.mutableState.disableCursor=!!n)}),r.jsx(tv.Provider,{value:j,children:r.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:w,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})})}sv.displayName="Group";function lm(){const t=V.useContext(tv);return Ot(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function ME(t,e){const{id:s}=lm(),n=V.useRef({collapse:C9,expand:C9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:C9});V.useImperativeHandle(e,()=>n.current,[]),Bo(()=>{Object.assign(n.current,Jb({groupId:s,panelId:t}))})}function nv({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:o,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=im(c),b=om({disabled:o}),v=V.useRef(null),y=rm(v,l),{getPanelStyles:_,id:L,orientation:w,registerPanel:S,updatePanelProps:k}=lm(),j=h!==null,T=Za((P,R,E)=>{h?.(P,c,E)});Bo(()=>{const P=v.current;if(P!==null){const R={element:P,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?T:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return S(R)}},[a,s,n,i,j,x,g,d,u,T,S,b]),V.useEffect(()=>{k(x,{disabled:o})},[o,x,k]),ME(x,f);const N=()=>{const P=_(L,x);if(P)return JSON.stringify(P)},C=V.useSyncExternalStore(P=>sm(L,P),N,N);let A;return C?A=JSON.parse(C):i!==void 0?A={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:A={flexGrow:1},r.jsx("div",{...p,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:y,style:{...$E,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...A},children:r.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:w==="horizontal"?"pan-y":"pan-x"},children:t})})}nv.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 OE({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,o;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];o=Co({layout:Ac({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=Co({layout:Ac({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function iv({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=im(o),d=om({disabled:s,disableDoubleClick:n}),[u,h]=V.useState({}),[f,m]=V.useState("inactive"),[p,g]=V.useState(!1),x=V.useRef(null),b=rm(x,i),{disableCursor:v,id:y,orientation:_,registerSeparator:L,updateSeparatorProps:w}=lm(),S=_==="horizontal"?"vertical":"horizontal";Bo(()=>{const T=x.current;if(T!==null){const N={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:T,id:c},C=L(N),A=gE(R=>{m(R.next.state!=="inactive"&&R.next.hitRegions.some(E=>E.separator===N)?R.next.state:"inactive")}),P=sm(y,R=>{const{derivedPanelConstraints:E,layout:M,separatorToPanels:I}=R.next,$=I.get(N);if($){const O=$[0],D=$.indexOf(O);h(OE({layout:M,panelConstraints:E,panelId:O.id,panelIndex:D}))}});return()=>{A(),P(),C()}}},[y,c,L,d]),V.useEffect(()=>{w(c,{disabled:s,disableDoubleClick:n})},[s,n,c,w]);let k;s&&!v&&(k="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":S,"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})}iv.displayName="Separator";function rv(t){const e=z.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 o;e[4]!==s?(o=ie("flex h-full w-full",s),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==o?(l=r.jsx(sv,{groupRef:i,"data-slot":"resizable-panel-group",className:o,...n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function Vu(t){const e=z.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 o;e[4]!==i?(o={overflow:"hidden",...i},e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==o?(l=r.jsx(nv,{panelRef:n,"data-slot":"resizable-panel",style:o,...s}),e[6]=s,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function ov(t){const e=z.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 o;e[4]!==s?(o=ie("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]=o):o=e[5];let l;e[6]!==i?(l=i&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(Hl,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==o||e[10]!==l?(a=r.jsx(iv,{"data-slot":"resizable-handle",className:o,...n,children:l}),e[8]=n,e[9]=o,e[10]=l,e[11]=a):a=e[11],a}function M2(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function BE(t,e){const s=z.c(8);let n;s[0]!==e?(n=c=>M2(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=p4(t,n);let l;s[2]!==e||s[3]!==i?(l=M2(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==o||s[6]!==l?(a=[l,o],s[5]=o,s[6]=l,s[7]=a):a=s[7],a}const zE=33;function FE(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Jf.sidePanelWidth(),t[0]=e):e=t[0],BE(e,zE)}function $2(){const t=z.c(3),[e,s]=V.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 o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function lv(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function zo(t){const e=lv(t);if(e)throw new Error(e)}function UE(t){try{return JSON.parse(t)}catch{return null}}function KE(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,n=s?UE(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function eo(t){const e=KE(t);return e===null?null:e}function av(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function HE(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=av(s);return!n||!s?null:{number:n,htmlUrl:s}}function O2(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const B2=/[\r\n<>]/,WE=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function td(t){const e=t?.userName?.trim();if(!e||B2.test(e))return null;const s=t?.userEmail?.trim();return!s||B2.test(s)?{userName:e}:WE.test(s)?{userName:e,userEmail:s}:{userName:e}}function qE(t){return t.split(`
|
|
3
3
|
`).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
|
|
4
4
|
`).trimEnd()}function GE(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function cv(t,e){const s=td(e);if(!s)return t;const n=qE(t),i=GE(s);if(n.includes(i))return n;const o=n.trimEnd();return o.length>0?`${o}
|
|
5
5
|
|
|
@@ -81,7 +81,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
81
81
|
`),x=g[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),b=x?x[2]:"";let v=[];if(g.length>1&&g.slice(1).join(`
|
|
82
82
|
`).trim()){const _=g.slice(1),L=_.filter(w=>w.trim());if(L.length>0){const w=Math.min(...L.map(j=>j.length-j.trimStart().length)),k=_.map(j=>j.trim()?j.slice(w):"").join(`
|
|
83
83
|
`).trim();k&&(v=this.markedInstance.lexer(`${k}
|
|
84
|
-
`))}}f={type:"taskItem",raw:"",mainContent:b,indentLevel:h,checked:u??!1,text:b,tokens:this.lexer.inlineTokens(b),nestedTokens:v}}const m=d?"taskList":"list";o!==m?(i.length>0&&n.push({type:o,items:i}),i=[f],o=m):i.push(f)}i.length>0&&n.push({type:o,items:i});const l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d={...t,type:c.type,items:c.items},u=this.parseToken(d);u&&(Array.isArray(u)?l.push(...u):l.push(u))}return l.length>0?l:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),s=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const o=i.parseMarkdown(t,s),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,s)=>{const n={type:t,attrs:e||void 0,content:s||void 0};return(!e||Object.keys(e).length===0)&&delete n.attrs,n},applyMark:(t,e,s)=>({mark:t,content:e,attrs:s&&Object.keys(s).length>0?s:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,s,n,i;const o=[];for(let l=0;l<t.length;l+=1){const a=t[l];if(a.type==="text")o.push({type:"text",text:a.text||""});else if(a.type==="html"){const c=((s=(e=a.raw)!=null?e:a.text)!=null?s:"").toString(),d=/^<\/[\s]*[\w-]+/i.test(c),u=c.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!d&&u&&!/\/>$/.test(c)){const f=u[1],m=this.escapeRegex(f),p=new RegExp(`^<\\/\\s*${m}\\b`,"i");let g=-1;const x=[c];for(let b=l+1;b<t.length;b+=1){const v=t[b],y=((i=(n=v.raw)!=null?n:v.text)!=null?i:"").toString();if(x.push(y),v.type==="html"&&p.test(y)){g=b;break}}if(g!==-1){const b=x.join(""),v={type:"html",raw:b,text:b,block:!1},y=this.parseHTMLToken(v);if(y){const _=this.normalizeParseResult(y);Array.isArray(_)?o.push(..._):_&&o.push(_)}l=g;continue}}const h=this.parseHTMLToken(a);if(h){const f=this.normalizeParseResult(h);Array.isArray(f)?o.push(...f):f&&o.push(f)}}else if(a.type){const c=this.getHandlerForToken(a.type);if(c&&c.parseMarkdown){const d=this.createParseHelpers(),u=c.parseMarkdown(a,d);if(this.isMarkResult(u)){const h=this.applyMarkToContent(u.mark,u.content,u.attrs);o.push(...h)}else{const h=this.normalizeParseResult(u);Array.isArray(h)?o.push(...h):h&&o.push(h)}}else a.tokens&&o.push(...this.parseInlineTokens(a.tokens))}}return o}applyMarkToContent(t,e,s){return e.map(n=>{if(n.type==="text"){const i=n.marks||[],o=s?{type:t,attrs:s}:{type:t};return{...n,marks:[...i,o]}}return{...n,content:n.content?this.applyMarkToContent(t,n.content,s):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:t.text||""};case"html":return this.parseHTMLToken(t);case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(typeof window>"u")return t.block?{type:"paragraph",content:[{type:"text",text:e}]}:{type:"text",text:e};try{const s=bw(e,this.baseExtensions);return s.type==="doc"&&s.content?t.block?s.content:s.content.length===1&&s.content[0].type==="paragraph"&&s.content[0].content?s.content[0].content:s.content:s}catch(s){throw new Error(`Failed to parse HTML in markdown: ${s}`)}}renderNodeToMarkdown(t,e,s=0,n=0,i={}){var o;if(t.type==="text")return t.text||"";if(!t.type)return"";const l=this.getHandlerForToken(t.type);if(!l)return"";const a=Array.isArray(e?.content)&&s>0?e.content[s-1]:void 0,c={renderChildren:(h,f)=>{const m=l.isIndenting?n+1:n;return!Array.isArray(h)&&h.content?this.renderNodes(h.content,t,f||"",s,m):this.renderNodes(h,t,f||"",s,m)},renderChild:(h,f)=>{const m=l.isIndenting?n+1:n;return this.renderNodeToMarkdown(h,t,f,m)},indent:h=>this.indentString+h,wrapInBlock:wB},d={index:s,level:n,parentType:e?.type,previousNode:a,meta:{parentAttrs:e?.attrs,...i}};return((o=l.renderMarkdown)==null?void 0:o.call(l,t,c,d))||""}renderNodes(t,e,s="",n=0,i=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,s,i):t.type?this.renderNodeToMarkdown(t,e,n,i):""}renderNodesWithMarkBoundaries(t,e,s="",n=0){const i=[],o=new Map;return t.forEach((l,a)=>{const c=a<t.length-1?t[a+1]:null;if(l.type)if(l.type==="text"){let d=l.text||"";const u=new Map((l.marks||[]).map(b=>[b.type,b])),h=kB(o,u),f=SB(u,c);let m="";if(f.length>0){const b=d.match(/(\s+)$/);b&&(m=b[1],d=d.slice(0,-m.length))}f.forEach(b=>{const v=u.get(b),y=this.getMarkClosing(b,v);y&&(d+=y),o.has(b)&&o.delete(b)});let p="";if(h.length>0){const b=d.match(/^(\s+)/);b&&(p=b[1],d=d.slice(p.length))}h.forEach(({type:b,mark:v})=>{const y=this.getMarkOpening(b,v);y&&(d=y+d),f.includes(b)||o.set(b,v)}),d=p+d;const g=jB(o,u,c,this.markSetsEqual.bind(this));let x="";if(g.length>0){const b=d.match(/(\s+)$/);b&&(x=b[1],d=d.slice(0,-x.length))}g.forEach(b=>{const v=o.get(b),y=this.getMarkClosing(b,v);y&&(d+=y),o.delete(b)}),d+=x,d+=m,i.push(d)}else{const d=new Map(o),u=CB(o,this.getMarkClosing.bind(this)),h=this.renderNodeToMarkdown(l,e,a,n),f=l.type==="hardBreak"?"":NB(d,o,this.getMarkOpening.bind(this));i.push(u+h+f)}}),i.join(s)}getMarkOpening(t,e){const s=this.getHandlersForNodeType(t),n=s.length>0?s[0]:void 0;if(!n||!n.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",o={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const l=n.renderMarkdown(o,{renderChildren:()=>i,renderChild:()=>i,indent:c=>c,wrapInBlock:(c,d)=>c+d},{index:0,level:0,parentType:"text",meta:{}}),a=l.indexOf(i);return a>=0?l.substring(0,a):""}catch(l){throw new Error(`Failed to get mark opening for ${t}: ${l}`)}}getMarkClosing(t,e){const s=this.getHandlersForNodeType(t),n=s.length>0?s[0]:void 0;if(!n||!n.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",o={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const l=n.renderMarkdown(o,{renderChildren:()=>i,renderChild:()=>i,indent:d=>d,wrapInBlock:(d,u)=>d+u},{index:0,level:0,parentType:"text",meta:{}}),a=l.indexOf(i),c=a+i.length;return a>=0?l.substring(c):""}catch(l){throw new Error(`Failed to get mark closing for ${t}: ${l}`)}}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.keys()).every(s=>e.has(s))}},Og=VB,TB=Ki.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return Zi.setContent(t,e);if($d(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zi.setContent(t,e);const n=this.editor.markdown.parse(t);return Zi.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return Zi.insertContent(t,e);if($d(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zi.insertContent(t,e);const n=this.editor.markdown.parse(t);return Zi.insertContent(n,e)},insertContentAt:(t,e,s)=>{if(!s?.contentType)return Zi.insertContentAt(t,e,s);if($d(e,s?.contentType)!=="markdown"||!this.editor.markdown)return Zi.insertContentAt(t,e,s);const i=this.editor.markdown.parse(e);return Zi.insertContentAt(t,i,s)}}},addStorage(){return{manager:new Og({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new Og({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||$d(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=e}});function EB(t){const e=z.c(25),{node:s,selected:n,editor:i,deleteNode:o}=t,l=se(),a=typeof s.attrs.href=="string"?s.attrs.href:"",c=typeof s.attrs.name=="string"?s.attrs.name:"";let d;e[0]!==c||e[1]!==l?(d=c||l("markdownEditor.fileNameFallback"),e[0]=c,e[1]=l,e[2]=d):d=e[2];const u=d,h=n&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let f;e[3]!==h?(f=ie("mx-0.5 inline-flex max-w-full select-none items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 align-middle text-sm text-foreground",h),e[3]=h,e[4]=f):f=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Ri,{size:14,className:"shrink-0 text-muted-foreground"}),e[5]=m):m=e[5];let p;e[6]!==u?(p=r.jsx("span",{className:"min-w-0 truncate",children:u}),e[6]=u,e[7]=p):p=e[7];let g;e[8]!==u||e[9]!==l?(g=l("markdownEditor.downloadFile",{name:u}),e[8]=u,e[9]=l,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(wo,{size:14}),e[11]=x):x=e[11];let b;e[12]!==a||e[13]!==u||e[14]!==g?(b=r.jsx("a",{href:a,download:u,"aria-label":g,onMouseDown:PB,className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:x}),e[12]=a,e[13]=u,e[14]=g,e[15]=b):b=e[15];let v;e[16]!==o||e[17]!==i.isEditable||e[18]!==l?(v=i.isEditable&&r.jsx("button",{type:"button","aria-label":l("markdownEditor.removeFile"),onMouseDown:AB,onClick:o,className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(hs,{size:14})}),e[16]=o,e[17]=i.isEditable,e[18]=l,e[19]=v):v=e[19];let y;return e[20]!==f||e[21]!==p||e[22]!==b||e[23]!==v?(y=r.jsxs(z4,{as:"span",className:f,children:[m,p,b,v]}),e[20]=f,e[21]=p,e[22]=b,e[23]=v,e[24]=y):y=e[24],y}function AB(t){return t.preventDefault()}function PB(t){return t.preventDefault()}function RB(t){return t.replace(/([[\]])/g,"\\$1")}const DB=O4.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",o1(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",s=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${RB(s)}](${e})`},addNodeView(){return B4(EB)}});var IB=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,MB=O4.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",o1(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,s,n,i,o,l;const a=(s=(e=t.attrs)==null?void 0:e.src)!=null?s:"",c=(i=(n=t.attrs)==null?void 0:n.alt)!=null?i:"",d=(l=(o=t.attrs)==null?void 0:o.title)!=null?l:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:s,alwaysPreserveAspectRatio:n}=this.options.resize;return({node:i,getPos:o,HTMLAttributes:l,editor:a})=>{const c=document.createElement("img");Object.entries(l).forEach(([h,f])=>{if(f!=null)switch(h){case"width":case"height":break;default:c.setAttribute(h,f);break}}),c.src=l.src;const d=new yw({element:c,editor:a,node:i,getPos:o,onResize:(h,f)=>{c.style.width=`${h}px`,c.style.height=`${f}px`},onCommit:(h,f)=>{const m=o();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:h,height:f}).run()},onUpdate:(h,f,m)=>h.type===i.type,options:{directions:t,min:{width:e,height:s},preserveAspectRatio:n===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",c.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[vw({find:IB,type:this.type,getAttributes:t=>{const[,,e,s,n]=t;return{src:s,alt:e,title:n}}})]}}),$B=MB;function OB(t){const e=z.c(16),{node:s,selected:n,editor:i,deleteNode:o}=t,l=se(),a=typeof s.attrs.src=="string"?s.attrs.src:"",c=typeof s.attrs.alt=="string"?s.attrs.alt:"";let d;e[0]!==c||e[1]!==l?(d=c||l("markdownEditor.imageAltFallback"),e[0]=c,e[1]=l,e[2]=d):d=e[2];const u=n&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==u?(h=ie("max-h-[420px] max-w-full rounded-lg border border-border object-contain",u),e[3]=u,e[4]=h):h=e[4];let f;e[5]!==a||e[6]!==d||e[7]!==h?(f=r.jsx("img",{src:a,alt:d,draggable:!1,className:h}),e[5]=a,e[6]=d,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i.isEditable||e[11]!==l?(m=i.isEditable&&r.jsx("button",{type:"button","aria-label":l("markdownEditor.removeImage"),onMouseDown:BB,onClick:o,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-md border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:r.jsx(hs,{size:14})}),e[9]=o,e[10]=i.isEditable,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==f||e[14]!==m?(p=r.jsxs(z4,{className:"group/image relative my-3 w-fit max-w-full",children:[f,m]}),e[13]=f,e[14]=m,e[15]=p):p=e[15],p}function BB(t){return t.preventDefault()}const zB=$B.extend({addNodeView(){return B4(OB)}}).configure({inline:!1,allowBase64:!1}),Xh="uploads",FB="editor-images",k6="editor-files",UB=new RegExp(`^/api/[^/]+/fs/${Xh}/read$`),Bg="http://relative.invalid";function KB(t){let e;try{e=new URL(t,Bg)}catch{return!1}return e.origin!==Bg||!UB.test(e.pathname)?!1:(e.searchParams.get("path")??"").startsWith(`${k6}/`)}const HB={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},WB=_w.extend({parseMarkdown:(t,e)=>{const s=typeof t.href=="string"?t.href:"";return KB(s)?e.createNode("attachment",{href:s,name:t.text??""}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:s,title:t.title||null})}});function qB(t=""){return[i1.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),WB.configure(HB),pb.configure({placeholder:t}),zB,DB,TB.configure({markedOptions:{breaks:!0}})]}const GB=10,YB=25,QB={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function XB(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??QB[t.type]??(Zm(t)?".png":"")}function Zm(t){return t.type.startsWith("image/")}function JB(){const t=se(),{upload:e}=Ec(Xh),s=J1(Xh),[n,i]=V.useState(0);return{uploadFile:async l=>{const a=Zm(l),c=a?GB:YB;if(l.size>c*1024*1024)return me.error(t("markdownEditor.fileTooLarge",{name:l.name,max:String(c)})),null;const d=a?FB:k6,u=`${crypto.randomUUID()}${XB(l)}`;i(h=>h+1);try{return await e.mutateAsync({dir:d,files:[new File([l],u,{type:l.type})]}),s(`${d}/${u}`)}catch{return me.error(t("markdownEditor.uploadFailed",{name:l.name})),null}finally{i(h=>h-1)}},pending:n}}const ZB=["outline-none","min-h-[200px] sm:min-h-[320px]","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-2 [&_p]:leading-relaxed","[&_h1]:mb-2 [&_h1]:mt-5 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-snug","[&_h2]:mb-1.5 [&_h2]:mt-4 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-snug","[&_h3]:mb-1 [&_h3]:mt-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-snug","[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[13px]","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2","[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold"].join(" "),ez=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function zg(t,e,s,n){const i=t.state.schema.nodes[s];if(!i)return e;const o=t.state.tr.replaceWith(e,e,i.create(n)),l=o.mapping.map(e,1);return o.setSelection(_i.near(o.doc.resolve(l))),t.dispatch(o),t.state.selection.to}function tz({defaultValue:t,onChange:e,placeholder:s,editable:n=!0}){const i=se(),{uploadFile:o,pending:l}=JB(),a=V.useRef(null),c=V.useRef(e),d=V.useRef(o);c.current=e,d.current=o;const u=(m,p,g)=>p.length===0?!1:((async()=>{let x=g;for(const b of p){const v=await d.current(b);v&&(x=Zm(b)?zg(m,x,"image",{src:v,alt:b.name}):zg(m,x,"attachment",{href:v,name:b.name}))}})(),!0),h=n1({extensions:qB(s),content:t,contentType:"markdown",editable:n,editorProps:{attributes:{class:ie(ZB,ez)},handlePaste:(m,p)=>u(m,Array.from(p.clipboardData?.files??[]),m.state.selection.to),handleDrop:(m,p,g,x)=>{if(x)return!1;const b=Array.from(p.dataTransfer?.files??[]),v=m.posAtCoords({left:p.clientX,top:p.clientY})?.pos;return v===void 0?!1:u(m,b,v)}},onUpdate:({editor:m})=>c.current(m.getMarkdown())});if(!h)return null;const f=m=>{!m||m.length===0||u(h.view,Array.from(m),h.state.selection.to)};return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(RO,{editor:h}),r.jsx(r1,{editor:h,className:"text-[15px] text-foreground"}),r.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground",children:[n&&r.jsx(ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":i("markdownEditor.attachFile"),onClick:()=>a.current?.click(),children:r.jsx(o5,{size:14})}),l>0&&r.jsxs("span",{className:"inline-flex items-center gap-1.5","aria-live":"polite",role:"status",children:[r.jsx(Kc,{size:12,className:"animate-spin"}),l===1?i("markdownEditor.uploading"):i("markdownEditor.uploadingCount",{count:String(l)})]})]}),r.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:m=>{f(m.target.files),m.target.value=""}})]})}const sz=6e4;function nz(t){const e=z.c(10),{locator:s}=Me(),n=Cs();let i;e[0]!==t||e[1]!==s?(i=Fe.taskBoardItemPrs(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ITEM_PRS_GET",{taskBoardItemId:t})).prs,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,refetchInterval:sz,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],xt(a)}function j6(t){const e=z.c(10),{locator:s}=Me(),n=Cs();let i;e[0]!==t||e[1]!==s?(i=Fe.taskBoardActivity(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ACTIVITY_LIST",{taskBoardItemId:t})).activity,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],xt(a)}function iz(t){const e=z.c(10),{locator:s}=Me(),n=Cs(),i=Qt();let o;e[0]!==t||e[1]!==n?(o=async()=>await n.call("TASK_BOARD_PROMOTE_TO_PRODUCTION",{taskBoardItemId:t}),e[0]=t,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==t||e[4]!==s||e[5]!==i?(l=()=>{i.invalidateQueries({queryKey:Fe.taskBoardItemPrs(s,t)}),i.invalidateQueries({queryKey:Fe.taskBoardActivity(s,t)})},e[3]=t,e[4]=s,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==o||e[8]!==l?(a={mutationFn:o,onSuccess:l},e[7]=o,e[8]=l,e[9]=a):a=e[9],Rt(a)}function rz(t){const e=[];return t.qa&&e.push("qa"),t.codeReview&&e.push("code_review"),e}function oz(t,e){return e.length===0?!0:ej(t,e)}function ep(t){const e=z.c(54),{members:s,onSelect:n}=t,i=se();let o;e[0]!==i?(o=i("taskBoard.taskDialog.assignToPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==o?(l=r.jsx(Wi,{placeholder:o,className:"h-9"}),e[2]=o,e[3]=l):l=e[3];let a;e[4]!==i?(a=i("taskBoard.taskDialog.noMembersFound"),e[4]=i,e[5]=a):a=e[5];let c;e[6]!==a?(c=r.jsx(si,{children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i?(d=i("taskBoard.taskDialog.superAgentLabel"),e[8]=i,e[9]=d):d=e[9];let u;e[10]!==n?(u=()=>n(cs),e[10]=n,e[11]=u):u=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Dn,{size:16}),e[12]=h):h=e[12];let f;e[13]!==i?(f=i("taskBoard.taskDialog.superAgentLabel"),e[13]=i,e[14]=f):f=e[14];let m;e[15]!==f?(m=r.jsx("span",{className:"truncate",children:f}),e[15]=f,e[16]=m):m=e[16];let p;e[17]!==d||e[18]!==u||e[19]!==m?(p=r.jsxs(Jt,{value:d,onSelect:u,className:"gap-2",children:[h,m]}),e[17]=d,e[18]=u,e[19]=m,e[20]=p):p=e[20];let g;e[21]!==i?(g=i("taskBoard.taskDialog.unassignedLabel"),e[21]=i,e[22]=g):g=e[22];let x;e[23]!==n?(x=()=>n(null),e[23]=n,e[24]=x):x=e[24];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Su,{size:16,className:"text-muted-foreground"}),e[25]=b):b=e[25];let v;e[26]!==i?(v=i("taskBoard.taskDialog.unassignedLabel"),e[26]=i,e[27]=v):v=e[27];let y;e[28]!==v?(y=r.jsx("span",{className:"truncate",children:v}),e[28]=v,e[29]=y):y=e[29];let _;e[30]!==g||e[31]!==x||e[32]!==y?(_=r.jsxs(Jt,{value:g,onSelect:x,className:"gap-2",children:[b,y]}),e[30]=g,e[31]=x,e[32]=y,e[33]=_):_=e[33];let L;e[34]!==p||e[35]!==_?(L=r.jsxs(ks,{children:[p,_]}),e[34]=p,e[35]=_,e[36]=L):L=e[36];let w;e[37]!==i?(w=i("taskBoard.taskDialog.membersGroupHeading"),e[37]=i,e[38]=w):w=e[38];let S;if(e[39]!==s||e[40]!==n){let N;e[42]!==n?(N=C=>r.jsxs(Jt,{value:C.user?.name??C.userId,onSelect:()=>n(C.userId),className:"gap-2",children:[r.jsx(Us,{url:C.user?.image??void 0,fallback:Rn(C.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:C.user?.name??C.userId})]},C.userId),e[42]=n,e[43]=N):N=e[43],S=s.map(N),e[39]=s,e[40]=n,e[41]=S}else S=e[41];let k;e[44]!==w||e[45]!==S?(k=r.jsx(ks,{heading:w,children:S}),e[44]=w,e[45]=S,e[46]=k):k=e[46];let j;e[47]!==L||e[48]!==k||e[49]!==c?(j=r.jsxs(qi,{children:[c,L,k]}),e[47]=L,e[48]=k,e[49]=c,e[50]=j):j=e[50];let T;return e[51]!==l||e[52]!==j?(T=r.jsxs(pr,{children:[l,j]}),e[51]=l,e[52]=j,e[53]=T):T=e[53],T}function lz({tags:t,selectedIds:e,defaultColor:s,onToggle:n,onCreate:i,onDelete:o}){const l=se(),[a,c]=V.useState(""),[d,u]=V.useState(!1),[h,f]=V.useState(s),m=a.trim(),p=t.some(x=>x.name.toLowerCase()===m.toLowerCase()),g=async()=>{if(!(!m||p||d)){u(!0);try{await i(m,h),c("")}finally{u(!1)}}};return r.jsxs(pr,{children:[r.jsx(Wi,{value:a,onValueChange:c,placeholder:l("taskBoard.taskDialog.tagFilterPlaceholder"),className:"h-9"}),r.jsxs(qi,{children:[m&&!p?r.jsx(ks,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"color",value:h,onChange:x=>f(x.target.value),"aria-label":l("taskBoard.taskDialog.pickTagColorAriaLabel"),className:"ml-2 size-4 shrink-0 cursor-pointer appearance-none rounded-full border-0 bg-transparent p-0 [&::-moz-color-swatch]:rounded-full [&::-moz-color-swatch]:border-0 [&::-webkit-color-swatch]:rounded-full [&::-webkit-color-swatch]:border-0 [&::-webkit-color-swatch-wrapper]:p-0"}),r.jsxs(Jt,{value:`create-${m}`,disabled:d,onSelect:g,className:"flex-1 gap-2",children:[r.jsx(Nt,{size:16,className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:l("taskBoard.taskDialog.createTagOption",{name:m})})]})]})}):r.jsx(si,{children:l("taskBoard.taskDialog.noTagsFound")}),r.jsx(ks,{children:t.map(x=>{const b=e.includes(x.id);return r.jsxs(Jt,{value:x.name,onSelect:()=>n(x.id),className:"group gap-2",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:cd(x.color)}}),r.jsx("span",{className:"flex-1 truncate",children:x.name}),r.jsx("button",{type:"button","aria-label":l("taskBoard.taskDialog.deleteTagAriaLabel",{name:x.name}),className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-background hover:text-destructive group-hover:opacity-100",onClick:v=>{v.stopPropagation(),o(x.id)},children:r.jsx(y1,{size:13})}),b&&r.jsx(Ut,{size:14,className:"shrink-0 text-foreground"})]},x.id)})})]})]})}function az(t){if(!t)return[];const e=[],s=new Set,n=(l,a)=>{s.has(l)||(s.add(l),e.push({url:l,label:a.trim()||l}))},i=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"");for(const l of i.matchAll(/\[([^\]]*)\]\((https?:\/\/[^)\s]+)[^)]*\)/g))n(l[2]??"",l[1]??"");const o=i.replace(/\[[^\]]*\]\([^)]*\)/g,"");for(const l of o.matchAll(/https?:\/\/[^\s)]+/g))n(l[0],l[0]);return e}function cz(t){const e=z.c(40),{thread:s,me:n,onReply:i,onDelete:o,onToggleResolved:l}=t,a=se(),[c,d]=V.useState(!1);if(s.resolved&&!c){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>d(!0),e[0]=v):v=e[0];let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(NS,{size:16,className:"shrink-0 text-muted-foreground"}),e[1]=y):y=e[1];let _;e[2]!==a||e[3]!==s?(_=uz(s,a),e[2]=a,e[3]=s,e[4]=_):_=e[4];let L;e[5]!==_?(L=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:_}),e[5]=_,e[6]=L):L=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(m0,{size:16,className:"shrink-0 text-muted-foreground"}),e[7]=w):w=e[7];let S;return e[8]!==L?(S=r.jsxs("button",{type:"button",onClick:v,className:"flex w-full items-center gap-2.5 rounded-xl bg-card px-4 py-3 text-left card-shadow transition-colors hover:bg-muted/60",children:[y,L,w]}),e[8]=L,e[9]=S):S=e[9],S}let u;e[10]!==a||e[11]!==s.resolved?(u=s.resolved&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>d(!1),className:"flex items-center justify-between gap-2 rounded-t-xl bg-muted/40 px-4 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:text-foreground",children:[a("taskBoard.taskDialog.commentCollapseThread"),r.jsx(hs,{size:14,"aria-hidden":!0})]}),r.jsx(z9,{})]}),e[10]=a,e[11]=s.resolved,e[12]=u):u=e[12];let h;e[13]!==n||e[14]!==o||e[15]!==s?(h=Fg(s,n)?()=>o(s.id):void 0,e[13]=n,e[14]=o,e[15]=s,e[16]=h):h=e[16];let f;e[17]!==l||e[18]!==h||e[19]!==s?(f=r.jsx(Ug,{comment:s,onDelete:h,resolved:s.resolved,onToggleResolved:l}),e[17]=l,e[18]=h,e[19]=s,e[20]=f):f=e[20];let m;if(e[21]!==n||e[22]!==o||e[23]!==s.replies){let v;e[25]!==n||e[26]!==o?(v=(y,_)=>r.jsxs(V.Fragment,{children:[r.jsx(z9,{inset:_>0}),r.jsx(Ug,{comment:y,onDelete:Fg(y,n)?()=>o(y.id):void 0,isReply:!0})]},y.id),e[25]=n,e[26]=o,e[27]=v):v=e[27],m=s.replies.map(v),e[21]=n,e[22]=o,e[23]=s.replies,e[24]=m}else m=e[24];let p;e[28]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(z9,{}),e[28]=p):p=e[28];let g;e[29]!==a?(g=a("taskBoard.taskDialog.commentReplyPlaceholder"),e[29]=a,e[30]=g):g=e[30];let x;e[31]!==n||e[32]!==i||e[33]!==g?(x=r.jsx(N6,{variant:"reply",placeholder:g,author:n,onSubmit:i}),e[31]=n,e[32]=i,e[33]=g,e[34]=x):x=e[34];let b;return e[35]!==u||e[36]!==f||e[37]!==m||e[38]!==x?(b=r.jsxs("div",{className:"flex flex-col rounded-xl bg-card card-shadow",children:[u,f,m,p,x]}),e[35]=u,e[36]=f,e[37]=m,e[38]=x,e[39]=b):b=e[39],b}function Fg(t,e){return t.author.id===e.id||t.author.isAgent===!0}const dz=new Intl.ListFormat(void 0,{style:"long",type:"conjunction"});function uz(t,e){const s=[t,...t.replies],n=dz.format([...new Set(s.map(i=>i.author.name))]);return s.length===1?e("taskBoard.taskDialog.commentResolvedSummaryOne",{names:n}):e("taskBoard.taskDialog.commentResolvedSummaryMany",{count:s.length,names:n})}function hz(t){const e=z.c(6),{me:s,onSubmit:n}=t,i=se();let o;e[0]!==i?(o=i("taskBoard.taskDialog.commentPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;return e[2]!==s||e[3]!==n||e[4]!==o?(l=r.jsx(N6,{variant:"root",placeholder:o,author:s,onSubmit:n}),e[2]=s,e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function z9(t){const e=z.c(4),{inset:s}=t,n=s&&"ml-12";let i;e[0]!==n?(i=ie("h-px bg-border/50",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==i?(o=r.jsx("span",{className:i}),e[2]=i,e[3]=o):o=e[3],o}function Ug(t){const e=z.c(28),{comment:s,isReply:n,resolved:i,onDelete:o,onToggleResolved:l}=t;let a;e[0]!==s.author?(a=r.jsx(C6,{author:s.author}),e[0]=s.author,e[1]=a):a=e[1];let c;e[2]!==s.author.name?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:s.author.name}),e[2]=s.author.name,e[3]=c):c=e[3];let d;e[4]!==s.createdAt?(d=Jc(new Date(s.createdAt)),e[4]=s.createdAt,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==l||e[10]!==i?(h=(o||l)&&r.jsx(fz,{resolved:i,onDelete:o,onToggleResolved:l}),e[8]=o,e[9]=l,e[10]=i,e[11]=h):h=e[11];let f;e[12]!==a||e[13]!==c||e[14]!==u||e[15]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2",children:[a,c,u,h]}),e[12]=a,e[13]=c,e[14]=u,e[15]=h,e[16]=f):f=e[16];const m=n&&"pl-8";let p;e[17]!==m?(p=ie("text-[15px] leading-relaxed text-foreground",m),e[17]=m,e[18]=p):p=e[18];let g;e[19]!==s.body||e[20]!==s.id?(g=r.jsx(Qr,{id:s.id,text:s.body}),e[19]=s.body,e[20]=s.id,e[21]=g):g=e[21];let x;e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:p,children:g}),e[22]=p,e[23]=g,e[24]=x):x=e[24];let b;return e[25]!==x||e[26]!==f?(b=r.jsxs("div",{className:"group flex flex-col gap-1.5 p-4",children:[f,x]}),e[25]=x,e[26]=f,e[27]=b):b=e[27],b}function fz(t){const e=z.c(18),{resolved:s,onDelete:n,onToggleResolved:i}=t,o=se();let l;e[0]!==o?(l=o("taskBoard.taskDialog.commentActionsAriaLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Hi,{size:16}),e[2]=a):a=e[2];let c;e[3]!==l?(c=r.jsx(Gt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":l,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-colors hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100",children:a})}),e[3]=l,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==o?(d=i&&r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{onSelect:i,children:[r.jsx(Ut,{size:16}),o(s?"taskBoard.taskDialog.commentUnresolveThread":"taskBoard.taskDialog.commentResolveThread")]}),r.jsx(ki,{})]}),e[5]=i,e[6]=s,e[7]=o,e[8]=d):d=e[8];let u;e[9]!==n||e[10]!==o?(u=n&&r.jsxs(Ze,{variant:"destructive",onSelect:n,children:[r.jsx(y1,{size:16}),o("taskBoard.taskDialog.commentDelete")]}),e[9]=n,e[10]=o,e[11]=u):u=e[11];let h;e[12]!==d||e[13]!==u?(h=r.jsxs(Yt,{align:"end",className:"w-48",children:[d,u]}),e[12]=d,e[13]=u,e[14]=h):h=e[14];let f;return e[15]!==c||e[16]!==h?(f=r.jsxs(qt,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=f):f=e[17],f}function C6(t){const e=z.c(6),{author:s}=t;if(s.isAgent){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Dn,{size:24}),e[0]=l):l=e[0],l}const n=s.image??void 0;let i;e[1]!==s.name?(i=Rn(s.name),e[1]=s.name,e[2]=i):i=e[2];let o;return e[3]!==n||e[4]!==i?(o=r.jsx(Us,{url:n,fallback:i,shape:"circle",size:"xs"}),e[3]=n,e[4]=i,e[5]=o):o=e[5],o}function N6(t){const e=z.c(36),{variant:s,placeholder:n,author:i,onSubmit:o}=t,l=se(),a=V.useRef(null),[c,d]=V.useState("");let u;e[0]!==o||e[1]!==c?(u=()=>{const P=c.trim();if(!P)return;o(P),d("");const R=a.current;R&&(R.value="",Kg(R))},e[0]=o,e[1]=c,e[2]=u):u=e[2];const h=u;let f;e[3]!==h?(f=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),h())},e[3]=h,e[4]=f):f=e[4];const m=f;let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=P=>{d(P.currentTarget.value),Kg(P.currentTarget)},e[5]=p):p=e[5];const g=s==="root"&&"min-h-10";let x;e[6]!==g?(x=ie("w-full resize-none overflow-hidden border-0 bg-transparent text-[15px] leading-relaxed text-foreground outline-none placeholder:text-muted-foreground",g),e[6]=g,e[7]=x):x=e[7];let b;e[8]!==m||e[9]!==n||e[10]!==x||e[11]!==c?(b=r.jsx("textarea",{ref:a,value:c,onChange:p,onKeyDown:m,placeholder:n,rows:1,className:x}),e[8]=m,e[9]=n,e[10]=x,e[11]=c,e[12]=b):b=e[12];const v=b;let y;e[13]!==c?(y=c.trim(),e[13]=c,e[14]=y):y=e[14];const _=!y;let L;e[15]!==l?(L=l("taskBoard.taskDialog.commentSubmitAriaLabel"),e[15]=l,e[16]=L):L=e[16];let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(o0,{size:16}),e[17]=w):w=e[17];let S;e[18]!==h||e[19]!==_||e[20]!==L?(S=r.jsx("button",{type:"button",disabled:_,onClick:h,"aria-label":L,className:"flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40",children:w}),e[18]=h,e[19]=_,e[20]=L,e[21]=S):S=e[21];const k=S;let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=()=>a.current?.focus(),e[22]=j):j=e[22];const T=j;if(s==="root"){let P;e[23]!==k?(P=r.jsx("div",{className:"flex items-center justify-end",children:k}),e[23]=k,e[24]=P):P=e[24];let R;return e[25]!==P||e[26]!==v?(R=r.jsxs("div",{"data-testid":"new-comment-composer",onClick:T,className:"relative flex cursor-text flex-col gap-1 rounded-xl bg-card p-3 card-shadow",children:[v,P]}),e[25]=P,e[26]=v,e[27]=R):R=e[27],R}let N;e[28]!==i?(N=r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(C6,{author:i})}),e[28]=i,e[29]=N):N=e[29];let C;e[30]!==v?(C=r.jsx("div",{className:"min-w-0 flex-1 pt-0.5",children:v}),e[30]=v,e[31]=C):C=e[31];let A;return e[32]!==k||e[33]!==N||e[34]!==C?(A=r.jsxs("div",{"data-testid":"reply-composer",onClick:T,className:"relative flex cursor-text items-start gap-2 p-3",children:[N,C,k]}),e[32]=k,e[33]=N,e[34]=C,e[35]=A):A=e[35],A}function Kg(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`}function mz(t){const e=t.filter(n=>!n.parentId).map(n=>({...n,replies:[]})),s=new Map(e.map(n=>[n.id,n]));for(const n of t)n.parentId&&s.get(n.parentId)?.replies.push(n);return e}function pz(t){const e=z.c(36),{locator:s}=Me(),n=Cs(),i=Qt();let o;e[0]!==t||e[1]!==s?(o=Fe.taskBoardComments(s,t??""),e[0]=t,e[1]=s,e[2]=o):o=e[2];const l=o,a=!!t;let c;e[3]!==t||e[4]!==n?(c=async()=>mz((await n.call("TASK_BOARD_COMMENT_LIST",{taskBoardItemId:t})).comments),e[3]=t,e[4]=n,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d={queryKey:l,enabled:a,queryFn:c},e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];const u=xt(d);let h;e[10]!==i||e[11]!==l?(h=()=>i.invalidateQueries({queryKey:l}),e[10]=i,e[11]=l,e[12]=h):h=e[12];const f=h;let m;e[13]!==t||e[14]!==n?(m=k=>n.call("TASK_BOARD_COMMENT_CREATE",{taskBoardItemId:t,...k}),e[13]=t,e[14]=n,e[15]=m):m=e[15];let p;e[16]!==f||e[17]!==m?(p={mutationFn:m,onSuccess:f},e[16]=f,e[17]=m,e[18]=p):p=e[18];const g=Rt(p);let x;e[19]!==n?(x=k=>n.call("TASK_BOARD_COMMENT_UPDATE",k),e[19]=n,e[20]=x):x=e[20];let b;e[21]!==f||e[22]!==x?(b={mutationFn:x,onSuccess:f},e[21]=f,e[22]=x,e[23]=b):b=e[23];const v=Rt(b);let y;e[24]!==n?(y=k=>n.call("TASK_BOARD_COMMENT_DELETE",{id:k}),e[24]=n,e[25]=y):y=e[25];let _;e[26]!==f||e[27]!==y?(_={mutationFn:y,onSuccess:f},e[26]=f,e[27]=y,e[28]=_):_=e[28];const L=Rt(_);let w;e[29]!==u.data?(w=u.data??[],e[29]=u.data,e[30]=w):w=e[30];let S;return e[31]!==g||e[32]!==L||e[33]!==v||e[34]!==w?(S={threads:w,post:g,setResolved:v,remove:L},e[31]=g,e[32]=L,e[33]=v,e[34]=w,e[35]=S):S=e[35],S}function Jh(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59).toISOString()}function Zh(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?null:e}const V6=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),cl="inline-flex h-9 items-center justify-start gap-2 rounded-lg border border-border px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted sm:border-transparent";function T6(t){const e=z.c(305),{open:s,onClose:n,item:i,defaultStatus:o,onSubmit:l,onDelete:a,onOpenThread:c,onNewChat:d,onAutoFix:u,onRerun:h,isSaving:f}=t,m=se(),{data:p}=j0();let g;e[0]!==p?.data?.members?(g=p?.data?.members??[],e[0]=p?.data?.members,e[1]=g):g=e[1];const x=g,{handleCopy:b,copied:v}=sj(),{data:y}=U5();let _;e[2]!==y?(_=y===void 0?[]:y,e[2]=y,e[3]=_):_=e[3];const L=_,w=nj(),S=ij(),[k,j]=V.useState(i?.title??""),[T,N]=V.useState(i?.description??""),[C,A]=V.useState(i?.status??o??"triage"),[P,R]=V.useState(i?.priority??"medium"),[E,M]=V.useState(i?.assigneeId??null),I=i?.dueDate;let $;e[4]!==I?($=Zh(I),e[4]=I,e[5]=$):$=e[5];const[O,D]=V.useState($);let B;e[6]!==i?.tags?(B=i?.tags.map(yz)??[],e[6]=i?.tags,e[7]=B):B=e[7];const[F,U]=V.useState(B),[H,W]=V.useState(!1),[q,ee]=V.useState(!1),[X,Y]=V.useState(!1);let G;e[8]!==o||e[9]!==i?.assigneeId||e[10]!==i?.description||e[11]!==i?.dueDate||e[12]!==i?.priority||e[13]!==i?.status||e[14]!==i?.tags||e[15]!==i?.title?(G=()=>{j(i?.title??""),N(i?.description??""),A(i?.status??o??"triage"),R(i?.priority??"medium"),M(i?.assigneeId??null),D(Zh(i?.dueDate)),U(i?.tags.map(vz)??[])},e[8]=o,e[9]=i?.assigneeId,e[10]=i?.description,e[11]=i?.dueDate,e[12]=i?.priority,e[13]=i?.status,e[14]=i?.tags,e[15]=i?.title,e[16]=G):G=e[16];const J=G;let oe;e[17]!==n||e[18]!==J?(oe=()=>{n(),J()},e[17]=n,e[18]=J,e[19]=oe):oe=e[19];const le=oe;let Q;e[20]!==w?(Q=async(et,Ht)=>{const Vs=await w.mutateAsync({name:et,color:Ht});U($n=>[...$n,Vs.id])},e[20]=w,e[21]=Q):Q=e[21];const K=Q;let te;e[22]!==S?(te=et=>{S.mutate(et),U(Ht=>Ht.filter(Vs=>Vs!==et))},e[22]=S,e[23]=te):te=e[23];const ne=te;let re;e[24]!==E||e[25]!==T||e[26]!==O||e[27]!==l||e[28]!==P||e[29]!==C||e[30]!==F||e[31]!==k?(re=()=>{const et=k.trim();et&&l({title:et,description:T.trim()||null,status:C,priority:P,assigneeId:E,dueDate:O?Jh(O):null,tagIds:F})},e[24]=E,e[25]=T,e[26]=O,e[27]=l,e[28]=P,e[29]=C,e[30]=F,e[31]=k,e[32]=re):re=e[32];const he=re,pe=E===cs,de=i&&u&&(C==="triage"||C==="todo")&&!pe,Z=i&&h&&i.assigneeId===cs;let fe;if(e[33]!==E||e[34]!==T||e[35]!==O||e[36]!==i||e[37]!==P||e[38]!==C||e[39]!==F||e[40]!==k){const et=i?.tags.map(bz)??[];fe=!i||k.trim()!==i.title||(T.trim()||null)!==i.description||C!==i.status||P!==i.priority||E!==(i.assigneeId??null)||(O?Jh(O):null)!==(i.dueDate??null)||F.length!==et.length||!F.every(Ht=>et.includes(Ht)),e[33]=E,e[34]=T,e[35]=O,e[36]=i,e[37]=P,e[38]=C,e[39]=F,e[40]=k,e[41]=fe}else fe=e[41];const ue=fe;let ye;if(e[42]!==E||e[43]!==x){let et;e[45]!==E?(et=Ht=>Ht.userId===E,e[45]=E,e[46]=et):et=e[46],ye=x.find(et),e[42]=E,e[43]=x,e[44]=ye}else ye=e[44];const Le=ye;let Re;e[47]!==i||e[48]!==x?(Re=i?.assignedBy?x.find(et=>et.userId===i.assignedBy):void 0,e[47]=i,e[48]=x,e[49]=Re):Re=e[49];const De=Re,Ue=En[C].icon;let $e,je,be,Ee,_e,Ae,Ce,xe,Se,we,ze,Be,Xe,Ve,ot,gt,ct,dt,mt,ge,Ye;if(e[50]!==le||e[51]!==i||e[52]!==s||e[53]!==m||e[54]!==k){be=!!i&&z5(i),je=Ct,ge=s,e[76]!==le?(Ye=$n=>!$n&&le(),e[76]=le,e[77]=Ye):Ye=e[77],$e=jt,gt="flex max-h-[92vh] flex-col gap-0 overflow-hidden rounded-2xl p-0 sm:h-[90vh] sm:max-h-[820px] sm:max-w-[1040px]",ct="hidden";let et;e[78]!==i||e[79]!==m?(et=m(i?"taskBoard.taskDialog.editTaskTitle":"taskBoard.taskDialog.newTaskTitle"),e[78]=i,e[79]=m,e[80]=et):et=e[80],e[81]!==et?(dt=r.jsx(At,{className:"sr-only",children:et}),e[81]=et,e[82]=dt):dt=e[82];let Ht;e[83]!==m?(Ht=m("taskBoard.taskDialog.closeAriaLabel"),e[83]=m,e[84]=Ht):Ht=e[84];let Vs;e[85]===Symbol.for("react.memo_cache_sentinel")?(Vs=r.jsx(hs,{size:16}),e[85]=Vs):Vs=e[85],e[86]!==le||e[87]!==Ht?(mt=r.jsx("button",{type:"button","aria-label":Ht,onClick:le,className:"absolute right-2.5 top-2.5 z-10 flex size-10 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:Vs}),e[86]=le,e[87]=Ht,e[88]=mt):mt=e[88],ot="flex min-h-0 flex-1 flex-col overflow-y-auto sm:flex-row sm:overflow-hidden",Ve="flex min-w-0 flex-col sm:flex-1 sm:overflow-y-auto",Xe="sticky top-0 z-20 bg-background p-6 pb-0 sm:p-8 sm:pb-0",Ee=xz,_e=k,Ae=$n=>{be||(j($n.target.value),$n.target.style.height="auto",$n.target.style.height=`${$n.target.scrollHeight}px`)},Ce=gz,e[89]!==m?(xe=m("taskBoard.taskDialog.taskTitlePlaceholder"),e[89]=m,e[90]=xe):xe=e[90],Se=!0,we=1,ze=be,Be=ie("w-full resize-none overflow-hidden border-0 bg-transparent text-xl font-medium leading-snug text-foreground outline-none placeholder:text-foreground/30",be&&"cursor-default"),e[50]=le,e[51]=i,e[52]=s,e[53]=m,e[54]=k,e[55]=$e,e[56]=je,e[57]=be,e[58]=Ee,e[59]=_e,e[60]=Ae,e[61]=Ce,e[62]=xe,e[63]=Se,e[64]=we,e[65]=ze,e[66]=Be,e[67]=Xe,e[68]=Ve,e[69]=ot,e[70]=gt,e[71]=ct,e[72]=dt,e[73]=mt,e[74]=ge,e[75]=Ye}else $e=e[55],je=e[56],be=e[57],Ee=e[58],_e=e[59],Ae=e[60],Ce=e[61],xe=e[62],Se=e[63],we=e[64],ze=e[65],Be=e[66],Xe=e[67],Ve=e[68],ot=e[69],gt=e[70],ct=e[71],dt=e[72],mt=e[73],ge=e[74],Ye=e[75];let tt;e[91]!==Ee||e[92]!==_e||e[93]!==Ae||e[94]!==Ce||e[95]!==xe||e[96]!==Se||e[97]!==we||e[98]!==ze||e[99]!==Be?(tt=r.jsx("textarea",{ref:Ee,value:_e,onChange:Ae,onKeyDown:Ce,placeholder:xe,autoFocus:Se,rows:we,readOnly:ze,className:Be}),e[91]=Ee,e[92]=_e,e[93]=Ae,e[94]=Ce,e[95]=xe,e[96]=Se,e[97]=we,e[98]=ze,e[99]=Be,e[100]=tt):tt=e[100];let ut;e[101]!==be||e[102]!==m?(ut=be&&r.jsxs("p",{className:"mb-3 mt-1 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Bc,{size:12}),m("taskBoard.taskDialog.reportsContentLocked")]}),e[101]=be,e[102]=m,e[103]=ut):ut=e[103];let bt;e[104]!==Xe||e[105]!==tt||e[106]!==ut?(bt=r.jsxs("div",{className:Xe,children:[tt,ut]}),e[104]=Xe,e[105]=tt,e[106]=ut,e[107]=bt):bt=e[107];let Vt;e[108]!==m?(Vt=m("taskBoard.taskDialog.descriptionPlaceholder"),e[108]=m,e[109]=Vt):Vt=e[109];const St=!be;let Tt;e[110]!==T||e[111]!==Vt||e[112]!==St?(Tt=r.jsx(tz,{defaultValue:T,onChange:N,placeholder:Vt,editable:St}),e[110]=T,e[111]=Vt,e[112]=St,e[113]=Tt):Tt=e[113];let Kt;e[114]!==v||e[115]!==T||e[116]!==b||e[117]!==m?(Kt=T&&r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":m("taskBoard.taskDialog.copyDescriptionAriaLabel"),className:"absolute right-0 top-0 size-7 rounded-md border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground group-hover:opacity-100",onClick:()=>b(T),children:v?r.jsx(Ut,{size:14}):r.jsx(on,{size:14})}),e[114]=v,e[115]=T,e[116]=b,e[117]=m,e[118]=Kt):Kt=e[118];let es;e[119]!==Tt||e[120]!==Kt?(es=r.jsxs("div",{className:"group relative flex flex-col",children:[Tt,Kt]}),e[119]=Tt,e[120]=Kt,e[121]=es):es=e[121];let Mt;e[122]!==i?(Mt=i&&r.jsx("hr",{className:"border-border"}),e[122]=i,e[123]=Mt):Mt=e[123];let ce;e[124]!==T||e[125]!==i||e[126]!==c?(ce=i?.id&&r.jsx(Vz,{item:i,description:T,onOpenThread:c}),e[124]=T,e[125]=i,e[126]=c,e[127]=ce):ce=e[127];let Pe;e[128]!==De||e[129]!==Le||e[130]!==i||e[131]!==x||e[132]!==c?(Pe=i&&r.jsx(Az,{item:i,members:x,startedBy:De??Le,onOpenThread:c}),e[128]=De,e[129]=Le,e[130]=i,e[131]=x,e[132]=c,e[133]=Pe):Pe=e[133];let He;e[134]!==es||e[135]!==Mt||e[136]!==ce||e[137]!==Pe?(He=r.jsxs("div",{className:"flex flex-col gap-6 p-6 pt-6 sm:p-8 sm:pt-6",children:[es,Mt,ce,Pe]}),e[134]=es,e[135]=Mt,e[136]=ce,e[137]=Pe,e[138]=He):He=e[138];let Qe;e[139]!==Ve||e[140]!==bt||e[141]!==He?(Qe=r.jsxs("div",{className:Ve,children:[bt,He]}),e[139]=Ve,e[140]=bt,e[141]=He,e[142]=Qe):Qe=e[142];let Ne;e[143]!==m?(Ne=m("taskBoard.taskDialog.propertiesLabel"),e[143]=m,e[144]=Ne):Ne=e[144];let lt;e[145]!==Ne?(lt=r.jsx("span",{className:"hidden px-3 text-sm text-muted-foreground sm:block",children:Ne}),e[145]=Ne,e[146]=lt):lt=e[146];let Bt;e[147]!==i||e[148]!==C?(Bt=ie(i?$m({...i,status:C}):En[C].iconClassName),e[147]=i,e[148]=C,e[149]=Bt):Bt=e[149];let Ns;e[150]!==Ue||e[151]!==Bt?(Ns=r.jsx(Ue,{size:16,className:Bt}),e[150]=Ue,e[151]=Bt,e[152]=Ns):Ns=e[152];const an=En[C];let Ds;e[153]!==m||e[154]!==an.labelKey?(Ds=m(an.labelKey),e[153]=m,e[154]=an.labelKey,e[155]=Ds):Ds=e[155];let Ft;e[156]!==Ns||e[157]!==Ds?(Ft=r.jsx(Gt,{asChild:!0,children:r.jsxs("button",{type:"button",className:cl,children:[Ns,Ds]})}),e[156]=Ns,e[157]=Ds,e[158]=Ft):Ft=e[158];let Xs;e[159]!==m?(Xs=Bu.map(et=>{const Ht=En[et].icon;return r.jsxs(Ze,{onSelect:()=>A(et),className:"gap-2",children:[r.jsx(Ht,{size:16,className:En[et].iconClassName}),m(En[et].labelKey)]},et)}),e[159]=m,e[160]=Xs):Xs=e[160];let Cn;e[161]!==Xs?(Cn=r.jsx(Yt,{align:"start",className:"w-44",children:Xs}),e[161]=Xs,e[162]=Cn):Cn=e[162];let Js;e[163]!==Ft||e[164]!==Cn?(Js=r.jsxs(qt,{children:[Ft,Cn]}),e[163]=Ft,e[164]=Cn,e[165]=Js):Js=e[165];let Zs;e[166]!==be||e[167]!==m?(Zs=be?m("taskBoard.taskDialog.reportsContentLocked"):void 0,e[166]=be,e[167]=m,e[168]=Zs):Zs=e[168];const di=P==="none"&&"text-muted-foreground",Te=be&&"cursor-default opacity-60";let st;e[169]!==di||e[170]!==Te?(st=ie(cl,di,Te),e[169]=di,e[170]=Te,e[171]=st):st=e[171];let Lt;e[172]!==P||e[173]!==m?(Lt=P==="none"?r.jsxs(r.Fragment,{children:[r.jsx(Hi,{size:16}),m("taskBoard.taskDialog.setPriorityButton")]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:ie("size-2 rounded-full",Pn[P].dotClassName)}),m(Pn[P].labelKey)]}),e[172]=P,e[173]=m,e[174]=Lt):Lt=e[174];let ts;e[175]!==be||e[176]!==Zs||e[177]!==st||e[178]!==Lt?(ts=r.jsx(Gt,{asChild:!0,children:r.jsx("button",{type:"button",disabled:be,title:Zs,className:st,children:Lt})}),e[175]=be,e[176]=Zs,e[177]=st,e[178]=Lt,e[179]=ts):ts=e[179];let en;e[180]!==m?(en=Om.map(et=>r.jsxs(Ze,{onSelect:()=>R(et),children:[r.jsx("span",{className:ie("size-2 rounded-full",Pn[et].dotClassName)}),m(Pn[et].labelKey)]},et)),e[180]=m,e[181]=en):en=e[181];let qs;e[182]!==en?(qs=r.jsx(Yt,{align:"start",className:"w-40",children:en}),e[182]=en,e[183]=qs):qs=e[183];let Gi;e[184]!==ts||e[185]!==qs?(Gi=r.jsxs(qt,{children:[ts,qs]}),e[184]=ts,e[185]=qs,e[186]=Gi):Gi=e[186];const ca=!E&&"text-muted-foreground";let yr;e[187]!==ca?(yr=ie(cl,ca),e[187]=ca,e[188]=yr):yr=e[188];let _r;e[189]!==De||e[190]!==Le||e[191]!==pe||e[192]!==m?(_r=pe&&De?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"hidden items-center gap-2 sm:flex",children:[r.jsx(Us,{url:De.user?.image??void 0,fallback:Rn(De.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:De.user?.name??m("taskBoard.taskDialog.superAgentDefaultName")})]}),r.jsxs("span",{className:"flex items-center gap-2 sm:hidden",children:[r.jsxs("span",{className:"inline-flex items-center",children:[r.jsx(Us,{url:De.user?.image??void 0,fallback:Rn(De.user?.name),shape:"circle",size:"2xs",className:"-mr-1.5 ring-2 ring-background"}),r.jsx(Dn,{size:16,className:"ring-2 ring-background"})]}),m("taskBoard.taskDialog.superAgentLabel")]})]}):pe?r.jsxs(r.Fragment,{children:[r.jsx(Dn,{size:16}),m("taskBoard.taskDialog.superAgentLabel")]}):Le?r.jsxs(r.Fragment,{children:[r.jsx(Us,{url:Le.user?.image??void 0,fallback:Rn(Le.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:Le.user?.name??m("taskBoard.taskDialog.unassignedLabel")})]}):r.jsxs(r.Fragment,{children:[r.jsx(x5,{size:16,className:"text-muted-foreground"}),m("taskBoard.taskDialog.assignButton")]}),e[189]=De,e[190]=Le,e[191]=pe,e[192]=m,e[193]=_r):_r=e[193];let Lr;e[194]!==yr||e[195]!==_r?(Lr=r.jsx(us,{asChild:!0,children:r.jsx("button",{type:"button",className:yr,children:_r})}),e[194]=yr,e[195]=_r,e[196]=Lr):Lr=e[196];let Xo;e[197]===Symbol.for("react.memo_cache_sentinel")?(Xo=et=>{M(et),ee(!1)},e[197]=Xo):Xo=e[197];let wr;e[198]!==x?(wr=r.jsx(ys,{align:"start",className:"w-56 p-0",children:r.jsx(ep,{members:x,onSelect:Xo})}),e[198]=x,e[199]=wr):wr=e[199];let Sr;e[200]!==q||e[201]!==Lr||e[202]!==wr?(Sr=r.jsxs(_s,{open:q,onOpenChange:ee,modal:!0,children:[Lr,wr]}),e[200]=q,e[201]=Lr,e[202]=wr,e[203]=Sr):Sr=e[203];let ui;e[204]!==De||e[205]!==pe||e[206]!==m?(ui=pe&&De&&r.jsxs("div",{className:"relative mt-1.5 hidden items-center pl-5 sm:flex",children:[r.jsx("span",{className:"absolute -top-1.5 left-5 h-[calc(50%+0.375rem)] w-2.5 rounded-bl-md border-b border-l border-border"}),r.jsxs("span",{className:ie(cl,"pointer-events-none"),children:[r.jsx(Dn,{size:16}),m("taskBoard.taskDialog.superAgentLabel")]})]}),e[204]=De,e[205]=pe,e[206]=m,e[207]=ui):ui=e[207];let hi;e[208]!==Sr||e[209]!==ui?(hi=r.jsxs("div",{className:"flex flex-col",children:[Sr,ui]}),e[208]=Sr,e[209]=ui,e[210]=hi):hi=e[210];const da=!O&&"text-muted-foreground";let kr;e[211]!==da?(kr=ie(cl,da),e[211]=da,e[212]=kr):kr=e[212];let Mn;e[213]===Symbol.for("react.memo_cache_sentinel")?(Mn=r.jsx(ar,{size:16,className:"text-muted-foreground"}),e[213]=Mn):Mn=e[213];let Yi;e[214]!==O||e[215]!==m?(Yi=O?V6.format(O):m("taskBoard.taskDialog.dueDateLabel"),e[214]=O,e[215]=m,e[216]=Yi):Yi=e[216];let Qi;e[217]!==O||e[218]!==m?(Qi=O&&r.jsx("span",{role:"button",tabIndex:0,"aria-label":m("taskBoard.taskDialog.clearDueDateAriaLabel"),className:"-mr-1 ml-0.5 flex size-4 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:et=>{et.stopPropagation(),D(null)},onKeyDown:et=>{(et.key==="Enter"||et.key===" ")&&(et.preventDefault(),et.stopPropagation(),D(null))},children:r.jsx(hs,{size:12})}),e[217]=O,e[218]=m,e[219]=Qi):Qi=e[219];let Xi;e[220]!==kr||e[221]!==Yi||e[222]!==Qi?(Xi=r.jsx(us,{asChild:!0,children:r.jsxs("button",{type:"button",className:kr,children:[Mn,Yi,Qi]})}),e[220]=kr,e[221]=Yi,e[222]=Qi,e[223]=Xi):Xi=e[223];const ua=O??void 0;let jr;e[224]===Symbol.for("react.memo_cache_sentinel")?(jr=et=>{D(et??null),et&&W(!1)},e[224]=jr):jr=e[224];let fi;e[225]!==ua?(fi=r.jsx(ys,{className:"w-auto p-0",align:"start",children:r.jsx(l1,{mode:"single",selected:ua,onSelect:jr,initialFocus:!0})}),e[225]=ua,e[226]=fi):fi=e[226];let Ji;e[227]!==H||e[228]!==Xi||e[229]!==fi?(Ji=r.jsxs(_s,{open:H,onOpenChange:W,children:[Xi,fi]}),e[227]=H,e[228]=Xi,e[229]=fi,e[230]=Ji):Ji=e[230];let ve;e[231]!==L||e[232]!==m||e[233]!==F?(ve=F.length===0?r.jsx(us,{asChild:!0,children:r.jsxs("button",{type:"button",className:ie(cl,"text-muted-foreground"),children:[r.jsx(_1,{size:16}),m("taskBoard.taskDialog.tagsButton")]})}):r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:px-3",children:[F.map(et=>{const Ht=L.find(Vs=>Vs.id===et);return Ht?r.jsxs("button",{type:"button",onClick:()=>Y(!0),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:cd(Ht.color)}}),r.jsx("span",{className:"truncate",children:Ht.name}),r.jsx("span",{role:"button",tabIndex:0,"aria-label":m("taskBoard.taskDialog.removeTagAriaLabel",{name:Ht.name}),className:"-mr-0.5 flex size-3.5 items-center justify-center rounded-sm text-muted-foreground hover:bg-background hover:text-foreground",onClick:Vs=>{Vs.stopPropagation(),U($n=>$n.filter(m9=>m9!==et))},onKeyDown:Vs=>{(Vs.key==="Enter"||Vs.key===" ")&&(Vs.preventDefault(),Vs.stopPropagation(),U($n=>$n.filter(m9=>m9!==et)))},children:r.jsx(hs,{size:10})})]},et):null}),r.jsx(us,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":m("taskBoard.taskDialog.addTagButton"),className:"flex size-7 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(Nt,{size:14})})})]}),e[231]=L,e[232]=m,e[233]=F,e[234]=ve):ve=e[234];let Ie;e[235]!==L.length?(Ie=fO(L.length),e[235]=L.length,e[236]=Ie):Ie=e[236];let vt;e[237]===Symbol.for("react.memo_cache_sentinel")?(vt=et=>U(Ht=>Ht.includes(et)?Ht.filter(Vs=>Vs!==et):[...Ht,et]),e[237]=vt):vt=e[237];let wt;e[238]!==K||e[239]!==ne||e[240]!==L||e[241]!==Ie||e[242]!==F?(wt=r.jsx(ys,{align:"start",className:"w-56 p-0",children:r.jsx(lz,{tags:L,selectedIds:F,defaultColor:Ie,onToggle:vt,onCreate:K,onDelete:ne})}),e[238]=K,e[239]=ne,e[240]=L,e[241]=Ie,e[242]=F,e[243]=wt):wt=e[243];let ls;e[244]!==ve||e[245]!==wt||e[246]!==X?(ls=r.jsxs(_s,{open:X,onOpenChange:Y,modal:!0,children:[ve,wt]}),e[244]=ve,e[245]=wt,e[246]=X,e[247]=ls):ls=e[247];let tn;e[248]!==Js||e[249]!==Gi||e[250]!==hi||e[251]!==Ji||e[252]!==ls?(tn=r.jsxs("div",{className:"flex flex-wrap gap-2 sm:flex-col",children:[Js,Gi,hi,Ji,ls]}),e[248]=Js,e[249]=Gi,e[250]=hi,e[251]=Ji,e[252]=ls,e[253]=tn):tn=e[253];let Is;e[254]!==lt||e[255]!==tn?(Is=r.jsxs("div",{className:"flex w-full shrink-0 flex-col gap-4 border-t border-border p-6 sm:w-[220px] sm:border-t-0 sm:border-l sm:px-6 sm:py-10",children:[lt,tn]}),e[254]=lt,e[255]=tn,e[256]=Is):Is=e[256];let Jo;e[257]!==ot||e[258]!==Qe||e[259]!==Is?(Jo=r.jsxs("div",{className:ot,children:[Qe,Is]}),e[257]=ot,e[258]=Qe,e[259]=Is,e[260]=Jo):Jo=e[260];let Zo;e[261]!==i||e[262]!==a||e[263]!==m?(Zo=i&&a?r.jsx(ae,{variant:"ghost",size:"icon","aria-label":m("taskBoard.taskDialog.deleteTaskAriaLabel"),className:"size-10 text-muted-foreground hover:text-destructive",onClick:a,children:r.jsx(y1,{size:16})}):r.jsx("span",{}),e[261]=i,e[262]=a,e[263]=m,e[264]=Zo):Zo=e[264];let el;e[265]!==i||e[266]!==d||e[267]!==m?(el=i&&d&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:d,children:[r.jsx(p1,{size:16}),m("taskBoard.taskDialog.newChatButton")]}),e[265]=i,e[266]=d,e[267]=m,e[268]=el):el=e[268];let tl;e[269]!==u||e[270]!==de||e[271]!==m?(tl=de&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:u,children:[r.jsx(Jr,{size:16}),m("taskBoard.taskBoard.autoFix")]}),e[269]=u,e[270]=de,e[271]=m,e[272]=tl):tl=e[272];let sl;e[273]!==h||e[274]!==Z||e[275]!==m?(sl=Z&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:h,children:[r.jsx(vn,{size:16}),m("taskBoard.taskBoard.rerun")]}),e[273]=h,e[274]=Z,e[275]=m,e[276]=sl):sl=e[276];let nl;e[277]!==ue||e[278]!==f||e[279]!==i||e[280]!==he||e[281]!==m||e[282]!==k?(nl=ue&&r.jsxs(ae,{size:"sm",disabled:!k.trim()||f,onClick:he,children:[i?null:r.jsx(Nt,{size:16}),m(i?"taskBoard.taskDialog.saveButton":"taskBoard.taskDialog.createTaskButton")]}),e[277]=ue,e[278]=f,e[279]=i,e[280]=he,e[281]=m,e[282]=k,e[283]=nl):nl=e[283];let il;e[284]!==el||e[285]!==tl||e[286]!==sl||e[287]!==nl?(il=r.jsxs("div",{className:"flex items-center gap-2",children:[el,tl,sl,nl]}),e[284]=el,e[285]=tl,e[286]=sl,e[287]=nl,e[288]=il):il=e[288];let rl;e[289]!==Zo||e[290]!==il?(rl=r.jsxs("div",{className:"flex h-16 items-center justify-between border-t border-border px-4",children:[Zo,il]}),e[289]=Zo,e[290]=il,e[291]=rl):rl=e[291];let ol;e[292]!==$e||e[293]!==gt||e[294]!==ct||e[295]!==dt||e[296]!==mt||e[297]!==Jo||e[298]!==rl?(ol=r.jsxs($e,{className:gt,closeButtonClassName:ct,children:[dt,mt,Jo,rl]}),e[292]=$e,e[293]=gt,e[294]=ct,e[295]=dt,e[296]=mt,e[297]=Jo,e[298]=rl,e[299]=ol):ol=e[299];let vd;return e[300]!==je||e[301]!==ge||e[302]!==Ye||e[303]!==ol?(vd=r.jsx(je,{open:ge,onOpenChange:Ye,children:ol}),e[300]=je,e[301]=ge,e[302]=Ye,e[303]=ol,e[304]=vd):vd=e[304],vd}function gz(t){t.key==="Enter"&&t.preventDefault()}function xz(t){t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)}function bz(t){return t.id}function vz(t){return t.id}function yz(t){return t.id}function E6(t,e){switch(t){case"failed":return{label:e("taskBoard.taskDialog.threadStatusError"),className:"text-destructive",icon:VS};case"requires_action":return{label:e("taskBoard.taskDialog.threadStatusNeedsInput"),className:"text-warning",icon:x0};case"in_progress":return{label:e("taskBoard.taskDialog.threadStatusRunning"),className:"text-primary",icon:Kc,spin:!0};case"completed":return{label:e("taskBoard.taskDialog.threadStatusCompleted"),className:"text-success",icon:Gn};case"expired":return{label:e("taskBoard.taskDialog.threadStatusExpired"),className:"text-muted-foreground",icon:fn};default:return t}}function _z(t){const e=z.c(31),{thread:s,startedBy:n,onOpen:i}=t,o=se();let l;if(e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==s){const a=s.status?E6(s.status,o):null,c=s.lastMessage;let d;e[5]!==s.title?(d=Nc(s.title,"qa"),e[5]=s.title,e[6]=d):d=e[6];const u=d;let h;e[7]!==s.title?(h=Nc(s.title,"code_review"),e[7]=s.title,e[8]=h):h=e[8];const f=h;let m;e[9]!==i||e[10]!==s?(m=()=>i?.(s),e[9]=i,e[10]=s,e[11]=m):m=e[11];let p;e[12]!==f||e[13]!==u?(p=u?r.jsx(Bm,{size:16,className:"shrink-0"}):f?r.jsx(zm,{size:16,className:"shrink-0"}):r.jsx(Dn,{size:16,className:"shrink-0"}),e[12]=f,e[13]=u,e[14]=p):p=e[14];let g;e[15]!==o||e[16]!==s.title?(g=s.title||o("taskBoard.taskDialog.superAgentDefaultName"),e[15]=o,e[16]=s.title,e[17]=g):g=e[17];let x;e[18]!==g?(x=r.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:g}),e[18]=g,e[19]=x):x=e[19];let b;e[20]!==n||e[21]!==o?(b=n&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"shrink-0 text-sm text-muted-foreground/50",children:o("taskBoard.taskDialog.startedByLabel")}),r.jsx(Us,{url:n.user?.image??void 0,fallback:Rn(n.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate text-sm text-foreground",children:n.user?.name??o("taskBoard.taskDialog.someoneLabel")})]}),e[20]=n,e[21]=o,e[22]=b):b=e[22];let v;e[23]!==i||e[24]!==o?(v=i&&r.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1 text-xs text-muted-foreground/60 group-hover:text-foreground",children:[o("taskBoard.taskDialog.openThreadHint"),r.jsx(wn,{size:14})]}),e[23]=i,e[24]=o,e[25]=v):v=e[25];let y;e[26]!==p||e[27]!==x||e[28]!==b||e[29]!==v?(y=r.jsxs("div",{className:"flex items-center gap-2",children:[p,x,b,v]}),e[26]=p,e[27]=x,e[28]=b,e[29]=v,e[30]=y):y=e[30],l=r.jsxs("button",{type:"button",disabled:!i,onClick:m,className:"group flex w-full flex-col gap-2 rounded-xl bg-card p-4 text-left card-shadow transition-colors enabled:hover:bg-muted/60 disabled:cursor-default",children:[y,a&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:ie("flex shrink-0 items-center gap-1.5",a.className),children:[r.jsx(a.icon,{size:15,className:ie(a.spin&&"animate-spin")}),r.jsx("span",{className:"text-sm",children:a.label})]}),c&&r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:c})]})]}),e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=l}else l=e[4];return l}function Lz(t,e){return t.merged?{label:e("taskBoard.taskDialog.prStateMerged"),className:"text-special",icon:TS}:t.state==="closed"?{label:e("taskBoard.taskDialog.prStateClosed"),className:"text-destructive",icon:Xa}:t.draft?{label:e("taskBoard.taskDialog.prStateDraft"),className:"text-muted-foreground",icon:Xa}:{label:e("taskBoard.taskDialog.prStateOpen"),className:"text-success",icon:Xa}}function wz(t,e){switch(t){case"passing":return{label:e("taskBoard.taskDialog.prChecksPassing"),className:"text-success",icon:Gn};case"failing":return{label:e("taskBoard.taskDialog.prChecksFailing"),className:"text-destructive",icon:fn};case"pending":return{label:e("taskBoard.taskDialog.prChecksPending"),className:"text-warning",icon:Kc};default:return null}}const Sz=new Set(["failure","cancelled","timed_out","action_required","startup_failure","stale"]);function kz(t){if(t.status!=="completed")return{icon:Kc,className:"text-warning",spin:!0};const e=t.conclusion;return e&&Sz.has(e)?{icon:fn,className:"text-destructive",spin:!1}:e==="success"||e==="neutral"||e==="skipped"?{icon:Gn,className:"text-success",spin:!1}:{icon:x0,className:"text-muted-foreground",spin:!1}}function jz(t){const e=z.c(37),{pr:s,previewThread:n,reviewsReady:i,shipPending:o,onShip:l,onOpenThread:a}=t,c=se(),[d,u]=V.useState(!1);let h;if(e[0]!==d||e[1]!==a||e[2]!==l||e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==o||e[7]!==c){const f=Lz(s,c),m=wz(s.checksStatus,c),p=s.state==="open"&&!s.merged,g=s.checksStatus!=="failing"&&s.checksStatus!=="pending",x=i&&p&&g,b=!!n||!!s.previewUrl||x;let v;e[9]!==s.checks?(v=s.checks??[],e[9]=s.checks,e[10]=v):v=e[10];const y=v,_=y.length>0||m!=null,L=y.length>0;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Kr,{className:"size-4 shrink-0 text-foreground"}),e[11]=w):w=e[11];const S=s.title??`${s.repoOwner}/${s.repoName}`;let k;e[12]!==S?(k=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:S}),e[12]=S,e[13]=k):k=e[13];const j=ie("flex shrink-0 items-center gap-1 text-xs font-medium",f.className);let T;e[14]!==f?(T=r.jsx(f.icon,{size:13}),e[14]=f,e[15]=T):T=e[15];let N;e[16]!==f||e[17]!==j||e[18]!==T?(N=r.jsxs("span",{className:j,children:[T,f.label]}),e[16]=f,e[17]=j,e[18]=T,e[19]=N):N=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(hn,{size:12,className:"text-muted-foreground/60 group-hover:text-foreground"}),e[20]=C):C=e[20];let A;e[21]!==s.number||e[22]!==s.url?(A=r.jsxs("a",{href:s.url,target:"_blank",rel:"noreferrer",title:s.url,className:"group flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted",children:["#",s.number,C]}),e[21]=s.number,e[22]=s.url,e[23]=A):A=e[23];let P;e[24]!==A||e[25]!==k||e[26]!==N?(P=r.jsxs("div",{className:"flex items-center gap-3",children:[w,k,N,A]}),e[24]=A,e[25]=k,e[26]=N,e[27]=P):P=e[27];let R;e[28]!==b||e[29]!==a||e[30]!==l||e[31]!==s.previewUrl||e[32]!==n||e[33]!==o||e[34]!==x||e[35]!==c?(R=b&&r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&r.jsxs(ae,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",title:c("taskBoard.taskDialog.openPreviewTitle"),onClick:()=>a?.(n),children:[r.jsx(p1,{size:13}),c("taskBoard.taskDialog.openPreviewButton")]}),s.previewUrl&&r.jsx(ae,{asChild:!0,type:"button",variant:"outline",size:"sm",className:"gap-1.5",children:r.jsxs("a",{href:s.previewUrl,target:"_blank",rel:"noreferrer",children:[r.jsx(kn,{size:14}),c("taskBoard.taskDialog.previewLabel"),r.jsx(hn,{size:12})]})}),x&&r.jsx(ae,{type:"button",variant:"success",size:"sm",disabled:o,onClick:l,children:c("taskBoard.taskDialog.shipToProductionButton")})]}),e[28]=b,e[29]=a,e[30]=l,e[31]=s.previewUrl,e[32]=n,e[33]=o,e[34]=x,e[35]=c,e[36]=R):R=e[36],h=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[P,R,_&&r.jsxs("div",{className:"border-t border-border pt-2 text-xs",children:[r.jsxs("button",{type:"button",disabled:!L,onClick:()=>u(Cz),className:"flex w-full items-center gap-1.5 font-medium disabled:cursor-default",children:[m?r.jsx(m.icon,{size:13,className:m.className}):r.jsx(Gn,{size:13,className:"text-muted-foreground"}),r.jsx("span",{className:ie(m?.className??"text-muted-foreground"),children:m?.label??c("taskBoard.taskDialog.prChecksLabel")}),L&&r.jsx(wn,{size:14,className:ie("ml-auto text-muted-foreground/60 transition-transform",d&&"rotate-90")})]}),d&&r.jsx("div",{className:"mt-2 flex flex-col gap-2",children:y.map(E=>{const M=kz(E);return r.jsxs("div",{className:"rounded-md bg-muted/40 p-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(M.icon,{size:13,className:ie("shrink-0",M.className,M.spin&&"animate-spin")}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:E.name}),E.detailsUrl&&r.jsx("a",{href:E.detailsUrl,target:"_blank",rel:"noreferrer",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:r.jsx(hn,{size:12})})]}),E.summary&&r.jsx("div",{className:"mt-1.5 max-h-64 overflow-auto text-muted-foreground",children:r.jsx(Qr,{id:`${s.url}-${E.name}`,text:E.summary})})]},E.name)})})]})]}),e[0]=d,e[1]=a,e[2]=l,e[3]=s,e[4]=n,e[5]=i,e[6]=o,e[7]=c,e[8]=h}else h=e[8];return h}function Cz(t){return!t}function Nz(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(at,{className:"size-4 shrink-0 rounded"}),r.jsx(at,{className:"h-4 min-w-0 flex-1"}),r.jsx(at,{className:"h-4 w-16 shrink-0"}),r.jsx(at,{className:"h-4 w-10 shrink-0"})]}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[e,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{className:"h-7 w-20"}),r.jsx(at,{className:"h-7 w-28"})]})]}),t[1]=s):s=t[1],s}function Vz(t){const e=z.c(36),{item:s,description:n,onOpenThread:i}=t,o=se(),{data:l,isLoading:a}=nz(s.id),{data:c}=j6(s.id),d=Gp("qa_agent_enabled"),u=Gp("code_reviewer_enabled"),h=iz(s.id);let f,m;if(e[0]!==c||e[1]!==u||e[2]!==n||e[3]!==s.status||e[4]!==s.threads||e[5]!==i||e[6]!==h||e[7]!==l||e[8]!==a||e[9]!==d||e[10]!==o){m=Symbol.for("react.early_return_sentinel");e:{const p=az(n),g=a&&!l;if(!g&&(!l||l.length===0)&&p.length===0){m=null;break e}let x;e[13]!==c||e[14]!==u||e[15]!==s.status||e[16]!==d?(x=s.status==="in_review"&&oz(c??[],rz({qa:d,codeReview:u})),e[13]=c,e[14]=u,e[15]=s.status,e[16]=d,e[17]=x):x=e[17];const b=x;let v;e[18]!==h||e[19]!==o?(v=()=>h.mutate(void 0,{onSuccess:j=>j?.merged?me.success(o("taskBoard.taskDialog.shipSuccess")):me.error(o("taskBoard.taskDialog.shipError")),onError:()=>me.error(o("taskBoard.taskDialog.shipError"))}),e[18]=h,e[19]=o,e[20]=v):v=e[20];const y=v;let _;e[21]!==s.threads||e[22]!==i?(_=i?s.threads.find(Ez):void 0,e[21]=s.threads,e[22]=i,e[23]=_):_=e[23];const L=_;let w;e[24]!==o?(w=o("taskBoard.taskDialog.linksLabel"),e[24]=o,e[25]=w):w=e[25];let S;e[26]!==w?(S=r.jsx("span",{className:"mb-1 text-xs font-medium text-muted-foreground",children:w}),e[26]=w,e[27]=S):S=e[27];let k;e[28]!==g||e[29]!==i||e[30]!==y||e[31]!==L||e[32]!==h||e[33]!==l||e[34]!==b?(k=g?r.jsx(Nz,{}):(l??[]).map(j=>r.jsx(jz,{pr:j,previewThread:L,reviewsReady:b,shipPending:h.isPending,onShip:y,onOpenThread:i},j.url)),e[28]=g,e[29]=i,e[30]=y,e[31]=L,e[32]=h,e[33]=l,e[34]=b,e[35]=k):k=e[35],f=r.jsxs("div",{className:"flex flex-col gap-1 pb-2",children:[S,k,p.map(Tz)]})}e[0]=c,e[1]=u,e[2]=n,e[3]=s.status,e[4]=s.threads,e[5]=i,e[6]=h,e[7]=l,e[8]=a,e[9]=d,e[10]=o,e[11]=f,e[12]=m}else f=e[11],m=e[12];return m!==Symbol.for("react.early_return_sentinel")?m:f}function Tz(t){return r.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"group flex items-center gap-2 rounded-md px-1 py-1.5 transition-colors hover:bg-muted",children:[r.jsx(kn,{size:15,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.label}),r.jsx(hn,{size:13,className:"shrink-0 text-muted-foreground/50 group-hover:text-foreground"})]},t.url)}function Ez(t){return t.hasPreview&&t.virtualMcpId}function Az(t){const e=z.c(6),{item:s,members:n,startedBy:i,onOpenThread:o}=t,l=se(),{data:a}=j6(s.id),{data:c}=Ui.useSession(),d=new Map(n.map(Mz)),u={id:c?.user?.id??"me",name:c?.user?.name??l("taskBoard.taskDialog.commentYouLabel"),image:c?.user?.image},h=pz(s.id),f=y=>{if(y===cs)return{id:y,name:l("taskBoard.taskDialog.superAgentLabel"),isAgent:!0};if(y===u.id)return u;const _=d.get(y);return{id:y,name:_?.user?.name??y,image:_?.user?.image}},m=h.threads.map(y=>({id:y.id,author:f(y.authorId),body:y.body,createdAt:y.createdAt,resolved:y.resolved,replies:y.replies.map(_=>({id:_.id,author:f(_.authorId),body:_.body,createdAt:_.createdAt,replies:[]}))})),p=[...(a??[]).map(Iz),...s.threads.map(Dz),...m.map(Rz)].sort(Pz),g=[];for(const y of p){if(y.kind==="thread"){g.push({type:"thread",thread:y.thread});continue}if(y.kind==="comment"){g.push({type:"comment",comment:y.comment});continue}const _=g[g.length-1];_?.type==="timeline"?_.items.push(y.activity):g.push({type:"timeline",items:[y.activity]})}let x;e[0]!==l?(x=l("taskBoard.taskDialog.activityLabel"),e[0]=l,e[1]=x):x=e[1];let b;e[2]!==x?(b=r.jsx("span",{className:"text-sm font-medium text-foreground",children:x}),e[2]=x,e[3]=b):b=e[3];let v;return e[4]!==h.post?(v=y=>h.post.mutate({body:y}),e[4]=h.post,e[5]=v):v=e[5],r.jsxs("div",{className:"flex flex-col gap-5 pb-2",children:[b,g.map((y,_)=>y.type==="timeline"?r.jsx(Oz,{items:y.items,memberByUserId:d},`timeline-${_}`):y.type==="comment"?r.jsx(cz,{thread:y.comment,me:u,onReply:L=>h.post.mutate({body:L,parentId:y.comment.id}),onDelete:L=>h.remove.mutate(L),onToggleResolved:()=>h.setResolved.mutate({id:y.comment.id,resolved:!y.comment.resolved})},`comment-${y.comment.id}`):r.jsx(_z,{thread:y.thread,startedBy:i,onOpen:o},`thread-${y.thread.threadId}`)),r.jsx(hz,{me:u,onSubmit:v})]})}function Pz(t,e){return t.at-e.at}function Rz(t){return{kind:"comment",at:new Date(t.createdAt).getTime(),comment:t}}function Dz(t){return{kind:"thread",at:new Date(t.createdAt).getTime(),thread:t}}function Iz(t){return{kind:"activity",at:new Date(t.occurredAt).getTime(),activity:t}}function Mz(t){return[t.userId,t]}function ro(t){const e=z.c(7),{icon:s,label:n}=t;let i;e[0]!==s?(i=r.jsx("span",{className:"ml-1 mr-1 inline-flex h-[1lh] items-center align-top",children:s}),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=r.jsx("span",{className:"mr-1",children:n}),e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==o?(l=r.jsxs(r.Fragment,{children:[i,o]}),e[4]=i,e[5]=o,e[6]=l):l=e[6],l}const Ku="\0";function Od(t){return`${Ku}${t}${Ku}`}function dl(t,e){return t.split(new RegExp(`${Ku}(\\w+)${Ku}`)).map((s,n)=>r.jsx(V.Fragment,{children:n%2===0?s:e[s]},n))}function xa(t,e){return e(t==="code_review"?"taskBoard.taskDialog.codeReviewerLabel":"taskBoard.taskDialog.qaAgentLabel")}function $z(t,e,s){const n=f=>{const m=typeof f=="string"?En[f]:void 0;if(!m)return String(f??"");const p=m.icon;return r.jsx(ro,{icon:r.jsx(p,{size:14,className:m.iconClassName}),label:e(m.labelKey)})},i=f=>{const m=typeof f=="string"?Pn[f]:void 0;return m?r.jsx(ro,{icon:r.jsx("span",{className:ie("size-2 rounded-full",m.dotClassName)}),label:e(m.labelKey)}):String(f??"")},o=f=>{const m=Zh(typeof f=="string"?f:null);return m?r.jsx(ro,{icon:r.jsx(ar,{size:14,className:"text-muted-foreground"}),label:V6.format(m)}):""},l=f=>!Array.isArray(f)||f.length===0?null:f.map((m,p)=>{const g=m;return r.jsx(ro,{icon:r.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:cd(g.color)}}),label:g.name??""},g.id??p)}),a=f=>{if(f===cs)return r.jsx(ro,{icon:r.jsx(Dn,{size:14}),label:e("taskBoard.taskDialog.superAgentLabel")});const m=typeof f=="string"?s.get(f):void 0;return r.jsx(ro,{icon:r.jsx(Us,{url:m?.user?.image??void 0,fallback:Rn(m?.user?.name),shape:"circle",size:"2xs"}),label:m?.user?.name??e("taskBoard.taskDialog.someoneLabel")})},c=f=>r.jsx(ro,{icon:f==="code_review"?r.jsx(zm,{size:14}):r.jsx(Bm,{size:14}),label:xa(f,e)}),d=t.data,u=Od("from"),h=Od("to");switch(t.action){case"created":return e("taskBoard.taskDialog.activityCreated");case"status_changed":return dl(d.from?e("taskBoard.taskDialog.activityMovedFromTo",{from:u,to:h}):e("taskBoard.taskDialog.activityMovedTo",{to:h}),{from:n(d.from),to:n(d.to)});case"assignee_changed":return d.to==null?e("taskBoard.taskDialog.activityUnassigned"):dl(e(d.to===cs?"taskBoard.taskDialog.activityDelegated":"taskBoard.taskDialog.activityAssigned",{name:Od("name")}),{name:a(d.to)});case"priority_changed":return d.to==="none"?e("taskBoard.taskDialog.activityPriorityCleared"):dl(!d.from||d.from==="none"?e("taskBoard.taskDialog.activityPrioritySet",{to:h}):e("taskBoard.taskDialog.activityPriorityFromTo",{from:u,to:h}),{from:i(d.from),to:i(d.to)});case"due_date_changed":return d.to==null?e("taskBoard.taskDialog.activityDueDateCleared"):dl(d.from==null?e("taskBoard.taskDialog.activityDueDateSet",{to:h}):e("taskBoard.taskDialog.activityDueDateFromTo",{from:u,to:h}),{from:o(d.from),to:o(d.to)});case"title_changed":return e("taskBoard.taskDialog.activityRenamed",{to:String(d.to??"")});case"description_changed":return e("taskBoard.taskDialog.activityDescriptionUpdated");case"tags_changed":return!Array.isArray(d.to)||d.to.length===0?e("taskBoard.taskDialog.activityTagsCleared"):dl(e("taskBoard.taskDialog.activityTagsSet",{to:h}),{to:l(d.to)});case"review_requested":return dl(e("taskBoard.taskDialog.activityDelegated",{name:Od("name")}),{name:c(d.reviewer)});case"review_approved":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewApprovedWithNotes",{reviewer:xa(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewApproved",{reviewer:xa(d.reviewer,e)});case"review_changes_requested":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewChangesRequestedWithNotes",{reviewer:xa(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewChangesRequested",{reviewer:xa(d.reviewer,e)});case"merge_conflict_resolution":return e("taskBoard.taskDialog.activityMergeConflictResolution");default:{const f=t.action;return String(f)}}}function Hg(t){return!t||t===cs}function Oz(t){const e=z.c(21),{items:s,memberByUserId:n}=t,i=se();let o;e[0]!==n||e[1]!==i?(o=f=>Hg(f)?i("taskBoard.taskDialog.superAgentLabel"):n.get(f)?.user?.name??i("taskBoard.taskDialog.someoneLabel"),e[0]=n,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]!==n?(a=f=>{if(Hg(f))return r.jsx("span",{className:"z-10 flex size-4 shrink-0 items-center justify-center bg-background",children:r.jsx(Dn,{size:16})});const m=n.get(f);return r.jsx("span",{className:"z-10 shrink-0 rounded-full bg-background",children:r.jsx(Us,{url:m?.user?.image??void 0,fallback:Rn(m?.user?.name),shape:"circle",size:"2xs"})})},e[3]=n,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.length?(d=s.length>1&&r.jsx("span",{"aria-hidden":!0,className:"absolute bottom-3 left-2 top-3 w-px bg-border"}),e[5]=s.length,e[6]=d):d=e[6];let u;if(e[7]!==c||e[8]!==l||e[9]!==s||e[10]!==n||e[11]!==i){let f;e[13]!==c||e[14]!==l||e[15]!==n||e[16]!==i?(f=m=>r.jsxs("div",{className:"relative flex items-center gap-2.5",children:[c(m.actorId),r.jsxs("span",{className:"min-w-0 truncate text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:l(m.actorId)})," ",$z(m,i,n),r.jsxs("span",{className:"text-muted-foreground/60",children:[" · ",Jc(new Date(m.occurredAt))]})]})]},m.id),e[13]=c,e[14]=l,e[15]=n,e[16]=i,e[17]=f):f=e[17],u=s.map(f),e[7]=c,e[8]=l,e[9]=s,e[10]=n,e[11]=i,e[12]=u}else u=e[12];let h;return e[18]!==d||e[19]!==u?(h=r.jsxs("div",{className:"relative flex flex-col gap-4",children:[d,u]}),e[18]=d,e[19]=u,e[20]=h):h=e[20],h}const Bz=[{id:"all",labelKey:"home.homeTasks.tabAll"},{id:"in_progress",labelKey:"home.homeTasks.tabInProgress"},{id:"in_review",labelKey:"home.homeTasks.tabInReview"},{id:"done",labelKey:"home.homeTasks.tabDone"}],zz=4;function Fz(t){const e=z.c(64),{task:s,assignee:n,onOpen:i}=t,o=En[s.status],l=o.icon,a=Pn[s.priority];let c,d,u,h,f,m,p,g,x,b,v,y,_,L;if(e[0]!==l||e[1]!==n?.user?.email||e[2]!==n?.user?.image||e[3]!==n?.user?.name||e[4]!==i||e[5]!==o.iconClassName||e[6]!==s.dueDate||e[7]!==s.title||e[8]!==s.updatedAt){const P=n?.user?.name??n?.user?.email?.split("@")[0]??null;let R;e[23]!==s.updatedAt?(R=Jc(new Date(s.updatedAt)),e[23]=s.updatedAt,e[24]=R):R=e[24],L=R;let E;e[25]!==s.dueDate?(E=s.dueDate?{label:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(s.dueDate)),overdue:new Date(s.dueDate).getTime()<Date.now()}:null,e[25]=s.dueDate,e[26]=E):E=e[26],d=E,v="button",y=i,_="flex w-full items-center gap-3 rounded-2xl bg-card px-4 py-3.5 text-left card-shadow transition-colors hover:bg-accent/60";let M;e[27]!==o.iconClassName?(M=ie("size-4 shrink-0",o.iconClassName),e[27]=o.iconClassName,e[28]=M):M=e[28],e[29]!==l||e[30]!==M?(h=r.jsx(l,{className:M}),e[29]=l,e[30]=M,e[31]=h):h=e[31],e[32]!==s.title?(f=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),e[32]=s.title,e[33]=f):f=e[33],b="flex shrink-0 items-center gap-3 text-xs text-muted-foreground",x="hidden @2xl:inline-flex",c=Us,u="circle",m="2xs",p=n?.user?.image??void 0,g=(P??"?").slice(0,2).toUpperCase(),e[0]=l,e[1]=n?.user?.email,e[2]=n?.user?.image,e[3]=n?.user?.name,e[4]=i,e[5]=o.iconClassName,e[6]=s.dueDate,e[7]=s.title,e[8]=s.updatedAt,e[9]=c,e[10]=d,e[11]=u,e[12]=h,e[13]=f,e[14]=m,e[15]=p,e[16]=g,e[17]=x,e[18]=b,e[19]=v,e[20]=y,e[21]=_,e[22]=L}else c=e[9],d=e[10],u=e[11],h=e[12],f=e[13],m=e[14],p=e[15],g=e[16],x=e[17],b=e[18],v=e[19],y=e[20],_=e[21],L=e[22];let w;e[34]!==c||e[35]!==u||e[36]!==m||e[37]!==p||e[38]!==g?(w=r.jsx(c,{shape:u,size:m,url:p,fallback:g}),e[34]=c,e[35]=u,e[36]=m,e[37]=p,e[38]=g,e[39]=w):w=e[39];let S;e[40]!==w||e[41]!==x?(S=r.jsx("span",{className:x,children:w}),e[40]=w,e[41]=x,e[42]=S):S=e[42];let k;e[43]!==a.flagClassName?(k=ie("size-3.5 shrink-0",a.flagClassName),e[43]=a.flagClassName,e[44]=k):k=e[44];let j;e[45]!==k?(j=r.jsx(S0,{className:k}),e[45]=k,e[46]=j):j=e[46];let T;e[47]!==d?(T=d&&r.jsxs("span",{className:ie("hidden items-center gap-1 @xl:inline-flex",d.overdue?"text-red-600":""),children:[r.jsx(ar,{className:"size-3"}),d.label]}),e[47]=d,e[48]=T):T=e[48];let N;e[49]!==L?(N=r.jsx("span",{className:"hidden @xl:inline",children:L}),e[49]=L,e[50]=N):N=e[50];let C;e[51]!==S||e[52]!==j||e[53]!==T||e[54]!==N||e[55]!==b?(C=r.jsxs("div",{className:b,children:[S,j,T,N]}),e[51]=S,e[52]=j,e[53]=T,e[54]=N,e[55]=b,e[56]=C):C=e[56];let A;return e[57]!==h||e[58]!==f||e[59]!==C||e[60]!==v||e[61]!==y||e[62]!==_?(A=r.jsxs("button",{type:v,onClick:y,className:_,children:[h,f,C]}),e[57]=h,e[58]=f,e[59]=C,e[60]=v,e[61]=y,e[62]=_,e[63]=A):A=e[63],A}function Uz(t,e){const s=t.filter(u=>u.status!=="done");if(s.length===0)return"";const n=s.filter(u=>u.status==="in_progress").length,i=s.filter(u=>u.status==="in_review").length,o=s.filter(u=>u.priority==="urgent"||u.priority==="high").length,l=s.filter(u=>u.dueDate&&new Date(u.dueDate).getTime()<Date.now()).length,a=[];n>0&&a.push(e("home.homeTasks.breakdownInProgress",{count:n})),i>0&&a.push(e("home.homeTasks.breakdownNeedsReview",{count:i}));let c=e("home.homeTasks.summaryLead",{count:s.length});a.length>0&&(c+=` — ${a.join(", ")}`),c+=".";const d=[];return o>0&&d.push(e("home.homeTasks.noteHighPriority",{count:o})),l>0&&d.push(e("home.homeTasks.noteOverdue",{count:l})),d.length>0?`${c} ${d.join(" ")}`:c}function Kz(t){const e=z.c(49),{afterSummary:s}=t,n=se(),i=It(),{items:o,error:l}=e6(),a=t6(),{data:c}=j0();let d;if(e[0]!==c?.data?.members){const T=c?.data?.members??[];d=new Map(T.map(qz)),e[0]=c?.data?.members,e[1]=d}else d=e[1];const u=d,[h,f]=V.useState("all"),[m,p]=V.useState(!1);let g,x,b,v,y,_;if(e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==u||e[6]!==i||e[7]!==n||e[8]!==h){const T=l?[]:o,N=[...T].sort(Wz);let C;e[15]!==n?(C=(B,F)=>n(B,F),e[15]=n,e[16]=C):C=e[16];const A=Uz(T,C),P=h==="all"?N:N.filter(B=>B.status===h);let R;e[17]!==i?(R=()=>i({to:".",search:Hz}),e[17]=i,e[18]=R):R=e[18];const E=R;v="flex flex-col gap-10";let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(Dn,{size:24,className:"mt-0.5"}),e[19]=M):M=e[19],y=r.jsxs("div",{className:"flex items-start gap-4 animate-in fade-in slide-in-from-top-1 duration-300",children:[M,r.jsx("p",{className:"max-w-3xl text-lg font-medium leading-snug text-foreground",children:A})]}),_=s,g="flex flex-col gap-4";let I;e[20]!==n?(I=n("home.homeTasks.tasksHeading"),e[20]=n,e[21]=I):I=e[21];let $;e[22]!==I?($=r.jsx("h2",{className:"text-base font-medium text-foreground",children:I}),e[22]=I,e[23]=$):$=e[23];let O;e[24]!==n||e[25]!==h?(O=Bz.map(B=>r.jsx("button",{type:"button",onClick:()=>f(B.id),className:ie("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",h===B.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:n(B.labelKey)},B.id)),e[24]=n,e[25]=h,e[26]=O):O=e[26];let D;e[27]!==O?(D=r.jsx("div",{className:"flex items-center gap-1",children:O}),e[27]=O,e[28]=D):D=e[28],e[29]!==$||e[30]!==D?(x=r.jsxs("div",{className:"flex items-center gap-3",children:[$,D]}),e[29]=$,e[30]=D,e[31]=x):x=e[31],b=P.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl bg-card px-4 py-10 text-center card-shadow",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:h==="all"?n("home.homeTasks.emptyStateNoTasks"):n("home.homeTasks.emptyStateNothing",{status:n(h==="in_progress"?"home.homeTasks.statusInProgress":h==="in_review"?"home.homeTasks.statusInReview":"home.homeTasks.statusDone")})}),h==="all"&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>p(!0),className:"gap-2",children:[r.jsx(Nt,{className:"size-4"}),n("home.homeTasks.createNewTask")]})]}):r.jsxs("div",{className:"flex flex-col gap-2",children:[P.slice(0,zz).map(B=>r.jsx(Fz,{task:B,assignee:B.assigneeId?u.get(B.assigneeId):void 0,onOpen:E},B.id)),r.jsxs("button",{type:"button",onClick:E,className:"flex w-full items-center justify-center gap-1.5 rounded-2xl bg-card px-4 py-3 text-sm font-medium text-muted-foreground card-shadow transition-colors hover:bg-accent/60 hover:text-foreground",children:[n("home.homeTasks.seeAllTasks"),r.jsx(O5,{className:"size-3.5"})]})]}),e[2]=s,e[3]=l,e[4]=o,e[5]=u,e[6]=i,e[7]=n,e[8]=h,e[9]=g,e[10]=x,e[11]=b,e[12]=v,e[13]=y,e[14]=_}else g=e[9],x=e[10],b=e[11],v=e[12],y=e[13],_=e[14];let L;e[32]!==g||e[33]!==x||e[34]!==b?(L=r.jsxs("section",{className:g,children:[x,b]}),e[32]=g,e[33]=x,e[34]=b,e[35]=L):L=e[35];let w;e[36]===Symbol.for("react.memo_cache_sentinel")?(w=()=>p(!1),e[36]=w):w=e[36];let S;e[37]!==a.create?(S=T=>{a.create.mutate(T),p(!1)},e[37]=a.create,e[38]=S):S=e[38];let k;e[39]!==a.create.isPending||e[40]!==m||e[41]!==S?(k=r.jsx(T6,{open:m,onClose:w,isSaving:a.create.isPending,onSubmit:S}),e[39]=a.create.isPending,e[40]=m,e[41]=S,e[42]=k):k=e[42];let j;return e[43]!==k||e[44]!==v||e[45]!==y||e[46]!==_||e[47]!==L?(j=r.jsxs("div",{className:v,children:[y,_,L,k]}),e[43]=k,e[44]=v,e[45]=y,e[46]=_,e[47]=L,e[48]=j):j=e[48],j}function Hz(t){return{...t,main:"board"}}function Wz(t,e){return(e.updatedAt??"").localeCompare(t.updatedAt??"")}function qz(t){return[t.userId,t]}function Gz(t){const e=z.c(29),{isEditMode:s,hasChanges:n,onEnter:i,onSave:o,onCancel:l,onAddTile:a}=t,c=se();if(!s){let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(d5,{size:14}),e[0]=_):_=e[0];let L;e[1]!==c?(L=c("home.customizeToolbar.label"),e[1]=c,e[2]=L):L=e[2];let w;return e[3]!==i||e[4]!==L?(w=r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:i,className:"h-8 gap-1.5 text-muted-foreground",children:[_,L]}),e[3]=i,e[4]=L,e[5]=w):w=e[5],w}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Nt,{size:14}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("home.customizeToolbar.addTile"),e[7]=c,e[8]=u):u=e[8];let h;e[9]!==a||e[10]!==u?(h=r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:a,className:"h-8 gap-1.5",children:[d,u]}),e[9]=a,e[10]=u,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(hs,{size:14}),e[12]=f):f=e[12];let m;e[13]!==c?(m=c("home.customizeToolbar.cancel"),e[13]=c,e[14]=m):m=e[14];let p;e[15]!==l||e[16]!==m?(p=r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:l,className:"h-8 gap-1.5",children:[f,m]}),e[15]=l,e[16]=m,e[17]=p):p=e[17];const g=!n;let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Ut,{size:14}),e[18]=x):x=e[18];let b;e[19]!==c?(b=c("home.customizeToolbar.save"),e[19]=c,e[20]=b):b=e[20];let v;e[21]!==o||e[22]!==g||e[23]!==b?(v=r.jsxs(ae,{type:"button",size:"sm",onClick:o,disabled:g,className:"h-8 gap-1.5",children:[x,b]}),e[21]=o,e[22]=g,e[23]=b,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==h||e[27]!==p?(y=r.jsxs("div",{className:"flex items-center gap-1",children:[h,p,v]}),e[25]=v,e[26]=h,e[27]=p,e[28]=y):y=e[28],y}function Yz(){const t=z.c(18),{isEditMode:e,enter:s,save:n,cancel:i,hasChanges:o}=km(),[l,a]=V.useState(!1),c=Wc();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Kz,{afterSummary:r.jsx(MD,{})}),t[0]=d):d=t[0];let u;t[1]!==i||t[2]!==s||t[3]!==o||t[4]!==e||t[5]!==c||t[6]!==n?(u=!c&&r.jsx("div",{className:"flex justify-end",children:r.jsx(Gz,{isEditMode:e,hasChanges:o,onEnter:s,onSave:n,onCancel:i,onAddTile:()=>a(!0)})}),t[1]=i,t[2]=s,t[3]=o,t[4]=e,t[5]=c,t[6]=n,t[7]=u):u=t[7];let h;t[8]!==e?(h=r.jsx(h$,{isEditMode:e}),t[8]=e,t[9]=h):h=t[9];let f;t[10]!==u||t[11]!==h?(f=r.jsxs("div",{className:"@container mx-auto flex max-w-5xl flex-col gap-10 px-6 py-8",children:[d,r.jsxs("div",{className:"flex flex-col gap-4",children:[u,h]})]}),t[10]=u,t[11]=h,t[12]=f):f=t[12];let m;t[13]!==l?(m=r.jsx(O$,{open:l,onOpenChange:a}),t[13]=l,t[14]=m):m=t[14];let p;return t[15]!==f||t[16]!==m?(p=r.jsxs("div",{className:"h-full overflow-y-auto",children:[f,m]}),t[15]=f,t[16]=m,t[17]=p):p=t[17],p}function Qz(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(TD,{children:r.jsx(Yz,{})}),t[0]=e):e=t[0],e}const A6="https://decoims.com/image?src=decocms%2F7263a67f-fb83-410b-a5f2-e54e87deaaac%2Freport-kanban.png&quality=original&fit=cover",Xz=["taskBoard.backlogPaywall.benefitPrioritizedTasks","taskBoard.backlogPaywall.benefitRecurringReport","taskBoard.backlogPaywall.benefitAgentResolves"],Wg={price:"R$ 99",anchor:"R$ 499"};function Jz(t){const e=z.c(21),{onOpen:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-success/10",children:r.jsx(Jr,{size:16,className:"text-success"})}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("taskBoard.backlogPaywall.bannerTitle"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("span",{className:"text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=l):l=e[4];let a;e[5]!==n?(a=n("taskBoard.backlogPaywall.bannerSubtitle"),e[5]=n,e[6]=a):a=e[6];let c;e[7]!==a?(c=r.jsx("span",{className:"text-sm text-muted-foreground",children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[i,r.jsxs("div",{className:"flex min-w-0 flex-col",children:[l,c]})]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==n?(u=n("taskBoard.backlogPaywall.unlockButton"),e[12]=n,e[13]=u):u=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Zr,{size:16}),e[14]=h):h=e[14];let f;e[15]!==s||e[16]!==u?(f=r.jsxs(ae,{size:"sm",onClick:s,className:"w-full gap-2 sm:w-auto sm:shrink-0",children:[u,h]}),e[15]=s,e[16]=u,e[17]=f):f=e[17];let m;return e[18]!==d||e[19]!==f?(m=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-4 card-shadow sm:flex-row sm:items-center sm:gap-4",children:[d,f]}),e[18]=d,e[19]=f,e[20]=m):m=e[20],m}function Zz({open:t,onOpenChange:e,cdClient:s,onExpired:n}){const i=se(),[o,l]=V.useState(!1),a=async()=>{if(!s){n();return}l(!0);try{const c=await s.callTool({name:"start_checkout",arguments:{}}),{url:d}=Sh(c);if(new URL(d).protocol!=="https:")throw new Error("unsafe checkout url");window.open(d,"_blank","noopener,noreferrer"),e(!1)}catch{n()}finally{l(!1)}};return r.jsx(Ct,{open:t,onOpenChange:e,children:r.jsxs(jt,{className:"gap-0 p-3 sm:max-w-[500px]",closeButtonClassName:"z-10 rounded-full bg-background/70 p-1 text-foreground backdrop-blur transition-colors hover:bg-background",children:[r.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:r.jsx("img",{src:A6,alt:i("taskBoard.backlogPaywall.previewAlt"),className:"h-[208px] w-full object-cover object-left-top"})}),r.jsxs("div",{className:"flex flex-col gap-7 px-3 pb-3 pt-7",children:[r.jsxs("div",{className:"flex flex-col gap-5",children:[r.jsx(At,{className:"text-xl font-semibold text-foreground",children:i("taskBoard.backlogPaywall.modalTitle")}),r.jsx("ul",{className:"flex flex-col gap-3.5",children:Xz.map(c=>r.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[r.jsx(Gn,{size:18,className:"mt-0.5 shrink-0 text-success","aria-hidden":!0}),r.jsx("span",{className:"leading-snug text-foreground",children:i(c)})]},c))})]}),r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsx("span",{className:"text-2xl font-semibold text-foreground",children:Wg.price}),r.jsx("span",{className:"text-sm text-muted-foreground line-through",children:Wg.anchor})]}),r.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[r.jsx(ae,{variant:"ghost",onClick:()=>e(!1),disabled:o,className:"order-2 w-full sm:order-none sm:w-auto",children:i("taskBoard.backlogPaywall.exploreButton")}),r.jsxs(ae,{onClick:a,disabled:o,className:"order-1 w-full gap-2 sm:order-none sm:w-auto",children:[o?r.jsx(it,{size:16,className:"animate-spin"}):null,i("taskBoard.backlogPaywall.unlockButton"),!o&&r.jsx(Zr,{size:16})]})]})]})]})]})})}function F9(t){return`board-paywall-seen:${t}`}function eF(){const t=z.c(26),{org:e}=Me(),s=It(),{diagnostic:n,cdClient:i,connectionId:o}=iy();let l;t[0]!==e.id?(l=()=>({orgId:e.id,open:!sessionStorage.getItem(F9(e.id))}),t[0]=e.id,t[1]=l):l=t[1];const[a,c]=V.useState(l);let d;t[2]!==a.open||t[3]!==a.orgId||t[4]!==e.id?(d=a.orgId===e.id?a.open:!sessionStorage.getItem(F9(e.id)),t[2]=a.open,t[3]=a.orgId,t[4]=e.id,t[5]=d):d=t[5];const u=d;if(!n?.locked)return null;let h;t[6]!==e.id?(h=_=>c({orgId:e.id,open:_}),t[6]=e.id,t[7]=h):h=t[7];const f=h;let m;t[8]!==e.id||t[9]!==f?(m=_=>{f(_),_||sessionStorage.setItem(F9(e.id),"1")},t[8]=e.id,t[9]=f,t[10]=m):m=t[10];const p=m;let g;t[11]!==o||t[12]!==s||t[13]!==e?(g=()=>{Je("board_paywall_report_opened",{organization_id:e.id}),s(ry(e,o))},t[11]=o,t[12]=s,t[13]=e,t[14]=g):g=t[14];const x=g;let b;t[15]!==e.id||t[16]!==f?(b=r.jsx(Jz,{onOpen:()=>{Je("board_paywall_banner_clicked",{organization_id:e.id}),f(!0)}}),t[15]=e.id,t[16]=f,t[17]=b):b=t[17];let v;t[18]!==i||t[19]!==p||t[20]!==u||t[21]!==x?(v=r.jsx(Zz,{open:u,onOpenChange:p,cdClient:i,onExpired:x}),t[18]=i,t[19]=p,t[20]=u,t[21]=x,t[22]=v):v=t[22];let y;return t[23]!==b||t[24]!==v?(y=r.jsxs(r.Fragment,{children:[b,v]}),t[23]=b,t[24]=v,t[25]=y):y=t[25],y}function tF(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Fs,{fallback:null,children:r.jsx(eF,{})}),t[0]=e):e=t[0],e}const sF=["taskBoard.subscriptionPaywall.trialBenefitMonitoring","taskBoard.subscriptionPaywall.trialBenefitAutoFix","taskBoard.subscriptionPaywall.trialBenefitRuns"];function nF(t){const e=z.c(83),{kind:s,onOpenChange:n}=t,i=se(),{mutate:o,isPending:l}=w5("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");if(s==="trial_exhausted"){let _;e[0]!==i?(_=i("taskBoard.subscriptionPaywall.previewAlt"),e[0]=i,e[1]=_):_=e[1];let L;e[2]!==_?(L=r.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:r.jsx("img",{src:A6,alt:_,className:"h-[160px] w-full object-cover object-left-top"})}),e[2]=_,e[3]=L):L=e[3];let w;e[4]!==i?(w=i("taskBoard.subscriptionPaywall.trialTitle"),e[4]=i,e[5]=w):w=e[5];let S;e[6]!==w?(S=r.jsx(At,{className:"text-xl font-semibold text-foreground",children:w}),e[6]=w,e[7]=S):S=e[7];let k;e[8]!==i?(k=sF.map(q=>r.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[r.jsx(Gn,{size:18,className:"mt-0.5 shrink-0 text-success","aria-hidden":!0}),r.jsx("span",{className:"leading-snug text-foreground",children:i(q)})]},q)),e[8]=i,e[9]=k):k=e[9];let j;e[10]!==k?(j=r.jsx("ul",{className:"flex flex-col gap-3",children:k}),e[10]=k,e[11]=j):j=e[11];let T;e[12]!==i?(T=i("taskBoard.subscriptionPaywall.trialPrice"),e[12]=i,e[13]=T):T=e[13];let N;e[14]!==T?(N=r.jsx("span",{className:"text-2xl font-semibold text-foreground",children:T}),e[14]=T,e[15]=N):N=e[15];let C;e[16]!==i?(C=i("taskBoard.subscriptionPaywall.trialPricePeriod"),e[16]=i,e[17]=C):C=e[17];let A;e[18]!==C?(A=r.jsx("span",{className:"text-sm text-muted-foreground",children:C}),e[18]=C,e[19]=A):A=e[19];let P;e[20]!==A||e[21]!==N?(P=r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[N,A]}),e[20]=A,e[21]=N,e[22]=P):P=e[22];let R;e[23]!==n?(R=()=>n(!1),e[23]=n,e[24]=R):R=e[24];let E;e[25]!==i?(E=i("taskBoard.subscriptionPaywall.notNowButton"),e[25]=i,e[26]=E):E=e[26];let M;e[27]!==l||e[28]!==R||e[29]!==E?(M=r.jsx(ae,{variant:"ghost",onClick:R,disabled:l,className:"order-2 w-full sm:order-none sm:w-auto",children:E}),e[27]=l,e[28]=R,e[29]=E,e[30]=M):M=e[30];let I;e[31]!==n||e[32]!==o?(I=()=>o(void 0,{onSuccess:()=>n(!1)}),e[31]=n,e[32]=o,e[33]=I):I=e[33];let $;e[34]!==l?($=l&&r.jsx(it,{size:16,className:"animate-spin"}),e[34]=l,e[35]=$):$=e[35];let O;e[36]!==i?(O=i("taskBoard.subscriptionPaywall.subscribeButton"),e[36]=i,e[37]=O):O=e[37];let D;e[38]!==l||e[39]!==I||e[40]!==$||e[41]!==O?(D=r.jsxs(ae,{disabled:l,onClick:I,className:"order-1 w-full gap-2 sm:order-none sm:w-auto",children:[$,O]}),e[38]=l,e[39]=I,e[40]=$,e[41]=O,e[42]=D):D=e[42];let B;e[43]!==M||e[44]!==D?(B=r.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[M,D]}),e[43]=M,e[44]=D,e[45]=B):B=e[45];let F;e[46]!==P||e[47]!==B?(F=r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[P,B]}),e[46]=P,e[47]=B,e[48]=F):F=e[48];let U;e[49]!==F||e[50]!==S||e[51]!==j?(U=r.jsxs("div",{className:"flex flex-col gap-6 px-3 pb-3 pt-7",children:[S,j,F]}),e[49]=F,e[50]=S,e[51]=j,e[52]=U):U=e[52];let H;e[53]!==L||e[54]!==U?(H=r.jsxs(jt,{className:"gap-0 p-3 sm:max-w-[440px]",closeButtonClassName:"z-10 rounded-full bg-background/70 p-1 text-foreground backdrop-blur transition-colors hover:bg-background",children:[L,U]}),e[53]=L,e[54]=U,e[55]=H):H=e[55];let W;return e[56]!==n||e[57]!==H?(W=r.jsx(Ct,{open:!0,onOpenChange:n,children:H}),e[56]=n,e[57]=H,e[58]=W):W=e[58],W}let a;e[59]!==s||e[60]!==i?(a=s?{monthly_exhausted:{title:i("taskBoard.subscriptionPaywall.monthlyTitle"),description:i("taskBoard.subscriptionPaywall.monthlyDescription")},runs_exhausted:{title:i("taskBoard.subscriptionPaywall.runsTitle"),description:i("taskBoard.subscriptionPaywall.runsDescription")}}[s]:null,e[59]=s,e[60]=i,e[61]=a):a=e[61];const c=a,d=!!s,u=c?.title;let h;e[62]!==u?(h=r.jsx(At,{children:u}),e[62]=u,e[63]=h):h=e[63];const f=c?.description;let m;e[64]!==f?(m=r.jsx(_n,{children:f}),e[64]=f,e[65]=m):m=e[65];let p;e[66]!==h||e[67]!==m?(p=r.jsxs(os,{children:[h,m]}),e[66]=h,e[67]=m,e[68]=p):p=e[68];let g;e[69]!==n?(g=()=>n(!1),e[69]=n,e[70]=g):g=e[70];let x;e[71]!==i?(x=i("taskBoard.subscriptionPaywall.dismissButton"),e[71]=i,e[72]=x):x=e[72];let b;e[73]!==g||e[74]!==x?(b=r.jsx(In,{children:r.jsx(ae,{variant:"ghost",onClick:g,children:x})}),e[73]=g,e[74]=x,e[75]=b):b=e[75];let v;e[76]!==b||e[77]!==p?(v=r.jsxs(jt,{className:"sm:max-w-[440px]",children:[p,b]}),e[76]=b,e[77]=p,e[78]=v):v=e[78];let y;return e[79]!==n||e[80]!==v||e[81]!==d?(y=r.jsx(Ct,{open:d,onOpenChange:n,children:v}),e[79]=n,e[80]=v,e[81]=d,e[82]=y):y=e[82],y}const iF=new Set(["completed","failed","expired"]);function rF(t){return t.threads.some(e=>e.status!==null&&!iF.has(e.status))}function oF(t){const e=z.c(43),{items:s,pending:n,onOpenChange:i,onConfirm:o}=t,l=se(),a=s.length;let c;e[0]!==s?(c=s.some(rF),e[0]=s,e[1]=c):c=e[1];const d=c,u=a>0;let h;e[2]!==a||e[3]!==l?(h=a>1?l("taskBoard.rerun.titleMany",{count:a}):l("taskBoard.rerun.title"),e[2]=a,e[3]=l,e[4]=h):h=e[4];let f;e[5]!==h?(f=r.jsx(At,{children:h}),e[5]=h,e[6]=f):f=e[6];let m;e[7]!==a||e[8]!==l||e[9]!==d?(m=a>1?l("taskBoard.rerun.descriptionMany",{count:a}):l(d?"taskBoard.rerun.descriptionTakeover":"taskBoard.rerun.description"),e[7]=a,e[8]=l,e[9]=d,e[10]=m):m=e[10];let p;e[11]!==m?(p=r.jsx(_n,{children:m}),e[11]=m,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==p?(g=r.jsxs(os,{children:[f,p]}),e[13]=f,e[14]=p,e[15]=g):g=e[15];let x;e[16]!==i?(x=()=>i(!1),e[16]=i,e[17]=x):x=e[17];let b;e[18]!==l?(b=l("taskBoard.rerun.cancel"),e[18]=l,e[19]=b):b=e[19];let v;e[20]!==n||e[21]!==x||e[22]!==b?(v=r.jsx(ae,{variant:"outline",onClick:x,disabled:n,children:b}),e[20]=n,e[21]=x,e[22]=b,e[23]=v):v=e[23];let y;e[24]!==n?(y=n&&r.jsx(it,{className:"size-4 animate-spin"}),e[24]=n,e[25]=y):y=e[25];let _;e[26]!==l?(_=l("taskBoard.rerun.confirm"),e[26]=l,e[27]=_):_=e[27];let L;e[28]!==o||e[29]!==n||e[30]!==y||e[31]!==_?(L=r.jsxs(ae,{onClick:o,disabled:n,children:[y,_]}),e[28]=o,e[29]=n,e[30]=y,e[31]=_,e[32]=L):L=e[32];let w;e[33]!==v||e[34]!==L?(w=r.jsxs(In,{children:[v,L]}),e[33]=v,e[34]=L,e[35]=w):w=e[35];let S;e[36]!==w||e[37]!==g?(S=r.jsxs(jt,{className:"max-w-md",children:[g,w]}),e[36]=w,e[37]=g,e[38]=S):S=e[38];let k;return e[39]!==i||e[40]!==S||e[41]!==u?(k=r.jsx(Ct,{open:u,onOpenChange:i,children:S}),e[39]=i,e[40]=S,e[41]=u,e[42]=k):k=e[42],k}const qg=380,lF=90,Gg=5,aF="cubic-bezier(0.22, 0.61, 0.36, 1)";function cF(t,e,s){const n=V.useRef(new Map),i=V.useRef(new Map);V.useLayoutEffect(()=>{const o=t.current;if(!o)return;const l=o.querySelectorAll("[data-flip-id]"),a=new Map,c=n.current;n.current=a;const d=typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,u=[];for(const b of l){const v=b.dataset.flipId;if(!v)continue;const y=b.getBoundingClientRect(),_=b.dataset.flipLane;if(a.set(v,{rect:y,lane:_}),!s)continue;const L=c.get(v);if(!L)continue;const w=L.rect.left-y.left,S=L.rect.top-y.top;(w||S)&&u.push({el:b,dx:w,dy:S,lane:L.lane!==_})}if(!s||d||u.length===0)return;const h=i.current,f=b=>{b instanceof HTMLElement&&(h.set(b,(h.get(b)??0)+1),b.style.overflow="visible")},m=b=>{if(!(b instanceof HTMLElement))return;const v=(h.get(b)??1)-1;if(v>0){h.set(b,v);return}h.delete(b),b.style.overflow=""};for(const b of u){const v=b.lane?` rotate(${b.dx>0?Gg:-Gg}deg)`:"";b.el.style.transition="none",b.el.style.transform=`translate(${b.dx}px, ${b.dy}px)${v}`,b.lane&&(b.el.style.zIndex="10",f(b.el.closest("[data-lane-scroll]")))}let p=0;const g=[],x=requestAnimationFrame(()=>{for(const b of u){const v=b.lane?p++*lF:0;b.el.style.transition=`transform ${qg}ms ${aF} ${v}ms`,b.el.style.transform="",g.push(window.setTimeout(()=>{b.el.style.transition="",b.el.style.transform="",b.el.style.zIndex="",b.lane&&m(b.el.closest("[data-lane-scroll]"))},qg+v+30))}});return()=>{cancelAnimationFrame(x);for(const b of g)clearTimeout(b);for(const b of u)b.el.style.transition="",b.el.style.transform="",b.el.style.zIndex="",b.lane&&m(b.el.closest("[data-lane-scroll]"))}},[e,t,s])}function dF(t,e=[]){const s=[[`# Task: ${t.title}`,t.description?.trim()].filter(Boolean).join(`
|
|
84
|
+
`))}}f={type:"taskItem",raw:"",mainContent:b,indentLevel:h,checked:u??!1,text:b,tokens:this.lexer.inlineTokens(b),nestedTokens:v}}const m=d?"taskList":"list";o!==m?(i.length>0&&n.push({type:o,items:i}),i=[f],o=m):i.push(f)}i.length>0&&n.push({type:o,items:i});const l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d={...t,type:c.type,items:c.items},u=this.parseToken(d);u&&(Array.isArray(u)?l.push(...u):l.push(u))}return l.length>0?l:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),s=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const o=i.parseMarkdown(t,s),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,s)=>{const n={type:t,attrs:e||void 0,content:s||void 0};return(!e||Object.keys(e).length===0)&&delete n.attrs,n},applyMark:(t,e,s)=>({mark:t,content:e,attrs:s&&Object.keys(s).length>0?s:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,s,n,i;const o=[];for(let l=0;l<t.length;l+=1){const a=t[l];if(a.type==="text")o.push({type:"text",text:a.text||""});else if(a.type==="html"){const c=((s=(e=a.raw)!=null?e:a.text)!=null?s:"").toString(),d=/^<\/[\s]*[\w-]+/i.test(c),u=c.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!d&&u&&!/\/>$/.test(c)){const f=u[1],m=this.escapeRegex(f),p=new RegExp(`^<\\/\\s*${m}\\b`,"i");let g=-1;const x=[c];for(let b=l+1;b<t.length;b+=1){const v=t[b],y=((i=(n=v.raw)!=null?n:v.text)!=null?i:"").toString();if(x.push(y),v.type==="html"&&p.test(y)){g=b;break}}if(g!==-1){const b=x.join(""),v={type:"html",raw:b,text:b,block:!1},y=this.parseHTMLToken(v);if(y){const _=this.normalizeParseResult(y);Array.isArray(_)?o.push(..._):_&&o.push(_)}l=g;continue}}const h=this.parseHTMLToken(a);if(h){const f=this.normalizeParseResult(h);Array.isArray(f)?o.push(...f):f&&o.push(f)}}else if(a.type){const c=this.getHandlerForToken(a.type);if(c&&c.parseMarkdown){const d=this.createParseHelpers(),u=c.parseMarkdown(a,d);if(this.isMarkResult(u)){const h=this.applyMarkToContent(u.mark,u.content,u.attrs);o.push(...h)}else{const h=this.normalizeParseResult(u);Array.isArray(h)?o.push(...h):h&&o.push(h)}}else a.tokens&&o.push(...this.parseInlineTokens(a.tokens))}}return o}applyMarkToContent(t,e,s){return e.map(n=>{if(n.type==="text"){const i=n.marks||[],o=s?{type:t,attrs:s}:{type:t};return{...n,marks:[...i,o]}}return{...n,content:n.content?this.applyMarkToContent(t,n.content,s):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:t.text||""};case"html":return this.parseHTMLToken(t);case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(typeof window>"u")return t.block?{type:"paragraph",content:[{type:"text",text:e}]}:{type:"text",text:e};try{const s=bw(e,this.baseExtensions);return s.type==="doc"&&s.content?t.block?s.content:s.content.length===1&&s.content[0].type==="paragraph"&&s.content[0].content?s.content[0].content:s.content:s}catch(s){throw new Error(`Failed to parse HTML in markdown: ${s}`)}}renderNodeToMarkdown(t,e,s=0,n=0,i={}){var o;if(t.type==="text")return t.text||"";if(!t.type)return"";const l=this.getHandlerForToken(t.type);if(!l)return"";const a=Array.isArray(e?.content)&&s>0?e.content[s-1]:void 0,c={renderChildren:(h,f)=>{const m=l.isIndenting?n+1:n;return!Array.isArray(h)&&h.content?this.renderNodes(h.content,t,f||"",s,m):this.renderNodes(h,t,f||"",s,m)},renderChild:(h,f)=>{const m=l.isIndenting?n+1:n;return this.renderNodeToMarkdown(h,t,f,m)},indent:h=>this.indentString+h,wrapInBlock:wB},d={index:s,level:n,parentType:e?.type,previousNode:a,meta:{parentAttrs:e?.attrs,...i}};return((o=l.renderMarkdown)==null?void 0:o.call(l,t,c,d))||""}renderNodes(t,e,s="",n=0,i=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,s,i):t.type?this.renderNodeToMarkdown(t,e,n,i):""}renderNodesWithMarkBoundaries(t,e,s="",n=0){const i=[],o=new Map;return t.forEach((l,a)=>{const c=a<t.length-1?t[a+1]:null;if(l.type)if(l.type==="text"){let d=l.text||"";const u=new Map((l.marks||[]).map(b=>[b.type,b])),h=kB(o,u),f=SB(u,c);let m="";if(f.length>0){const b=d.match(/(\s+)$/);b&&(m=b[1],d=d.slice(0,-m.length))}f.forEach(b=>{const v=u.get(b),y=this.getMarkClosing(b,v);y&&(d+=y),o.has(b)&&o.delete(b)});let p="";if(h.length>0){const b=d.match(/^(\s+)/);b&&(p=b[1],d=d.slice(p.length))}h.forEach(({type:b,mark:v})=>{const y=this.getMarkOpening(b,v);y&&(d=y+d),f.includes(b)||o.set(b,v)}),d=p+d;const g=jB(o,u,c,this.markSetsEqual.bind(this));let x="";if(g.length>0){const b=d.match(/(\s+)$/);b&&(x=b[1],d=d.slice(0,-x.length))}g.forEach(b=>{const v=o.get(b),y=this.getMarkClosing(b,v);y&&(d+=y),o.delete(b)}),d+=x,d+=m,i.push(d)}else{const d=new Map(o),u=CB(o,this.getMarkClosing.bind(this)),h=this.renderNodeToMarkdown(l,e,a,n),f=l.type==="hardBreak"?"":NB(d,o,this.getMarkOpening.bind(this));i.push(u+h+f)}}),i.join(s)}getMarkOpening(t,e){const s=this.getHandlersForNodeType(t),n=s.length>0?s[0]:void 0;if(!n||!n.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",o={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const l=n.renderMarkdown(o,{renderChildren:()=>i,renderChild:()=>i,indent:c=>c,wrapInBlock:(c,d)=>c+d},{index:0,level:0,parentType:"text",meta:{}}),a=l.indexOf(i);return a>=0?l.substring(0,a):""}catch(l){throw new Error(`Failed to get mark opening for ${t}: ${l}`)}}getMarkClosing(t,e){const s=this.getHandlersForNodeType(t),n=s.length>0?s[0]:void 0;if(!n||!n.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",o={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const l=n.renderMarkdown(o,{renderChildren:()=>i,renderChild:()=>i,indent:d=>d,wrapInBlock:(d,u)=>d+u},{index:0,level:0,parentType:"text",meta:{}}),a=l.indexOf(i),c=a+i.length;return a>=0?l.substring(c):""}catch(l){throw new Error(`Failed to get mark closing for ${t}: ${l}`)}}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.keys()).every(s=>e.has(s))}},Og=VB,TB=Ki.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return Zi.setContent(t,e);if($d(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zi.setContent(t,e);const n=this.editor.markdown.parse(t);return Zi.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return Zi.insertContent(t,e);if($d(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zi.insertContent(t,e);const n=this.editor.markdown.parse(t);return Zi.insertContent(n,e)},insertContentAt:(t,e,s)=>{if(!s?.contentType)return Zi.insertContentAt(t,e,s);if($d(e,s?.contentType)!=="markdown"||!this.editor.markdown)return Zi.insertContentAt(t,e,s);const i=this.editor.markdown.parse(e);return Zi.insertContentAt(t,i,s)}}},addStorage(){return{manager:new Og({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new Og({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||$d(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=e}});function EB(t){const e=z.c(25),{node:s,selected:n,editor:i,deleteNode:o}=t,l=se(),a=typeof s.attrs.href=="string"?s.attrs.href:"",c=typeof s.attrs.name=="string"?s.attrs.name:"";let d;e[0]!==c||e[1]!==l?(d=c||l("markdownEditor.fileNameFallback"),e[0]=c,e[1]=l,e[2]=d):d=e[2];const u=d,h=n&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let f;e[3]!==h?(f=ie("mx-0.5 inline-flex max-w-full select-none items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 align-middle text-sm text-foreground",h),e[3]=h,e[4]=f):f=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Ri,{size:14,className:"shrink-0 text-muted-foreground"}),e[5]=m):m=e[5];let p;e[6]!==u?(p=r.jsx("span",{className:"min-w-0 truncate",children:u}),e[6]=u,e[7]=p):p=e[7];let g;e[8]!==u||e[9]!==l?(g=l("markdownEditor.downloadFile",{name:u}),e[8]=u,e[9]=l,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(wo,{size:14}),e[11]=x):x=e[11];let b;e[12]!==a||e[13]!==u||e[14]!==g?(b=r.jsx("a",{href:a,download:u,"aria-label":g,onMouseDown:PB,className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:x}),e[12]=a,e[13]=u,e[14]=g,e[15]=b):b=e[15];let v;e[16]!==o||e[17]!==i.isEditable||e[18]!==l?(v=i.isEditable&&r.jsx("button",{type:"button","aria-label":l("markdownEditor.removeFile"),onMouseDown:AB,onClick:o,className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(hs,{size:14})}),e[16]=o,e[17]=i.isEditable,e[18]=l,e[19]=v):v=e[19];let y;return e[20]!==f||e[21]!==p||e[22]!==b||e[23]!==v?(y=r.jsxs(z4,{as:"span",className:f,children:[m,p,b,v]}),e[20]=f,e[21]=p,e[22]=b,e[23]=v,e[24]=y):y=e[24],y}function AB(t){return t.preventDefault()}function PB(t){return t.preventDefault()}function RB(t){return t.replace(/([[\]])/g,"\\$1")}const DB=O4.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",o1(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",s=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${RB(s)}](${e})`},addNodeView(){return B4(EB)}});var IB=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,MB=O4.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",o1(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,s,n,i,o,l;const a=(s=(e=t.attrs)==null?void 0:e.src)!=null?s:"",c=(i=(n=t.attrs)==null?void 0:n.alt)!=null?i:"",d=(l=(o=t.attrs)==null?void 0:o.title)!=null?l:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:s,alwaysPreserveAspectRatio:n}=this.options.resize;return({node:i,getPos:o,HTMLAttributes:l,editor:a})=>{const c=document.createElement("img");Object.entries(l).forEach(([h,f])=>{if(f!=null)switch(h){case"width":case"height":break;default:c.setAttribute(h,f);break}}),c.src=l.src;const d=new yw({element:c,editor:a,node:i,getPos:o,onResize:(h,f)=>{c.style.width=`${h}px`,c.style.height=`${f}px`},onCommit:(h,f)=>{const m=o();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:h,height:f}).run()},onUpdate:(h,f,m)=>h.type===i.type,options:{directions:t,min:{width:e,height:s},preserveAspectRatio:n===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",c.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[vw({find:IB,type:this.type,getAttributes:t=>{const[,,e,s,n]=t;return{src:s,alt:e,title:n}}})]}}),$B=MB;function OB(t){const e=z.c(16),{node:s,selected:n,editor:i,deleteNode:o}=t,l=se(),a=typeof s.attrs.src=="string"?s.attrs.src:"",c=typeof s.attrs.alt=="string"?s.attrs.alt:"";let d;e[0]!==c||e[1]!==l?(d=c||l("markdownEditor.imageAltFallback"),e[0]=c,e[1]=l,e[2]=d):d=e[2];const u=n&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==u?(h=ie("max-h-[420px] max-w-full rounded-lg border border-border object-contain",u),e[3]=u,e[4]=h):h=e[4];let f;e[5]!==a||e[6]!==d||e[7]!==h?(f=r.jsx("img",{src:a,alt:d,draggable:!1,className:h}),e[5]=a,e[6]=d,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i.isEditable||e[11]!==l?(m=i.isEditable&&r.jsx("button",{type:"button","aria-label":l("markdownEditor.removeImage"),onMouseDown:BB,onClick:o,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-md border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:r.jsx(hs,{size:14})}),e[9]=o,e[10]=i.isEditable,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==f||e[14]!==m?(p=r.jsxs(z4,{className:"group/image relative my-3 w-fit max-w-full",children:[f,m]}),e[13]=f,e[14]=m,e[15]=p):p=e[15],p}function BB(t){return t.preventDefault()}const zB=$B.extend({addNodeView(){return B4(OB)}}).configure({inline:!1,allowBase64:!1}),Xh="uploads",FB="editor-images",k6="editor-files",UB=new RegExp(`^/api/[^/]+/fs/${Xh}/read$`),Bg="http://relative.invalid";function KB(t){let e;try{e=new URL(t,Bg)}catch{return!1}return e.origin!==Bg||!UB.test(e.pathname)?!1:(e.searchParams.get("path")??"").startsWith(`${k6}/`)}const HB={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},WB=_w.extend({parseMarkdown:(t,e)=>{const s=typeof t.href=="string"?t.href:"";return KB(s)?e.createNode("attachment",{href:s,name:t.text??""}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:s,title:t.title||null})}});function qB(t=""){return[i1.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),WB.configure(HB),pb.configure({placeholder:t}),zB,DB,TB.configure({markedOptions:{breaks:!0}})]}const GB=10,YB=25,QB={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function XB(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??QB[t.type]??(Zm(t)?".png":"")}function Zm(t){return t.type.startsWith("image/")}function JB(){const t=se(),{upload:e}=Ec(Xh),s=J1(Xh),[n,i]=V.useState(0);return{uploadFile:async l=>{const a=Zm(l),c=a?GB:YB;if(l.size>c*1024*1024)return me.error(t("markdownEditor.fileTooLarge",{name:l.name,max:String(c)})),null;const d=a?FB:k6,u=`${crypto.randomUUID()}${XB(l)}`;i(h=>h+1);try{return await e.mutateAsync({dir:d,files:[new File([l],u,{type:l.type})]}),s(`${d}/${u}`)}catch{return me.error(t("markdownEditor.uploadFailed",{name:l.name})),null}finally{i(h=>h-1)}},pending:n}}const ZB=["outline-none","min-h-[200px] sm:min-h-[320px]","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-2 [&_p]:leading-relaxed","[&_h1]:mb-2 [&_h1]:mt-5 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-snug","[&_h2]:mb-1.5 [&_h2]:mt-4 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-snug","[&_h3]:mb-1 [&_h3]:mt-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-snug","[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[13px]","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2","[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold"].join(" "),ez=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function zg(t,e,s,n){const i=t.state.schema.nodes[s];if(!i)return e;const o=t.state.tr.replaceWith(e,e,i.create(n)),l=o.mapping.map(e,1);return o.setSelection(_i.near(o.doc.resolve(l))),t.dispatch(o),t.state.selection.to}function tz({defaultValue:t,onChange:e,placeholder:s,editable:n=!0}){const i=se(),{uploadFile:o,pending:l}=JB(),a=V.useRef(null),c=V.useRef(e),d=V.useRef(o);c.current=e,d.current=o;const u=(m,p,g)=>p.length===0?!1:((async()=>{let x=g;for(const b of p){const v=await d.current(b);v&&(x=Zm(b)?zg(m,x,"image",{src:v,alt:b.name}):zg(m,x,"attachment",{href:v,name:b.name}))}})(),!0),h=n1({extensions:qB(s),content:t,contentType:"markdown",editable:n,editorProps:{attributes:{class:ie(ZB,ez)},handlePaste:(m,p)=>u(m,Array.from(p.clipboardData?.files??[]),m.state.selection.to),handleDrop:(m,p,g,x)=>{if(x)return!1;const b=Array.from(p.dataTransfer?.files??[]),v=m.posAtCoords({left:p.clientX,top:p.clientY})?.pos;return v===void 0?!1:u(m,b,v)}},onUpdate:({editor:m})=>c.current(m.getMarkdown())});if(!h)return null;const f=m=>{!m||m.length===0||u(h.view,Array.from(m),h.state.selection.to)};return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(RO,{editor:h}),r.jsx(r1,{editor:h,className:"text-[15px] text-foreground"}),r.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground",children:[n&&r.jsx(ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":i("markdownEditor.attachFile"),onClick:()=>a.current?.click(),children:r.jsx(o5,{size:14})}),l>0&&r.jsxs("span",{className:"inline-flex items-center gap-1.5","aria-live":"polite",role:"status",children:[r.jsx(Kc,{size:12,className:"animate-spin"}),l===1?i("markdownEditor.uploading"):i("markdownEditor.uploadingCount",{count:String(l)})]})]}),r.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:m=>{f(m.target.files),m.target.value=""}})]})}const sz=6e4;function nz(t){const e=z.c(10),{locator:s}=Me(),n=Cs();let i;e[0]!==t||e[1]!==s?(i=Fe.taskBoardItemPrs(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ITEM_PRS_GET",{taskBoardItemId:t})).prs,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,refetchInterval:sz,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],xt(a)}function j6(t){const e=z.c(10),{locator:s}=Me(),n=Cs();let i;e[0]!==t||e[1]!==s?(i=Fe.taskBoardActivity(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ACTIVITY_LIST",{taskBoardItemId:t})).activity,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],xt(a)}function iz(t){const e=z.c(10),{locator:s}=Me(),n=Cs(),i=Qt();let o;e[0]!==t||e[1]!==n?(o=async()=>await n.call("TASK_BOARD_PROMOTE_TO_PRODUCTION",{taskBoardItemId:t}),e[0]=t,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==t||e[4]!==s||e[5]!==i?(l=()=>{i.invalidateQueries({queryKey:Fe.taskBoardItemPrs(s,t)}),i.invalidateQueries({queryKey:Fe.taskBoardActivity(s,t)})},e[3]=t,e[4]=s,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==o||e[8]!==l?(a={mutationFn:o,onSuccess:l},e[7]=o,e[8]=l,e[9]=a):a=e[9],Rt(a)}function rz(t){const e=[];return t.qa&&e.push("qa"),t.codeReview&&e.push("code_review"),e}function oz(t,e){return e.length===0?!0:ej(t,e)}function ep(t){const e=z.c(54),{members:s,onSelect:n}=t,i=se();let o;e[0]!==i?(o=i("taskBoard.taskDialog.assignToPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==o?(l=r.jsx(Wi,{placeholder:o,className:"h-9"}),e[2]=o,e[3]=l):l=e[3];let a;e[4]!==i?(a=i("taskBoard.taskDialog.noMembersFound"),e[4]=i,e[5]=a):a=e[5];let c;e[6]!==a?(c=r.jsx(si,{children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i?(d=i("taskBoard.taskDialog.superAgentLabel"),e[8]=i,e[9]=d):d=e[9];let u;e[10]!==n?(u=()=>n(cs),e[10]=n,e[11]=u):u=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Dn,{size:16}),e[12]=h):h=e[12];let f;e[13]!==i?(f=i("taskBoard.taskDialog.superAgentLabel"),e[13]=i,e[14]=f):f=e[14];let m;e[15]!==f?(m=r.jsx("span",{className:"truncate",children:f}),e[15]=f,e[16]=m):m=e[16];let p;e[17]!==d||e[18]!==u||e[19]!==m?(p=r.jsxs(Jt,{value:d,onSelect:u,className:"gap-2",children:[h,m]}),e[17]=d,e[18]=u,e[19]=m,e[20]=p):p=e[20];let g;e[21]!==i?(g=i("taskBoard.taskDialog.unassignedLabel"),e[21]=i,e[22]=g):g=e[22];let x;e[23]!==n?(x=()=>n(null),e[23]=n,e[24]=x):x=e[24];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Su,{size:16,className:"text-muted-foreground"}),e[25]=b):b=e[25];let v;e[26]!==i?(v=i("taskBoard.taskDialog.unassignedLabel"),e[26]=i,e[27]=v):v=e[27];let y;e[28]!==v?(y=r.jsx("span",{className:"truncate",children:v}),e[28]=v,e[29]=y):y=e[29];let _;e[30]!==g||e[31]!==x||e[32]!==y?(_=r.jsxs(Jt,{value:g,onSelect:x,className:"gap-2",children:[b,y]}),e[30]=g,e[31]=x,e[32]=y,e[33]=_):_=e[33];let L;e[34]!==p||e[35]!==_?(L=r.jsxs(ks,{children:[p,_]}),e[34]=p,e[35]=_,e[36]=L):L=e[36];let w;e[37]!==i?(w=i("taskBoard.taskDialog.membersGroupHeading"),e[37]=i,e[38]=w):w=e[38];let S;if(e[39]!==s||e[40]!==n){let N;e[42]!==n?(N=C=>r.jsxs(Jt,{value:C.user?.name??C.userId,onSelect:()=>n(C.userId),className:"gap-2",children:[r.jsx(Us,{url:C.user?.image??void 0,fallback:Rn(C.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:C.user?.name??C.userId})]},C.userId),e[42]=n,e[43]=N):N=e[43],S=s.map(N),e[39]=s,e[40]=n,e[41]=S}else S=e[41];let k;e[44]!==w||e[45]!==S?(k=r.jsx(ks,{heading:w,children:S}),e[44]=w,e[45]=S,e[46]=k):k=e[46];let j;e[47]!==L||e[48]!==k||e[49]!==c?(j=r.jsxs(qi,{children:[c,L,k]}),e[47]=L,e[48]=k,e[49]=c,e[50]=j):j=e[50];let T;return e[51]!==l||e[52]!==j?(T=r.jsxs(pr,{children:[l,j]}),e[51]=l,e[52]=j,e[53]=T):T=e[53],T}function lz({tags:t,selectedIds:e,defaultColor:s,onToggle:n,onCreate:i,onDelete:o}){const l=se(),[a,c]=V.useState(""),[d,u]=V.useState(!1),[h,f]=V.useState(s),m=a.trim(),p=t.some(x=>x.name.toLowerCase()===m.toLowerCase()),g=async()=>{if(!(!m||p||d)){u(!0);try{await i(m,h),c("")}finally{u(!1)}}};return r.jsxs(pr,{children:[r.jsx(Wi,{value:a,onValueChange:c,placeholder:l("taskBoard.taskDialog.tagFilterPlaceholder"),className:"h-9"}),r.jsxs(qi,{children:[m&&!p?r.jsx(ks,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"color",value:h,onChange:x=>f(x.target.value),"aria-label":l("taskBoard.taskDialog.pickTagColorAriaLabel"),className:"ml-2 size-4 shrink-0 cursor-pointer appearance-none rounded-full border-0 bg-transparent p-0 [&::-moz-color-swatch]:rounded-full [&::-moz-color-swatch]:border-0 [&::-webkit-color-swatch]:rounded-full [&::-webkit-color-swatch]:border-0 [&::-webkit-color-swatch-wrapper]:p-0"}),r.jsxs(Jt,{value:`create-${m}`,disabled:d,onSelect:g,className:"flex-1 gap-2",children:[r.jsx(Nt,{size:16,className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:l("taskBoard.taskDialog.createTagOption",{name:m})})]})]})}):r.jsx(si,{children:l("taskBoard.taskDialog.noTagsFound")}),r.jsx(ks,{children:t.map(x=>{const b=e.includes(x.id);return r.jsxs(Jt,{value:x.name,onSelect:()=>n(x.id),className:"group gap-2",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:cd(x.color)}}),r.jsx("span",{className:"flex-1 truncate",children:x.name}),r.jsx("button",{type:"button","aria-label":l("taskBoard.taskDialog.deleteTagAriaLabel",{name:x.name}),className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-background hover:text-destructive group-hover:opacity-100",onClick:v=>{v.stopPropagation(),o(x.id)},children:r.jsx(y1,{size:13})}),b&&r.jsx(Ut,{size:14,className:"shrink-0 text-foreground"})]},x.id)})})]})]})}function az(t){if(!t)return[];const e=[],s=new Set,n=(l,a)=>{s.has(l)||(s.add(l),e.push({url:l,label:a.trim()||l}))},i=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"");for(const l of i.matchAll(/\[([^\]]*)\]\((https?:\/\/[^)\s]+)[^)]*\)/g))n(l[2]??"",l[1]??"");const o=i.replace(/\[[^\]]*\]\([^)]*\)/g,"");for(const l of o.matchAll(/https?:\/\/[^\s)]+/g))n(l[0],l[0]);return e}function cz(t){const e=z.c(40),{thread:s,me:n,onReply:i,onDelete:o,onToggleResolved:l}=t,a=se(),[c,d]=V.useState(!1);if(s.resolved&&!c){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>d(!0),e[0]=v):v=e[0];let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(NS,{size:16,className:"shrink-0 text-muted-foreground"}),e[1]=y):y=e[1];let _;e[2]!==a||e[3]!==s?(_=uz(s,a),e[2]=a,e[3]=s,e[4]=_):_=e[4];let L;e[5]!==_?(L=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:_}),e[5]=_,e[6]=L):L=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(m0,{size:16,className:"shrink-0 text-muted-foreground"}),e[7]=w):w=e[7];let S;return e[8]!==L?(S=r.jsxs("button",{type:"button",onClick:v,className:"flex w-full items-center gap-2.5 rounded-xl bg-card px-4 py-3 text-left card-shadow transition-colors hover:bg-muted/60",children:[y,L,w]}),e[8]=L,e[9]=S):S=e[9],S}let u;e[10]!==a||e[11]!==s.resolved?(u=s.resolved&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>d(!1),className:"flex items-center justify-between gap-2 rounded-t-xl bg-muted/40 px-4 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:text-foreground",children:[a("taskBoard.taskDialog.commentCollapseThread"),r.jsx(hs,{size:14,"aria-hidden":!0})]}),r.jsx(z9,{})]}),e[10]=a,e[11]=s.resolved,e[12]=u):u=e[12];let h;e[13]!==n||e[14]!==o||e[15]!==s?(h=Fg(s,n)?()=>o(s.id):void 0,e[13]=n,e[14]=o,e[15]=s,e[16]=h):h=e[16];let f;e[17]!==l||e[18]!==h||e[19]!==s?(f=r.jsx(Ug,{comment:s,onDelete:h,resolved:s.resolved,onToggleResolved:l}),e[17]=l,e[18]=h,e[19]=s,e[20]=f):f=e[20];let m;if(e[21]!==n||e[22]!==o||e[23]!==s.replies){let v;e[25]!==n||e[26]!==o?(v=(y,_)=>r.jsxs(V.Fragment,{children:[r.jsx(z9,{inset:_>0}),r.jsx(Ug,{comment:y,onDelete:Fg(y,n)?()=>o(y.id):void 0,isReply:!0})]},y.id),e[25]=n,e[26]=o,e[27]=v):v=e[27],m=s.replies.map(v),e[21]=n,e[22]=o,e[23]=s.replies,e[24]=m}else m=e[24];let p;e[28]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(z9,{}),e[28]=p):p=e[28];let g;e[29]!==a?(g=a("taskBoard.taskDialog.commentReplyPlaceholder"),e[29]=a,e[30]=g):g=e[30];let x;e[31]!==n||e[32]!==i||e[33]!==g?(x=r.jsx(N6,{variant:"reply",placeholder:g,author:n,onSubmit:i}),e[31]=n,e[32]=i,e[33]=g,e[34]=x):x=e[34];let b;return e[35]!==u||e[36]!==f||e[37]!==m||e[38]!==x?(b=r.jsxs("div",{className:"flex flex-col rounded-xl bg-card card-shadow",children:[u,f,m,p,x]}),e[35]=u,e[36]=f,e[37]=m,e[38]=x,e[39]=b):b=e[39],b}function Fg(t,e){return t.author.id===e.id||t.author.isAgent===!0}const dz=new Intl.ListFormat(void 0,{style:"long",type:"conjunction"});function uz(t,e){const s=[t,...t.replies],n=dz.format([...new Set(s.map(i=>i.author.name))]);return s.length===1?e("taskBoard.taskDialog.commentResolvedSummaryOne",{names:n}):e("taskBoard.taskDialog.commentResolvedSummaryMany",{count:s.length,names:n})}function hz(t){const e=z.c(6),{me:s,onSubmit:n}=t,i=se();let o;e[0]!==i?(o=i("taskBoard.taskDialog.commentPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;return e[2]!==s||e[3]!==n||e[4]!==o?(l=r.jsx(N6,{variant:"root",placeholder:o,author:s,onSubmit:n}),e[2]=s,e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function z9(t){const e=z.c(4),{inset:s}=t,n=s&&"ml-12";let i;e[0]!==n?(i=ie("h-px bg-border/50",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==i?(o=r.jsx("span",{className:i}),e[2]=i,e[3]=o):o=e[3],o}function Ug(t){const e=z.c(28),{comment:s,isReply:n,resolved:i,onDelete:o,onToggleResolved:l}=t;let a;e[0]!==s.author?(a=r.jsx(C6,{author:s.author}),e[0]=s.author,e[1]=a):a=e[1];let c;e[2]!==s.author.name?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:s.author.name}),e[2]=s.author.name,e[3]=c):c=e[3];let d;e[4]!==s.createdAt?(d=Jc(new Date(s.createdAt)),e[4]=s.createdAt,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==l||e[10]!==i?(h=(o||l)&&r.jsx(fz,{resolved:i,onDelete:o,onToggleResolved:l}),e[8]=o,e[9]=l,e[10]=i,e[11]=h):h=e[11];let f;e[12]!==a||e[13]!==c||e[14]!==u||e[15]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2",children:[a,c,u,h]}),e[12]=a,e[13]=c,e[14]=u,e[15]=h,e[16]=f):f=e[16];const m=n&&"pl-8";let p;e[17]!==m?(p=ie("text-[15px] leading-relaxed text-foreground",m),e[17]=m,e[18]=p):p=e[18];let g;e[19]!==s.body||e[20]!==s.id?(g=r.jsx(Qr,{id:s.id,text:s.body}),e[19]=s.body,e[20]=s.id,e[21]=g):g=e[21];let x;e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:p,children:g}),e[22]=p,e[23]=g,e[24]=x):x=e[24];let b;return e[25]!==x||e[26]!==f?(b=r.jsxs("div",{className:"group flex flex-col gap-1.5 p-4",children:[f,x]}),e[25]=x,e[26]=f,e[27]=b):b=e[27],b}function fz(t){const e=z.c(18),{resolved:s,onDelete:n,onToggleResolved:i}=t,o=se();let l;e[0]!==o?(l=o("taskBoard.taskDialog.commentActionsAriaLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Hi,{size:16}),e[2]=a):a=e[2];let c;e[3]!==l?(c=r.jsx(Gt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":l,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-colors hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100",children:a})}),e[3]=l,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==o?(d=i&&r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{onSelect:i,children:[r.jsx(Ut,{size:16}),o(s?"taskBoard.taskDialog.commentUnresolveThread":"taskBoard.taskDialog.commentResolveThread")]}),r.jsx(ki,{})]}),e[5]=i,e[6]=s,e[7]=o,e[8]=d):d=e[8];let u;e[9]!==n||e[10]!==o?(u=n&&r.jsxs(Ze,{variant:"destructive",onSelect:n,children:[r.jsx(y1,{size:16}),o("taskBoard.taskDialog.commentDelete")]}),e[9]=n,e[10]=o,e[11]=u):u=e[11];let h;e[12]!==d||e[13]!==u?(h=r.jsxs(Yt,{align:"end",className:"w-48",children:[d,u]}),e[12]=d,e[13]=u,e[14]=h):h=e[14];let f;return e[15]!==c||e[16]!==h?(f=r.jsxs(qt,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=f):f=e[17],f}function C6(t){const e=z.c(6),{author:s}=t;if(s.isAgent){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Dn,{size:24}),e[0]=l):l=e[0],l}const n=s.image??void 0;let i;e[1]!==s.name?(i=Rn(s.name),e[1]=s.name,e[2]=i):i=e[2];let o;return e[3]!==n||e[4]!==i?(o=r.jsx(Us,{url:n,fallback:i,shape:"circle",size:"xs"}),e[3]=n,e[4]=i,e[5]=o):o=e[5],o}function N6(t){const e=z.c(36),{variant:s,placeholder:n,author:i,onSubmit:o}=t,l=se(),a=V.useRef(null),[c,d]=V.useState("");let u;e[0]!==o||e[1]!==c?(u=()=>{const P=c.trim();if(!P)return;o(P),d("");const R=a.current;R&&(R.value="",Kg(R))},e[0]=o,e[1]=c,e[2]=u):u=e[2];const h=u;let f;e[3]!==h?(f=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),h())},e[3]=h,e[4]=f):f=e[4];const m=f;let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=P=>{d(P.currentTarget.value),Kg(P.currentTarget)},e[5]=p):p=e[5];const g=s==="root"&&"min-h-10";let x;e[6]!==g?(x=ie("w-full resize-none overflow-hidden border-0 bg-transparent text-[15px] leading-relaxed text-foreground outline-none placeholder:text-muted-foreground",g),e[6]=g,e[7]=x):x=e[7];let b;e[8]!==m||e[9]!==n||e[10]!==x||e[11]!==c?(b=r.jsx("textarea",{ref:a,value:c,onChange:p,onKeyDown:m,placeholder:n,rows:1,className:x}),e[8]=m,e[9]=n,e[10]=x,e[11]=c,e[12]=b):b=e[12];const v=b;let y;e[13]!==c?(y=c.trim(),e[13]=c,e[14]=y):y=e[14];const _=!y;let L;e[15]!==l?(L=l("taskBoard.taskDialog.commentSubmitAriaLabel"),e[15]=l,e[16]=L):L=e[16];let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(o0,{size:16}),e[17]=w):w=e[17];let S;e[18]!==h||e[19]!==_||e[20]!==L?(S=r.jsx("button",{type:"button",disabled:_,onClick:h,"aria-label":L,className:"flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40",children:w}),e[18]=h,e[19]=_,e[20]=L,e[21]=S):S=e[21];const k=S;let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=()=>a.current?.focus(),e[22]=j):j=e[22];const T=j;if(s==="root"){let P;e[23]!==k?(P=r.jsx("div",{className:"flex items-center justify-end",children:k}),e[23]=k,e[24]=P):P=e[24];let R;return e[25]!==P||e[26]!==v?(R=r.jsxs("div",{"data-testid":"new-comment-composer",onClick:T,className:"relative flex cursor-text flex-col gap-1 rounded-xl bg-card p-3 card-shadow",children:[v,P]}),e[25]=P,e[26]=v,e[27]=R):R=e[27],R}let N;e[28]!==i?(N=r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(C6,{author:i})}),e[28]=i,e[29]=N):N=e[29];let C;e[30]!==v?(C=r.jsx("div",{className:"min-w-0 flex-1 pt-0.5",children:v}),e[30]=v,e[31]=C):C=e[31];let A;return e[32]!==k||e[33]!==N||e[34]!==C?(A=r.jsxs("div",{"data-testid":"reply-composer",onClick:T,className:"relative flex cursor-text items-start gap-2 p-3",children:[N,C,k]}),e[32]=k,e[33]=N,e[34]=C,e[35]=A):A=e[35],A}function Kg(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`}function mz(t){const e=t.filter(n=>!n.parentId).map(n=>({...n,replies:[]})),s=new Map(e.map(n=>[n.id,n]));for(const n of t)n.parentId&&s.get(n.parentId)?.replies.push(n);return e}function pz(t){const e=z.c(36),{locator:s}=Me(),n=Cs(),i=Qt();let o;e[0]!==t||e[1]!==s?(o=Fe.taskBoardComments(s,t??""),e[0]=t,e[1]=s,e[2]=o):o=e[2];const l=o,a=!!t;let c;e[3]!==t||e[4]!==n?(c=async()=>mz((await n.call("TASK_BOARD_COMMENT_LIST",{taskBoardItemId:t})).comments),e[3]=t,e[4]=n,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d={queryKey:l,enabled:a,queryFn:c},e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];const u=xt(d);let h;e[10]!==i||e[11]!==l?(h=()=>i.invalidateQueries({queryKey:l}),e[10]=i,e[11]=l,e[12]=h):h=e[12];const f=h;let m;e[13]!==t||e[14]!==n?(m=k=>n.call("TASK_BOARD_COMMENT_CREATE",{taskBoardItemId:t,...k}),e[13]=t,e[14]=n,e[15]=m):m=e[15];let p;e[16]!==f||e[17]!==m?(p={mutationFn:m,onSuccess:f},e[16]=f,e[17]=m,e[18]=p):p=e[18];const g=Rt(p);let x;e[19]!==n?(x=k=>n.call("TASK_BOARD_COMMENT_UPDATE",k),e[19]=n,e[20]=x):x=e[20];let b;e[21]!==f||e[22]!==x?(b={mutationFn:x,onSuccess:f},e[21]=f,e[22]=x,e[23]=b):b=e[23];const v=Rt(b);let y;e[24]!==n?(y=k=>n.call("TASK_BOARD_COMMENT_DELETE",{id:k}),e[24]=n,e[25]=y):y=e[25];let _;e[26]!==f||e[27]!==y?(_={mutationFn:y,onSuccess:f},e[26]=f,e[27]=y,e[28]=_):_=e[28];const L=Rt(_);let w;e[29]!==u.data?(w=u.data??[],e[29]=u.data,e[30]=w):w=e[30];let S;return e[31]!==g||e[32]!==L||e[33]!==v||e[34]!==w?(S={threads:w,post:g,setResolved:v,remove:L},e[31]=g,e[32]=L,e[33]=v,e[34]=w,e[35]=S):S=e[35],S}function Jh(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59).toISOString()}function Zh(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?null:e}const V6=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),cl="inline-flex h-9 items-center justify-start gap-2 rounded-lg border border-border px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted sm:border-transparent";function T6(t){const e=z.c(305),{open:s,onClose:n,item:i,defaultStatus:o,onSubmit:l,onDelete:a,onOpenThread:c,onNewChat:d,onAutoFix:u,onRerun:h,isSaving:f}=t,m=se(),{data:p}=j0();let g;e[0]!==p?.data?.members?(g=p?.data?.members??[],e[0]=p?.data?.members,e[1]=g):g=e[1];const x=g,{handleCopy:b,copied:v}=sj(),{data:y}=U5();let _;e[2]!==y?(_=y===void 0?[]:y,e[2]=y,e[3]=_):_=e[3];const L=_,w=nj(),S=ij(),[k,j]=V.useState(i?.title??""),[T,N]=V.useState(i?.description??""),[C,A]=V.useState(i?.status??o??"triage"),[P,R]=V.useState(i?.priority??"medium"),[E,M]=V.useState(i?.assigneeId??null),I=i?.dueDate;let $;e[4]!==I?($=Zh(I),e[4]=I,e[5]=$):$=e[5];const[O,D]=V.useState($);let B;e[6]!==i?.tags?(B=i?.tags.map(yz)??[],e[6]=i?.tags,e[7]=B):B=e[7];const[F,U]=V.useState(B),[H,W]=V.useState(!1),[q,ee]=V.useState(!1),[X,Y]=V.useState(!1);let G;e[8]!==o||e[9]!==i?.assigneeId||e[10]!==i?.description||e[11]!==i?.dueDate||e[12]!==i?.priority||e[13]!==i?.status||e[14]!==i?.tags||e[15]!==i?.title?(G=()=>{j(i?.title??""),N(i?.description??""),A(i?.status??o??"triage"),R(i?.priority??"medium"),M(i?.assigneeId??null),D(Zh(i?.dueDate)),U(i?.tags.map(vz)??[])},e[8]=o,e[9]=i?.assigneeId,e[10]=i?.description,e[11]=i?.dueDate,e[12]=i?.priority,e[13]=i?.status,e[14]=i?.tags,e[15]=i?.title,e[16]=G):G=e[16];const J=G;let oe;e[17]!==n||e[18]!==J?(oe=()=>{n(),J()},e[17]=n,e[18]=J,e[19]=oe):oe=e[19];const le=oe;let Q;e[20]!==w?(Q=async(et,Ht)=>{const Vs=await w.mutateAsync({name:et,color:Ht});U($n=>[...$n,Vs.id])},e[20]=w,e[21]=Q):Q=e[21];const K=Q;let te;e[22]!==S?(te=et=>{S.mutate(et),U(Ht=>Ht.filter(Vs=>Vs!==et))},e[22]=S,e[23]=te):te=e[23];const ne=te;let re;e[24]!==E||e[25]!==T||e[26]!==O||e[27]!==l||e[28]!==P||e[29]!==C||e[30]!==F||e[31]!==k?(re=()=>{const et=k.trim();et&&l({title:et,description:T.trim()||null,status:C,priority:P,assigneeId:E,dueDate:O?Jh(O):null,tagIds:F})},e[24]=E,e[25]=T,e[26]=O,e[27]=l,e[28]=P,e[29]=C,e[30]=F,e[31]=k,e[32]=re):re=e[32];const he=re,pe=E===cs,de=i&&u&&(C==="triage"||C==="todo")&&!pe,Z=i&&h&&i.assigneeId===cs;let fe;if(e[33]!==E||e[34]!==T||e[35]!==O||e[36]!==i||e[37]!==P||e[38]!==C||e[39]!==F||e[40]!==k){const et=i?.tags.map(bz)??[];fe=!i||k.trim()!==i.title||(T.trim()||null)!==i.description||C!==i.status||P!==i.priority||E!==(i.assigneeId??null)||(O?Jh(O):null)!==(i.dueDate??null)||F.length!==et.length||!F.every(Ht=>et.includes(Ht)),e[33]=E,e[34]=T,e[35]=O,e[36]=i,e[37]=P,e[38]=C,e[39]=F,e[40]=k,e[41]=fe}else fe=e[41];const ue=fe;let ye;if(e[42]!==E||e[43]!==x){let et;e[45]!==E?(et=Ht=>Ht.userId===E,e[45]=E,e[46]=et):et=e[46],ye=x.find(et),e[42]=E,e[43]=x,e[44]=ye}else ye=e[44];const Le=ye;let Re;e[47]!==i||e[48]!==x?(Re=i?.assignedBy?x.find(et=>et.userId===i.assignedBy):void 0,e[47]=i,e[48]=x,e[49]=Re):Re=e[49];const De=Re,Ue=En[C].icon;let $e,je,be,Ee,_e,Ae,Ce,xe,Se,we,ze,Be,Xe,Ve,ot,gt,ct,dt,mt,ge,Ye;if(e[50]!==le||e[51]!==i||e[52]!==s||e[53]!==m||e[54]!==k){be=!!i&&z5(i),je=Ct,ge=s,e[76]!==le?(Ye=$n=>!$n&&le(),e[76]=le,e[77]=Ye):Ye=e[77],$e=jt,gt="flex max-h-[92vh] flex-col gap-0 overflow-hidden rounded-2xl p-0 sm:h-[90vh] sm:max-h-[820px] sm:max-w-[1040px]",ct="hidden";let et;e[78]!==i||e[79]!==m?(et=m(i?"taskBoard.taskDialog.editTaskTitle":"taskBoard.taskDialog.newTaskTitle"),e[78]=i,e[79]=m,e[80]=et):et=e[80],e[81]!==et?(dt=r.jsx(At,{className:"sr-only",children:et}),e[81]=et,e[82]=dt):dt=e[82];let Ht;e[83]!==m?(Ht=m("taskBoard.taskDialog.closeAriaLabel"),e[83]=m,e[84]=Ht):Ht=e[84];let Vs;e[85]===Symbol.for("react.memo_cache_sentinel")?(Vs=r.jsx(hs,{size:16}),e[85]=Vs):Vs=e[85],e[86]!==le||e[87]!==Ht?(mt=r.jsx("button",{type:"button","aria-label":Ht,onClick:le,className:"absolute right-2.5 top-2.5 z-10 flex size-10 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:Vs}),e[86]=le,e[87]=Ht,e[88]=mt):mt=e[88],ot="flex min-h-0 flex-1 flex-col overflow-y-auto sm:flex-row sm:overflow-hidden",Ve="flex min-w-0 flex-col sm:flex-1 sm:overflow-y-auto",Xe="sticky top-0 z-20 bg-background p-6 pb-0 sm:p-8 sm:pb-0",Ee=xz,_e=k,Ae=$n=>{be||(j($n.target.value),$n.target.style.height="auto",$n.target.style.height=`${$n.target.scrollHeight}px`)},Ce=gz,e[89]!==m?(xe=m("taskBoard.taskDialog.taskTitlePlaceholder"),e[89]=m,e[90]=xe):xe=e[90],Se=!0,we=1,ze=be,Be=ie("w-full resize-none overflow-hidden border-0 bg-transparent text-xl font-medium leading-snug text-foreground outline-none placeholder:text-foreground/30",be&&"cursor-default"),e[50]=le,e[51]=i,e[52]=s,e[53]=m,e[54]=k,e[55]=$e,e[56]=je,e[57]=be,e[58]=Ee,e[59]=_e,e[60]=Ae,e[61]=Ce,e[62]=xe,e[63]=Se,e[64]=we,e[65]=ze,e[66]=Be,e[67]=Xe,e[68]=Ve,e[69]=ot,e[70]=gt,e[71]=ct,e[72]=dt,e[73]=mt,e[74]=ge,e[75]=Ye}else $e=e[55],je=e[56],be=e[57],Ee=e[58],_e=e[59],Ae=e[60],Ce=e[61],xe=e[62],Se=e[63],we=e[64],ze=e[65],Be=e[66],Xe=e[67],Ve=e[68],ot=e[69],gt=e[70],ct=e[71],dt=e[72],mt=e[73],ge=e[74],Ye=e[75];let tt;e[91]!==Ee||e[92]!==_e||e[93]!==Ae||e[94]!==Ce||e[95]!==xe||e[96]!==Se||e[97]!==we||e[98]!==ze||e[99]!==Be?(tt=r.jsx("textarea",{ref:Ee,value:_e,onChange:Ae,onKeyDown:Ce,placeholder:xe,autoFocus:Se,rows:we,readOnly:ze,className:Be}),e[91]=Ee,e[92]=_e,e[93]=Ae,e[94]=Ce,e[95]=xe,e[96]=Se,e[97]=we,e[98]=ze,e[99]=Be,e[100]=tt):tt=e[100];let ut;e[101]!==be||e[102]!==m?(ut=be&&r.jsxs("p",{className:"mb-3 mt-1 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Bc,{size:12}),m("taskBoard.taskDialog.reportsContentLocked")]}),e[101]=be,e[102]=m,e[103]=ut):ut=e[103];let bt;e[104]!==Xe||e[105]!==tt||e[106]!==ut?(bt=r.jsxs("div",{className:Xe,children:[tt,ut]}),e[104]=Xe,e[105]=tt,e[106]=ut,e[107]=bt):bt=e[107];let Vt;e[108]!==m?(Vt=m("taskBoard.taskDialog.descriptionPlaceholder"),e[108]=m,e[109]=Vt):Vt=e[109];const St=!be;let Tt;e[110]!==T||e[111]!==Vt||e[112]!==St?(Tt=r.jsx(tz,{defaultValue:T,onChange:N,placeholder:Vt,editable:St}),e[110]=T,e[111]=Vt,e[112]=St,e[113]=Tt):Tt=e[113];let Kt;e[114]!==v||e[115]!==T||e[116]!==b||e[117]!==m?(Kt=T&&r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":m("taskBoard.taskDialog.copyDescriptionAriaLabel"),className:"absolute right-0 top-0 size-7 rounded-md border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground group-hover:opacity-100",onClick:()=>b(T),children:v?r.jsx(Ut,{size:14}):r.jsx(on,{size:14})}),e[114]=v,e[115]=T,e[116]=b,e[117]=m,e[118]=Kt):Kt=e[118];let es;e[119]!==Tt||e[120]!==Kt?(es=r.jsxs("div",{className:"group relative flex flex-col",children:[Tt,Kt]}),e[119]=Tt,e[120]=Kt,e[121]=es):es=e[121];let Mt;e[122]!==i?(Mt=i&&r.jsx("hr",{className:"border-border"}),e[122]=i,e[123]=Mt):Mt=e[123];let ce;e[124]!==T||e[125]!==i||e[126]!==c?(ce=i?.id&&r.jsx(Vz,{item:i,description:T,onOpenThread:c}),e[124]=T,e[125]=i,e[126]=c,e[127]=ce):ce=e[127];let Pe;e[128]!==De||e[129]!==Le||e[130]!==i||e[131]!==x||e[132]!==c?(Pe=i&&r.jsx(Az,{item:i,members:x,startedBy:De??Le,onOpenThread:c}),e[128]=De,e[129]=Le,e[130]=i,e[131]=x,e[132]=c,e[133]=Pe):Pe=e[133];let He;e[134]!==es||e[135]!==Mt||e[136]!==ce||e[137]!==Pe?(He=r.jsxs("div",{className:"flex flex-col gap-6 p-6 pt-6 sm:p-8 sm:pt-6",children:[es,Mt,ce,Pe]}),e[134]=es,e[135]=Mt,e[136]=ce,e[137]=Pe,e[138]=He):He=e[138];let Qe;e[139]!==Ve||e[140]!==bt||e[141]!==He?(Qe=r.jsxs("div",{className:Ve,children:[bt,He]}),e[139]=Ve,e[140]=bt,e[141]=He,e[142]=Qe):Qe=e[142];let Ne;e[143]!==m?(Ne=m("taskBoard.taskDialog.propertiesLabel"),e[143]=m,e[144]=Ne):Ne=e[144];let lt;e[145]!==Ne?(lt=r.jsx("span",{className:"hidden px-3 text-sm text-muted-foreground sm:block",children:Ne}),e[145]=Ne,e[146]=lt):lt=e[146];let Bt;e[147]!==i||e[148]!==C?(Bt=ie(i?$m({...i,status:C}):En[C].iconClassName),e[147]=i,e[148]=C,e[149]=Bt):Bt=e[149];let Ns;e[150]!==Ue||e[151]!==Bt?(Ns=r.jsx(Ue,{size:16,className:Bt}),e[150]=Ue,e[151]=Bt,e[152]=Ns):Ns=e[152];const an=En[C];let Ds;e[153]!==m||e[154]!==an.labelKey?(Ds=m(an.labelKey),e[153]=m,e[154]=an.labelKey,e[155]=Ds):Ds=e[155];let Ft;e[156]!==Ns||e[157]!==Ds?(Ft=r.jsx(Gt,{asChild:!0,children:r.jsxs("button",{type:"button",className:cl,children:[Ns,Ds]})}),e[156]=Ns,e[157]=Ds,e[158]=Ft):Ft=e[158];let Xs;e[159]!==m?(Xs=Bu.map(et=>{const Ht=En[et].icon;return r.jsxs(Ze,{onSelect:()=>A(et),className:"gap-2",children:[r.jsx(Ht,{size:16,className:En[et].iconClassName}),m(En[et].labelKey)]},et)}),e[159]=m,e[160]=Xs):Xs=e[160];let Cn;e[161]!==Xs?(Cn=r.jsx(Yt,{align:"start",className:"w-44",children:Xs}),e[161]=Xs,e[162]=Cn):Cn=e[162];let Js;e[163]!==Ft||e[164]!==Cn?(Js=r.jsxs(qt,{children:[Ft,Cn]}),e[163]=Ft,e[164]=Cn,e[165]=Js):Js=e[165];let Zs;e[166]!==be||e[167]!==m?(Zs=be?m("taskBoard.taskDialog.reportsContentLocked"):void 0,e[166]=be,e[167]=m,e[168]=Zs):Zs=e[168];const di=P==="none"&&"text-muted-foreground",Te=be&&"cursor-default opacity-60";let st;e[169]!==di||e[170]!==Te?(st=ie(cl,di,Te),e[169]=di,e[170]=Te,e[171]=st):st=e[171];let Lt;e[172]!==P||e[173]!==m?(Lt=P==="none"?r.jsxs(r.Fragment,{children:[r.jsx(Hi,{size:16}),m("taskBoard.taskDialog.setPriorityButton")]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:ie("size-2 rounded-full",Pn[P].dotClassName)}),m(Pn[P].labelKey)]}),e[172]=P,e[173]=m,e[174]=Lt):Lt=e[174];let ts;e[175]!==be||e[176]!==Zs||e[177]!==st||e[178]!==Lt?(ts=r.jsx(Gt,{asChild:!0,children:r.jsx("button",{type:"button",disabled:be,title:Zs,className:st,children:Lt})}),e[175]=be,e[176]=Zs,e[177]=st,e[178]=Lt,e[179]=ts):ts=e[179];let en;e[180]!==m?(en=Om.map(et=>r.jsxs(Ze,{onSelect:()=>R(et),children:[r.jsx("span",{className:ie("size-2 rounded-full",Pn[et].dotClassName)}),m(Pn[et].labelKey)]},et)),e[180]=m,e[181]=en):en=e[181];let qs;e[182]!==en?(qs=r.jsx(Yt,{align:"start",className:"w-40",children:en}),e[182]=en,e[183]=qs):qs=e[183];let Gi;e[184]!==ts||e[185]!==qs?(Gi=r.jsxs(qt,{children:[ts,qs]}),e[184]=ts,e[185]=qs,e[186]=Gi):Gi=e[186];const ca=!E&&"text-muted-foreground";let yr;e[187]!==ca?(yr=ie(cl,ca),e[187]=ca,e[188]=yr):yr=e[188];let _r;e[189]!==De||e[190]!==Le||e[191]!==pe||e[192]!==m?(_r=pe&&De?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"hidden items-center gap-2 sm:flex",children:[r.jsx(Us,{url:De.user?.image??void 0,fallback:Rn(De.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:De.user?.name??m("taskBoard.taskDialog.superAgentDefaultName")})]}),r.jsxs("span",{className:"flex items-center gap-2 sm:hidden",children:[r.jsxs("span",{className:"inline-flex items-center",children:[r.jsx(Us,{url:De.user?.image??void 0,fallback:Rn(De.user?.name),shape:"circle",size:"2xs",className:"-mr-1.5 ring-2 ring-background"}),r.jsx(Dn,{size:16,className:"ring-2 ring-background"})]}),m("taskBoard.taskDialog.superAgentLabel")]})]}):pe?r.jsxs(r.Fragment,{children:[r.jsx(Dn,{size:16}),m("taskBoard.taskDialog.superAgentLabel")]}):Le?r.jsxs(r.Fragment,{children:[r.jsx(Us,{url:Le.user?.image??void 0,fallback:Rn(Le.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:Le.user?.name??m("taskBoard.taskDialog.unassignedLabel")})]}):r.jsxs(r.Fragment,{children:[r.jsx(x5,{size:16,className:"text-muted-foreground"}),m("taskBoard.taskDialog.assignButton")]}),e[189]=De,e[190]=Le,e[191]=pe,e[192]=m,e[193]=_r):_r=e[193];let Lr;e[194]!==yr||e[195]!==_r?(Lr=r.jsx(us,{asChild:!0,children:r.jsx("button",{type:"button",className:yr,children:_r})}),e[194]=yr,e[195]=_r,e[196]=Lr):Lr=e[196];let Xo;e[197]===Symbol.for("react.memo_cache_sentinel")?(Xo=et=>{M(et),ee(!1)},e[197]=Xo):Xo=e[197];let wr;e[198]!==x?(wr=r.jsx(ys,{align:"start",className:"w-56 p-0",children:r.jsx(ep,{members:x,onSelect:Xo})}),e[198]=x,e[199]=wr):wr=e[199];let Sr;e[200]!==q||e[201]!==Lr||e[202]!==wr?(Sr=r.jsxs(_s,{open:q,onOpenChange:ee,modal:!0,children:[Lr,wr]}),e[200]=q,e[201]=Lr,e[202]=wr,e[203]=Sr):Sr=e[203];let ui;e[204]!==De||e[205]!==pe||e[206]!==m?(ui=pe&&De&&r.jsxs("div",{className:"relative mt-1.5 hidden items-center pl-5 sm:flex",children:[r.jsx("span",{className:"absolute -top-1.5 left-5 h-[calc(50%+0.375rem)] w-2.5 rounded-bl-md border-b border-l border-border"}),r.jsxs("span",{className:ie(cl,"pointer-events-none"),children:[r.jsx(Dn,{size:16}),m("taskBoard.taskDialog.superAgentLabel")]})]}),e[204]=De,e[205]=pe,e[206]=m,e[207]=ui):ui=e[207];let hi;e[208]!==Sr||e[209]!==ui?(hi=r.jsxs("div",{className:"flex flex-col",children:[Sr,ui]}),e[208]=Sr,e[209]=ui,e[210]=hi):hi=e[210];const da=!O&&"text-muted-foreground";let kr;e[211]!==da?(kr=ie(cl,da),e[211]=da,e[212]=kr):kr=e[212];let Mn;e[213]===Symbol.for("react.memo_cache_sentinel")?(Mn=r.jsx(ar,{size:16,className:"text-muted-foreground"}),e[213]=Mn):Mn=e[213];let Yi;e[214]!==O||e[215]!==m?(Yi=O?V6.format(O):m("taskBoard.taskDialog.dueDateLabel"),e[214]=O,e[215]=m,e[216]=Yi):Yi=e[216];let Qi;e[217]!==O||e[218]!==m?(Qi=O&&r.jsx("span",{role:"button",tabIndex:0,"aria-label":m("taskBoard.taskDialog.clearDueDateAriaLabel"),className:"-mr-1 ml-0.5 flex size-4 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:et=>{et.stopPropagation(),D(null)},onKeyDown:et=>{(et.key==="Enter"||et.key===" ")&&(et.preventDefault(),et.stopPropagation(),D(null))},children:r.jsx(hs,{size:12})}),e[217]=O,e[218]=m,e[219]=Qi):Qi=e[219];let Xi;e[220]!==kr||e[221]!==Yi||e[222]!==Qi?(Xi=r.jsx(us,{asChild:!0,children:r.jsxs("button",{type:"button",className:kr,children:[Mn,Yi,Qi]})}),e[220]=kr,e[221]=Yi,e[222]=Qi,e[223]=Xi):Xi=e[223];const ua=O??void 0;let jr;e[224]===Symbol.for("react.memo_cache_sentinel")?(jr=et=>{D(et??null),et&&W(!1)},e[224]=jr):jr=e[224];let fi;e[225]!==ua?(fi=r.jsx(ys,{className:"w-auto p-0",align:"start",children:r.jsx(l1,{mode:"single",selected:ua,onSelect:jr,initialFocus:!0})}),e[225]=ua,e[226]=fi):fi=e[226];let Ji;e[227]!==H||e[228]!==Xi||e[229]!==fi?(Ji=r.jsxs(_s,{open:H,onOpenChange:W,children:[Xi,fi]}),e[227]=H,e[228]=Xi,e[229]=fi,e[230]=Ji):Ji=e[230];let ve;e[231]!==L||e[232]!==m||e[233]!==F?(ve=F.length===0?r.jsx(us,{asChild:!0,children:r.jsxs("button",{type:"button",className:ie(cl,"text-muted-foreground"),children:[r.jsx(_1,{size:16}),m("taskBoard.taskDialog.tagsButton")]})}):r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:px-3",children:[F.map(et=>{const Ht=L.find(Vs=>Vs.id===et);return Ht?r.jsxs("button",{type:"button",onClick:()=>Y(!0),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:cd(Ht.color)}}),r.jsx("span",{className:"truncate",children:Ht.name}),r.jsx("span",{role:"button",tabIndex:0,"aria-label":m("taskBoard.taskDialog.removeTagAriaLabel",{name:Ht.name}),className:"-mr-0.5 flex size-3.5 items-center justify-center rounded-sm text-muted-foreground hover:bg-background hover:text-foreground",onClick:Vs=>{Vs.stopPropagation(),U($n=>$n.filter(m9=>m9!==et))},onKeyDown:Vs=>{(Vs.key==="Enter"||Vs.key===" ")&&(Vs.preventDefault(),Vs.stopPropagation(),U($n=>$n.filter(m9=>m9!==et)))},children:r.jsx(hs,{size:10})})]},et):null}),r.jsx(us,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":m("taskBoard.taskDialog.addTagButton"),className:"flex size-7 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(Nt,{size:14})})})]}),e[231]=L,e[232]=m,e[233]=F,e[234]=ve):ve=e[234];let Ie;e[235]!==L.length?(Ie=fO(L.length),e[235]=L.length,e[236]=Ie):Ie=e[236];let vt;e[237]===Symbol.for("react.memo_cache_sentinel")?(vt=et=>U(Ht=>Ht.includes(et)?Ht.filter(Vs=>Vs!==et):[...Ht,et]),e[237]=vt):vt=e[237];let wt;e[238]!==K||e[239]!==ne||e[240]!==L||e[241]!==Ie||e[242]!==F?(wt=r.jsx(ys,{align:"start",className:"w-56 p-0",children:r.jsx(lz,{tags:L,selectedIds:F,defaultColor:Ie,onToggle:vt,onCreate:K,onDelete:ne})}),e[238]=K,e[239]=ne,e[240]=L,e[241]=Ie,e[242]=F,e[243]=wt):wt=e[243];let ls;e[244]!==ve||e[245]!==wt||e[246]!==X?(ls=r.jsxs(_s,{open:X,onOpenChange:Y,modal:!0,children:[ve,wt]}),e[244]=ve,e[245]=wt,e[246]=X,e[247]=ls):ls=e[247];let tn;e[248]!==Js||e[249]!==Gi||e[250]!==hi||e[251]!==Ji||e[252]!==ls?(tn=r.jsxs("div",{className:"flex flex-wrap gap-2 sm:flex-col",children:[Js,Gi,hi,Ji,ls]}),e[248]=Js,e[249]=Gi,e[250]=hi,e[251]=Ji,e[252]=ls,e[253]=tn):tn=e[253];let Is;e[254]!==lt||e[255]!==tn?(Is=r.jsxs("div",{className:"flex w-full shrink-0 flex-col gap-4 border-t border-border p-6 sm:w-[220px] sm:border-t-0 sm:border-l sm:px-6 sm:py-10",children:[lt,tn]}),e[254]=lt,e[255]=tn,e[256]=Is):Is=e[256];let Jo;e[257]!==ot||e[258]!==Qe||e[259]!==Is?(Jo=r.jsxs("div",{className:ot,children:[Qe,Is]}),e[257]=ot,e[258]=Qe,e[259]=Is,e[260]=Jo):Jo=e[260];let Zo;e[261]!==i||e[262]!==a||e[263]!==m?(Zo=i&&a?r.jsx(ae,{variant:"ghost",size:"icon","aria-label":m("taskBoard.taskDialog.deleteTaskAriaLabel"),className:"size-10 text-muted-foreground hover:text-destructive",onClick:a,children:r.jsx(y1,{size:16})}):r.jsx("span",{}),e[261]=i,e[262]=a,e[263]=m,e[264]=Zo):Zo=e[264];let el;e[265]!==i||e[266]!==d||e[267]!==m?(el=i&&d&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:d,children:[r.jsx(p1,{size:16}),m("taskBoard.taskDialog.newChatButton")]}),e[265]=i,e[266]=d,e[267]=m,e[268]=el):el=e[268];let tl;e[269]!==u||e[270]!==de||e[271]!==m?(tl=de&&r.jsxs(ae,{size:"sm",onClick:u,children:[r.jsx(Jr,{size:16}),m("taskBoard.taskBoard.autoFix")]}),e[269]=u,e[270]=de,e[271]=m,e[272]=tl):tl=e[272];let sl;e[273]!==h||e[274]!==Z||e[275]!==m?(sl=Z&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:h,children:[r.jsx(vn,{size:16}),m("taskBoard.taskBoard.rerun")]}),e[273]=h,e[274]=Z,e[275]=m,e[276]=sl):sl=e[276];let nl;e[277]!==ue||e[278]!==f||e[279]!==i||e[280]!==he||e[281]!==m||e[282]!==k?(nl=ue&&r.jsxs(ae,{size:"sm",disabled:!k.trim()||f,onClick:he,children:[i?null:r.jsx(Nt,{size:16}),m(i?"taskBoard.taskDialog.saveButton":"taskBoard.taskDialog.createTaskButton")]}),e[277]=ue,e[278]=f,e[279]=i,e[280]=he,e[281]=m,e[282]=k,e[283]=nl):nl=e[283];let il;e[284]!==el||e[285]!==tl||e[286]!==sl||e[287]!==nl?(il=r.jsxs("div",{className:"flex items-center gap-2",children:[el,tl,sl,nl]}),e[284]=el,e[285]=tl,e[286]=sl,e[287]=nl,e[288]=il):il=e[288];let rl;e[289]!==Zo||e[290]!==il?(rl=r.jsxs("div",{className:"flex h-16 items-center justify-between border-t border-border px-4",children:[Zo,il]}),e[289]=Zo,e[290]=il,e[291]=rl):rl=e[291];let ol;e[292]!==$e||e[293]!==gt||e[294]!==ct||e[295]!==dt||e[296]!==mt||e[297]!==Jo||e[298]!==rl?(ol=r.jsxs($e,{className:gt,closeButtonClassName:ct,children:[dt,mt,Jo,rl]}),e[292]=$e,e[293]=gt,e[294]=ct,e[295]=dt,e[296]=mt,e[297]=Jo,e[298]=rl,e[299]=ol):ol=e[299];let vd;return e[300]!==je||e[301]!==ge||e[302]!==Ye||e[303]!==ol?(vd=r.jsx(je,{open:ge,onOpenChange:Ye,children:ol}),e[300]=je,e[301]=ge,e[302]=Ye,e[303]=ol,e[304]=vd):vd=e[304],vd}function gz(t){t.key==="Enter"&&t.preventDefault()}function xz(t){t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)}function bz(t){return t.id}function vz(t){return t.id}function yz(t){return t.id}function E6(t,e){switch(t){case"failed":return{label:e("taskBoard.taskDialog.threadStatusError"),className:"text-destructive",icon:VS};case"requires_action":return{label:e("taskBoard.taskDialog.threadStatusNeedsInput"),className:"text-warning",icon:x0};case"in_progress":return{label:e("taskBoard.taskDialog.threadStatusRunning"),className:"text-primary",icon:Kc,spin:!0};case"completed":return{label:e("taskBoard.taskDialog.threadStatusCompleted"),className:"text-success",icon:Gn};case"expired":return{label:e("taskBoard.taskDialog.threadStatusExpired"),className:"text-muted-foreground",icon:fn};default:return t}}function _z(t){const e=z.c(31),{thread:s,startedBy:n,onOpen:i}=t,o=se();let l;if(e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==s){const a=s.status?E6(s.status,o):null,c=s.lastMessage;let d;e[5]!==s.title?(d=Nc(s.title,"qa"),e[5]=s.title,e[6]=d):d=e[6];const u=d;let h;e[7]!==s.title?(h=Nc(s.title,"code_review"),e[7]=s.title,e[8]=h):h=e[8];const f=h;let m;e[9]!==i||e[10]!==s?(m=()=>i?.(s),e[9]=i,e[10]=s,e[11]=m):m=e[11];let p;e[12]!==f||e[13]!==u?(p=u?r.jsx(Bm,{size:16,className:"shrink-0"}):f?r.jsx(zm,{size:16,className:"shrink-0"}):r.jsx(Dn,{size:16,className:"shrink-0"}),e[12]=f,e[13]=u,e[14]=p):p=e[14];let g;e[15]!==o||e[16]!==s.title?(g=s.title||o("taskBoard.taskDialog.superAgentDefaultName"),e[15]=o,e[16]=s.title,e[17]=g):g=e[17];let x;e[18]!==g?(x=r.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:g}),e[18]=g,e[19]=x):x=e[19];let b;e[20]!==n||e[21]!==o?(b=n&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"shrink-0 text-sm text-muted-foreground/50",children:o("taskBoard.taskDialog.startedByLabel")}),r.jsx(Us,{url:n.user?.image??void 0,fallback:Rn(n.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate text-sm text-foreground",children:n.user?.name??o("taskBoard.taskDialog.someoneLabel")})]}),e[20]=n,e[21]=o,e[22]=b):b=e[22];let v;e[23]!==i||e[24]!==o?(v=i&&r.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1 text-xs text-muted-foreground/60 group-hover:text-foreground",children:[o("taskBoard.taskDialog.openThreadHint"),r.jsx(wn,{size:14})]}),e[23]=i,e[24]=o,e[25]=v):v=e[25];let y;e[26]!==p||e[27]!==x||e[28]!==b||e[29]!==v?(y=r.jsxs("div",{className:"flex items-center gap-2",children:[p,x,b,v]}),e[26]=p,e[27]=x,e[28]=b,e[29]=v,e[30]=y):y=e[30],l=r.jsxs("button",{type:"button",disabled:!i,onClick:m,className:"group flex w-full flex-col gap-2 rounded-xl bg-card p-4 text-left card-shadow transition-colors enabled:hover:bg-muted/60 disabled:cursor-default",children:[y,a&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:ie("flex shrink-0 items-center gap-1.5",a.className),children:[r.jsx(a.icon,{size:15,className:ie(a.spin&&"animate-spin")}),r.jsx("span",{className:"text-sm",children:a.label})]}),c&&r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:c})]})]}),e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=l}else l=e[4];return l}function Lz(t,e){return t.merged?{label:e("taskBoard.taskDialog.prStateMerged"),className:"text-special",icon:TS}:t.state==="closed"?{label:e("taskBoard.taskDialog.prStateClosed"),className:"text-destructive",icon:Xa}:t.draft?{label:e("taskBoard.taskDialog.prStateDraft"),className:"text-muted-foreground",icon:Xa}:{label:e("taskBoard.taskDialog.prStateOpen"),className:"text-success",icon:Xa}}function wz(t,e){switch(t){case"passing":return{label:e("taskBoard.taskDialog.prChecksPassing"),className:"text-success",icon:Gn};case"failing":return{label:e("taskBoard.taskDialog.prChecksFailing"),className:"text-destructive",icon:fn};case"pending":return{label:e("taskBoard.taskDialog.prChecksPending"),className:"text-warning",icon:Kc};default:return null}}const Sz=new Set(["failure","cancelled","timed_out","action_required","startup_failure","stale"]);function kz(t){if(t.status!=="completed")return{icon:Kc,className:"text-warning",spin:!0};const e=t.conclusion;return e&&Sz.has(e)?{icon:fn,className:"text-destructive",spin:!1}:e==="success"||e==="neutral"||e==="skipped"?{icon:Gn,className:"text-success",spin:!1}:{icon:x0,className:"text-muted-foreground",spin:!1}}function jz(t){const e=z.c(37),{pr:s,previewThread:n,reviewsReady:i,shipPending:o,onShip:l,onOpenThread:a}=t,c=se(),[d,u]=V.useState(!1);let h;if(e[0]!==d||e[1]!==a||e[2]!==l||e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==o||e[7]!==c){const f=Lz(s,c),m=wz(s.checksStatus,c),p=s.state==="open"&&!s.merged,g=s.checksStatus!=="failing"&&s.checksStatus!=="pending",x=i&&p&&g,b=!!n||!!s.previewUrl||x;let v;e[9]!==s.checks?(v=s.checks??[],e[9]=s.checks,e[10]=v):v=e[10];const y=v,_=y.length>0||m!=null,L=y.length>0;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Kr,{className:"size-4 shrink-0 text-foreground"}),e[11]=w):w=e[11];const S=s.title??`${s.repoOwner}/${s.repoName}`;let k;e[12]!==S?(k=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:S}),e[12]=S,e[13]=k):k=e[13];const j=ie("flex shrink-0 items-center gap-1 text-xs font-medium",f.className);let T;e[14]!==f?(T=r.jsx(f.icon,{size:13}),e[14]=f,e[15]=T):T=e[15];let N;e[16]!==f||e[17]!==j||e[18]!==T?(N=r.jsxs("span",{className:j,children:[T,f.label]}),e[16]=f,e[17]=j,e[18]=T,e[19]=N):N=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(hn,{size:12,className:"text-muted-foreground/60 group-hover:text-foreground"}),e[20]=C):C=e[20];let A;e[21]!==s.number||e[22]!==s.url?(A=r.jsxs("a",{href:s.url,target:"_blank",rel:"noreferrer",title:s.url,className:"group flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted",children:["#",s.number,C]}),e[21]=s.number,e[22]=s.url,e[23]=A):A=e[23];let P;e[24]!==A||e[25]!==k||e[26]!==N?(P=r.jsxs("div",{className:"flex items-center gap-3",children:[w,k,N,A]}),e[24]=A,e[25]=k,e[26]=N,e[27]=P):P=e[27];let R;e[28]!==b||e[29]!==a||e[30]!==l||e[31]!==s.previewUrl||e[32]!==n||e[33]!==o||e[34]!==x||e[35]!==c?(R=b&&r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&r.jsxs(ae,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",title:c("taskBoard.taskDialog.openPreviewTitle"),onClick:()=>a?.(n),children:[r.jsx(p1,{size:13}),c("taskBoard.taskDialog.openPreviewButton")]}),s.previewUrl&&r.jsx(ae,{asChild:!0,type:"button",variant:"outline",size:"sm",className:"gap-1.5",children:r.jsxs("a",{href:s.previewUrl,target:"_blank",rel:"noreferrer",children:[r.jsx(kn,{size:14}),c("taskBoard.taskDialog.previewLabel"),r.jsx(hn,{size:12})]})}),x&&r.jsx(ae,{type:"button",variant:"success",size:"sm",disabled:o,onClick:l,children:c("taskBoard.taskDialog.shipToProductionButton")})]}),e[28]=b,e[29]=a,e[30]=l,e[31]=s.previewUrl,e[32]=n,e[33]=o,e[34]=x,e[35]=c,e[36]=R):R=e[36],h=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[P,R,_&&r.jsxs("div",{className:"border-t border-border pt-2 text-xs",children:[r.jsxs("button",{type:"button",disabled:!L,onClick:()=>u(Cz),className:"flex w-full items-center gap-1.5 font-medium disabled:cursor-default",children:[m?r.jsx(m.icon,{size:13,className:m.className}):r.jsx(Gn,{size:13,className:"text-muted-foreground"}),r.jsx("span",{className:ie(m?.className??"text-muted-foreground"),children:m?.label??c("taskBoard.taskDialog.prChecksLabel")}),L&&r.jsx(wn,{size:14,className:ie("ml-auto text-muted-foreground/60 transition-transform",d&&"rotate-90")})]}),d&&r.jsx("div",{className:"mt-2 flex flex-col gap-2",children:y.map(E=>{const M=kz(E);return r.jsxs("div",{className:"rounded-md bg-muted/40 p-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(M.icon,{size:13,className:ie("shrink-0",M.className,M.spin&&"animate-spin")}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:E.name}),E.detailsUrl&&r.jsx("a",{href:E.detailsUrl,target:"_blank",rel:"noreferrer",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:r.jsx(hn,{size:12})})]}),E.summary&&r.jsx("div",{className:"mt-1.5 max-h-64 overflow-auto text-muted-foreground",children:r.jsx(Qr,{id:`${s.url}-${E.name}`,text:E.summary})})]},E.name)})})]})]}),e[0]=d,e[1]=a,e[2]=l,e[3]=s,e[4]=n,e[5]=i,e[6]=o,e[7]=c,e[8]=h}else h=e[8];return h}function Cz(t){return!t}function Nz(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(at,{className:"size-4 shrink-0 rounded"}),r.jsx(at,{className:"h-4 min-w-0 flex-1"}),r.jsx(at,{className:"h-4 w-16 shrink-0"}),r.jsx(at,{className:"h-4 w-10 shrink-0"})]}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[e,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{className:"h-7 w-20"}),r.jsx(at,{className:"h-7 w-28"})]})]}),t[1]=s):s=t[1],s}function Vz(t){const e=z.c(36),{item:s,description:n,onOpenThread:i}=t,o=se(),{data:l,isLoading:a}=nz(s.id),{data:c}=j6(s.id),d=Gp("qa_agent_enabled"),u=Gp("code_reviewer_enabled"),h=iz(s.id);let f,m;if(e[0]!==c||e[1]!==u||e[2]!==n||e[3]!==s.status||e[4]!==s.threads||e[5]!==i||e[6]!==h||e[7]!==l||e[8]!==a||e[9]!==d||e[10]!==o){m=Symbol.for("react.early_return_sentinel");e:{const p=az(n),g=a&&!l;if(!g&&(!l||l.length===0)&&p.length===0){m=null;break e}let x;e[13]!==c||e[14]!==u||e[15]!==s.status||e[16]!==d?(x=s.status==="in_review"&&oz(c??[],rz({qa:d,codeReview:u})),e[13]=c,e[14]=u,e[15]=s.status,e[16]=d,e[17]=x):x=e[17];const b=x;let v;e[18]!==h||e[19]!==o?(v=()=>h.mutate(void 0,{onSuccess:j=>j?.merged?me.success(o("taskBoard.taskDialog.shipSuccess")):me.error(o("taskBoard.taskDialog.shipError")),onError:()=>me.error(o("taskBoard.taskDialog.shipError"))}),e[18]=h,e[19]=o,e[20]=v):v=e[20];const y=v;let _;e[21]!==s.threads||e[22]!==i?(_=i?s.threads.find(Ez):void 0,e[21]=s.threads,e[22]=i,e[23]=_):_=e[23];const L=_;let w;e[24]!==o?(w=o("taskBoard.taskDialog.linksLabel"),e[24]=o,e[25]=w):w=e[25];let S;e[26]!==w?(S=r.jsx("span",{className:"mb-1 text-xs font-medium text-muted-foreground",children:w}),e[26]=w,e[27]=S):S=e[27];let k;e[28]!==g||e[29]!==i||e[30]!==y||e[31]!==L||e[32]!==h||e[33]!==l||e[34]!==b?(k=g?r.jsx(Nz,{}):(l??[]).map(j=>r.jsx(jz,{pr:j,previewThread:L,reviewsReady:b,shipPending:h.isPending,onShip:y,onOpenThread:i},j.url)),e[28]=g,e[29]=i,e[30]=y,e[31]=L,e[32]=h,e[33]=l,e[34]=b,e[35]=k):k=e[35],f=r.jsxs("div",{className:"flex flex-col gap-1 pb-2",children:[S,k,p.map(Tz)]})}e[0]=c,e[1]=u,e[2]=n,e[3]=s.status,e[4]=s.threads,e[5]=i,e[6]=h,e[7]=l,e[8]=a,e[9]=d,e[10]=o,e[11]=f,e[12]=m}else f=e[11],m=e[12];return m!==Symbol.for("react.early_return_sentinel")?m:f}function Tz(t){return r.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"group flex items-center gap-2 rounded-md px-1 py-1.5 transition-colors hover:bg-muted",children:[r.jsx(kn,{size:15,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.label}),r.jsx(hn,{size:13,className:"shrink-0 text-muted-foreground/50 group-hover:text-foreground"})]},t.url)}function Ez(t){return t.hasPreview&&t.virtualMcpId}function Az(t){const e=z.c(6),{item:s,members:n,startedBy:i,onOpenThread:o}=t,l=se(),{data:a}=j6(s.id),{data:c}=Ui.useSession(),d=new Map(n.map(Mz)),u={id:c?.user?.id??"me",name:c?.user?.name??l("taskBoard.taskDialog.commentYouLabel"),image:c?.user?.image},h=pz(s.id),f=y=>{if(y===cs)return{id:y,name:l("taskBoard.taskDialog.superAgentLabel"),isAgent:!0};if(y===u.id)return u;const _=d.get(y);return{id:y,name:_?.user?.name??y,image:_?.user?.image}},m=h.threads.map(y=>({id:y.id,author:f(y.authorId),body:y.body,createdAt:y.createdAt,resolved:y.resolved,replies:y.replies.map(_=>({id:_.id,author:f(_.authorId),body:_.body,createdAt:_.createdAt,replies:[]}))})),p=[...(a??[]).map(Iz),...s.threads.map(Dz),...m.map(Rz)].sort(Pz),g=[];for(const y of p){if(y.kind==="thread"){g.push({type:"thread",thread:y.thread});continue}if(y.kind==="comment"){g.push({type:"comment",comment:y.comment});continue}const _=g[g.length-1];_?.type==="timeline"?_.items.push(y.activity):g.push({type:"timeline",items:[y.activity]})}let x;e[0]!==l?(x=l("taskBoard.taskDialog.activityLabel"),e[0]=l,e[1]=x):x=e[1];let b;e[2]!==x?(b=r.jsx("span",{className:"text-sm font-medium text-foreground",children:x}),e[2]=x,e[3]=b):b=e[3];let v;return e[4]!==h.post?(v=y=>h.post.mutate({body:y}),e[4]=h.post,e[5]=v):v=e[5],r.jsxs("div",{className:"flex flex-col gap-5 pb-2",children:[b,g.map((y,_)=>y.type==="timeline"?r.jsx(Oz,{items:y.items,memberByUserId:d},`timeline-${_}`):y.type==="comment"?r.jsx(cz,{thread:y.comment,me:u,onReply:L=>h.post.mutate({body:L,parentId:y.comment.id}),onDelete:L=>h.remove.mutate(L),onToggleResolved:()=>h.setResolved.mutate({id:y.comment.id,resolved:!y.comment.resolved})},`comment-${y.comment.id}`):r.jsx(_z,{thread:y.thread,startedBy:i,onOpen:o},`thread-${y.thread.threadId}`)),r.jsx(hz,{me:u,onSubmit:v})]})}function Pz(t,e){return t.at-e.at}function Rz(t){return{kind:"comment",at:new Date(t.createdAt).getTime(),comment:t}}function Dz(t){return{kind:"thread",at:new Date(t.createdAt).getTime(),thread:t}}function Iz(t){return{kind:"activity",at:new Date(t.occurredAt).getTime(),activity:t}}function Mz(t){return[t.userId,t]}function ro(t){const e=z.c(7),{icon:s,label:n}=t;let i;e[0]!==s?(i=r.jsx("span",{className:"ml-1 mr-1 inline-flex h-[1lh] items-center align-top",children:s}),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=r.jsx("span",{className:"mr-1",children:n}),e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==o?(l=r.jsxs(r.Fragment,{children:[i,o]}),e[4]=i,e[5]=o,e[6]=l):l=e[6],l}const Ku="\0";function Od(t){return`${Ku}${t}${Ku}`}function dl(t,e){return t.split(new RegExp(`${Ku}(\\w+)${Ku}`)).map((s,n)=>r.jsx(V.Fragment,{children:n%2===0?s:e[s]},n))}function xa(t,e){return e(t==="code_review"?"taskBoard.taskDialog.codeReviewerLabel":"taskBoard.taskDialog.qaAgentLabel")}function $z(t,e,s){const n=f=>{const m=typeof f=="string"?En[f]:void 0;if(!m)return String(f??"");const p=m.icon;return r.jsx(ro,{icon:r.jsx(p,{size:14,className:m.iconClassName}),label:e(m.labelKey)})},i=f=>{const m=typeof f=="string"?Pn[f]:void 0;return m?r.jsx(ro,{icon:r.jsx("span",{className:ie("size-2 rounded-full",m.dotClassName)}),label:e(m.labelKey)}):String(f??"")},o=f=>{const m=Zh(typeof f=="string"?f:null);return m?r.jsx(ro,{icon:r.jsx(ar,{size:14,className:"text-muted-foreground"}),label:V6.format(m)}):""},l=f=>!Array.isArray(f)||f.length===0?null:f.map((m,p)=>{const g=m;return r.jsx(ro,{icon:r.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:cd(g.color)}}),label:g.name??""},g.id??p)}),a=f=>{if(f===cs)return r.jsx(ro,{icon:r.jsx(Dn,{size:14}),label:e("taskBoard.taskDialog.superAgentLabel")});const m=typeof f=="string"?s.get(f):void 0;return r.jsx(ro,{icon:r.jsx(Us,{url:m?.user?.image??void 0,fallback:Rn(m?.user?.name),shape:"circle",size:"2xs"}),label:m?.user?.name??e("taskBoard.taskDialog.someoneLabel")})},c=f=>r.jsx(ro,{icon:f==="code_review"?r.jsx(zm,{size:14}):r.jsx(Bm,{size:14}),label:xa(f,e)}),d=t.data,u=Od("from"),h=Od("to");switch(t.action){case"created":return e("taskBoard.taskDialog.activityCreated");case"status_changed":return dl(d.from?e("taskBoard.taskDialog.activityMovedFromTo",{from:u,to:h}):e("taskBoard.taskDialog.activityMovedTo",{to:h}),{from:n(d.from),to:n(d.to)});case"assignee_changed":return d.to==null?e("taskBoard.taskDialog.activityUnassigned"):dl(e(d.to===cs?"taskBoard.taskDialog.activityDelegated":"taskBoard.taskDialog.activityAssigned",{name:Od("name")}),{name:a(d.to)});case"priority_changed":return d.to==="none"?e("taskBoard.taskDialog.activityPriorityCleared"):dl(!d.from||d.from==="none"?e("taskBoard.taskDialog.activityPrioritySet",{to:h}):e("taskBoard.taskDialog.activityPriorityFromTo",{from:u,to:h}),{from:i(d.from),to:i(d.to)});case"due_date_changed":return d.to==null?e("taskBoard.taskDialog.activityDueDateCleared"):dl(d.from==null?e("taskBoard.taskDialog.activityDueDateSet",{to:h}):e("taskBoard.taskDialog.activityDueDateFromTo",{from:u,to:h}),{from:o(d.from),to:o(d.to)});case"title_changed":return e("taskBoard.taskDialog.activityRenamed",{to:String(d.to??"")});case"description_changed":return e("taskBoard.taskDialog.activityDescriptionUpdated");case"tags_changed":return!Array.isArray(d.to)||d.to.length===0?e("taskBoard.taskDialog.activityTagsCleared"):dl(e("taskBoard.taskDialog.activityTagsSet",{to:h}),{to:l(d.to)});case"review_requested":return dl(e("taskBoard.taskDialog.activityDelegated",{name:Od("name")}),{name:c(d.reviewer)});case"review_approved":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewApprovedWithNotes",{reviewer:xa(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewApproved",{reviewer:xa(d.reviewer,e)});case"review_changes_requested":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewChangesRequestedWithNotes",{reviewer:xa(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewChangesRequested",{reviewer:xa(d.reviewer,e)});case"merge_conflict_resolution":return e("taskBoard.taskDialog.activityMergeConflictResolution");default:{const f=t.action;return String(f)}}}function Hg(t){return!t||t===cs}function Oz(t){const e=z.c(21),{items:s,memberByUserId:n}=t,i=se();let o;e[0]!==n||e[1]!==i?(o=f=>Hg(f)?i("taskBoard.taskDialog.superAgentLabel"):n.get(f)?.user?.name??i("taskBoard.taskDialog.someoneLabel"),e[0]=n,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]!==n?(a=f=>{if(Hg(f))return r.jsx("span",{className:"z-10 flex size-4 shrink-0 items-center justify-center bg-background",children:r.jsx(Dn,{size:16})});const m=n.get(f);return r.jsx("span",{className:"z-10 shrink-0 rounded-full bg-background",children:r.jsx(Us,{url:m?.user?.image??void 0,fallback:Rn(m?.user?.name),shape:"circle",size:"2xs"})})},e[3]=n,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.length?(d=s.length>1&&r.jsx("span",{"aria-hidden":!0,className:"absolute bottom-3 left-2 top-3 w-px bg-border"}),e[5]=s.length,e[6]=d):d=e[6];let u;if(e[7]!==c||e[8]!==l||e[9]!==s||e[10]!==n||e[11]!==i){let f;e[13]!==c||e[14]!==l||e[15]!==n||e[16]!==i?(f=m=>r.jsxs("div",{className:"relative flex items-center gap-2.5",children:[c(m.actorId),r.jsxs("span",{className:"min-w-0 truncate text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:l(m.actorId)})," ",$z(m,i,n),r.jsxs("span",{className:"text-muted-foreground/60",children:[" · ",Jc(new Date(m.occurredAt))]})]})]},m.id),e[13]=c,e[14]=l,e[15]=n,e[16]=i,e[17]=f):f=e[17],u=s.map(f),e[7]=c,e[8]=l,e[9]=s,e[10]=n,e[11]=i,e[12]=u}else u=e[12];let h;return e[18]!==d||e[19]!==u?(h=r.jsxs("div",{className:"relative flex flex-col gap-4",children:[d,u]}),e[18]=d,e[19]=u,e[20]=h):h=e[20],h}const Bz=[{id:"all",labelKey:"home.homeTasks.tabAll"},{id:"in_progress",labelKey:"home.homeTasks.tabInProgress"},{id:"in_review",labelKey:"home.homeTasks.tabInReview"},{id:"done",labelKey:"home.homeTasks.tabDone"}],zz=4;function Fz(t){const e=z.c(64),{task:s,assignee:n,onOpen:i}=t,o=En[s.status],l=o.icon,a=Pn[s.priority];let c,d,u,h,f,m,p,g,x,b,v,y,_,L;if(e[0]!==l||e[1]!==n?.user?.email||e[2]!==n?.user?.image||e[3]!==n?.user?.name||e[4]!==i||e[5]!==o.iconClassName||e[6]!==s.dueDate||e[7]!==s.title||e[8]!==s.updatedAt){const P=n?.user?.name??n?.user?.email?.split("@")[0]??null;let R;e[23]!==s.updatedAt?(R=Jc(new Date(s.updatedAt)),e[23]=s.updatedAt,e[24]=R):R=e[24],L=R;let E;e[25]!==s.dueDate?(E=s.dueDate?{label:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(s.dueDate)),overdue:new Date(s.dueDate).getTime()<Date.now()}:null,e[25]=s.dueDate,e[26]=E):E=e[26],d=E,v="button",y=i,_="flex w-full items-center gap-3 rounded-2xl bg-card px-4 py-3.5 text-left card-shadow transition-colors hover:bg-accent/60";let M;e[27]!==o.iconClassName?(M=ie("size-4 shrink-0",o.iconClassName),e[27]=o.iconClassName,e[28]=M):M=e[28],e[29]!==l||e[30]!==M?(h=r.jsx(l,{className:M}),e[29]=l,e[30]=M,e[31]=h):h=e[31],e[32]!==s.title?(f=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),e[32]=s.title,e[33]=f):f=e[33],b="flex shrink-0 items-center gap-3 text-xs text-muted-foreground",x="hidden @2xl:inline-flex",c=Us,u="circle",m="2xs",p=n?.user?.image??void 0,g=(P??"?").slice(0,2).toUpperCase(),e[0]=l,e[1]=n?.user?.email,e[2]=n?.user?.image,e[3]=n?.user?.name,e[4]=i,e[5]=o.iconClassName,e[6]=s.dueDate,e[7]=s.title,e[8]=s.updatedAt,e[9]=c,e[10]=d,e[11]=u,e[12]=h,e[13]=f,e[14]=m,e[15]=p,e[16]=g,e[17]=x,e[18]=b,e[19]=v,e[20]=y,e[21]=_,e[22]=L}else c=e[9],d=e[10],u=e[11],h=e[12],f=e[13],m=e[14],p=e[15],g=e[16],x=e[17],b=e[18],v=e[19],y=e[20],_=e[21],L=e[22];let w;e[34]!==c||e[35]!==u||e[36]!==m||e[37]!==p||e[38]!==g?(w=r.jsx(c,{shape:u,size:m,url:p,fallback:g}),e[34]=c,e[35]=u,e[36]=m,e[37]=p,e[38]=g,e[39]=w):w=e[39];let S;e[40]!==w||e[41]!==x?(S=r.jsx("span",{className:x,children:w}),e[40]=w,e[41]=x,e[42]=S):S=e[42];let k;e[43]!==a.flagClassName?(k=ie("size-3.5 shrink-0",a.flagClassName),e[43]=a.flagClassName,e[44]=k):k=e[44];let j;e[45]!==k?(j=r.jsx(S0,{className:k}),e[45]=k,e[46]=j):j=e[46];let T;e[47]!==d?(T=d&&r.jsxs("span",{className:ie("hidden items-center gap-1 @xl:inline-flex",d.overdue?"text-red-600":""),children:[r.jsx(ar,{className:"size-3"}),d.label]}),e[47]=d,e[48]=T):T=e[48];let N;e[49]!==L?(N=r.jsx("span",{className:"hidden @xl:inline",children:L}),e[49]=L,e[50]=N):N=e[50];let C;e[51]!==S||e[52]!==j||e[53]!==T||e[54]!==N||e[55]!==b?(C=r.jsxs("div",{className:b,children:[S,j,T,N]}),e[51]=S,e[52]=j,e[53]=T,e[54]=N,e[55]=b,e[56]=C):C=e[56];let A;return e[57]!==h||e[58]!==f||e[59]!==C||e[60]!==v||e[61]!==y||e[62]!==_?(A=r.jsxs("button",{type:v,onClick:y,className:_,children:[h,f,C]}),e[57]=h,e[58]=f,e[59]=C,e[60]=v,e[61]=y,e[62]=_,e[63]=A):A=e[63],A}function Uz(t,e){const s=t.filter(u=>u.status!=="done");if(s.length===0)return"";const n=s.filter(u=>u.status==="in_progress").length,i=s.filter(u=>u.status==="in_review").length,o=s.filter(u=>u.priority==="urgent"||u.priority==="high").length,l=s.filter(u=>u.dueDate&&new Date(u.dueDate).getTime()<Date.now()).length,a=[];n>0&&a.push(e("home.homeTasks.breakdownInProgress",{count:n})),i>0&&a.push(e("home.homeTasks.breakdownNeedsReview",{count:i}));let c=e("home.homeTasks.summaryLead",{count:s.length});a.length>0&&(c+=` — ${a.join(", ")}`),c+=".";const d=[];return o>0&&d.push(e("home.homeTasks.noteHighPriority",{count:o})),l>0&&d.push(e("home.homeTasks.noteOverdue",{count:l})),d.length>0?`${c} ${d.join(" ")}`:c}function Kz(t){const e=z.c(49),{afterSummary:s}=t,n=se(),i=It(),{items:o,error:l}=e6(),a=t6(),{data:c}=j0();let d;if(e[0]!==c?.data?.members){const T=c?.data?.members??[];d=new Map(T.map(qz)),e[0]=c?.data?.members,e[1]=d}else d=e[1];const u=d,[h,f]=V.useState("all"),[m,p]=V.useState(!1);let g,x,b,v,y,_;if(e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==u||e[6]!==i||e[7]!==n||e[8]!==h){const T=l?[]:o,N=[...T].sort(Wz);let C;e[15]!==n?(C=(B,F)=>n(B,F),e[15]=n,e[16]=C):C=e[16];const A=Uz(T,C),P=h==="all"?N:N.filter(B=>B.status===h);let R;e[17]!==i?(R=()=>i({to:".",search:Hz}),e[17]=i,e[18]=R):R=e[18];const E=R;v="flex flex-col gap-10";let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(Dn,{size:24,className:"mt-0.5"}),e[19]=M):M=e[19],y=r.jsxs("div",{className:"flex items-start gap-4 animate-in fade-in slide-in-from-top-1 duration-300",children:[M,r.jsx("p",{className:"max-w-3xl text-lg font-medium leading-snug text-foreground",children:A})]}),_=s,g="flex flex-col gap-4";let I;e[20]!==n?(I=n("home.homeTasks.tasksHeading"),e[20]=n,e[21]=I):I=e[21];let $;e[22]!==I?($=r.jsx("h2",{className:"text-base font-medium text-foreground",children:I}),e[22]=I,e[23]=$):$=e[23];let O;e[24]!==n||e[25]!==h?(O=Bz.map(B=>r.jsx("button",{type:"button",onClick:()=>f(B.id),className:ie("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",h===B.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:n(B.labelKey)},B.id)),e[24]=n,e[25]=h,e[26]=O):O=e[26];let D;e[27]!==O?(D=r.jsx("div",{className:"flex items-center gap-1",children:O}),e[27]=O,e[28]=D):D=e[28],e[29]!==$||e[30]!==D?(x=r.jsxs("div",{className:"flex items-center gap-3",children:[$,D]}),e[29]=$,e[30]=D,e[31]=x):x=e[31],b=P.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl bg-card px-4 py-10 text-center card-shadow",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:h==="all"?n("home.homeTasks.emptyStateNoTasks"):n("home.homeTasks.emptyStateNothing",{status:n(h==="in_progress"?"home.homeTasks.statusInProgress":h==="in_review"?"home.homeTasks.statusInReview":"home.homeTasks.statusDone")})}),h==="all"&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>p(!0),className:"gap-2",children:[r.jsx(Nt,{className:"size-4"}),n("home.homeTasks.createNewTask")]})]}):r.jsxs("div",{className:"flex flex-col gap-2",children:[P.slice(0,zz).map(B=>r.jsx(Fz,{task:B,assignee:B.assigneeId?u.get(B.assigneeId):void 0,onOpen:E},B.id)),r.jsxs("button",{type:"button",onClick:E,className:"flex w-full items-center justify-center gap-1.5 rounded-2xl bg-card px-4 py-3 text-sm font-medium text-muted-foreground card-shadow transition-colors hover:bg-accent/60 hover:text-foreground",children:[n("home.homeTasks.seeAllTasks"),r.jsx(O5,{className:"size-3.5"})]})]}),e[2]=s,e[3]=l,e[4]=o,e[5]=u,e[6]=i,e[7]=n,e[8]=h,e[9]=g,e[10]=x,e[11]=b,e[12]=v,e[13]=y,e[14]=_}else g=e[9],x=e[10],b=e[11],v=e[12],y=e[13],_=e[14];let L;e[32]!==g||e[33]!==x||e[34]!==b?(L=r.jsxs("section",{className:g,children:[x,b]}),e[32]=g,e[33]=x,e[34]=b,e[35]=L):L=e[35];let w;e[36]===Symbol.for("react.memo_cache_sentinel")?(w=()=>p(!1),e[36]=w):w=e[36];let S;e[37]!==a.create?(S=T=>{a.create.mutate(T),p(!1)},e[37]=a.create,e[38]=S):S=e[38];let k;e[39]!==a.create.isPending||e[40]!==m||e[41]!==S?(k=r.jsx(T6,{open:m,onClose:w,isSaving:a.create.isPending,onSubmit:S}),e[39]=a.create.isPending,e[40]=m,e[41]=S,e[42]=k):k=e[42];let j;return e[43]!==k||e[44]!==v||e[45]!==y||e[46]!==_||e[47]!==L?(j=r.jsxs("div",{className:v,children:[y,_,L,k]}),e[43]=k,e[44]=v,e[45]=y,e[46]=_,e[47]=L,e[48]=j):j=e[48],j}function Hz(t){return{...t,main:"board"}}function Wz(t,e){return(e.updatedAt??"").localeCompare(t.updatedAt??"")}function qz(t){return[t.userId,t]}function Gz(t){const e=z.c(29),{isEditMode:s,hasChanges:n,onEnter:i,onSave:o,onCancel:l,onAddTile:a}=t,c=se();if(!s){let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(d5,{size:14}),e[0]=_):_=e[0];let L;e[1]!==c?(L=c("home.customizeToolbar.label"),e[1]=c,e[2]=L):L=e[2];let w;return e[3]!==i||e[4]!==L?(w=r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:i,className:"h-8 gap-1.5 text-muted-foreground",children:[_,L]}),e[3]=i,e[4]=L,e[5]=w):w=e[5],w}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Nt,{size:14}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("home.customizeToolbar.addTile"),e[7]=c,e[8]=u):u=e[8];let h;e[9]!==a||e[10]!==u?(h=r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:a,className:"h-8 gap-1.5",children:[d,u]}),e[9]=a,e[10]=u,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(hs,{size:14}),e[12]=f):f=e[12];let m;e[13]!==c?(m=c("home.customizeToolbar.cancel"),e[13]=c,e[14]=m):m=e[14];let p;e[15]!==l||e[16]!==m?(p=r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:l,className:"h-8 gap-1.5",children:[f,m]}),e[15]=l,e[16]=m,e[17]=p):p=e[17];const g=!n;let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Ut,{size:14}),e[18]=x):x=e[18];let b;e[19]!==c?(b=c("home.customizeToolbar.save"),e[19]=c,e[20]=b):b=e[20];let v;e[21]!==o||e[22]!==g||e[23]!==b?(v=r.jsxs(ae,{type:"button",size:"sm",onClick:o,disabled:g,className:"h-8 gap-1.5",children:[x,b]}),e[21]=o,e[22]=g,e[23]=b,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==h||e[27]!==p?(y=r.jsxs("div",{className:"flex items-center gap-1",children:[h,p,v]}),e[25]=v,e[26]=h,e[27]=p,e[28]=y):y=e[28],y}function Yz(){const t=z.c(18),{isEditMode:e,enter:s,save:n,cancel:i,hasChanges:o}=km(),[l,a]=V.useState(!1),c=Wc();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Kz,{afterSummary:r.jsx(MD,{})}),t[0]=d):d=t[0];let u;t[1]!==i||t[2]!==s||t[3]!==o||t[4]!==e||t[5]!==c||t[6]!==n?(u=!c&&r.jsx("div",{className:"flex justify-end",children:r.jsx(Gz,{isEditMode:e,hasChanges:o,onEnter:s,onSave:n,onCancel:i,onAddTile:()=>a(!0)})}),t[1]=i,t[2]=s,t[3]=o,t[4]=e,t[5]=c,t[6]=n,t[7]=u):u=t[7];let h;t[8]!==e?(h=r.jsx(h$,{isEditMode:e}),t[8]=e,t[9]=h):h=t[9];let f;t[10]!==u||t[11]!==h?(f=r.jsxs("div",{className:"@container mx-auto flex max-w-5xl flex-col gap-10 px-6 py-8",children:[d,r.jsxs("div",{className:"flex flex-col gap-4",children:[u,h]})]}),t[10]=u,t[11]=h,t[12]=f):f=t[12];let m;t[13]!==l?(m=r.jsx(O$,{open:l,onOpenChange:a}),t[13]=l,t[14]=m):m=t[14];let p;return t[15]!==f||t[16]!==m?(p=r.jsxs("div",{className:"h-full overflow-y-auto",children:[f,m]}),t[15]=f,t[16]=m,t[17]=p):p=t[17],p}function Qz(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(TD,{children:r.jsx(Yz,{})}),t[0]=e):e=t[0],e}const A6="https://decoims.com/image?src=decocms%2F7263a67f-fb83-410b-a5f2-e54e87deaaac%2Freport-kanban.png&quality=original&fit=cover",Xz=["taskBoard.backlogPaywall.benefitPrioritizedTasks","taskBoard.backlogPaywall.benefitRecurringReport","taskBoard.backlogPaywall.benefitAgentResolves"],Wg={price:"R$ 99",anchor:"R$ 499"};function Jz(t){const e=z.c(21),{onOpen:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-success/10",children:r.jsx(Jr,{size:16,className:"text-success"})}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("taskBoard.backlogPaywall.bannerTitle"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("span",{className:"text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=l):l=e[4];let a;e[5]!==n?(a=n("taskBoard.backlogPaywall.bannerSubtitle"),e[5]=n,e[6]=a):a=e[6];let c;e[7]!==a?(c=r.jsx("span",{className:"text-sm text-muted-foreground",children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[i,r.jsxs("div",{className:"flex min-w-0 flex-col",children:[l,c]})]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==n?(u=n("taskBoard.backlogPaywall.unlockButton"),e[12]=n,e[13]=u):u=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Zr,{size:16}),e[14]=h):h=e[14];let f;e[15]!==s||e[16]!==u?(f=r.jsxs(ae,{size:"sm",onClick:s,className:"w-full gap-2 sm:w-auto sm:shrink-0",children:[u,h]}),e[15]=s,e[16]=u,e[17]=f):f=e[17];let m;return e[18]!==d||e[19]!==f?(m=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-4 card-shadow sm:flex-row sm:items-center sm:gap-4",children:[d,f]}),e[18]=d,e[19]=f,e[20]=m):m=e[20],m}function Zz({open:t,onOpenChange:e,cdClient:s,onExpired:n}){const i=se(),[o,l]=V.useState(!1),a=async()=>{if(!s){n();return}l(!0);try{const c=await s.callTool({name:"start_checkout",arguments:{}}),{url:d}=Sh(c);if(new URL(d).protocol!=="https:")throw new Error("unsafe checkout url");window.open(d,"_blank","noopener,noreferrer"),e(!1)}catch{n()}finally{l(!1)}};return r.jsx(Ct,{open:t,onOpenChange:e,children:r.jsxs(jt,{className:"gap-0 p-3 sm:max-w-[500px]",closeButtonClassName:"z-10 rounded-full bg-background/70 p-1 text-foreground backdrop-blur transition-colors hover:bg-background",children:[r.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:r.jsx("img",{src:A6,alt:i("taskBoard.backlogPaywall.previewAlt"),className:"h-[208px] w-full object-cover object-left-top"})}),r.jsxs("div",{className:"flex flex-col gap-7 px-3 pb-3 pt-7",children:[r.jsxs("div",{className:"flex flex-col gap-5",children:[r.jsx(At,{className:"text-xl font-semibold text-foreground",children:i("taskBoard.backlogPaywall.modalTitle")}),r.jsx("ul",{className:"flex flex-col gap-3.5",children:Xz.map(c=>r.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[r.jsx(Gn,{size:18,className:"mt-0.5 shrink-0 text-success","aria-hidden":!0}),r.jsx("span",{className:"leading-snug text-foreground",children:i(c)})]},c))})]}),r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsx("span",{className:"text-2xl font-semibold text-foreground",children:Wg.price}),r.jsx("span",{className:"text-sm text-muted-foreground line-through",children:Wg.anchor})]}),r.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[r.jsx(ae,{variant:"ghost",onClick:()=>e(!1),disabled:o,className:"order-2 w-full sm:order-none sm:w-auto",children:i("taskBoard.backlogPaywall.exploreButton")}),r.jsxs(ae,{onClick:a,disabled:o,className:"order-1 w-full gap-2 sm:order-none sm:w-auto",children:[o?r.jsx(it,{size:16,className:"animate-spin"}):null,i("taskBoard.backlogPaywall.unlockButton"),!o&&r.jsx(Zr,{size:16})]})]})]})]})]})})}function F9(t){return`board-paywall-seen:${t}`}function eF(){const t=z.c(26),{org:e}=Me(),s=It(),{diagnostic:n,cdClient:i,connectionId:o}=iy();let l;t[0]!==e.id?(l=()=>({orgId:e.id,open:!sessionStorage.getItem(F9(e.id))}),t[0]=e.id,t[1]=l):l=t[1];const[a,c]=V.useState(l);let d;t[2]!==a.open||t[3]!==a.orgId||t[4]!==e.id?(d=a.orgId===e.id?a.open:!sessionStorage.getItem(F9(e.id)),t[2]=a.open,t[3]=a.orgId,t[4]=e.id,t[5]=d):d=t[5];const u=d;if(!n?.locked)return null;let h;t[6]!==e.id?(h=_=>c({orgId:e.id,open:_}),t[6]=e.id,t[7]=h):h=t[7];const f=h;let m;t[8]!==e.id||t[9]!==f?(m=_=>{f(_),_||sessionStorage.setItem(F9(e.id),"1")},t[8]=e.id,t[9]=f,t[10]=m):m=t[10];const p=m;let g;t[11]!==o||t[12]!==s||t[13]!==e?(g=()=>{Je("board_paywall_report_opened",{organization_id:e.id}),s(ry(e,o))},t[11]=o,t[12]=s,t[13]=e,t[14]=g):g=t[14];const x=g;let b;t[15]!==e.id||t[16]!==f?(b=r.jsx(Jz,{onOpen:()=>{Je("board_paywall_banner_clicked",{organization_id:e.id}),f(!0)}}),t[15]=e.id,t[16]=f,t[17]=b):b=t[17];let v;t[18]!==i||t[19]!==p||t[20]!==u||t[21]!==x?(v=r.jsx(Zz,{open:u,onOpenChange:p,cdClient:i,onExpired:x}),t[18]=i,t[19]=p,t[20]=u,t[21]=x,t[22]=v):v=t[22];let y;return t[23]!==b||t[24]!==v?(y=r.jsxs(r.Fragment,{children:[b,v]}),t[23]=b,t[24]=v,t[25]=y):y=t[25],y}function tF(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Fs,{fallback:null,children:r.jsx(eF,{})}),t[0]=e):e=t[0],e}const sF=["taskBoard.subscriptionPaywall.trialBenefitMonitoring","taskBoard.subscriptionPaywall.trialBenefitAutoFix","taskBoard.subscriptionPaywall.trialBenefitRuns"];function nF(t){const e=z.c(83),{kind:s,onOpenChange:n}=t,i=se(),{mutate:o,isPending:l}=w5("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");if(s==="trial_exhausted"){let _;e[0]!==i?(_=i("taskBoard.subscriptionPaywall.previewAlt"),e[0]=i,e[1]=_):_=e[1];let L;e[2]!==_?(L=r.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:r.jsx("img",{src:A6,alt:_,className:"h-[160px] w-full object-cover object-left-top"})}),e[2]=_,e[3]=L):L=e[3];let w;e[4]!==i?(w=i("taskBoard.subscriptionPaywall.trialTitle"),e[4]=i,e[5]=w):w=e[5];let S;e[6]!==w?(S=r.jsx(At,{className:"text-xl font-semibold text-foreground",children:w}),e[6]=w,e[7]=S):S=e[7];let k;e[8]!==i?(k=sF.map(q=>r.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[r.jsx(Gn,{size:18,className:"mt-0.5 shrink-0 text-success","aria-hidden":!0}),r.jsx("span",{className:"leading-snug text-foreground",children:i(q)})]},q)),e[8]=i,e[9]=k):k=e[9];let j;e[10]!==k?(j=r.jsx("ul",{className:"flex flex-col gap-3",children:k}),e[10]=k,e[11]=j):j=e[11];let T;e[12]!==i?(T=i("taskBoard.subscriptionPaywall.trialPrice"),e[12]=i,e[13]=T):T=e[13];let N;e[14]!==T?(N=r.jsx("span",{className:"text-2xl font-semibold text-foreground",children:T}),e[14]=T,e[15]=N):N=e[15];let C;e[16]!==i?(C=i("taskBoard.subscriptionPaywall.trialPricePeriod"),e[16]=i,e[17]=C):C=e[17];let A;e[18]!==C?(A=r.jsx("span",{className:"text-sm text-muted-foreground",children:C}),e[18]=C,e[19]=A):A=e[19];let P;e[20]!==A||e[21]!==N?(P=r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[N,A]}),e[20]=A,e[21]=N,e[22]=P):P=e[22];let R;e[23]!==n?(R=()=>n(!1),e[23]=n,e[24]=R):R=e[24];let E;e[25]!==i?(E=i("taskBoard.subscriptionPaywall.notNowButton"),e[25]=i,e[26]=E):E=e[26];let M;e[27]!==l||e[28]!==R||e[29]!==E?(M=r.jsx(ae,{variant:"ghost",onClick:R,disabled:l,className:"order-2 w-full sm:order-none sm:w-auto",children:E}),e[27]=l,e[28]=R,e[29]=E,e[30]=M):M=e[30];let I;e[31]!==n||e[32]!==o?(I=()=>o(void 0,{onSuccess:()=>n(!1)}),e[31]=n,e[32]=o,e[33]=I):I=e[33];let $;e[34]!==l?($=l&&r.jsx(it,{size:16,className:"animate-spin"}),e[34]=l,e[35]=$):$=e[35];let O;e[36]!==i?(O=i("taskBoard.subscriptionPaywall.subscribeButton"),e[36]=i,e[37]=O):O=e[37];let D;e[38]!==l||e[39]!==I||e[40]!==$||e[41]!==O?(D=r.jsxs(ae,{disabled:l,onClick:I,className:"order-1 w-full gap-2 sm:order-none sm:w-auto",children:[$,O]}),e[38]=l,e[39]=I,e[40]=$,e[41]=O,e[42]=D):D=e[42];let B;e[43]!==M||e[44]!==D?(B=r.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[M,D]}),e[43]=M,e[44]=D,e[45]=B):B=e[45];let F;e[46]!==P||e[47]!==B?(F=r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[P,B]}),e[46]=P,e[47]=B,e[48]=F):F=e[48];let U;e[49]!==F||e[50]!==S||e[51]!==j?(U=r.jsxs("div",{className:"flex flex-col gap-6 px-3 pb-3 pt-7",children:[S,j,F]}),e[49]=F,e[50]=S,e[51]=j,e[52]=U):U=e[52];let H;e[53]!==L||e[54]!==U?(H=r.jsxs(jt,{className:"gap-0 p-3 sm:max-w-[440px]",closeButtonClassName:"z-10 rounded-full bg-background/70 p-1 text-foreground backdrop-blur transition-colors hover:bg-background",children:[L,U]}),e[53]=L,e[54]=U,e[55]=H):H=e[55];let W;return e[56]!==n||e[57]!==H?(W=r.jsx(Ct,{open:!0,onOpenChange:n,children:H}),e[56]=n,e[57]=H,e[58]=W):W=e[58],W}let a;e[59]!==s||e[60]!==i?(a=s?{monthly_exhausted:{title:i("taskBoard.subscriptionPaywall.monthlyTitle"),description:i("taskBoard.subscriptionPaywall.monthlyDescription")},runs_exhausted:{title:i("taskBoard.subscriptionPaywall.runsTitle"),description:i("taskBoard.subscriptionPaywall.runsDescription")}}[s]:null,e[59]=s,e[60]=i,e[61]=a):a=e[61];const c=a,d=!!s,u=c?.title;let h;e[62]!==u?(h=r.jsx(At,{children:u}),e[62]=u,e[63]=h):h=e[63];const f=c?.description;let m;e[64]!==f?(m=r.jsx(_n,{children:f}),e[64]=f,e[65]=m):m=e[65];let p;e[66]!==h||e[67]!==m?(p=r.jsxs(os,{children:[h,m]}),e[66]=h,e[67]=m,e[68]=p):p=e[68];let g;e[69]!==n?(g=()=>n(!1),e[69]=n,e[70]=g):g=e[70];let x;e[71]!==i?(x=i("taskBoard.subscriptionPaywall.dismissButton"),e[71]=i,e[72]=x):x=e[72];let b;e[73]!==g||e[74]!==x?(b=r.jsx(In,{children:r.jsx(ae,{variant:"ghost",onClick:g,children:x})}),e[73]=g,e[74]=x,e[75]=b):b=e[75];let v;e[76]!==b||e[77]!==p?(v=r.jsxs(jt,{className:"sm:max-w-[440px]",children:[p,b]}),e[76]=b,e[77]=p,e[78]=v):v=e[78];let y;return e[79]!==n||e[80]!==v||e[81]!==d?(y=r.jsx(Ct,{open:d,onOpenChange:n,children:v}),e[79]=n,e[80]=v,e[81]=d,e[82]=y):y=e[82],y}const iF=new Set(["completed","failed","expired"]);function rF(t){return t.threads.some(e=>e.status!==null&&!iF.has(e.status))}function oF(t){const e=z.c(43),{items:s,pending:n,onOpenChange:i,onConfirm:o}=t,l=se(),a=s.length;let c;e[0]!==s?(c=s.some(rF),e[0]=s,e[1]=c):c=e[1];const d=c,u=a>0;let h;e[2]!==a||e[3]!==l?(h=a>1?l("taskBoard.rerun.titleMany",{count:a}):l("taskBoard.rerun.title"),e[2]=a,e[3]=l,e[4]=h):h=e[4];let f;e[5]!==h?(f=r.jsx(At,{children:h}),e[5]=h,e[6]=f):f=e[6];let m;e[7]!==a||e[8]!==l||e[9]!==d?(m=a>1?l("taskBoard.rerun.descriptionMany",{count:a}):l(d?"taskBoard.rerun.descriptionTakeover":"taskBoard.rerun.description"),e[7]=a,e[8]=l,e[9]=d,e[10]=m):m=e[10];let p;e[11]!==m?(p=r.jsx(_n,{children:m}),e[11]=m,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==p?(g=r.jsxs(os,{children:[f,p]}),e[13]=f,e[14]=p,e[15]=g):g=e[15];let x;e[16]!==i?(x=()=>i(!1),e[16]=i,e[17]=x):x=e[17];let b;e[18]!==l?(b=l("taskBoard.rerun.cancel"),e[18]=l,e[19]=b):b=e[19];let v;e[20]!==n||e[21]!==x||e[22]!==b?(v=r.jsx(ae,{variant:"outline",onClick:x,disabled:n,children:b}),e[20]=n,e[21]=x,e[22]=b,e[23]=v):v=e[23];let y;e[24]!==n?(y=n&&r.jsx(it,{className:"size-4 animate-spin"}),e[24]=n,e[25]=y):y=e[25];let _;e[26]!==l?(_=l("taskBoard.rerun.confirm"),e[26]=l,e[27]=_):_=e[27];let L;e[28]!==o||e[29]!==n||e[30]!==y||e[31]!==_?(L=r.jsxs(ae,{onClick:o,disabled:n,children:[y,_]}),e[28]=o,e[29]=n,e[30]=y,e[31]=_,e[32]=L):L=e[32];let w;e[33]!==v||e[34]!==L?(w=r.jsxs(In,{children:[v,L]}),e[33]=v,e[34]=L,e[35]=w):w=e[35];let S;e[36]!==w||e[37]!==g?(S=r.jsxs(jt,{className:"max-w-md",children:[g,w]}),e[36]=w,e[37]=g,e[38]=S):S=e[38];let k;return e[39]!==i||e[40]!==S||e[41]!==u?(k=r.jsx(Ct,{open:u,onOpenChange:i,children:S}),e[39]=i,e[40]=S,e[41]=u,e[42]=k):k=e[42],k}const qg=380,lF=90,Gg=5,aF="cubic-bezier(0.22, 0.61, 0.36, 1)";function cF(t,e,s){const n=V.useRef(new Map),i=V.useRef(new Map);V.useLayoutEffect(()=>{const o=t.current;if(!o)return;const l=o.querySelectorAll("[data-flip-id]"),a=new Map,c=n.current;n.current=a;const d=typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,u=[];for(const b of l){const v=b.dataset.flipId;if(!v)continue;const y=b.getBoundingClientRect(),_=b.dataset.flipLane;if(a.set(v,{rect:y,lane:_}),!s)continue;const L=c.get(v);if(!L)continue;const w=L.rect.left-y.left,S=L.rect.top-y.top;(w||S)&&u.push({el:b,dx:w,dy:S,lane:L.lane!==_})}if(!s||d||u.length===0)return;const h=i.current,f=b=>{b instanceof HTMLElement&&(h.set(b,(h.get(b)??0)+1),b.style.overflow="visible")},m=b=>{if(!(b instanceof HTMLElement))return;const v=(h.get(b)??1)-1;if(v>0){h.set(b,v);return}h.delete(b),b.style.overflow=""};for(const b of u){const v=b.lane?` rotate(${b.dx>0?Gg:-Gg}deg)`:"";b.el.style.transition="none",b.el.style.transform=`translate(${b.dx}px, ${b.dy}px)${v}`,b.lane&&(b.el.style.zIndex="10",f(b.el.closest("[data-lane-scroll]")))}let p=0;const g=[],x=requestAnimationFrame(()=>{for(const b of u){const v=b.lane?p++*lF:0;b.el.style.transition=`transform ${qg}ms ${aF} ${v}ms`,b.el.style.transform="",g.push(window.setTimeout(()=>{b.el.style.transition="",b.el.style.transform="",b.el.style.zIndex="",b.lane&&m(b.el.closest("[data-lane-scroll]"))},qg+v+30))}});return()=>{cancelAnimationFrame(x);for(const b of g)clearTimeout(b);for(const b of u)b.el.style.transition="",b.el.style.transform="",b.el.style.zIndex="",b.lane&&m(b.el.closest("[data-lane-scroll]"))}},[e,t,s])}function dF(t,e=[]){const s=[[`# Task: ${t.title}`,t.description?.trim()].filter(Boolean).join(`
|
|
85
85
|
|
|
86
86
|
`)];if(e.length>0){const n=e.map(i=>{const o=i.merged?"merged":i.state??(i.draft?"draft":"open"),l=i.title?.trim()||`${i.repoOwner}/${i.repoName}`;return`- #${i.number} ${l} [${o}] ${i.url}`});s.push(["## Linked pull requests",...n].join(`
|
|
87
87
|
`))}if(t.threads.length>0){const n=t.threads.map(i=>{const o=i.title?.trim()||"Untitled chat";return i.status?`- ${o} [${i.status}]`:`- ${o}`});s.push(["## Other chats on this task",...n].join(`
|
|
@@ -528,8 +528,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
528
528
|
8% { opacity: 1; }
|
|
529
529
|
22% { opacity: 0; }
|
|
530
530
|
}
|
|
531
|
-
`}),e[26]=_):_=e[26];let L;return e[27]!==y||e[28]!==u?(L=r.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:[u,y,_]}),e[27]=y,e[28]=u,e[29]=L):L=e[29],L}function Fd(t){const e=z.c(10),{phase:s,current:n,children:i}=t,o=s-n,l=o<0,a=o===0,c=l?90:o*-22,d=l?.94:1-Math.max(o,0)*.04,u=l?0:a?1:o===1?.8:.55,h=l?10:30-o,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ie("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=r.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 s9(t){const e=z.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,o,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:ie("size-2.5 rounded-full",Un)}),o=r.jsx("div",{className:ie("size-2.5 rounded-full",Un)}),l=r.jsx("div",{className:ie("size-2.5 rounded-full",Un)}),e[0]=i,e[1]=o,e[2]=l):(i=e[0],o=e[1],l=e[2]);let a;e[3]!==n?(a=n&&r.jsx("div",{className:ie("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",yi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,o,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function wH(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"flex flex-1 px-8 py-5",children:r.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:xH.map(SH)})})]}),t[1]=s):s=t[1],s}function SH(t,e){if(e===T8)return r.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 r.jsx("div",{className:ie("relative rounded-md",Un),children:r.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${E8}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function kH(){const t=z.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:ie("w-[18%] rounded-md",yi),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=r.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=r.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 o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[r.jsx("div",{className:ie("rounded-md",yi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),r.jsx("div",{className:ie("rounded-md",yi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function jH(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:r.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:yH.map(CH)})})]}),t[1]=s):s=t[1],s}function CH(t,e){return r.jsx("div",{className:ie("aspect-square rounded-md",_H[e]?"bg-chart-2/70":Un),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function NH(){const t=z.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,o,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=r.jsx("div",{className:ie("h-1.5 w-[70%] rounded-sm",Un)}),i=r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",Un)}),o=r.jsx("div",{className:ie("h-1.5 w-[80%] rounded-sm",Un)}),l=r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",Un)}),t[1]=s,t[2]=n,t[3]=i,t[4]=o,t[5]=l):(s=t[1],n=t[2],i=t[3],o=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=r.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,o,l,r.jsx("div",{className:"mt-auto",children:r.jsx("div",{className:ie("h-4 rounded-md",Un)})})]}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:r.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[r.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",yi)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[r.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),r.jsx("div",{className:ie("h-4 w-10 rounded-full",yi)}),r.jsx("div",{className:ie("h-4 w-14 rounded-full",yi)})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsxs("div",{className:ie("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",yi),children:[r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",Un)}),r.jsx("div",{className:ie("h-1 w-[75%] rounded-sm",Un)})]}),t[9]=u):u=t[9];let h;return t[10]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[u,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[r.jsx("div",{className:ie("rounded-md",yi)}),r.jsx("div",{className:ie("rounded-md",yi)})]})]})]})]})]})]}),t[10]=h):h=t[10],h}function Vl(t){const e=z.c(42),s=se();if(t.kind==="starting"){let f;return e[0]!==t.claimPhase||e[1]!==t.progress?(f=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsx(LH,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=f):f=e[2],f}if(t.kind==="errored"){const f=t.error.code===Ov.githubNotAuthenticated;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Do,{className:"size-12 text-destructive"}),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("h3",{className:"text-lg font-medium",children:d3("errored")}),e[4]=p):p=e[4];let g;e[5]!==f||e[6]!==t.error.message||e[7]!==s?(g=f?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[5]=f,e[6]=t.error.message,e[7]=s,e[8]=g):g=e[8];let x;e[9]!==g?(x=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:g}),e[9]=g,e[10]=x):x=e[10];let b;e[11]!==f||e[12]!==t.connectionsHref||e[13]!==s?(b=f&&t.connectionsHref&&r.jsx(ae,{asChild:!0,children:r.jsx("a",{href:t.connectionsHref,children:s("sandbox.stateCard.reconnectGithub")})}),e[11]=f,e[12]=t.connectionsHref,e[13]=s,e[14]=b):b=e[14];const v=t.onRetry;let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(vn,{className:"size-4"}),e[15]=y):y=e[15];let _;e[16]!==s?(_=s("sandbox.stateCard.retry"),e[16]=s,e[17]=_):_=e[17];let L;e[18]!==t.onRetry||e[19]!==_?(L=r.jsxs(ae,{variant:"outline",onClick:v,children:[y," ",_]}),e[18]=t.onRetry,e[19]=_,e[20]=L):L=e[20];let w;e[21]!==b||e[22]!==L?(w=r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[b,L]}),e[21]=b,e[22]=L,e[23]=w):w=e[23];let S;return e[24]!==x||e[25]!==w?(S=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[m,p,x,w]})}),e[24]=x,e[25]=w,e[26]=S):S=e[26],S}let n;e[27]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(ES,{className:"size-12 text-blue-500"}),e[27]=n):n=e[27];let i;e[28]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("h3",{className:"text-lg font-medium",children:d3("suspended")}),e[28]=i):i=e[28];let o;e[29]!==s?(o=s("sandbox.stateCard.resumeToContinue"),e[29]=s,e[30]=o):o=e[30];let l;e[31]!==o?(l=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:o}),e[31]=o,e[32]=l):l=e[32];const a=t.onResume;let c;e[33]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(So,{className:"size-4"}),e[33]=c):c=e[33];let d;e[34]!==s?(d=s("sandbox.stateCard.resume"),e[34]=s,e[35]=d):d=e[35];let u;e[36]!==t.onResume||e[37]!==d?(u=r.jsxs(ae,{onClick:a,className:"mt-2",children:[c," ",d]}),e[36]=t.onResume,e[37]=d,e[38]=u):u=e[38];let h;return e[39]!==l||e[40]!==u?(h=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,i,l,u]})}),e[39]=l,e[40]=u,e[41]=h):h=e[41],h}function A8(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function VH(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,o]of Object.entries(e.params))typeof o=="string"&&(n[i]=o);return{path:e.path,pageKey:s,params:n}}catch{return null}}function P8(t){try{return VH(localStorage.getItem(t))}catch{return null}}function TH(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function Qu(t,e){const n=e.replace(/\\/g,"/").replace(/^(?!\/)/,"/").split("/").map(i=>encodeURIComponent(i).replace(/%3A/gi,":")).join("/");return`${t}://file${n}?windowId=_blank`}const h3="site-links",EH=/details?page|\bpdp\b/i,AH=/listingpage|\bplp\b/i;function PH(t,e,s){const n=new Set;for(const a of s)EH.test(a)&&n.add("product"),AH.test(a)&&n.add("category");const i=Tu($r(t)),o=i[i.length-1],l=i[i.length-2];return o?.type==="text"&&o.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 RH=["rosa","preto","pink","black"];function Ud(t,e){const s=e.trim();return s?t(s):RH.flatMap(n=>t(n))}function DH(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const o=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:o,count:10}}),n}const R8=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function ap(t){return t.split("/")[0]??""}function IH(t){const e=new Set;for(const s of t){const n=ap(s);R8.has(n)&&e.add(n)}return e}function MH(t,e){const s=ap(t);return!R8.has(s)||e.size===0?!0:e.has(s)}const $H=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>Ud(s=>DH(t,s),e),optionsFromPayload:Kd},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ud(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:Kd},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ud(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:Kd},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ud(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:Kd},{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:HH}];function OH(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of $H){if(d.kind!==a)continue;const u=n.find(h=>d.test(h)&&MH(h,s));u&&c.push({cand:d,resolveType:u})}return c.find(d=>s.has(ap(d.resolveType)))??c[0]},o=(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(o(c.cand,c.resolveType,!1))}return t.size>0&&l.push(BH(t.has("category")?"category":"product")),l}function BH(t){return{kind:t,id:h3,resolveType:h3,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>QH(e,s)}}function fo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function zH(t,e,s){const n=new Set,i=new Set,o=l=>{if(Array.isArray(l)){for(const d of l)o(d);return}const a=fo(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=fo(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),o(e[c])}}for(const d of Object.values(a))o(d)};return o(t),n}function D8(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 I8(t){try{return decodeURIComponent(t)}catch{return t}}function FH(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function UH(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=FH(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function M8(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=Tu($r(e)),{pattern:o,order:l}=UH(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(o);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?I8(d):null}function Kd(t,e){const s=fo(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],o=new Set;for(const l of n){const a=fo(l);if(!a)continue;const c=M8(a.url,e.template,e.paramName);if(!c||o.has(c))continue;o.add(c);const d=fo(a.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,h=Array.isArray(a.image)?fo(a.image[0]):null,f=typeof h?.url=="string"?h.url:void 0;i.push({value:c,label:u,image:f})}return i}function KH(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?I8(s):null}function HH(t){const e=[],s=new Set,n=(i,o)=>{const l=fo(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...o,a]:o,d=KH(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 WH=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 qH(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function GH(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 o=n[1]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:o,text:l})}return e}function YH(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 o,l=0;for(;(o=n.exec(t))!==null&&l++<3e3;){const a=(o[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(o.index,o.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:o[2]??"",image:c||void 0})}return e}function QH(t,e){const s=[],n=new Set,i=(o,l,a,c)=>{if(s.length>=200)return;const d=M8(o,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&WH.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:qH(d),kind:a,image:c}))};for(const{url:o,name:l,image:a}of YH(t))i(o,l,"product",a);for(const{href:o,text:l}of GH(t))o.startsWith("/")&&!o.startsWith("//")&&i(o,l,"category");return s}function va(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(o=>o.label.toLowerCase().includes(n)||o.value.toLowerCase().includes(n)):t).slice(0,s)}const f3=3e4;function $8(t){return`/api/${t.orgSlug}/sandbox/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}/preview-invoke`}function XH(t,e){return`${`/api/${t.orgSlug}/sandbox/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}/preview-fetch`}?path=${encodeURIComponent(e)}`}function JH(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 ZH(t,{resolveType:e,props:s}){let n;try{n=await fetch($8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(f3)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${f3/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let o=null,l=!1;try{o=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&o&&typeof o=="object"&&"error"in o&&typeof o.error=="string"?o.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?o:i}function eW(t){const e=z.c(2);let s;return e[0]!==t?(s={mutationFn:n=>ZH(t,n)},e[0]=t,e[1]=s):s=e[1],Rt(s)}const O8=1e4;function tW(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 sW(t,{resolveType:e,props:s}){const n=await fetch($8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(O8)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function m3(t,e){const s=await fetch(XH(t,e),{signal:AbortSignal.timeout(O8)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function nW(t,e,s){const n=e.optionsFromPayload(await m3(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const o=Pr(s.template,{[s.paramName]:i.value});if(o==="/")return n;try{const l=e.optionsFromPayload(await m3(t,o),s).filter(a=>a.kind==="product");return D8([n,l])}catch{return n}}function iW(t,e,s){return Fe.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function rW(t,e,s,n){if(e.homepageLinks)return nW(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const o=await Promise.allSettled(i.map(a=>sW(t,a))),l=o.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=o.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return D8(l.map(a=>e.optionsFromPayload(a,n)))}function rf(t,e,s,n,i){return{queryKey:iW(t,e,s),queryFn:()=>rW(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function ya(t){const e=z.c(16),{heading:s,iconKind:n,options:i,template:o,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]!==o){let h;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==o?(h=f=>r.jsxs(Jt,{value:`${a}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&r.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?r.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):r.jsx(v1,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:f.label}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Pr(o,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=o,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]=o,e[6]=d}else d=e[6];let u;return e[13]!==s||e[14]!==d?(u=r.jsx(ks,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=u):u=e[15],u}function p3(t){const e=z.c(2),{text:s}=t;let n;return e[0]!==s?(n=r.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 oW(t){const e=z.c(52),{sources:s,template:n,paramName:i,value:o,sandboxRef:l,onCommit:a}=t,c=se(),[d,u]=V.useState(!1),[h,f]=V.useState(""),[m,p]=V.useState(""),g=V.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=tW(c),y=[...new Set(s.map(_e=>b[_e.kind].noun))].join(" or ");let _;e[0]!==c||e[1]!==y?(_=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=c,e[1]=y,e[2]=_):_=e[2];const L=_,w={template:n,paramName:i};let S;e[3]!==h?(S=(_e,Ae)=>({source:_e,query:Ae,options:_e.clientFilter?va(Ae.data??[],h):Ae.data??[]}),e[3]=h,e[4]=S):S=e[4];const k=S,j=s.filter(mW),T=s.filter(fW),N=kh({queries:j.map(_e=>rf(l,_e,m,w,d))});let C;e[5]!==N||e[6]!==k?(C=(_e,Ae)=>k(_e,N[Ae]),e[5]=N,e[6]=k,e[7]=C):C=e[7];const A=j.map(C),P=A.length===0||A.every(hW),R=kh({queries:T.map(_e=>rf(l,_e,m,w,d&&P))});let E;e[8]!==R||e[9]!==k?(E=(_e,Ae)=>k(_e,R[Ae]),e[8]=R,e[9]=k,e[10]=E):E=e[10];const M=T.map(E),I=P?M:A,$=I.length===1&&I[0]?.source.homepageLinks?I[0]:null,D=$&&!$.query.isLoading&&!$.query.isError?$?.query.data??[]:[],B=va(D.filter(uW),h),F=va(D.filter(dW),h),U=B.length>0&&F.length>0,H=_e=>{u(_e),g.current&&clearTimeout(g.current),f(_e?o:""),p(_e?o:"")};let W;e[11]===Symbol.for("react.memo_cache_sentinel")?(W=_e=>{f(_e),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(_e)},300)},e[11]=W):W=e[11];const q=W,ee=_e=>{a(_e),H(!1)},X=jv(h),Y=Pr(n,{[i]:X}),G=Ct,J=jt,oe="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",le=cW;let Q;e[12]!==x||e[13]!==c?(Q=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=Q):Q=e[14];let K;e[15]!==Q?(K=r.jsx(os,{className:"sr-only",children:r.jsx(At,{children:Q})}),e[15]=Q,e[16]=K):K=e[16];let te;e[17]===Symbol.for("react.memo_cache_sentinel")?(te=r.jsx(v1,{size:16,className:"shrink-0 text-foreground"}),e[17]=te):te=e[17];let ne;e[18]!==c?(ne=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=ne):ne=e[19];let re;e[20]!==x?(re=r.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]=re):re=e[21];let he;e[22]!==ne||e[23]!==re?(he=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[te,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[ne," ",re]})]}),e[22]=ne,e[23]=re,e[24]=he):he=e[24];const pe=pr,de=!1,Z="min-h-0 flex-1";let fe;e[25]!==L||e[26]!==h?(fe=r.jsx(Wi,{autoFocus:!0,placeholder:L,value:h,onValueChange:q}),e[25]=L,e[26]=h,e[27]=fe):fe=e[27];const ue=qi,ye="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Le;e[28]!==c?(Le=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=Le):Le=e[29];let Re;e[30]!==Le?(Re=r.jsx(si,{children:Le}),e[30]=Le,e[31]=Re):Re=e[31];const De=X&&r.jsx(ks,{className:"shrink-0",children:r.jsxs(Jt,{value:`__raw__:${X}`,className:"gap-3 py-2",onSelect:()=>ee(X),children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:r.jsx(Zr,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:X,paramLabel:x})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Y})]})]})}),Ue=U?r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:r.jsx(ya,{heading:b.category.heading,iconKind:"category",options:B,template:n,paramName:i,keyPrefix:`${$?.source.id}:cat`,onSelect:ee})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(ya,{heading:b.product.heading,iconKind:"product",options:F,template:n,paramName:i,keyPrefix:`${$?.source.id}:prod`,onSelect:ee})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:I.map(_e=>{const{source:Ae,query:Ce,options:xe}=_e,{noun:Se}=b[Ae.kind];if(Ce.isLoading)return r.jsx(p3,{text:c("sandbox.pathParamPickerChip.loading",{noun:Se})},Ae.id);if(Ce.isError)return r.jsx(p3,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ae.id);if(Ae.homepageLinks){const we=Ce.data??[];return r.jsxs(V.Fragment,{children:[r.jsx(ya,{heading:b.category.heading,iconKind:"category",options:va(we.filter(aW),h),template:n,paramName:i,keyPrefix:`${Ae.id}:cat`,onSelect:ee}),r.jsx(ya,{heading:b.product.heading,iconKind:"product",options:va(we.filter(lW),h),template:n,paramName:i,keyPrefix:`${Ae.id}:prod`,onSelect:ee})]},Ae.id)}return r.jsx(ya,{heading:I.length>1?b[Ae.kind].heading:void 0,iconKind:Ae.kind,options:xe,template:n,paramName:i,keyPrefix:Ae.id,onSelect:ee},Ae.id)})});let $e;e[32]!==ue||e[33]!==Re||e[34]!==De||e[35]!==Ue?($e=r.jsxs(ue,{className:ye,children:[Re,De,Ue]}),e[32]=ue,e[33]=Re,e[34]=De,e[35]=Ue,e[36]=$e):$e=e[36];let je;e[37]!==pe||e[38]!==fe||e[39]!==$e?(je=r.jsxs(pe,{shouldFilter:de,className:Z,children:[fe,$e]}),e[37]=pe,e[38]=fe,e[39]=$e,e[40]=je):je=e[40];let be;e[41]!==J||e[42]!==K||e[43]!==he||e[44]!==je||e[45]!==le?(be=r.jsxs(J,{className:oe,onClick:le,children:[K,he,je]}),e[41]=J,e[42]=K,e[43]=he,e[44]=je,e[45]=le,e[46]=be):be=e[46];let Ee;return e[47]!==G||e[48]!==H||e[49]!==d||e[50]!==be?(Ee=r.jsx(G,{open:d,onOpenChange:H,children:be}),e[47]=G,e[48]=H,e[49]=d,e[50]=be,e[51]=Ee):Ee=e[51],r.jsxs(r.Fragment,{children:[r.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:_e=>{_e.stopPropagation(),H(!0)},children:o||x}),Ee]})}function lW(t){return t.kind==="product"}function aW(t){return t.kind!=="product"}function cW(t){return t.stopPropagation()}function dW(t){return t.kind==="product"}function uW(t){return t.kind!=="product"}function hW(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function fW(t){return t.isFallback}function mW(t){return!t.isFallback}function pW(t){const e=z.c(8),{sources:s,template:n,paramName:i,sandboxRef:o,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==o||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(gW);c=kh,a=p.map(g=>rf(o,g,"",m,!0)),e[0]=i,e[1]=o,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]=V.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 gW(t){return!t.isFallback}function xW(t){const e=z.c(31),{name:s,value:n,onCommit:i}=t,o=se(),[l,a]=V.useState(n),[c,d]=V.useState(!1),u=V.useRef(!1);let h;e[0]!==s||e[1]!==o?(h=s==="*"?o("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=o,e[2]=h):h=e[2];const f=h,m=l||f;let p;e[3]!==m?(p=r.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]!==o?(g=o("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=o,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 v;e[10]!==n?(v=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(u.current=!0,a(n),k.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let y;e[12]!==l||e[13]!==i||e[14]!==n?(y=()=>{if(d(!1),u.current){u.current=!1;return}const k=jv(l);a(k),k!==n&&i(k)},e[12]=l,e[13]=i,e[14]=n,e[15]=y):y=e[15];let _;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==y?(_=r.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:bW,onChange:x,onFocus:b,onKeyDown:v,onBlur:y}),e[16]=l,e[17]=f,e[18]=g,e[19]=v,e[20]=y,e[21]=_):_=e[21];let L;e[22]!==p||e[23]!==_?(L=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,_]}),e[22]=p,e[23]=_,e[24]=L):L=e[24];let w;e[25]!==c||e[26]!==o?(w=c&&r.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:[r.jsx(AS,{size:10}),o("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=o,e[27]=w):w=e[27];let S;return e[28]!==w||e[29]!==L?(S=r.jsxs(r.Fragment,{children:[L,w]}),e[28]=w,e[29]=L,e[30]=S):S=e[30],S}function bW(t){return t.stopPropagation()}const vW={loaders:"loader",actions:"action"},B8=new Set(["workflows"]);function z8(t){return vW[t]}function yW(t,e,s){const n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(s)&&e in o)return!0;return!1}function _W(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(o))s.add(l);return s}function LW(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function F8(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[o,l]of Object.entries(s))if(o.includes(e))for(const a of Object.keys(l))i.add(a);for(const o of i){if(o.toLowerCase().includes("preview")||Av.has(o)||B8.has(cp(o))||LW(o,i))continue;const l=to(o,t);if(l.hidden)continue;const a=l.title&&l.title!==o?l.title:ds(o);n.push({resolveType:o,title:a})}return n.sort((o,l)=>o.title.localeCompare(l.title))}function g3(t,e){return F8(t,e).length}function cp(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const wW={deco:"Deco",std:"Deco Standard",website:"Website"};function SW(t){return wW[t]??t}function U8(t){const e=cp(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 kW(t,e,s){const n=[];for(const[i,o]of Object.entries(e)){if(i.includes("/")||A0(i)||!o||typeof o!="object"||Array.isArray(o))continue;const l=o,a=l.__resolveType;typeof a=="string"&&(Av.has(a)||B8.has(cp(a))||yW(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,o)=>i.title.localeCompare(o.title))}function K8(t){const e=z.c(12),{orgSlug:s,virtualMcpId:n,branch:i,enabled:o}=t,l=o===void 0?!0:o;let a;e[0]!==i||e[1]!==s||e[2]!==n?(a=Fe.sandboxRepoDir(s,n,i),e[0]=i,e[1]=s,e[2]=n,e[3]=a):a=e[3];let c;e[4]!==i||e[5]!==s||e[6]!==n?(c=async()=>{const h=`/api/${s}/sandbox/${encodeURIComponent(n)}/${encodeURIComponent(i)}/config`,f=await fetch(h);return f.ok?(await f.json()).repoDir??null:null},e[4]=i,e[5]=s,e[6]=n,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d={queryKey:a,queryFn:c,enabled:l,staleTime:1/0},e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],xt(d).data??null}const jW={target:null,editSeoPageKey:null,variantOverride:null};function CW(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const H8=V.createContext(null);function NW(t){const e=z.c(9),{children:s}=t,[n,i]=V.useReducer(CW,jW);let o,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o,e[1]=l,e[2]=a,e[3]=c):(o=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:o,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=r.jsx(H8,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=u):u=e[8],u}function dp(){const t=V.use(H8);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}const VW="https://github.com/decocms/blocks";function TW(){const t=z.c(14),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(PS,{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 o;t[5]!==e?(o=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=o):o=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(hn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(ae,{size:"sm",asChild:!0,children:r.jsxs("a",{href:VW,target:"_blank",rel:"noreferrer",children:[o,l]})}),t[8]=o,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=r.jsx(Fr,{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 EW(t){const e=z.c(15),{source:s,onRetry:n}=t,i=se();let o;e[0]!==s||e[1]!==i?(o=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(fn,{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=r.jsx(ae,{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=r.jsx(Fr,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}function To(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const AW=V.lazy(()=>Sn(()=>import("./sections-editor-BZXWTjdM.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])).then(t=>({default:t.SectionsEditor})));function x3(t){const e=z.c(42),{virtualMcpId:s,externalSelectedIndex:n}=t,i=n===void 0?null:n,{org:o}=Me(),{currentBranch:l}=Qs(),a=jn(),c=Uo(),d=dp(),u=a.lifecycle.phase==="running",h=c.previewUrl;let f;e[0]!==l||e[1]!==o||e[2]!==h||e[3]!==s?(f=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,previewUrl:h}:null,e[0]=l,e[1]=o,e[2]=h,e[3]=s,e[4]=f):f=e[4];const m=f;let p;e[5]!==u?(p={fetchEnabled:u},e[5]=u,e[6]=p):p=e[6];const g=T0(m,p);let x;e[7]!==u?(x={fetchEnabled:u},e[7]=u,e[8]=x):x=e[8];const b=E0(m,x);let v;e[9]!==g||e[10]!==b||e[11]!==a.lifecycle.phase?(v=x8({lifecyclePhase:a.lifecycle.phase,decofile:qu(g),meta:qu(b),hasEditableContent:R0(g.data,b.data)}),e[9]=g,e[10]=b,e[11]=a.lifecycle.phase,e[12]=v):v=e[12];const y=v;if(y.kind==="loading"){let M;return e[13]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(To,{}),e[13]=M):M=e[13],M}if(y.kind==="empty"){let M;return e[14]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(TW,{}),e[14]=M):M=e[14],M}if(y.kind==="error"){let M;e[15]!==g||e[16]!==c||e[17]!==b||e[18]!==y.source?(M=()=>{if(y.source==="sandbox"){c.retry();return}Promise.all([g.refetch(),b.refetch()])},e[15]=g,e[16]=c,e[17]=b,e[18]=y.source,e[19]=M):M=e[19];const I=M;let $;return e[20]!==I||e[21]!==y.source?($=r.jsx(EW,{source:y.source,onRetry:I}),e[20]=I,e[21]=y.source,e[22]=$):$=e[22],$}const _=d.state.target;let L;e[23]!==l||e[24]!==o.slug||e[25]!==_||e[26]!==s?(L=_||!l?null:P8(A8(o.slug,s,l)),e[23]=l,e[24]=o.slug,e[25]=_,e[26]=s,e[27]=L):L=e[27];const w=L;let S="/",k=null,j=null;_?.kind==="page"?(S=_.path,k=_.key):_?.kind==="section"?j=_.key:w&&(S=w.path,k=w.pageKey);const T=k?`page:${k}`:j?`section:${j}`:`path:${S}`;let N;e[28]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),e[28]=N):N=e[28];const C=l??"",A=h??void 0,P=j?null:i,R=!!k&&d.state.editSeoPageKey===k;let E;return e[29]!==j||e[30]!==k||e[31]!==S||e[32]!==T||e[33]!==o.slug||e[34]!==P||e[35]!==R||e[36]!==C||e[37]!==A||e[38]!==s||e[39]!==d.consumeEditSeo||e[40]!==d.setVariantOverride?(E=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(V.Suspense,{fallback:N,children:r.jsx(AW,{orgSlug:o.slug,virtualMcpId:s,branch:C,previewReady:!0,previewUrl:A,currentPath:S,activePageBlockKey:k,activeGlobalBlockKey:j,externalSelectedIndex:P,initialEditSeo:R,onExitSeo:d.consumeEditSeo,onVariantPreviewOverride:d.setVariantOverride},T)})}),e[29]=j,e[30]=k,e[31]=S,e[32]=T,e[33]=o.slug,e[34]=P,e[35]=R,e[36]=C,e[37]=A,e[38]=s,e[39]=d.consumeEditSeo,e[40]=d.setVariantOverride,e[41]=E):E=e[41],E}function PW(t,e){return t===e?"preview":e}function RW(t){return t.cmsDefaultOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const DW="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",IW="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",MW=500,$W={mobile:375,tablet:768,desktop:null},U9=["desktop","mobile","tablet"],b3={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function v3(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function _a(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function OW(t){const{onOpen:e}=t,[s,n]=V.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function BW(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function zW({virtualMcpId:t}){const e=se(),s=_0(),n=Xr(),i=CK(),o=It(),{currentBranch:l}=Qs(),a=dp(),c=h8(),d=ve=>{o({to:".",search:Ie=>({...Ie,main:ve}),replace:!0})},[u,h]=V.useState("preview"),[f,m]=V.useState(!1),[p,g]=V.useState("desktop"),[x,b]=V.useState(null),[v,y]=V.useState(null),_=V.useRef(null),L=V.useRef(null),[w,S]=V.useState(null),[k,j]=V.useState(!1),[T,N]=V.useState(""),C=V.useRef(null),[A,P]=V.useState(!1),[R,E]=V.useState(),[M,I]=V.useState(null),[$,O]=V.useState(null),[D,B]=V.useState("/"),[F,U]=V.useState(null),[H,W]=V.useState({}),[q,ee]=V.useState(!1),X=V.useRef(null),Y=()=>{ee(!0),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>ee(!1),15e3)},G=()=>{X.current&&(clearTimeout(X.current),X.current=null),ee(!1)},{org:J}=Me(),oe=jn(),le=Uo(),Q=le.vmEntry,K=le.previewUrl,te=oe.lifecycle.phase,ne=oe.decofileVersion,re=te==="running",he=Q?.sandboxProviderKind==="user-desktop",pe=K8({orgSlug:J.slug,virtualMcpId:t??"",branch:l??"",enabled:he&&re&&!!t&&!!l}),de=he?pe:null,Z=t&&l?{orgSlug:J.slug,virtualMcpId:t,branch:l,previewUrl:K}:null,fe=T0(Z,{fetchEnabled:re}),ue=E0(Z,{fetchEnabled:re}),ye=fe.data,Le=ue.data,Re=x8({lifecyclePhase:te,decofile:qu(fe),meta:qu(ue),hasEditableContent:R0(ye,Le)}).kind==="content",De=t&&l?{orgSlug:J.slug,virtualMcpId:t,branch:l}:null,Ue=HK(De),$e=ye?ym(ye).sort((ve,Ie)=>ve.name.localeCompare(Ie.name)):[],je=ye&&Le?_m(ye,Le):[],be=$r,Ee=$e.filter(ve=>{if(!T)return!0;const Ie=T.toLowerCase();return ve.name.toLowerCase().includes(Ie)||ve.path.toLowerCase().includes(Ie)}),_e=je.filter(ve=>{if(!T)return!0;const Ie=T.toLowerCase();return ve.name.toLowerCase().includes(Ie)||ve.key.toLowerCase().includes(Ie)||ve.resolveType.toLowerCase().includes(Ie)}),Ae=M?null:nP($e,D,F),Ce=M?M.name:Ae?.name,xe=Ae?.key??null,Se=Ae?.path??null,we=(xe?H[xe]:void 0)??{},ze=Pr(D,we),Be={};if(re&&K&&Le&&ye){const ve=_W(Le,"loaders"),Ie=xe?ye[xe]:void 0,vt=zH(Ie,ye,ls=>ve.has(ls)),wt=IH(vt);for(const ls of Tu(D)){if(ls.type!=="param")continue;const tn=PH(D,ls.name,vt),Is=OH(tn,ve,wt);Is.length>0&&(Be[ls.name]=Is)}}const Xe=t&&l?{orgSlug:J.slug,virtualMcpId:t,branch:l}:null,Ve=ye&&xe?C8(ye,xe,0):[],ot=ye?L8(Ve,ye):[],gt=ot.map(ve=>ve.isSavedBlock?ve.label:""),ct=ot.map(ve=>ve.isSavedBlock?"global":ve.isMultivariate?"variant":"normal"),dt=Ve.map(ve=>sf(ve,ye??{})),mt=V.useRef(null),ge=V.useRef(null),Ye=oe.status.state==="paused",tt=oe.phase,ut=V8({claimPhase:tt,lifecycle:oe.lifecycle}),bt=le.previewState,Vt=le.userStopped,St=vr(),Tt=St?.entity?.id===t?w0(St.entity.metadata?.productionUrl):null,Kt=(St?.entity?.id===t?St.entity.metadata?.ui?.layout?.cmsDefaultOpen:null)??!1,es=!!Tt&&St?.entity?.metadata?.fastPreview===!0,Mt=es&&Tt&&K&&ne?zK({productionUrl:Tt,previewUrl:K,version:ne,path:ze}):null,ce=pK({previewState:bt,progressStatus:ut.status,productionUrl:Tt,fastPreviewActive:es,fastPreviewReady:!!Mt}),Pe=ce.mode!=="none",He=ce.mode==="production"&&ce.iframeBase?new URL(ce.iframeBase).origin:null,Qe=!s,Ne=ce.mode==="sandbox"?$K(v3($??new URL(ze,ce.iframeBase).href,p),a.state.variantOverride??[]):ce.mode==="production"&&Qe?v3(Mt??new URL(ze,ce.iframeBase).href,p):null;V.useEffect(()=>{},[s,He,w]);const lt="sandbox.preview.openInNewTab",Bt=ce.mode==="production"?Mt??(ce.iframeBase?new URL(ze,ce.iframeBase).href:null):Ne??ce.iframeBase,Ns=async()=>{const ve=Bt;if(ve){window.open(ve,"_blank","noopener");return}},an=t&&l?A8(J.slug,t,l):null,Ds=ve=>{an&&TH(an,ve)},Ft=a.state.target;V.useEffect(()=>{if(!(!Ft||!K||!Le))if(Ft.kind==="page"){const ve=H[Ft.key]??{};ge.current=Pr(Ft.path,ve),I(null),O(null),U(Ft.key),B(Ft.path),Ds({path:Ft.path,pageKey:Ft.key,params:ve})}else{const ve=je.find(Ie=>Ie.key===Ft.key);if(ve){ge.current=null;const Ie=Rh(Le);I(ve),O(l3(K,Ie,ve.key))}}},[Ft,K,Le,H]),V.useEffect(()=>{!xe||Se===null||Ft?.kind==="page"&&Ft.key===xe&&Ft.path===Se||a.selectTarget({kind:"page",key:xe,path:Se})},[xe,Se,Ft]);const[Xs,Cn]=V.useState(null);if(bt.kind==="iframe"&&Xs!==bt.previewUrl){const ve=Xs!==null;Cn(bt.previewUrl);const Ie=an?P8(an):null;if(Ie){if(ge.current=Pr(Ie.path,Ie.params),B(Ie.path),U(Ie.pageKey),O(null),I(null),Ie.pageKey&&Object.keys(Ie.params).length>0){const vt=Ie.pageKey;W(wt=>({...wt,[vt]:Ie.params}))}}else ve&&(ge.current=null,B("/"),O(null),U(null),I(null))}mt.current=Ne;const Js=vK({iframeRef:_,src:ce.mode==="sandbox"?Ne:null,active:ce.mode==="sandbox"}),Zs=V.useRef(null);V.useEffect(()=>{if(!Mt||!Ne||Zs.current===Mt)return;Zs.current=Mt;const ve=_.current;ve&&ve.getAttribute("src")!==Ne&&(Y(),ve.src=Ne)},[Mt,Ne]);const di=!!t&&!!l&&!oe.notFound&&!Vt&&!Ye&&(tt?.kind==="ready"||te!=="idle"),Te=ce.mode!=="sandbox"&&u==="visual"?"preview":u;V.useEffect(()=>{const ve=_a(K);if(!ve)return;const Ie=vt=>{if(vt.origin===ve){if(vt.data?.type==="visual-editor::element-clicked"){const wt=GK.safeParse(vt.data.payload);wt.success&&b(wt.data)}else if(vt.data?.type==="cms-editor::section-clicked"){const wt=QK.safeParse(vt.data.payload);wt.success&&y(wt.data.sectionIndex)}}};return window.addEventListener("message",Ie),()=>window.removeEventListener("message",Ie)},[K]),V.useEffect(()=>{if(!k)return;const ve=Ie=>{C.current?.contains(Ie.target)||(j(!1),N(""))};return document.addEventListener("pointerdown",ve),()=>document.removeEventListener("pointerdown",ve)},[k]);const st=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||ve.postMessage({type:"visual-editor::activate",script:YK},Ie)},Lt=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||ve.postMessage({type:"visual-editor::deactivate"},Ie)},ts=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||(ve.postMessage({type:"visual-editor::activate",script:XK},Ie),ve.postMessage({type:"cms-editor::set-labels",labels:gt,kinds:ct,keys:dt},Ie))},en=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||ve.postMessage({type:"cms-editor::deactivate"},Ie)},qs=ve=>{const Ie=u;!n&&ve!==Ie&&(ve==="blocks"?L.current?.resize("30%"):L.current?.collapse()),h(ve),b(null),y(null),Ie==="visual"&&Lt(),ve==="visual"&&st(),Ie==="blocks"&&ve!=="blocks"&&en(),ve==="blocks"&&ts()},Gi=ve=>{m(!0),qs(PW(u,ve))},ca=RW({cmsDefaultOpen:Kt,blocksReady:Re,autoOpenResolved:f,editingMode:u}),yr=()=>{m(!0),qs("blocks")},_r=()=>{if(!_.current||!Ne)return;const ve=_.current;ve.src=Ne},Lr=()=>{const ve=_.current;if(!ve)return;Y();const Ie=document.activeElement,vt=ve.tabIndex;ve.tabIndex=-1,ve.style.pointerEvents="none",ve.blur(),BW(ve,mt.current);let wt;const ls=()=>{clearTimeout(wt),ve.tabIndex=vt,ve.style.pointerEvents="";const tn=document.activeElement;(!tn||tn===document.body||tn===ve)&&Ie?.focus(),ve.removeEventListener("load",ls)};ve.addEventListener("load",ls),wt=setTimeout(ls,3e3)};gP(()=>{Mt||Lr()}),xP(()=>{Y()});const Xo=()=>{const ve=U9.indexOf(p);g(U9[(ve+1)%U9.length])},wr=async()=>{let ve=null;try{ve=_.current?.contentWindow?.location?.href??null}catch{}const Ie=ve??Ne??K;if(Ie)try{await navigator.clipboard.writeText(Ie),me.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{me.error(e("sandbox.preview.failedToCopyUrl"))}},Sr=yK({iframeBase:ce.iframeBase,resolvedPath:ze,activeGlobalSectionName:M?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),ui=ve=>{const Ie=H[ve.key]??{},vt=Pr(ve.path,Ie);(M||be(vt)!==be(ze))&&Y(),ge.current=vt,I(null),O(null),y(null),U(ve.key),B(ve.path),Ds({path:ve.path,pageKey:ve.key,params:Ie}),a.selectTarget({kind:"page",key:ve.key,path:ve.path})},hi=(ve,Ie)=>{if(!xe)return;const vt=xe,wt={...we,[ve]:Ie};ge.current=Pr(D,wt),W(ls=>({...ls,[vt]:wt})),Ds({path:D,pageKey:vt,params:wt})},da=ve=>{if(!K||!Le){me.error(e("sandbox.preview.previewMetadataNotReady"));return}Y(),ge.current=null;const Ie=Rh(Le),vt=l3(K,Ie,ve.key);I(ve),O(vt),y(null),a.selectTarget({kind:"section",key:ve.key})},kr=async({name:ve,path:Ie,templateKey:vt})=>{if(!t||!l)return;const wt=xm(Ie);if(wt){E(wt);return}const ls=Ie.trim().startsWith("/")?Ie.trim():`/${Ie.trim()}`;if($e.some(Is=>be(Is.path)===be(ls))){E(e("sandbox.preview.pageAlreadyExists",{path:ls}));return}let tn;if(vt&&(tn=ye?.[vt],!tn)){E(e("sandbox.preview.templateNoLongerExists"));return}E(void 0);try{const Is=await Ue.mutateAsync({name:ve,path:ls,template:tn});P(!1),me.success(e("sandbox.preview.pageCreated",{name:ve})),await Yl(MW),ui({key:Is.key,name:Is.name,path:Is.path}),qs("blocks")}catch(Is){E(Is instanceof Error?Is.message:e("sandbox.preview.failedToCreatePage"))}},Mn=Pe&&(di||ce.mode==="production"),Yi=u==="blocks",Qi=Mn?r.jsx(rp,{title:e("sandbox.preview.cms"),tooltip:e(Yi?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:RS},active:Yi,onClick:()=>Gi("blocks"),testId:"preview-blocks-toggle",dataTour:dr.edit}):null,Xi=Mn?r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{onClick:_r,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(vn,{size:16})})}),r.jsx(qe,{side:"bottom",children:e("sandbox.preview.refresh")})]}),r.jsxs("div",{ref:C,className:"relative min-w-0 w-64 shrink",children:[r.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:[r.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>j(ve=>!ve),children:[M&&r.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:[r.jsx(Vi,{size:11}),"Global"]}),r.jsx("span",{className:ie("text-[13px] font-medium text-foreground",Ce==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:Ce??Sr}),!M&&Ce!=null&&D&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:Tu(D).map((ve,Ie)=>{if(ve.type==="text")return r.jsx("span",{className:ie(Ie===0?"min-w-0 truncate":"shrink-0"),children:ve.text},`text-${Ie}`);const vt=Be[ve.name];return vt&&Xe?r.jsx(oW,{sources:vt,template:D,paramName:ve.name,value:we[ve.name]??"",sandboxRef:Xe,onCommit:wt=>hi(ve.name,wt)},`${xe}:${ve.name}`):r.jsx(xW,{name:ve.name,value:we[ve.name]??"",onCommit:wt=>hi(ve.name,wt)},`${xe}:${ve.name}`)})})]}),r.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>j(ve=>!ve),"aria-label":e("sandbox.preview.choosePage"),children:r.jsx(fs,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",k&&"rotate-180")})})]}),k&&r.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:[r.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[r.jsx(C0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:T,onChange:ve=>N(ve.target.value),onKeyDown:ve=>{if(ve.key!=="Enter")return;const Ie=T.trim();if(!Ie)return;const vt=Ee.find(wt=>be(wt.path)===be(Ie));vt&&(ve.preventDefault(),j(!1),N(""),ui(vt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),r.jsx("div",{className:"p-1.5 border-b",children:r.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:ve=>{ve.preventDefault(),j(!1),N(""),E(void 0),P(!0)},children:[r.jsx(Nt,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),Ee.length===0&&_e.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:$e.length===0&&je.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[Ee.length>0&&r.jsx("div",{className:"p-1.5",children:Ee.map(ve=>r.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:Ie=>{Ie.preventDefault(),j(!1),N(""),ui(ve)},children:[r.jsx(or,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.path})]},ve.key))}),_e.length>0&&r.jsxs("div",{className:ie("p-1.5",Ee.length>0&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),_e.map(ve=>r.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:Ie=>{Ie.preventDefault(),j(!1),N(""),da(ve)},children:[r.jsx(Vi,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]})]})]})]}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{"aria-label":e(lt),onClick:()=>{Ns()},children:r.jsx(hn,{size:16})})}),r.jsx(qe,{side:"bottom",children:e(lt)})]})]}):null,ua=Mn?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Qi,r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Xi]}):null,jr=Mn||c?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(Hi,{size:14})})}),r.jsxs(Yt,{align:"end",className:"w-44",children:[c&&r.jsxs(Ze,{onClick:()=>c.setVisible(!c.visible),children:[r.jsx(b5,{size:14}),c.visible?e("sandbox.preview.hideTerminal"):e("sandbox.preview.showTerminal")]}),Mn&&r.jsxs(r.Fragment,{children:[c&&r.jsx(ki,{}),r.jsxs(Ze,{onClick:wr,children:[r.jsx(on,{size:14}),e("sandbox.preview.copyCurrentUrl")]})]}),ye&&Le&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),xe&&r.jsxs(Ze,{onClick:()=>{a.editSeo({kind:"page",key:xe,path:D}),qs("blocks")},children:[r.jsx(S1,{size:14}),e("sandbox.preview.editSeo")]}),xe&&r.jsxs(Ze,{onClick:()=>{try{d(oS(vA(xe)))}catch{me.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx($o,{size:14}),e("sandbox.preview.viewJson")]})]}),de&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),r.jsxs(Ze,{onClick:()=>window.open(Qu("vscode",de)),children:[r.jsx("img",{src:DW,alt:"VSCode",width:14,height:14}),e("sandbox.preview.openInVscode")]}),r.jsxs(Ze,{onClick:()=>window.open(Qu("cursor",de)),children:[r.jsx("img",{src:IW,alt:"Cursor",width:14,height:14}),e("sandbox.preview.openInCursor")]})]}),r.jsx(ki,{}),r.jsxs(Ze,{onClick:()=>hK(e),children:[r.jsx(DS,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,fi=ce.mode==="sandbox",Ji=fi?r.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:r.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{onClick:()=>Gi("visual"),"aria-pressed":u==="visual","aria-label":e("sandbox.preview.visualEditor"),active:u==="visual",disabled:!fi,className:"rounded-full","data-tour":dr.visualEditor,children:r.jsx(Wp,{size:16})})}),r.jsx(qe,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{onClick:Xo,"aria-label":e(b3[p]),disabled:!fi,className:"rounded-full","data-tour":dr.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&r.jsx(IS,{size:16}),p==="tablet"&&r.jsx(MS,{size:16}),p==="desktop"&&r.jsx($S,{size:16})]},p)})}),r.jsx(qe,{side:"top",children:e(b3[p])})]})]})}):null;return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[ca&&r.jsx(OW,{onOpen:yr}),Xe&&Object.entries(Be).map(([ve,Ie])=>(we[ve]??"")===""?r.jsx(pW,{sources:Ie,template:D,paramName:ve,sandboxRef:Xe,onFill:vt=>hi(ve,vt)},`${xe}:${ve}`):null),i?r.jsxs(r.Fragment,{children:[Mn&&r.jsx(kK,{children:ua}),r.jsx(jK,{children:jr})]}):(Mn||jr)&&r.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:[r.jsx("div",{className:"flex flex-1 items-center justify-start",children:Qi}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Xi}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:jr})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:n&&Te==="blocks"?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(x3,{virtualMcpId:t,externalSelectedIndex:v}),Ji]}):r.jsxs(rv,{orientation:"horizontal",disabled:Te!=="blocks",children:[r.jsx(Vu,{ref:L,id:"preview-blocks-editor",defaultSize:Te==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Te==="blocks"&&r.jsx(x3,{virtualMcpId:t,externalSelectedIndex:v})}),Te==="blocks"&&r.jsx(ov,{withHandle:!0}),r.jsx(Vu,{id:"preview-canvas",defaultSize:Te==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{className:ie("h-full relative overflow-hidden",p!=="desktop"&&Pe&&"flex justify-center bg-muted/30"),children:[q&&Pe&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-0.5 overflow-hidden bg-primary/15",children:r.jsx("div",{className:"absolute inset-y-0 w-2/5 rounded-full bg-primary animate-preview-nav"})}),ce.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Vl,{kind:"starting",progress:ut,claimPhase:tt})}),bt.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Vl,{kind:"suspended",onResume:le.resume})}),bt.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Vl,{kind:"errored",error:bt.error,onRetry:le.retry,connectionsHref:`/${J.slug}/settings/connections`})}),ce.showWakingPill&&r.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:[r.jsx(it,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Te==="visual"&&!x&&r.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:[r.jsx(Wp,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Te==="visual"&&x&&r.jsx(mH,{element:x,onDismiss:()=>b(null)}),Ji,Pe&&Ne&&r.jsx("div",{className:ie("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",p!=="desktop"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:p==="desktop"?"100%":`${$W[p]}px`},children:r.jsx("iframe",{ref:_,src:Ne,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Js.handleError,onLoad:()=>{if(Js.handleLoad(),G(),ce.mode==="sandbox"){if(Je("vm_preview_loaded",{view_mode:u,vm_id:Q?.sandboxHandle??null}),!M)try{const ve=_.current?.contentWindow?.location?.pathname;if(!ve)return;const Ie=ge.current;if(Ie!==null&&(ge.current=null,be(ve)!==be(Ie))||be(ve)===be(ze))return;B(ve),Ds({path:ve,pageKey:F,params:we})}catch{}u==="visual"&&st(),u==="blocks"&&ts()}}},ce.iframeBase)})]})})]})}),r.jsx(qK,{open:A,onOpenChange:P,isPending:Ue.isPending,error:R,templates:$e,onSubmit:kr})]})}function FW(t){const e=z.c(22),{virtualMcpId:s}=t,n=se(),i=Hs(s),{activeTask:o}=Qs(),[l,a]=V.useState(!1);if(!(Ln(i?.metadata)||Ln(o?.metadata))){let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(Kr,{className:"size-7 text-foreground"})}),e[0]=u):u=e[0];let h;e[1]!==n?(h=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=h):h=e[2];let f;e[3]!==n?(f=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=f):f=e[4];let m,p;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),p=r.jsx(Kr,{className:"size-4"}),e[5]=m,e[6]=p):(m=e[5],p=e[6]);let g;e[7]!==n?(g=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=g):g=e[8];let x;e[9]!==g?(x=r.jsxs(ae,{onClick:m,children:[p,g]}),e[9]=g,e[10]=x):x=e[10];let b;e[11]!==h||e[12]!==f||e[13]!==x?(b=r.jsx(Fr,{className:"h-full",image:u,title:h,description:f,actions:x}),e[11]=h,e[12]=f,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==l?(v=r.jsx(z1,{open:l,onOpenChange:a,mode:"agent"}),e[15]=l,e[16]=v):v=e[16];let y;return e[17]!==b||e[18]!==v?(y=r.jsxs(r.Fragment,{children:[b,v]}),e[17]=b,e[18]=v,e[19]=y):y=e[19],y}let d;return e[20]!==s?(d=r.jsx(zW,{virtualMcpId:s}),e[20]=s,e[21]=d):d=e[21],d}const UW="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",KW="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",HW=V.lazy(()=>Sn(()=>import("./file-explorer-DfuHOOLl.js"),__vite__mapDeps([149,1,2,84,85,78,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,79,80,81,82,83,86,87,88,89,90,91,92,93,94,95,96,107,101,102,103,104,105,106,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.FileExplorer})));function WW(t){const e=z.c(21),{openPath:s}=t,n=se(),i=vr(),{org:o}=Me(),{currentBranch:l}=Qs(),a=i?.entity?.id??null,c=Uo(),d=jn(),u=c.vmEntry,h=d.lifecycle.phase==="running",f=u?.sandboxProviderKind==="user-desktop",m=a??"",p=l??"",g=f&&h&&!!a&&!!l;let x;e[0]!==o.slug||e[1]!==m||e[2]!==p||e[3]!==g?(x={orgSlug:o.slug,virtualMcpId:m,branch:p,enabled:g},e[0]=o.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x):x=e[4];const b=K8(x),v=f?b:null;if(!a||!l){let S;e[5]!==n?(S=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[5]=n,e[6]=S):S=e[6];let k;return e[7]!==S?(k=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:S}),e[7]=S,e[8]=k):k=e[8],k}let y;e[9]!==v||e[10]!==n?(y=v&&r.jsx("div",{className:"relative flex h-12 shrink-0 items-center border-b border-border/60 px-3 md:px-4",children:r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInVscode"),onClick:()=>window.open(Qu("vscode",v)),children:r.jsx("img",{src:UW,alt:"VSCode",width:14,height:14})})}),r.jsx(qe,{side:"bottom",children:n("mainPanelTabs.codeTab.openInVscode")})]}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInCursor"),onClick:()=>window.open(Qu("cursor",v)),children:r.jsx("img",{src:KW,alt:"Cursor",width:14,height:14})})}),r.jsx(qe,{side:"bottom",children:n("mainPanelTabs.codeTab.openInCursor")})]})]})}),e[9]=v,e[10]=n,e[11]=y):y=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),e[12]=_):_=e[12];let L;e[13]!==l||e[14]!==s||e[15]!==o.slug||e[16]!==a?(L=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(V.Suspense,{fallback:_,children:r.jsx(HW,{orgSlug:o.slug,virtualMcpId:a,branch:l,openPath:s})})}),e[13]=l,e[14]=s,e[15]=o.slug,e[16]=a,e[17]=L):L=e[17];let w;return e[18]!==y||e[19]!==L?(w=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[y,L]}),e[18]=y,e[19]=L,e[20]=w):w=e[20],w}function qW(t){return Hs(t)?.metadata?.runtime?.path??null}function GW(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 YW(t,e,s){return typeof t!="string"?null:GW(ni(t,e),s)}function W8(t,e,s){if(!e||typeof t!="string")return!1;const n=YW(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function QW({orgSlug:t,virtualMcpId:e,branch:s}){const n=Qt(),i=Hs(e)?.metadata?.runtime?.path??null;return Rt({mutationFn:async({blockKey:o})=>{const l=Xl(i,um(o)),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:l})});if(!a.ok){const c=await a.json().catch(()=>({}));throw new Error(c.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:o})=>{const l=`${t}/${e}/${s}`,a=Fe.decofile(l);await n.cancelQueries({queryKey:a});const c=n.getQueryData(a);return n.setQueryData(a,d=>{if(!d)return d;const{[o]:u,...h}=d;return h}),{previous:c,queryKey:a}},onError:(o,l,a)=>{a?.queryKey&&n.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:Fe.liveMeta(t,e,s)})}})}function hl(t){const e=z.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let o;e[0]!==i||e[1]!==n||e[2]!==s?(o=s?"No results match your search.":r.jsxs(r.Fragment,{children:[r.jsx("div",{children:n}),r.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==o?(l=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=l):l=e[5],l}function n9(t,e){return`${t}-${e}`}function q8(t,e){return`site/apps/${t}/${e}.ts`}function G8(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 XW(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function JW(t){return t==="local"?"Custom":"Installed"}function Y8(t,e,s){const n=new Set([n9(t,e),e].map(o=>o.toLowerCase())),i=q8(t,e);for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(o.toLowerCase())||a.__resolveType===i)return o}return null}function ZW(t,e){const s=t.vendor.alias,n=t.name,i=Y8(s,n,e);return{id:n9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:q8(s,n),blockKey:i,installed:i!==null}}function eq(t,e,s){if(t===vm)return null;const n=G8(t);if(!n)return null;const{vendor:i,app:o}=n,l=Y8(i,o,s),a=to(t,e);return{id:n9(i,o),app:o,vendor:i,title:a.title??o,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function tq(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Eu(t,e)||!kv(n))return null;const i=G8(n)??XW(t);if(!i)return null;const o=to(n,s),{vendor:l,app:a}=i;return{id:n9(l,a),app:a,vendor:l,title:o.title??Au(t,e,s),description:o.description??"",category:JW(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function sq(t,e,s){const n=new Map;for(const o of t){const l=ZW(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=eq(o,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=tq(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(nq)}function nq(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function iq(){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 rq(t,e,s){const n=z.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=Fe.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:iq,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=xt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?sq(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 Q8(t){return(e,s)=>{xv(e),t(e,s)}}function oq(t){const e=z.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=t,l=se();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=r.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:r.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]!==o||e[8]!==d||e[9]!==u?(h=r.jsx(On,{id:"pages",icon:or,label:d,count:n.pages,active:u,onSelect:o}),e[6]=n.pages,e[7]=o,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]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(On,{id:"sections",icon:Vi,label:f,count:n.sections,active:m,onSelect:o}),e[13]=n.sections,e[14]=o,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]!==o||e[22]!==x||e[23]!==g?(b=r.jsx(On,{id:"apps",icon:F5,label:g,count:n.apps,active:x,onSelect:o}),e[20]=n.apps,e[21]=o,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const y=s==="redirects";let _;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==y?(_=r.jsx(On,{id:"redirects",icon:v5,label:v,count:n.redirects,active:y,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=y,e[31]=_):_=e[31];let L;e[32]!==l?(L=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=L):L=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==o||e[36]!==L||e[37]!==w?(S=r.jsx(On,{id:"loaders",icon:_u,label:L,count:n.loaders,active:w,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=L,e[37]=w,e[38]=S):S=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 T;e[41]!==n.actions||e[42]!==o||e[43]!==k||e[44]!==j?(T=r.jsx(On,{id:"actions",icon:$i,label:k,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=k,e[44]=j,e[45]=T):T=e[45];let N;e[46]!==l?(N=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=N):N=e[47];const C=s==="site";let A;e[48]!==o||e[49]!==N||e[50]!==C?(A=r.jsx(On,{id:"site",icon:f1,label:N,active:C,onSelect:o}),e[48]=o,e[49]=N,e[50]=C,e[51]=A):A=e[51];let P;e[52]!==l?(P=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=P):P=e[53];const R=s==="seo";let E;e[54]!==o||e[55]!==P||e[56]!==R?(E=r.jsx(On,{id:"seo",icon:S1,label:P,active:R,onSelect:o}),e[54]=o,e[55]=P,e[56]=R,e[57]=E):E=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 $;e[60]!==o||e[61]!==M||e[62]!==I?($=r.jsx(On,{id:"calendar",icon:ar,label:M,active:I,onSelect:o}),e[60]=o,e[61]=M,e[62]=I,e[63]=$):$=e[63];let O;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(O=i&&r.jsxs(r.Fragment,{children:[r.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:[r.jsx(Pl,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(On,{id:"posts",icon:Ri,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(On,{id:"authors",icon:F1,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(On,{id:"categories",icon:_1,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=o,e[69]=i,e[70]=l,e[71]=O):O=e[71];let D;e[72]!==b||e[73]!==_||e[74]!==S||e[75]!==T||e[76]!==A||e[77]!==E||e[78]!==$||e[79]!==O||e[80]!==h||e[81]!==p?(D=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,_,S,T,A,E,$,O]}),e[72]=b,e[73]=_,e[74]=S,e[75]=T,e[76]=A,e[77]=E,e[78]=$,e[79]=O,e[80]=h,e[81]=p,e[82]=D):D=e[82];let B;return e[83]!==c||e[84]!==D?(B=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,D]}),e[83]=c,e[84]=D,e[85]=B):B=e[85],B}function On(t){const e=z.c(18),{id:s,icon:n,label:i,count:o,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=ie("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=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=r.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==o?(m=o!==void 0&&r.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=l,e[10]=o,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=r.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 lq(t){const e=z.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:o,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=V8({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=r.jsx(Vl,{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]!==o?(a=r.jsx(Vl,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==o||e[10]!==s.error?(a=r.jsx(Vl,{kind:"errored",error:s.error,onRetry:o,connectionsHref:l}),e[8]=l,e[9]=o,e[10]=s.error,e[11]=a):a=e[11],a}}}function y3(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 o=`${s} (copy ${i})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function aq(t,e){const s=$r,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let o=2;o<1e3;o++){const l=`${n}-copy-${o}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function cq(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 o=`${s}_copy_${i}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function dq(t){const e=op(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function uq(t,e){return v8(t,e)}const hq=1e3;function fq(t,e){for(let s=0;s<hq;s++){const n=op(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const mq={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},pq={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},gq={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function xq(t){const e=z.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=se(),[p,g]=V.useState(i),[x,b]=V.useState(o),[v,y]=V.useState(Or),[_,L]=V.useState(null),[w,S]=V.useState(s);s!==w&&(S(s),s&&(g(i),b(o),y(Or),L(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=pe=>{!pe&&!f&&(L(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const T=j;let N;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(N=async pe=>{pe.preventDefault();const de=p.trim(),Z=x.trim();if(!de||!Z||f)return;const fe=xm(Z);if(fe){L(fe);return}const ue=d?.({name:de,path:Z});if(ue){L(ue);return}L(null),await u({name:de,path:Z,templateKey:k&&v!==Or?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=N):N=e[10];const C=N,A=_??a,P=mq[n];let R;e[11]!==m||e[12]!==P?(R=m(P),e[11]=m,e[12]=P,e[13]=R):R=e[13];let E;e[14]!==R?(E=r.jsx(os,{children:r.jsx(At,{children:R})}),e[14]=R,e[15]=E):E=e[15];let M;e[16]!==f||e[17]!==k||e[18]!==m||e[19]!==v||e[20]!==c?(M=k&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),r.jsx(_8,{id:"page-form-template",value:v,onChange:y,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=v,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 $;e[24]!==I?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:I}),e[24]=I,e[25]=$):$=e[25];let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=pe=>g(pe.target.value),e[26]=O):O=e[26];let D;e[27]!==m?(D=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=D):D=e[28];let B;e[29]!==f||e[30]!==p||e[31]!==D?(B=r.jsx(rt,{id:"page-form-name",value:p,onChange:O,placeholder:D,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=D,e[32]=B):B=e[32];let F;e[33]!==B||e[34]!==$?(F=r.jsxs("div",{className:"space-y-1.5",children:[$,B]}),e[33]=B,e[34]=$,e[35]=F):F=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let H;e[38]!==U?(H=r.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>b(pe.target.value),e[40]=W):W=e[40];let q;e[41]!==m?(q=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=q):q=e[42];let ee;e[43]!==f||e[44]!==x||e[45]!==q?(ee=r.jsx(rt,{id:"page-form-path",value:x,onChange:W,placeholder:q,disabled:f}),e[43]=f,e[44]=x,e[45]=q,e[46]=ee):ee=e[46];let X;e[47]!==H||e[48]!==ee?(X=r.jsxs("div",{className:"space-y-1.5",children:[H,ee]}),e[47]=H,e[48]=ee,e[49]=X):X=e[49];let Y;e[50]!==A?(Y=A&&r.jsx("p",{className:"text-xs text-destructive",children:A}),e[50]=A,e[51]=Y):Y=e[51];let G;e[52]!==F||e[53]!==X||e[54]!==Y||e[55]!==M?(G=r.jsxs("div",{className:"space-y-4 py-4",children:[M,F,X,Y]}),e[52]=F,e[53]=X,e[54]=Y,e[55]=M,e[56]=G):G=e[56];let J;e[57]!==h?(J=()=>h(!1),e[57]=h,e[58]=J):J=e[58];let oe;e[59]!==m?(oe=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=oe):oe=e[60];let le;e[61]!==f||e[62]!==J||e[63]!==oe?(le=r.jsx(ae,{type:"button",variant:"outline",onClick:J,disabled:f,children:oe}),e[61]=f,e[62]=J,e[63]=oe,e[64]=le):le=e[64];let Q;e[65]!==f||e[66]!==p||e[67]!==x?(Q=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=Q):Q=e[68];let K;e[69]!==f||e[70]!==n||e[71]!==m?(K=f?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),m(gq[n])]}):m(pq[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=K):K=e[72];let te;e[73]!==Q||e[74]!==K?(te=r.jsx(ae,{type:"submit",disabled:Q,children:K}),e[73]=Q,e[74]=K,e[75]=te):te=e[75];let ne;e[76]!==le||e[77]!==te?(ne=r.jsxs(In,{children:[le,te]}),e[76]=le,e[77]=te,e[78]=ne):ne=e[78];let re;e[79]!==C||e[80]!==G||e[81]!==ne||e[82]!==E?(re=r.jsx(jt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:C,children:[E,G,ne]})}),e[79]=C,e[80]=G,e[81]=ne,e[82]=E,e[83]=re):re=e[83];let he;return e[84]!==T||e[85]!==s||e[86]!==re?(he=r.jsx(Ct,{open:s,onOpenChange:T,children:re}),e[84]=T,e[85]=s,e[86]=re,e[87]=he):he=e[87],he}function bq(t){const e=z.c(70),{open:s,blockKey:n,initialName:i,isPending:o,onSubmit:l,onOpenChange:a}=t,c=o===void 0?!1:o,d=se(),[u,h]=V.useState(i),[f,m]=V.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=W=>{!W&&!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 W=>{W.preventDefault();const q=u.trim();!q||c||await l(q)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx(At,{children:v}),e[9]=v,e[10]=y):y=e[10];let _;e[11]!==d?(_=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=_):_=e[12];let L;e[13]!==_?(L=r.jsx(_n,{children:_}),e[13]=_,e[14]=L):L=e[14];let w;e[15]!==y||e[16]!==L?(w=r.jsxs(os,{children:[y,L]}),e[15]=y,e[16]=L,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>h(W.target.value),e[22]=j):j=e[22];let T;e[23]!==c||e[24]!==u?(T=r.jsx(rt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=T):T=e[25];let N;e[26]!==k||e[27]!==T?(N=r.jsxs("div",{className:"space-y-1.5",children:[k,T]}),e[26]=k,e[27]=T,e[28]=N):N=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let A;e[31]!==C?(A=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=A):A=e[32];let P;e[33]!==n?(P=r.jsx(rt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=P):P=e[34];let R;e[35]!==A||e[36]!==P?(R=r.jsxs("div",{className:"space-y-1.5",children:[A,P]}),e[35]=A,e[36]=P,e[37]=R):R=e[37];let E;e[38]!==N||e[39]!==R?(E=r.jsxs("div",{className:"space-y-4 py-4",children:[N,R]}),e[38]=N,e[39]=R,e[40]=E):E=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 $;e[45]!==c||e[46]!==M||e[47]!==I?($=r.jsx(ae,{type:"button",variant:"outline",onClick:M,disabled:c,children:I}),e[45]=c,e[46]=M,e[47]=I,e[48]=$):$=e[48];let O;e[49]!==c||e[50]!==u?(O=!u.trim()||c,e[49]=c,e[50]=u,e[51]=O):O=e[51];let D;e[52]!==c||e[53]!==d?(D=c?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=D):D=e[54];let B;e[55]!==O||e[56]!==D?(B=r.jsx(ae,{type:"submit",disabled:O,children:D}),e[55]=O,e[56]=D,e[57]=B):B=e[57];let F;e[58]!==$||e[59]!==B?(F=r.jsxs(In,{children:[$,B]}),e[58]=$,e[59]=B,e[60]=F):F=e[60];let U;e[61]!==b||e[62]!==E||e[63]!==F||e[64]!==w?(U=r.jsx(jt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[w,E,F]})}),e[61]=b,e[62]=E,e[63]=F,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=r.jsx(Ct,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function vq(t){const e=z.c(7),{type:s}=t,n=QA[s];let i;e[0]!==n?(i=r.jsx(We,{asChild:!0,children:r.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 o=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==o?(l=r.jsx(qe,{side:"left",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs(Ge,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const K9={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},up=["posts","authors","categories"],ic={posts:"post",authors:"author",categories:"category"};function rc(t){return up.includes(t)}const hp={posts:"post",authors:"author",categories:"category"},X8={posts:K9.post,authors:K9.author,categories:K9.category},yq=Object.fromEntries(Object.entries(X8).map(([t,e])=>[e,t]));function _q(t){return typeof t=="string"?yq[t]??null:null}function Wr(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function gs(t){return typeof t=="string"?t:""}function Lq(t,e){switch(t){case"posts":return{label:gs(e.title)||"Untitled post",subtitle:gs(e.slug)};case"authors":return{label:gs(e.name)||"Unnamed author",subtitle:gs(e.email)};case"categories":return{label:gs(e.name)||"Unnamed category",subtitle:gs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function J8(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Wr(n);if(!i)continue;const o=_q(i.__resolveType);if(!o)continue;const l=Wr(i[hp[o]])??{},{label:a,subtitle:c}=Lq(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of up)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function wq(t,e){return J8(t)[e]}function Ic(t,e){return wq(t,e).map(s=>({key:s.key,payload:uu(Wr(t[s.key])??void 0,e)}))}const _3=Object.freeze({});function uu(t,e){return t?Wr(t[hp[e]])??_3:_3}function Hd(t,e,s){return{name:t,__resolveType:X8[e],[hp[e]]:s}}function Z8(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function Mae({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:gs(Wr(f)?.[s]),l=f=>typeof f=="string"?f:gs(Wr(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>gs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>gs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:gs(m.name)||gs(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)||o(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 Eo(t){return Array.isArray(t)?t:[]}function ur(t){if(typeof t=="string")return t;const e=Wr(t);return e?gs(e.slug):""}function Sq(t){if(typeof t=="string")return t;const e=Wr(t);return e?gs(e.email):""}function kq(t){const e=[];return gs(t.title).trim()||e.push("Title"),gs(t.slug).trim()||e.push("Slug"),Eo(t.categories).map(ur).filter(Boolean).length===0&&e.push("Category"),gs(t.excerpt).trim()||e.push("Excerpt"),gs(t.image).trim()||e.push("Cover image"),e}function e7(t){return Ic(t,"posts").map(({key:e,payload:s})=>({key:e,title:gs(s.title)||"Untitled post",slug:gs(s.slug),date:gs(s.date),categorySlugs:Eo(s.categories).map(ur).filter(Boolean),authorEmails:Eo(s.authors).map(Sq).filter(Boolean),missing:kq(s)}))}function jq(t,e){const s=Eo(t.categories);return s.some(n=>ur(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Cq(t,e){const s=Eo(t.categories);return s.length===1&&ur(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function $ae(t,e,s){const n=Eo(t.categories);if(!n.some(a=>ur(a)===e))return t;const i=n.map(a=>{const c=ur(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=ur(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function Nq(t,e){const s=Eo(t.categories);return s.some(n=>ur(n)===e)?{...t,categories:s.filter(n=>ur(n)!==e)}:t}function L3(t){return{...t,dateModified:new Date().toISOString()}}function of(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 w3(t,e){const s=`collections/blog/${e}/${of(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Vq(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${of(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${of(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Tq={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"}},S3="Box";function Eq(t){return t.startsWith("site/")?"site":"app"}function Aq(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function La(...t){for(const e of t)if(e!==void 0)return e}function Oae(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const o of Object.keys(i)){if(!Dq(o)||e.has(o))continue;e.add(o);const l=to(o,t),a=Pq(o),c=Tq[a],d=Eq(o),u=(d==="site"?La(l.title,c?.title):La(c?.title,l.title))??a,h=d==="site"?La(l.description,c?.description):La(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Aq(f)?f:void 0,p=m!==void 0?c?.iconName??S3:La(f,c?.iconName)??S3;s.push({resolveType:o,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function Pq(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Rq=["blog/sections/blocks/","site/sections/Blog/Post/"];function Dq(t){return Rq.some(e=>t.startsWith(e))}function t7({orgSlug:t,virtualMcpId:e,branch:s}){return Fe.decofile(`${t}/${e}/${s}`)}function Iq({orgSlug:t,virtualMcpId:e,branch:s}){return Fe.liveMeta(t,e,s)}function Mq({orgSlug:t,virtualMcpId:e,branch:s},n){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${n}`}async function s7(t,e,s,n){const i=await fetch(Mq(t,e),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s)});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error??`${n} (${i.status})`)}return i.json()}function $q(t){const e=z.c(11),s=Qt();let n;e[0]!==t?(n=a=>{const{blockKey:c,data:d}=a;return s7(t,"write",{path:Xl(t.packagePath,Z8(c)),content:JSON.stringify(d,null,2)},"Write failed")},e[0]=t,e[1]=n):n=e[1];let i;e[2]!==t||e[3]!==s?(i=async a=>{const{blockKey:c,data:d}=a,u=t7(t);await s.cancelQueries({queryKey:u});const h=s.getQueryData(u);return s.setQueryData(u,f=>({...f??{},[c]:d})),{previous:h,queryKey:u}},e[2]=t,e[3]=s,e[4]=i):i=e[4];let o;e[5]!==s?(o=(a,c,d)=>{d?.queryKey&&s.setQueryData(d.queryKey,d.previous)},e[5]=s,e[6]=o):o=e[6];let l;return e[7]!==n||e[8]!==i||e[9]!==o?(l={mutationFn:n,onMutate:i,onError:o},e[7]=n,e[8]=i,e[9]=o,e[10]=l):l=e[10],Rt(l)}function Oq(t){const e=Qt();return Rt({mutationFn:({blockKey:s})=>s7(t,"unlink",{path:Xl(t.packagePath,Z8(s))},"Delete failed"),onMutate:async({blockKey:s})=>{const n=t7(t);await e.cancelQueries({queryKey:n});const i=e.getQueryData(n);return e.setQueryData(n,o=>{if(!o)return o;const{[s]:l,...a}=o;return a}),{previous:i,queryKey:n}},onError:(s,n,i)=>{i?.queryKey&&e.setQueryData(i.queryKey,i.previous)},onSuccess:()=>{e.invalidateQueries({queryKey:Iq(t)})}})}function Bq({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=se(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=V.useState(!1),[h,f]=V.useState(c),[m,p]=V.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async y=>{if(!i||m)return;let _;try{_=JSON.parse(y)}catch{me.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(_),me.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(L){me.error(o("sectionsEditor.pageJsonDialog.saveError",{error:L instanceof Error?L.message:String(L)}))}finally{p(!1)}};return r.jsx(Ct,{open:t,onOpenChange:e,children:r.jsxs(jt,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(os,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx(At,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(ae,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(Gn,{size:12}):r.jsx(on,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(ae,{size:"sm",onClick:()=>v(h),disabled:!x||m,className:"h-7 text-xs",children:o(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",o("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"h-[70vh]",children:r.jsx(Qc,{code:c,language:"json",readOnly:g,height:"100%",onChange:y=>f(y??""),onSave:y=>{v(y)}})})]})})}function Yn(t){const e=z.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,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,v=a==="global";let y;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(y=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(qe,{side:"right",children:[c," variants"]})]})}):n?r.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):r.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",v?"bg-global-section/15":"bg-muted"),children:r.jsx(s,{size:16,className:ie("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:fm}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=y):y=e[5];const _=y,L=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==L?(w=ie("group relative flex min-w-0 items-center rounded-md transition-colors",L),e[6]=L,e[7]=w):w=e[7];let S;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(S=u&&r.jsx("span",{className:ie("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:zq,children:r.jsx(Gl,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=S):S=e[13];const k=m&&!l&&"text-destructive";let j;e[14]!==k?(j=ie("block truncate text-sm font-medium",k),e[14]=k,e[15]=j):j=e[15];let T;e[16]!==j||e[17]!==i?(T=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=T):T=e[18];const N=l?"text-accent-foreground/70":"text-muted-foreground";let C;e[19]!==N?(C=ie("block truncate text-xs",N),e[19]=N,e[20]=C):C=e[20];let A;e[21]!==o||e[22]!==C?(A=r.jsx("span",{className:C,children:o}),e[21]=o,e[22]=C,e[23]=A):A=e[23];let P;e[24]!==A||e[25]!==T?(P=r.jsxs("span",{className:"min-w-0 flex-1",children:[T,A]}),e[24]=A,e[25]=T,e[26]=P):P=e[26];let R;e[27]!==l||e[28]!==m||e[29]!==p?(R=m&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(fn,{size:14})})}),p&&r.jsx(qe,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=R):R=e[30];let E;e[31]!==x||e[32]!==_||e[33]!==P||e[34]!==R||e[35]!==d?(E=r.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:[_,P,R,d]}),e[31]=x,e[32]=_,e[33]=P,e[34]=R,e[35]=d,e[36]=E):E=e[36];let M;e[37]!==l||e[38]!==b?(M=b&&r.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=M):M=e[39];let I;return e[40]!==E||e[41]!==M||e[42]!==w||e[43]!==S?(I=r.jsxs("div",{className:w,children:[S,E,M]}),e[40]=E,e[41]=M,e[42]=w,e[43]=S,e[44]=I):I=e[44],I}function zq(t){return t.stopPropagation()}function Dr(t){const e=z.c(10),{icon:s,title:n,description:i}=t;let o;e[0]!==s?(o=s&&r.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==n?(l=r.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&r.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]!==o||e[7]!==l||e[8]!==a?(c=r.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:[o,l,a]}),e[6]=o,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Fq="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function i9(t){return Hs(t)?.metadata?.fieldDescriptionTooltips??!1}function fp(t){const e=z.c(9),{description:s,virtualMcpId:n,children:i}=t,o=i9(n);if(!s||!o)return i;let l;e[0]!==i?(l=V.cloneElement(i,{className:ie(i.props.className,Fq)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx(We,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=r.jsx(qe,{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=r.jsxs(Ge,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Ps(t){const e=z.c(17),{htmlFor:s,label:n,description:i,labelClassName:o,virtualMcpId:l}=t;if(!i9(l)){let u;e[0]!==s||e[1]!==n||e[2]!==o?(u=r.jsx(Et,{htmlFor:s,className:o,children:n}),e[0]=s,e[1]=n,e[2]=o,e[3]=u):u=e[3];let h;e[4]!==i?(h=i&&r.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=r.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]!==o?(c=r.jsx(Et,{htmlFor:s,className:o,children:n}),e[9]=s,e[10]=n,e[11]=o,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==l?(d=r.jsx(fp,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}var Uq=Ki.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")}}}),Kq=Uq,Hq=20,n7=(t,e=0)=>{const s=[];return!t.children.length||e>Hq||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...n7(n,e+1))}),s},Wq=t=>{if(!t.children.length)return;const e=n7(t);e&&e.forEach(s=>{var n,i;const o=s.getAttribute("style"),l=(i=(n=s.parentElement)==null?void 0:n.closest("span"))==null?void 0:i.getAttribute("style");s.setAttribute("style",`${l};${o}`)})},i7=Cw.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Wq(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",o1(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.isTextblock)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),qq=Ki.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.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()}}}),r7=Ki.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.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()}}}),Gq=Ki.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>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()}}}),o7=Ki.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>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()}}}),Yq=Ki.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>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()}}});Ki.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(qq.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(r7.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Gq.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(o7.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Yq.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(i7.configure(this.options.textStyle)),t}});const Qq=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function Xq(t){const e=z.c(30),{editor:s,currentColor:n,open:i,onOpenChange:o}=t,l=se(),[a,c]=V.useState("#000000");let d;e[0]!==s||e[1]!==o?(d=w=>{s.chain().focus().setColor(w).run(),o(!1)},e[0]=s,e[1]=o,e[2]=d):d=e[2];const u=d;let h;e[3]!==s||e[4]!==o?(h=()=>{s.chain().focus().unsetColor().run(),o(!1)},e[3]=s,e[4]=o,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]!==o||e[9]!==i?(g=()=>o(!i),e[8]=o,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(ku,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let v;e[12]!==b?(v=r.jsxs("span",{className:"relative flex flex-col items-center",children:[x,r.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=v):v=e[13];let y;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(y=r.jsx(zt,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=y):y=e[18];let _;e[19]!==u||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==o||e[24]!==i||e[25]!==l?(_=i&&r.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:w=>{w.currentTarget.contains(w.relatedTarget)||o(!1)},children:[r.jsx("div",{className:"grid grid-cols-6 gap-1",children:Qq.map(w=>r.jsx("button",{type:"button","aria-label":w,"aria-pressed":n===w,onMouseDown:eG,onClick:()=>u(w),className:ie("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===w&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:w}},w))}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.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:[r.jsx("input",{type:"color",value:a,onMouseDown:Zq,onChange:w=>c(w.target.value),onBlur:()=>u(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),r.jsx("button",{type:"button",onMouseDown:Jq,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]=o,e[24]=i,e[25]=l,e[26]=_):_=e[26];let L;return e[27]!==_||e[28]!==y?(L=r.jsxs("div",{className:"relative",children:[y,_]}),e[27]=_,e[28]=y,e[29]=L):L=e[29],L}function Jq(t){return t.preventDefault()}function Zq(t){return t.stopPropagation()}function eG(t){return t.preventDefault()}const Wd=[1,2,3,4,5,6];function tG(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 sG=8,nG=128,iG=16,k3=1;function rG({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o,inline:l=!1}){const a=se(),c=typeof e=="string"?e:"",d=V.useRef(s);d.current=s;const[u,h]=V.useState(!1),[f,m]=V.useState(!1),p=n1({extensions:[i1.configure({heading:l?!1:{levels:[...Wd]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[Kq.configure({types:["heading","paragraph"]})],i7,o7,r7],content:c||"",editorProps:{attributes:{class:ie("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:L})=>{const w=L.getHTML(),S=l?tG(w):w;d.current(S==="<p></p>"||S===""?"":S)}}),g=$4({editor:p,selector:({editor:L})=>({bold:L?.isActive("bold")??!1,italic:L?.isActive("italic")??!1,underline:L?.isActive("underline")??!1,strike:L?.isActive("strike")??!1,headingLevel:Wd.find(w=>L?.isActive("heading",{level:w})??!1)??0,fontSize:L?.getAttributes("textStyle").fontSize??null,color:L?.getAttributes("textStyle").color??null,bulletList:L?.isActive("bulletList")??!1,orderedList:L?.isActive("orderedList")??!1,link:L?.isActive("link")??!1,alignLeft:L?.isActive({textAlign:"left"})??!1,alignCenter:L?.isActive({textAlign:"center"})??!1,alignRight:L?.isActive({textAlign:"right"})??!1,alignJustify:L?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=L=>{const w=p.chain().focus();if(L==="paragraph"){w.setParagraph().run();return}const S=Wd.find(k=>`h${k}`===L);S&&w.setHeading({level:S}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,y=Number.isFinite(v)?v:iG,_=L=>{const w=Math.min(nG,Math.max(sG,L));p.chain().focus().setFontSize(`${w}px`).run()};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ps,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),r.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[r.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:[r.jsx(zt,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:r.jsx(m5,{size:14})}),r.jsx(zt,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:r.jsx(p5,{size:14})}),r.jsx(zt,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:r.jsx(OS,{size:14})}),r.jsx(zt,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:r.jsx(g5,{size:14})}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs(xs,{value:x,onValueChange:b,children:[r.jsx(bs,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:L=>L.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:r.jsx(js,{})}),r.jsxs(vs,{children:[r.jsx(kt,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),Wd.map(L=>r.jsx(kt,{value:`h${L}`,children:a("sectionsEditor.richTextField.styleHeading",{level:L})},L))]})]})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(zt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>_(y-k3),children:r.jsx(b1,{size:14})}),r.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:y}),r.jsx(zt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>_(y+k3),children:r.jsx(Nt,{size:14})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(Xq,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(zt,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:r.jsx(U1,{size:14})}),r.jsx(zt,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:r.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(EO,{editor:p,active:g.link,open:u,onOpenChange:h}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(zt,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:r.jsx(mS,{size:14})}),r.jsx(zt,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:r.jsx(BS,{size:14})}),r.jsx(zt,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:r.jsx(zS,{size:14})}),r.jsx(zt,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:r.jsx(FS,{size:14})})]})]}),r.jsx(r1,{editor:p})]})]})}const yl=t=>String(t).padStart(2,"0"),oG="1900-01-01",lG="2099-12-31",aG="1900-01-01T00:00",cG="2099-12-31T23:59";function dG(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()}-${yl(s.getUTCMonth()+1)}-${yl(s.getUTCDate())}`}function uG(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function hG(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${yl(e.getMonth()+1)}-${yl(e.getDate())}T${yl(e.getHours())}:${yl(e.getMinutes())}`}function fG(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function mG(t){const e=z.c(41),{id:s,withTime:n,value:i,onChange:o,calendarLabel:l}=t,[a,c]=V.useState(!1);let d;e[0]!==n?(d=$=>n?hG($):dG($),e[0]=n,e[1]=d):d=e[1];const u=d;let h;e[2]!==n?(h=$=>n?fG($):uG($),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]=V.useState(m),[x,b]=V.useState(i);if(i!==x){b(i);const $=u(i);$!==p&&g($)}let v;e[7]!==o||e[8]!==f?(v=$=>{g($.target.value),o(f($.target.value))},e[7]=o,e[8]=f,e[9]=v):v=e[9];const y=v;let _;if(e[10]!==i){const $=i?new Date(i):null;_=$&&!Number.isNaN($.getTime())?$:null,e[10]=i,e[11]=_}else _=e[11];const L=_;let w;e[12]!==o||e[13]!==L||e[14]!==u||e[15]!==n?(w=$=>{if(!$)return;n&&L?$.setHours(L.getHours(),L.getMinutes(),0,0):$.setHours(0,0,0,0);const O=$.toISOString();g(u(O)),b(O),o(O),c(!1)},e[12]=o,e[13]=L,e[14]=u,e[15]=n,e[16]=w):w=e[16];const S=w,k=n?"datetime-local":"date",j=n?aG:oG,T=n?cG:lG;let N;e[17]!==u||e[18]!==i?(N=()=>g(u(i)),e[17]=u,e[18]=i,e[19]=N):N=e[19];let C;e[20]!==y||e[21]!==s||e[22]!==p||e[23]!==N||e[24]!==k||e[25]!==j||e[26]!==T?(C=r.jsx(rt,{id:s,type:k,min:j,max:T,value:p,onChange:y,onBlur:N,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=y,e[21]=s,e[22]=p,e[23]=N,e[24]=k,e[25]=j,e[26]=T,e[27]=C):C=e[27];let A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(ar,{className:"h-4 w-4"}),e[28]=A):A=e[28];let P;e[29]!==l?(P=r.jsx(us,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:A})}),e[29]=l,e[30]=P):P=e[30];const R=L??void 0;let E;e[31]!==S||e[32]!==R?(E=r.jsx(ys,{className:"w-auto p-0",align:"end",onCloseAutoFocus:pG,children:r.jsx(l1,{mode:"single",selected:R,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=R,e[33]=E):E=e[33];let M;e[34]!==a||e[35]!==P||e[36]!==E?(M=r.jsxs(_s,{open:a,onOpenChange:c,children:[P,E]}),e[34]=a,e[35]=P,e[36]=E,e[37]=M):M=e[37];let I;return e[38]!==C||e[39]!==M?(I=r.jsxs("div",{className:"flex gap-1",children:[C,M]}),e[38]=C,e[39]=M,e[40]=I):I=e[40],I}function pG(t){return t.preventDefault()}function qd(t){const e=z.c(76),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=typeof n=="string"?n:"",u=s.format;if(u==="rich-text"||u==="rich-text-inline"||u==="html"){const v=u==="rich-text-inline";let y;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==a||e[4]!==s||e[5]!==v||e[6]!==n?(y=r.jsx(rG,{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a,inline:v}),e[0]=l,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=v,e[6]=n,e[7]=y):y=e[7],y}if(u==="textarea"||u==="markdown"){const v=a?.virtualMcpId;let y;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==v?(y=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=v,e[12]=y):y=e[12];let _;e[13]!==i?(_=S=>i(S.target.value),e[13]=i,e[14]=_):_=e[14];let L;e[15]!==o||e[16]!==d||e[17]!==_?(L=r.jsx(Ur,{id:o,value:d,onChange:_,rows:4}),e[15]=o,e[16]=d,e[17]=_,e[18]=L):L=e[18];let w;return e[19]!==y||e[20]!==L?(w=r.jsxs("div",{className:"space-y-2",children:[y,L]}),e[19]=y,e[20]=L,e[21]=w):w=e[21],w}if(u==="date"||u==="date-time"){const v=a?.virtualMcpId;let y;e[22]!==l||e[23]!==o||e[24]!==s.description||e[25]!==v?(y=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[22]=l,e[23]=o,e[24]=s.description,e[25]=v,e[26]=y):y=e[26];const _=u==="date-time";let L;e[27]!==c?(L=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=L):L=e[28];let w;e[29]!==i||e[30]!==o||e[31]!==d||e[32]!==_||e[33]!==L?(w=r.jsx(mG,{id:o,withTime:_,value:d,onChange:i,calendarLabel:L}),e[29]=i,e[30]=o,e[31]=d,e[32]=_,e[33]=L,e[34]=w):w=e[34];let S;return e[35]!==y||e[36]!==w?(S=r.jsxs("div",{className:"space-y-2",children:[y,w]}),e[35]=y,e[36]=w,e[37]=S):S=e[37],S}if(u==="color-input"||u==="color"){const v=a?.virtualMcpId;let y;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==v?(y=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=v,e[42]=y):y=e[42];const _=d||"#000000";let L;e[43]!==i?(L=N=>i(N.target.value),e[43]=i,e[44]=L):L=e[44];let w;e[45]!==_||e[46]!==L?(w=r.jsx("input",{type:"color",value:_,onChange:L,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=_,e[46]=L,e[47]=w):w=e[47];let S;e[48]!==i?(S=N=>i(N.target.value),e[48]=i,e[49]=S):S=e[49];let k;e[50]!==o||e[51]!==d||e[52]!==S?(k=r.jsx(rt,{id:o,value:d,onChange:S,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=o,e[51]=d,e[52]=S,e[53]=k):k=e[53];let j;e[54]!==w||e[55]!==k?(j=r.jsxs("div",{className:"flex items-center gap-2",children:[w,k]}),e[54]=w,e[55]=k,e[56]=j):j=e[56];let T;return e[57]!==y||e[58]!==j?(T=r.jsxs("div",{className:"space-y-2",children:[y,j]}),e[57]=y,e[58]=j,e[59]=T):T=e[59],T}const h=a?.virtualMcpId;let f;e[60]!==l||e[61]!==o||e[62]!==s.description||e[63]!==h?(f=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:h}),e[60]=l,e[61]=o,e[62]=s.description,e[63]=h,e[64]=f):f=e[64];const m=u==="url"?"url":"text";let p;e[65]!==i?(p=v=>i(v.target.value),e[65]=i,e[66]=p):p=e[66];const g=s.default!=null?String(s.default):void 0;let x;e[67]!==o||e[68]!==d||e[69]!==m||e[70]!==p||e[71]!==g?(x=r.jsx(rt,{id:o,type:m,value:d,onChange:p,placeholder:g,className:"h-10"}),e[67]=o,e[68]=d,e[69]=m,e[70]=p,e[71]=g,e[72]=x):x=e[72];let b;return e[73]!==f||e[74]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[f,x]}),e[73]=f,e[74]=x,e[75]=b):b=e[75],b}const gG=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,xG=/^[+-]?\d*$/;function bG(t,e){return(e?xG:gG).test(t)}function vG(t){const e=z.c(16),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,u]=V.useState(c),[h,f]=V.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]!==o||e[2]!==s.description||e[3]!==m?(p=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=o,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=y=>{const _=y.target.value,L=s.type==="integer";if(_!==""&&!bG(_,L))return;u(_);const w=Number(_);i(_===""||Number.isNaN(w)?void 0:w)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==o||e[9]!==d||e[10]!==g||e[11]!==x?(b=r.jsx(rt,{id:o,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=o,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let v;return e[13]!==p||e[14]!==b?(v=r.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=v):v=e[15],v}function yG(t){const e=z.c(14),{value:s,onChange:n,path:i,label:o,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let u;e[0]!==o||e[1]!==i||e[2]!==l.description||e[3]!==d?(u=r.jsx(Ps,{htmlFor:i,label:o,description:l.description,virtualMcpId:d}),e[0]=o,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=r.jsx(Mi,{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=r.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 mp="__enum_empty__";function pp(t){return t===""?mp:String(t)}function _G(t,e){if(t===mp)return"";const s=e.find(n=>pp(n)===t);return s!==void 0?s:t}function LG(t,e){return t==null?e.some(s=>s==="")?mp:void 0:pp(t)}function wG(t){return t===""?"":String(t)}function SG(t){const e=z.c(32),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se();let d;e[0]!==s.enum?(d=s.enum??[],e[0]=s.enum,e[1]=d):d=e[1];const u=d;let h;e[2]!==u||e[3]!==n?(h=LG(n,u),e[2]=u,e[3]=n,e[4]=h):h=e[4];const f=h,m=a?.virtualMcpId;let p;e[5]!==l||e[6]!==o||e[7]!==s.description||e[8]!==m?(p=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:m}),e[5]=l,e[6]=o,e[7]=s.description,e[8]=m,e[9]=p):p=e[9];let g;e[10]!==i||e[11]!==u?(g=S=>i(_G(S,u)),e[10]=i,e[11]=u,e[12]=g):g=e[12];let x;e[13]!==c?(x=c("sectionsEditor.enumField.selectPlaceholder"),e[13]=c,e[14]=x):x=e[14];let b;e[15]!==x?(b=r.jsx(js,{placeholder:x}),e[15]=x,e[16]=b):b=e[16];let v;e[17]!==o||e[18]!==b?(v=r.jsx(bs,{id:o,className:"h-10",children:b}),e[17]=o,e[18]=b,e[19]=v):v=e[19];let y;e[20]!==u?(y=u.map(kG),e[20]=u,e[21]=y):y=e[21];let _;e[22]!==y?(_=r.jsx(vs,{children:y}),e[22]=y,e[23]=_):_=e[23];let L;e[24]!==f||e[25]!==_||e[26]!==g||e[27]!==v?(L=r.jsxs(xs,{value:f,onValueChange:g,children:[v,_]}),e[24]=f,e[25]=_,e[26]=g,e[27]=v,e[28]=L):L=e[28];let w;return e[29]!==L||e[30]!==p?(w=r.jsxs("div",{className:"space-y-2",children:[p,L]}),e[29]=L,e[30]=p,e[31]=w):w=e[31],w}function kG(t){const e=pp(t);return r.jsx(kt,{value:e,children:wG(t)},e)}const l7={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function a7(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function oc(t){return a7(t)?.variants?.[0]?.rule?.__resolveType===Jl}function j3(t){return{__resolveType:Fo,variants:[{value:t,rule:{__resolveType:Jl}}]}}function c7(t){return oc(t)?a7(t)?.variants?.[0]?.value:t}function za(t){return oc(t)?c7(t):t}function gp(t){const e=t.__resolveType;if(typeof e!="string")return null;if(ln(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function jG(t){return t.includes("flags/multivariate")}function CG(t){return ds(t)}function NG(t,e){const s=[...t],n=new Set(s.map(o=>o.resolveType)),i=(o,l)=>{!o||n.has(o)||(n.add(o),s.push({resolveType:o,title:l??CG(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=gp(e.editorValue);o?.includes("/")&&i(o)}return s}function VG(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,o=i.__resolveType;if(typeof o=="string"){if(Bi(o)){const h=e.find(f=>f.resolveType===o);return h?h.resolveType:o}const d=e.find(h=>K2(h.resolveType,o));if(d)return d.resolveType;const u=e.find(h=>h.resolveType===o);if(u)return u.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(u=>u.discriminatorValue===l||u.resolveType===l||K2(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 C3(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=gp(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=ni(n,e);return i||(n.includes("/")?null:s??null)}function TG(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 d7(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!ln(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function EG(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=gp(s);return n&&jG(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function xp(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(o=>o.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(o=>typeof o.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:""}function AG(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function PG(t){if(Array.isArray(t.variants)){const e=t.variants,s=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof s?.value=="string")return s.value;const n=e.find(i=>typeof i.value=="string");if(n)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 u7(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(u7);const e=t;return e.__resolveType?PG(e)??t:h7(e)}function h7(t){const e={};for(const[s,n]of Object.entries(t))e[s]=u7(n);return e}function RG(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function f7(t){return t==null?"":Array.isArray(t)?t.map(f7).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function bp(t,e){if(!t.includes("{"))return;const s=h7(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return f7(RG(s,a))}).trim()||void 0}function DG(t){return t.replace(/<[^>]*>/g,"").trim()}function IG(t,e){if(e.includes("{"))return bp(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 lf(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=za(t);const i=d7(n);if(i&&(n=i),s?.titleBy){const l=IG(n,s.titleBy);if(l)return l}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=DG(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 o=n.__resolveType;if(typeof o=="string"&&o)return ds(o);if(s?.title){const l=bp(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function Gd(t){return t.normalize("NFC").trim()}function r9(t,e){const s=t.map((o,l)=>lf(o,l,e)),n=new Map;for(const o of s){const l=Gd(o);n.set(l,(n.get(l)??0)+1)}const i=new Set;return s.map((o,l)=>{let a=(n.get(Gd(o))??0)>1?`${o} ${l+1}`:o;for(;i.has(Gd(a));)a=`${a} ${l+1}`;return i.add(Gd(a)),a})}function H9(t,e,s,n){return!n||n.length<2?lf(t,e,s):r9(n,s)[e]??lf(t,e,s)}function MG(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 N3(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=MG(e);if(!s)return;const n=bp(s,t);if(!n)return;const i=xp(n)||n;return AG(i)}function m7(t){return t===Zl||t===Fo}function o9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function Xu(t,e){const s=t.__resolveType??"";if(!s)return null;if(ln(s)){const n=t.section??{};return p7(n,e)}if(m7(s)){const n=t.variants?.[0]?.value;return n?Xu(n,e):null}return!Bi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:o9(s,e)}function p7(t,e){const s=t.__resolveType??"";if(!s)return null;if(m7(s)){const n=t.variants?.[0]?.value;return n?Xu(n,e):null}return!Bi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:o9(s,e)}function g7(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!Bi(n)||!Object.hasOwn(e,n))return null;const i=o9(n,e);return i?{blockKey:n,...i}:null}function $G(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return o9(n,s)}if(e.isHidden){const o=(ln(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return Xu(o,s)}if(e.isLazy||ln(t.__resolveType)){const n=t.section??{};return p7(n,s)}return Xu(t,s)}function x7(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ao(t){return t.normalize("NFC").trim()}function rs(t,e){return Ao(t)===Ao(e)}function V3(t,e){return Ao(t).replace(/\s+/g,"").toLowerCase()===Ao(e).replace(/\s+/g,"").toLowerCase()}function OG(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||rs(e,t)||s?.arrayKey!=null&&rs(e,s.arrayKey)}function Yd(t,e,s,n){const i=Ao(s);if(t.some(l=>rs(l,i)||rs(l,s)))return t;const o=[...t];return OG(e,s,n)&&!o.some(l=>rs(l,e))&&o.push(e),o.push(s),o}function BG(t,e){return t.slice(0,t.length-e.length)}function zG(t,e,s){if(s.length===0)return s;const n=_l(t,e),i=s[0];return rs(i,n)||rs(i,t)?s.slice(1):s}function _l(t,e){return e.title??x7(t)}function Bae(t,e){return e.isMultivariateSectionTop?0:t-2}function zae(t,e){return e<=0?[]:t.slice(0,e)}function T3(t,e){const s=Ao(e);return t.findIndex(n=>Ao(n)===s)}function af(t,e){return t.type==="array"&&t.items||t9(t)?!0:Array.isArray(e)}function E3(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}const FG=["name","label","title","alt"];function UG(t){if(t==null||typeof t!="object"||Array.isArray(t))return;const e=t;for(const s of FG){const n=e[s];if(typeof n=="string"&&n.trim())return n}}function cf(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;const i=e.replace(/\s+\d+$/,"");if(Array.isArray(t)){for(const o of t){if(--s.n<=0)return!1;const l=UG(o);if(l&&(rs(l,e)||rs(l,i))||cf(o,e,s,n+1))return!0}return!1}for(const[o,l]of Object.entries(t))if(!o.startsWith("__")){if(--s.n<=0)return!1;if(cf(l,e,s,n+1))return!0}return!1}function mo(t,e,s,n,i){if(n.length===0)return null;const o=n[0];for(const a of t){const c=e[a];if(!c||!af(c,s[a]))continue;const d=_l(a,c);if(rs(o,d)||rs(o,a)||n.some(u=>rs(u,d)||rs(u,a)))return a}for(const a of t){const c=e[a];if(!c||!af(c,s[a]))continue;const d=s[a];if(!Array.isArray(d))continue;if(r9(d,c.items).some(h=>rs(h,o)))return a}for(const a of t){const c=e[a];if(c?.type!=="object"||!c.properties)continue;const d=Object.keys(c.properties),u=E3(s[a]),h=_l(a,c);if(mo(d,c.properties,u,n,i)||(rs(o,h)||rs(o,a))&&mo(d,c.properties,u,n.slice(1),i))return a}for(const a of t){const c=e[a];if(c?.type!=="inline-union"||!c.inlineUnionBranches?.length)continue;const d=E3(s[a]),u=_l(a,c);for(const h of c.inlineUnionBranches){const f=h.schema?.properties;if(!f)continue;const m=Object.keys(f);if(mo(m,f,d,n,i)||(rs(o,u)||rs(o,a))&&mo(m,f,d,n.slice(1),i))return a}}let l=null;for(const a of t){const c=e[a];if(c?.type!=="block-ref")continue;const d=_l(a,c);if(o!==d&&o!==a){const u=s[a],h=i?g7(u,i):null;if(cf(h?.data??u,o))return a;continue}if(n.length>1){const u=s[a];if(u&&typeof u=="object"&&!Array.isArray(u)){const h=n[1];if(Object.keys(u).some(m=>!m.startsWith("__")&&(V3(x7(m),h)||V3(m,h))))return a}}l||(l=a)}return l||null}function KG(t,e,s,n,i){return mo(t,e,s,n,i)}function HG(t,e,s,n,i,o){if(i.length===0||!s.properties)return!1;const l=Object.keys(s.properties);if(mo(l,s.properties,n,i,o))return!0;const a=i[0];return!rs(a,e)&&!rs(a,t)?!1:i.length>1||mo(l,s.properties,n,i.slice(1),o)!==null}function A3(t,e,s,n){const i=r9(t,e),o=n!=null?i[n]:void 0;return o!==void 0&&rs(o,s)?n:i.findIndex(l=>rs(l,s))}function WG(t,e,s,n,i){if(e.length===0)return null;for(let l=0;l<e.length;l++){const a=e[l],c=A3(s,n,a,i);if(c>=0)return{index:c,innerPath:e.slice(l+1)}}const o=e.findIndex(l=>rs(l,t));if(o>=0&&e.length>o+1){const l=e[o+1],a=A3(s,n,l,i);if(a>=0)return{index:a,innerPath:e.slice(o+2)}}return null}function W9(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===Zl}function qG(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>W9(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>W9(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>W9(s.resolveType)):!1}function GG(t,e){if(e==="global"||e==="sections"||t9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?qG(s):!1}function P3(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function b7(t){return t.map((e,s)=>({...e,index:s}))}function YG(t,e){if(e===t.length)return t;if(e<t.length)return b7(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 QG(t,e){const s=t.findIndex(o=>o.index===e),n=t.map(o=>o.index>e?{...o,index:o.index+1}:o),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function XG(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const JG="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ZG="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]",eY="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 R3(t,e){return ie("h-6 shrink-0 overflow-hidden",e?JG:t?eY:ZG)}function tY(t){const e=z.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Hl,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n&&r.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==s?(l=r.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs(r.Fragment,{children:[i,r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[o,l]})]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function sY(t){const e=z.c(63),{sortableId:s,labelText:n,imageSrc:i,hidden:o,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,u=se();let h;e[0]!==s?(h={id:s,animateLayoutChanges:oY},e[0]=s,e[1]=h):h=e[1];const{attributes:f,listeners:m,setNodeRef:p,transform:g,isDragging:x}=H0(h);let b;e[2]!==g?(b=ri.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let y;e[4]!==b||e[5]!==v?(y={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=y):y=e[6];const _=y;let L;e[7]!==a?(L=q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),a())},e[7]=a,e[8]=L):L=e[8];const w=x?"cursor-grabbing":"cursor-pointer";let S;e[9]!==w?(S=ie("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",w),e[9]=w,e[10]=S):S=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Hl,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let j;e[12]!==i?(j=i&&r.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=j):j=e[13];const T=o&&"line-through opacity-50";let N;e[14]!==T?(N=ie("min-w-0 flex-1 truncate text-sm",T),e[14]=T,e[15]=N):N=e[15];let C;e[16]!==n||e[17]!==N?(C=r.jsx("span",{className:N,children:n}),e[16]=n,e[17]=N,e[18]=C):C=e[18];let A;e[19]!==o||e[20]!==l||e[21]!==u?(A=l&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ie(R3(o===!0,o===!0)),onClick:q=>{q.stopPropagation(),l()},onPointerDown:rY,children:o?r.jsx(ZS,{size:14}):r.jsx(Zc,{size:14})})}),r.jsx(qe,{side:"bottom",children:u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=o,e[20]=l,e[21]=u,e[22]=A):A=e[22];let P;e[23]!==n||e[24]!==u?(P=u("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=u,e[25]=P):P=e[25];let R;e[26]!==o?(R=ie(R3(o===!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[26]=o,e[27]=R):R=e[27];let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(Hi,{size:14}),e[28]=E):E=e[28];let M;e[29]!==P||e[30]!==R?(M=r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":P,className:R,onClick:iY,onPointerDown:nY,children:E})}),e[29]=P,e[30]=R,e[31]=M):M=e[31];let I;e[32]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(on,{size:14}),e[32]=I):I=e[32];let $;e[33]!==u?($=u("sectionsEditor.arrayField.duplicate"),e[33]=u,e[34]=$):$=e[34];let O;e[35]!==c||e[36]!==$?(O=r.jsxs(Ze,{onClick:c,children:[I,$]}),e[35]=c,e[36]=$,e[37]=O):O=e[37];let D;e[38]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(Ks,{size:14}),e[38]=D):D=e[38];let B;e[39]!==u?(B=u("sectionsEditor.arrayField.delete"),e[39]=u,e[40]=B):B=e[40];let F;e[41]!==d||e[42]!==B?(F=r.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:d,children:[D,B]}),e[41]=d,e[42]=B,e[43]=F):F=e[43];let U;e[44]!==O||e[45]!==F?(U=r.jsxs(Yt,{align:"end",children:[O,F]}),e[44]=O,e[45]=F,e[46]=U):U=e[46];let H;e[47]!==M||e[48]!==U?(H=r.jsxs(qt,{children:[M,U]}),e[47]=M,e[48]=U,e[49]=H):H=e[49];let W;return e[50]!==f||e[51]!==n||e[52]!==m||e[53]!==a||e[54]!==p||e[55]!==_||e[56]!==C||e[57]!==A||e[58]!==H||e[59]!==L||e[60]!==S||e[61]!==j?(W=r.jsxs("div",{ref:p,style:_,...f,...m,role:"button",tabIndex:0,onClick:a,onKeyDown:L,className:S,title:n,children:[k,j,C,A,H]}),e[50]=f,e[51]=n,e[52]=m,e[53]=a,e[54]=p,e[55]=_,e[56]=C,e[57]=A,e[58]=H,e[59]=L,e[60]=S,e[61]=j,e[62]=W):W=e[62],W}function nY(t){return t.stopPropagation()}function iY(t){return t.stopPropagation()}function rY(t){return t.stopPropagation()}function oY(){return!1}function lY(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 o=t.__resolveType;if(typeof o=="string"&&s){const l=ni(o,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=ni(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function aY(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function Qd(t){const e=z.c(28),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,hasSiblingDrillDownFields:d,meta:u,decofile:h,onSaveReferencedBlock:f,containerResolveType:m,previewBaseUrl:p,onAddSectionItem:g,onRequestAddSection:x,sandbox:b}=t,v=a===void 0?[]:a,y=se(),_=i9(b?.virtualMcpId),L=Array.isArray(n)?n:[],w=s.items,S=aY(o),k={arrayKey:S,hasSiblingDrillDownFields:d},j=GG(s,S),T=!j&&w?.type==="object",[N,C]=V.useState(null),A=WG(l,v,L,w,N),P=A?.index??null;A===null?N!==null&&C(null):A.index!==N&&C(A.index);const[R,E]=V.useState(()=>P3(L.length)),[M,I]=V.useState(null),[$,O]=V.useState(o),[D,B]=V.useState(L.length),F=V.useRef(!1);$!==o?(O(o),B(L.length),E(P3(L.length)),C(null)):D!==L.length&&(B(L.length),E(xe=>YG(xe,L.length)));const U=(xe,Se,we)=>{const ze=we===void 0?L:we;return H9(za(xe),Se,w,ze)},H=xe=>{if(F.current)return;const Se=U(L[xe],xe);C(xe),c?.(Yd(v,l,Se,k))},W=xe=>{const Se=[...L,xe];i(Se);const we=Se.length-1;C(we);const ze=H9(xe,we,w,Se);c?.(Yd(v,l,ze,k))},q=()=>{const xe=w?.type,Se=w?.default!==void 0?w.default:xe==="object"?{}:xe==="block-ref"?(()=>{const Xe=w?.anyOfRefs?.[0]?.resolveType;return typeof Xe!="string"||ec(Xe)?{}:{__resolveType:Xe}})():xe==="number"||xe==="integer"?0:xe==="boolean"?!1:xe==="array"?[]:"",we=[...L,Se];i(we);const ze=we.length-1;C(ze);const Be=H9(Se,ze,w,we);c?.(Yd(v,l,Be,k))},ee=()=>{if(j){if(!p){me.error(y("sectionsEditor.arrayField.startPreviewServer"));return}if(x){x({append:W});return}me.error(y("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}q()},X=xe=>{const Se=L[xe],we=typeof structuredClone=="function"?structuredClone(Se):JSON.parse(JSON.stringify(Se??null)),ze=[...L.slice(0,xe+1),we,...L.slice(xe+1)];i(ze),E(Be=>QG(Be,xe))},Y=xe=>{const Se=L[xe],we=[...L];we[xe]=oc(Se)?c7(Se):j3(Se),i(we)},G=xe=>{i(L.filter((Se,we)=>we!==xe)),E(Se=>XG(Se,xe))},J=(xe,Se)=>{const we=[...L];if(we[xe]=oc(L[xe])?j3(Se):Se,i(we),xe===P&&P!==null){const ze=U(L[xe],xe),Be=U(we[xe],xe,we);if(ze!==Be){const Xe=T3(v,ze);if(Xe>=0){const Ve=[...v];Ve[Xe]=Be,c?.(Ve)}}}};let oe;e[0]===Symbol.for("react.memo_cache_sentinel")?(oe={activationConstraint:{distance:8}},e[0]=oe):oe=e[0];let le;e[1]===Symbol.for("react.memo_cache_sentinel")?(le={coordinateGetter:W0},e[1]=le):le=e[1];const Q=od(zi(Ho,oe),zi(Ko,le)),K=R.map(cY);let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te=xe=>{I(String(xe.active.id))},e[2]=te):te=e[2];const ne=te,re=xe=>{I(null);const{active:Se,over:we}=xe;if(!we||Se.id===we.id)return;const ze=K.indexOf(String(Se.id)),Be=K.indexOf(String(we.id));ze===-1||Be===-1||(E(Xe=>b7(No([...Xe],ze,Be))),i(No([...L],ze,Be)),F.current=!0,requestAnimationFrame(()=>{F.current=!1}))};let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he=()=>{I(null)},e[3]=he):he=e[3];const pe=he,de=M?R.find(xe=>xe.id===M):null,Z=de!=null?L[de.index]:void 0,fe=de!=null&&Z!==void 0?U(Z,de.index):null,ue=de!=null&&Z!==void 0?N3(za(Z),w):void 0;if(P!==null&&P<L.length){const xe=za(L[P]),Se=lY(xe,w,u,m,S),we=()=>{const ze=U(xe,P),Be=Yd(v,l,ze,k),Xe=T3(Be,ze);return Xe>=0?Be.slice(0,Xe+1):Be};return r.jsx("div",{className:"min-w-0",children:Se?.type==="object"&&Se.properties?r.jsx(gr,{schema:Se,value:xe,onChange:ze=>J(P,ze),basePath:`${o}.${P}`,breadcrumbPath:A?.innerPath??[],onBreadcrumbChange:ze=>{c?.([...we(),...ze])},meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:g,onRequestAddSection:x,sandbox:b}):Se?Ol({schema:Se,value:xe,onChange:ze=>J(P,ze),path:`${o}.${P}`,label:Se.title&&!Se.title.includes("{{")?Se.title:U(xe,P),breadcrumbPath:A?.innerPath??[],onBreadcrumbChange:ze=>{c?.([...we(),...ze])},meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:g,onRequestAddSection:x,sandbox:b}):null})}const ye="space-y-2",Le=b?.virtualMcpId;let Re;e[4]!==l?(Re=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[4]=l,e[5]=Re):Re=e[5];let De;e[6]!==s.description||e[7]!==Le||e[8]!==Re?(De=r.jsx(fp,{description:s.description,virtualMcpId:Le,children:Re}),e[6]=s.description,e[7]=Le,e[8]=Re,e[9]=De):De=e[9];const Ue=L.length>0&&r.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:L.length});let $e;e[10]!==De||e[11]!==Ue?($e=r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[De,Ue]}),e[10]=De,e[11]=Ue,e[12]=$e):$e=e[12];let je;e[13]!==s.description||e[14]!==_?(je=!_&&s.description&&r.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:s.description}),e[13]=s.description,e[14]=_,e[15]=je):je=e[15];const be=L.length>0&&r.jsx("div",{className:ie(M&&"cursor-grabbing"),children:r.jsxs(ad,{sensors:Q,collisionDetection:Nm,onDragStart:ne,onDragEnd:re,onDragCancel:pe,children:[r.jsx(K0,{items:K,strategy:U0,children:r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const xe=r9(L,w);return R.map(Se=>{const we=L[Se.index];if(we===void 0)return null;const ze=xe[Se.index]??U(we,Se.index),Be=N3(za(we),w);return r.jsx(sY,{sortableId:Se.id,labelText:ze,imageSrc:Be,hidden:oc(we),onToggleHidden:T?()=>Y(Se.index):void 0,onOpen:()=>H(Se.index),onDuplicate:()=>X(Se.index),onRemove:()=>G(Se.index)},Se.id)})})()})}),bn.createPortal(r.jsx(F0,{dropAnimation:l7,children:fe?r.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:r.jsx(tY,{labelText:fe,imageSrc:ue})}):null}),document.body)]})});let Ee;e[16]===Symbol.for("react.memo_cache_sentinel")?(Ee=r.jsx(Nt,{size:14}),e[16]=Ee):Ee=e[16];let _e;e[17]!==y||e[18]!==j?(_e=y(j?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem"),e[17]=y,e[18]=j,e[19]=_e):_e=e[19];let Ae;e[20]!==ee||e[21]!==_e?(Ae=r.jsxs("button",{type:"button",onClick:ee,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",children:[Ee,_e]}),e[20]=ee,e[21]=_e,e[22]=Ae):Ae=e[22];let Ce;return e[23]!==$e||e[24]!==je||e[25]!==be||e[26]!==Ae?(Ce=r.jsxs("div",{className:ye,children:[$e,je,be,Ae]}),e[23]=$e,e[24]=je,e[25]=be,e[26]=Ae,e[27]=Ce):Ce=e[27],Ce}function cY(t){return t.id}function dY(t){const e=z.c(50),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}=t;let x;e[0]!==a?(x=a===void 0?[]:a,e[0]=a,e[1]=x):x=e[1];const b=x,[v,y]=V.useState(!1),_=i9(g?.virtualMcpId);let L;e[2]!==n?(L=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=L):L=e[3];const w=L;if(!s.properties)return null;let S;e[4]!==o?(S=o.split(".").pop()??o,e[4]=o,e[5]=S):S=e[5];const k=S;let j;e[6]!==b||e[7]!==u||e[8]!==k||e[9]!==l||e[10]!==w||e[11]!==s?(j=HG(k,l,s,w,b,u),e[6]=b,e[7]=u,e[8]=k,e[9]=l,e[10]=w,e[11]=s,e[12]=j):j=e[12];const N=v||j,C=`${o}-fields`;let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=()=>y(uY),e[13]=A):A=e[13];let P;e[14]!==N?(P=r.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:N?r.jsx(fs,{size:16}):r.jsx(wn,{size:16})}),e[14]=N,e[15]=P):P=e[15];const R=g?.virtualMcpId;let E;e[16]!==l?(E=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[16]=l,e[17]=E):E=e[17];let M;e[18]!==s.description||e[19]!==R||e[20]!==E?(M=r.jsx(fp,{description:s.description,virtualMcpId:R,children:E}),e[18]=s.description,e[19]=R,e[20]=E,e[21]=M):M=e[21];let I;e[22]!==C||e[23]!==N||e[24]!==M||e[25]!==P?(I=r.jsxs("button",{type:"button","aria-expanded":N,"aria-controls":C,onClick:A,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:[P,M]}),e[22]=C,e[23]=N,e[24]=M,e[25]=P,e[26]=I):I=e[26];let $;e[27]!==s.description||e[28]!==_?($=!_&&s.description&&r.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[27]=s.description,e[28]=_,e[29]=$):$=e[29];let O;e[30]!==b||e[31]!==C||e[32]!==u||e[33]!==N||e[34]!==d||e[35]!==w||e[36]!==m||e[37]!==c||e[38]!==i||e[39]!==p||e[40]!==h||e[41]!==o||e[42]!==f||e[43]!==g||e[44]!==s?(O=N&&r.jsx("div",{id:C,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:r.jsx(gr,{schema:s,value:w,onChange:i,basePath:o,breadcrumbPath:b,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g})}),e[30]=b,e[31]=C,e[32]=u,e[33]=N,e[34]=d,e[35]=w,e[36]=m,e[37]=c,e[38]=i,e[39]=p,e[40]=h,e[41]=o,e[42]=f,e[43]=g,e[44]=s,e[45]=O):O=e[45];let D;return e[46]!==I||e[47]!==$||e[48]!==O?(D=r.jsxs("div",{className:"min-w-0 space-y-2",children:[I,$,O]}),e[46]=I,e[47]=$,e[48]=O,e[49]=D):D=e[49],D}function uY(t){return!t}function Fae(t,e,s,n,i){const o={...t[e]};if(i.length>1){const l=o.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),o.sections={...l,variants:a}}else o.sections=s;return o}function Uae(t){return structuredClone(t)}function Kae(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function v7(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 vp(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 yp(t){const e=z.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:o,onSubmit:l}=t,a=i===void 0?"":i,c=o===void 0?!1:o,[d,u]=V.useState(a),[h,f]=V.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=se();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx(At,{children:v}),e[9]=v,e[10]=y):y=e[10];let _;e[11]!==b?(_=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=_):_=e[12];let L;e[13]!==_?(L=r.jsx(_n,{children:_}),e[13]=_,e[14]=L):L=e[14];let w;e[15]!==y||e[16]!==L?(w=r.jsxs(os,{children:[y,L]}),e[15]=y,e[16]=L,e[17]=w):w=e[17];let S;e[18]!==b?(S=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=S):S=e[19];let k;e[20]!==S?(k=r.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:S}),e[20]=S,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 T;e[23]!==b?(T=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=T):T=e[24];let N;e[25]!==d||e[26]!==c||e[27]!==T?(N=r.jsx(rt,{id:"block-id",value:d,onChange:j,placeholder:T,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=T,e[28]=N):N=e[28];let C;e[29]!==k||e[30]!==N?(C=r.jsxs("div",{className:"py-4 space-y-2",children:[k,N]}),e[29]=k,e[30]=N,e[31]=C):C=e[31];let A;e[32]!==n?(A=()=>n(!1),e[32]=n,e[33]=A):A=e[33];let P;e[34]!==b?(P=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=P):P=e[35];let R;e[36]!==c||e[37]!==A||e[38]!==P?(R=r.jsx(ae,{type:"button",variant:"outline",onClick:A,disabled:c,children:P}),e[36]=c,e[37]=A,e[38]=P,e[39]=R):R=e[39];let E;e[40]!==d||e[41]!==c?(E=!d.trim()||c,e[40]=d,e[41]=c,e[42]=E):E=e[42];let M;e[43]!==c||e[44]!==b?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=M):M=e[45];let I;e[46]!==E||e[47]!==M?(I=r.jsx(ae,{type:"submit",disabled:E,children:M}),e[46]=E,e[47]=M,e[48]=I):I=e[48];let $;e[49]!==R||e[50]!==I?($=r.jsxs(In,{children:[R,I]}),e[49]=R,e[50]=I,e[51]=$):$=e[51];let O;e[52]!==x||e[53]!==C||e[54]!==$||e[55]!==w?(O=r.jsx(jt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:x,children:[w,C,$]})}),e[52]=x,e[53]=C,e[54]=$,e[55]=w,e[56]=O):O=e[56];let D;return e[57]!==p||e[58]!==s||e[59]!==O?(D=r.jsx(Ct,{open:s,onOpenChange:p,children:O}),e[57]=p,e[58]=s,e[59]=O,e[60]=D):D=e[60],D}function hY(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 fY(t){const e=z.c(13),{blockKey:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(kn,{size:11}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(We,{asChild:!0,children:r.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,o]})}),e[3]=o,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=r.jsx(qe,{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=r.jsxs(Ge,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function mY(t){const e=z.c(36),{path:s,open:n,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:u}=t,h=se(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=ie("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=r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?r.jsx(fs,{size:16}):r.jsx(wn,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==o?(b=r.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:o}),e[7]=o,e[8]=b):b=e[8];let v;e[9]!==c?(v=c&&r.jsx(fY,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let y;e[11]!==b||e[12]!==v?(y=r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=y):y=e[13];let _;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==y?(_=r.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,y]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=y,e[19]=_):_=e[19];let L;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(L=(d||u)&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":h("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:r.jsx(Hi,{size:16})})}),r.jsxs(Yt,{align:"end",className:"w-48",children:[c&&d&&r.jsxs(Ze,{onClick:d,children:[r.jsx(or,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.detach")]}),!c&&u&&r.jsxs(Ze,{onClick:u,children:[r.jsx(kn,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=L):L=e[24];let w;e[25]!==_||e[26]!==L?(w=r.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]}),e[25]=_,e[26]=L,e[27]=w):w=e[27];let S;e[28]!==f||e[29]!==l||e[30]!==n?(S=n&&r.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:r.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[28]=f,e[29]=l,e[30]=n,e[31]=S):S=e[31];let k;return e[32]!==w||e[33]!==S||e[34]!==p?(k=r.jsxs("div",{className:p,children:[w,S]}),e[32]=w,e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function D3(t){const e=z.c(42),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=se(),x=(s.anyOfRefs??[]).filter(xY),b=u&&n?g7(n,u):null,v=b?.data??n,y=b?null:d7(v),_=y??v,L=NG(x,{savedBlockKey:b?.blockKey,editorValue:v}),w=L.length>0?VG(v,L,b?.blockKey):L[0]?.resolveType??"",k=s.type==="block-ref"&&L.some(gY);let j;e[0]!==l||e[1]!==o?(j=l??(o.includes(".")?o.split(".")[0]:o),e[0]=l,e[1]=o,e[2]=j):j=e[2];const T=j;let N;e[3]!==a?(N=a??[],e[3]=a,e[4]=N):N=e[4];const C=N,A=k&&C[0]===T,P=A?C.slice(1):C,R=A?G=>{c?.([T,...G])}:c,[E,M]=V.useState(w),[I,$]=V.useState(w);I!==w&&($(w),M(w));const[O,D]=V.useState(()=>EG(v,b?.blockKey)),[B,F]=V.useState(!1);if(L.length>0){const G=E||w;let J;e[5]!==G?(J=je=>je.resolveType===G,e[5]=G,e[6]=J):J=e[6];const oe=L.find(J),le=C3(v,d,oe?.schema),Q=TG(le??oe?.schema??null,s.discriminatorKey),K=s.discriminatorKey,te=je=>{M(je);const be=L.find(Se=>Se.resolveType===je),Ee=C3(v,d,be?.schema),_e=new Set(Object.keys((Ee??be?.schema)?.properties??{})),Ae=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Ce=Object.fromEntries(Object.entries(Ae).filter(Se=>{const[we]=Se;return _e.has(we)})),xe={...hY(be?.schema),...Ce};if(K){const Se=be?.discriminatorValue??je;i({...xe,[K]:Se});return}if(ec(je)){i(xe);return}i({...xe,__resolveType:je})};let ne;e[7]!==G||e[8]!==K||e[9]!==i?(ne=je=>{if(K||!ec(G)||je===null||typeof je!="object"||Array.isArray(je)){i(je);return}const{__resolveType:be,...Ee}=je;i(Ee)},e[7]=G,e[8]=K,e[9]=i,e[10]=ne):ne=e[10];const re=ne,he=Q?.properties?r.jsx(gr,{schema:Q,value:_,onChange:je=>{if(b&&h){h(b.blockKey,je);return}if(y){i({...v,section:je});return}re(je)},basePath:o,breadcrumbPath:P,onBreadcrumbChange:R,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(k&&he&&P.length>0){let je;return e[11]!==he?(je=r.jsx("div",{className:"min-w-0",children:he}),e[11]=he,e[12]=je):je=e[12],je}let pe;e[13]!==o?(pe=o.includes("."),e[13]=o,e[14]=pe):pe=e[14];const de=pe,Z=b?()=>{const{name:je,...be}=b.data;i(be)}:void 0,fe=!b&&!y&&!!h&&k&&!ec(G)&&G.includes("/"),ue=_&&typeof _=="object"&&!Array.isArray(_)?_:{},ye=je=>{if(!h)return;const be=je.trim(),Ee=u?vp(be,u):null;if(Ee){me.error(Ee);return}h(be,{...ue,__resolveType:G,name:be}),i({__resolveType:be}),F(!1),me.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:be}))},Le=f?.virtualMcpId;let Re;e[15]!==l||e[16]!==o||e[17]!==s.description||e[18]!==Le?(Re=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:Le}),e[15]=l,e[16]=o,e[17]=s.description,e[18]=Le,e[19]=Re):Re=e[19];let De;e[20]!==g?(De=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=De):De=e[21];let Ue;e[22]!==De?(Ue=r.jsx(js,{placeholder:De}),e[22]=De,e[23]=Ue):Ue=e[23];let $e;return e[24]!==o||e[25]!==Ue?($e=r.jsx(bs,{id:o,children:Ue}),e[24]=o,e[25]=Ue,e[26]=$e):$e=e[26],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[Re,r.jsxs(xs,{value:G||void 0,onValueChange:te,children:[$e,r.jsx(vs,{children:L.map(pY)})]})]}),he&&(k?r.jsx(mY,{path:o,open:O,onOpenChange:D,title:g(de?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:he,nestedBlockRef:de,globalBlockKey:b?.blockKey,onDetach:Z,onMakeGlobal:fe?()=>F(!0):void 0}):he),fe&&r.jsx(yp,{open:B,onOpenChange:F,defaultBlockId:v7(ds(G)),onSubmit:ye})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=f?.virtualMcpId;let H;e[27]!==l||e[28]!==o||e[29]!==s.description||e[30]!==U?(H=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:U}),e[27]=l,e[28]=o,e[29]=s.description,e[30]=U,e[31]=H):H=e[31];const W=n!=null?String(n):"";let q;e[32]!==i?(q=G=>i(G.target.value),e[32]=i,e[33]=q):q=e[33];const ee=s.description??"";let X;e[34]!==o||e[35]!==W||e[36]!==q||e[37]!==ee?(X=r.jsx("input",{id:o,type:"text",value:W,onChange:q,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:ee}),e[34]=o,e[35]=W,e[36]=q,e[37]=ee,e[38]=X):X=e[38];let Y;return e[39]!==H||e[40]!==X?(Y=r.jsxs("div",{className:"space-y-1.5",children:[H,X]}),e[39]=H,e[40]=X,e[41]=Y):Y=e[41],Y}function pY(t){const e=t.title&&!t.title.includes("/")?t.title:Ph(t.resolveType)??ds(t.resolveType);return r.jsx(kt,{value:t.resolveType,children:e},t.resolveType)}function gY(t){return t.resolveType.includes("/")&&!ec(t.resolveType)}function xY(t){return t.resolveType!==""}const q9=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function bY(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]??"",o=n[2]??"",l=q9(i,"id");if(!l)continue;const a=q9(i,"viewBox"),c=q9(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${o}</svg>`}return e}async function vY(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return bY(await e.text())}function yY(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 _Y(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 LY(t,e){return t.length>0?t:e}function wY(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function SY({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:o}){return!!t&&!e&&s===0&&o&&n.length>0&&!i.includes(n)}function y7(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 kY(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function jY(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return y7(t.icon,e)}async function CY(t,e,s){const n={};s&&(n.term=s);const o=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(o,{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 yY(a)}function I3(t){const e=z.c(9),{option:s,className:n,fg:i}=t;let o;e[0]!==i||e[1]!==s?(o=jY(s,i),e[0]=i,e[1]=s,e[2]=o):o=e[2];const l=o;if(!l)return null;const a=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==a?(c=ie("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=r.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function NY(t){const e=z.c(53),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=s.options,u=a?.previewUrl,[h,f]=V.useState(!1),[m,p]=V.useState(""),[g,x]=V.useState(""),b=V.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=re=>{p(re),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(re)},300)},e[0]=v):v=e[0];const y=v,_=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",L=typeof n=="string"?n:"",w=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==_?(S=Fe.sandboxInvoke(_,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=_,e[4]=S):S=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==u?(k=()=>CY(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||!!L);let T;e[9]!==S||e[10]!==k||e[11]!==j?(T={queryKey:S,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=S,e[10]=k,e[11]=j,e[12]=T):T=e[12];const N=xt(T),C=N.data??[];let A;e[13]!==_?(A=Fe.sandboxSprite(_),e[13]=_,e[14]=A):A=e[14];let P;e[15]!==u||e[16]!==a?(P=()=>vY(gv({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,previewUrl:u},"/sprites.svg")),e[15]=u,e[16]=a,e[17]=P):P=e[17];const R=w&&!!a&&(h||!!L)&&(!d||N.isFetched&&C.length===0);let E;e[18]!==A||e[19]!==P||e[20]!==R?(E={queryKey:A,queryFn:P,enabled:R,staleTime:3e5,retry:1},e[18]=A,e[19]=P,e[20]=R,e[21]=E):E=e[21];const M=xt(E),I=_Y(s.enum),$=M.data??{},O=kY(),D=Object.fromEntries(Object.entries($).map(re=>{const[he,pe]=re;return[he,y7(pe,O)]})),B=w&&Object.keys(D).length>0?I.map(re=>({...re,previewSrc:D[re.value]})):I,F=LY(C,B),U=wY(F,m);let H;e[22]!==L?(H=re=>re.value===L,e[22]=L,e[23]=H):H=e[23];const W=F.find(H),q=m.trim(),ee=N.isFetched&&!N.isFetching&&m===g,X=SY({loaderPath:d,isIconSelect:w,enumFallbackCount:I.length,trimmedSearch:q,optionValues:F.map(VY),optionsSettled:ee});if((!u||!d)&&I.length===0){const re=a?.virtualMcpId;let he;e[24]!==l||e[25]!==o||e[26]!==s.description||e[27]!==re?(he=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:re}),e[24]=l,e[25]=o,e[26]=s.description,e[27]=re,e[28]=he):he=e[28];let pe;e[29]!==i?(pe=fe=>i(fe.target.value),e[29]=i,e[30]=pe):pe=e[30];let de;e[31]!==L||e[32]!==o||e[33]!==pe?(de=r.jsx(rt,{id:o,type:"text",value:L,onChange:pe}),e[31]=L,e[32]=o,e[33]=pe,e[34]=de):de=e[34];let Z;return e[35]!==he||e[36]!==de?(Z=r.jsxs("div",{className:"space-y-2",children:[he,de]}),e[35]=he,e[36]=de,e[37]=Z):Z=e[37],Z}const G=a?.virtualMcpId;let J;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==G?(J=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:G}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=G,e[42]=J):J=e[42];const oe=W?r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(I3,{option:W,className:"h-6 w-6",fg:O}),r.jsx("span",{className:"truncate",children:W.label??W.value})]}):L?r.jsx("span",{className:"truncate",children:L}):r.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let le;e[43]===Symbol.for("react.memo_cache_sentinel")?(le=r.jsx(m0,{className:"size-4 shrink-0 opacity-50"}),e[43]=le):le=e[43];let Q;e[44]!==h||e[45]!==oe?(Q=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{variant:"outline",role:"combobox","aria-expanded":h,className:"h-10 w-full justify-between font-normal",children:[oe,le]})}),e[44]=h,e[45]=oe,e[46]=Q):Q=e[46];let K;e[47]===Symbol.for("react.memo_cache_sentinel")?(K={width:"var(--radix-popover-trigger-width)"},e[47]=K):K=e[47];let te;e[48]!==c?(te=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=te):te=e[49];let ne;return e[50]!==m||e[51]!==te?(ne=r.jsx(Wi,{placeholder:te,className:"h-9",value:m,onValueChange:y}),e[50]=m,e[51]=te,e[52]=ne):ne=e[52],r.jsxs("div",{className:"space-y-2",children:[J,r.jsxs(_s,{open:h,onOpenChange:f,children:[Q,r.jsx(ys,{className:"p-0",style:K,children:r.jsxs(pr,{shouldFilter:!1,children:[ne,r.jsxs(qi,{children:[!X&&r.jsx(si,{children:N.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),r.jsx(ks,{children:U.map(re=>r.jsxs(Jt,{value:re.value,className:"cursor-pointer",onSelect:()=>{i(re.value===L?"":re.value),f(!1)},children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(I3,{option:re,className:ie(re.image?"h-9 w-9":"h-6 w-6"),fg:O}),r.jsx("span",{className:"truncate",children:re.label??re.value})]}),r.jsx(Ut,{className:ie("ml-auto size-4 shrink-0",L===re.value?"opacity-100":"opacity-0")})]},re.value))}),X&&r.jsx(ks,{children:r.jsx(Jt,{value:q,className:"cursor-pointer",onSelect:()=>{i(q),p(""),x(""),f(!1)},children:r.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:q})})})})]})]})})]})]})}function VY(t){return t.value}function TY(t){const e=z.c(17),{org:s}=Me(),n=Cs();let i,o,l,a;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(o=t.search?.trim()||void 0,i=t.imageOnly??!1,a=W5,l=Fe.filePickerObjects(s.id,t.configId,o,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=o,e[6]=l,e[7]=a):(i=e[4],o=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]!==o||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:o,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=o,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:EY},e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],a(u)}function EY(t){return t.nextCursor??void 0}function _p(){const t=z.c(2),{org:e}=Me();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",o=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(!o.ok){const l=await o.text().catch(AY);let a=`${o.status} ${o.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 o.json()}},t[0]=e,t[1]=s):s=t[1],Rt(s)}function AY(){return""}const l9="file-picker:last-config-id";function _7(t){const e=z.c(31),s=se(),n=t.open,i=t.onOpenChange;let o;e[0]!==t.mode||e[1]!==s?(o=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(At,{children:o}),e[3]=o,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=r.jsx(_n,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.jsxs(os,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==s?(u=b=>{const{error:v}=b;return r.jsx(PY,{error:v??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=r.jsx(at,{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=r.jsx(V.Suspense,{fallback:h,children:r.jsx(RY,{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=r.jsx(Fs,{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=r.jsxs(jt,{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=r.jsx(Ct,{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 PY(t){const e=z.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(fn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=r.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,r.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function RY(t){const e=z.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,o=oj();if(o.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(MY,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==o||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=o.find(x),e[1]=o,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=r.jsx(G9,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(o.length===1){const p=o[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=r.jsx(G9,{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(l9):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==o?(c=o.find(p=>p.id===a)?.id??o[0].id,e[15]=o,e[16]=c):c=e[16];const d=c;let u;e[17]!==o?(u=o.map(DY),e[17]=o,e[18]=u):u=e[18];let h;e[19]!==u?(h=r.jsx(Hc,{className:"self-start",children:u}),e[19]=u,e[20]=h):h=e[20];let f;if(e[21]!==o||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>r.jsx(go,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:r.jsx(G9,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],f=o.map(p),e[21]=o,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=r.jsxs(Wl,{defaultValue:d,onValueChange:IY,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 DY(t){return r.jsx(Ti,{value:t.id,children:t.name},t.id)}function IY(t){typeof window<"u"&&window.localStorage.setItem(l9,t)}function MY(){const t=z.c(12),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Wn,{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=r.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function G9({config:t,mode:e,onSelect:s}){const n=se(),[i,o]=V.useState(""),l=K5(i,300),a=TY({configId:t.id,search:l,imageOnly:e==="image"}),c=_p(),[d,u]=V.useState(!1),h=V.useRef(null),f=e==="image"?"image/*":void 0;async function m(S){if(!S)return;const k=Array.from(S);if(k.length===0)return;let j=null;const T=[];for(const N of k)try{const C=await c.mutateAsync({configId:t.id,file:N});j??=C.publicUrl}catch(C){T.push(`${N.name} (${C instanceof Error?C.message:"upload failed"})`)}await a.refetch(),T.length>0&&me.error(T.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:T.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:T.join("; ")})),j&&s(j)}function p(S){S.preventDefault(),u(!0)}function g(){u(!1)}function x(S){S.preventDefault(),u(!1),m(S.dataTransfer.files)}const v=(a.data?.pages??[]).flatMap(S=>S.items),y=v.filter(S=>e==="image"?L7(S.key):!0),_=l.trim(),L=v.length>0||i.trim().length>0,w=i!==l||a.isFetching&&!a.isFetchingNextPage;return r.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[r.jsxs("button",{type:"button",onClick:()=>h.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:ie("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:[r.jsx(Wn,{size:18,className:"text-muted-foreground"}),r.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),r.jsx("input",{ref:h,type:"file",accept:f,multiple:!0,className:"hidden",onChange:S=>{const k=Array.from(S.target.files??[]);S.target.value="",m(k)}})]}),L?r.jsx(B1,{value:i,onChange:o,isSearching:w,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[y.length===0?_?r.jsx(BY,{query:_}):e==="image"&&v.length>0?r.jsx(OY,{}):r.jsx($Y,{}):e==="image"?r.jsx(FY,{items:y,onSelect:s}):r.jsx(UY,{items:y,onSelect:s}),a.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(ae,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function $Y(){const t=z.c(12),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(Pi,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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 OY(){const t=z.c(12),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(Pi,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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 BY(t){const e=z.c(13),{query:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(Pi,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s||e[2]!==n?(o=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==o?(l=r.jsx("p",{className:"text-sm font-medium",children:o}),e[4]=o,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=r.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=r.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 L7(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function zY(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function FY(t){const e=z.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx(w7,{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 o;return e[5]!==i?(o=r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=o):o=e[6],o}function UY(t){const e=z.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx("li",{children:r.jsx(w7,{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 o;return e[5]!==i?(o=r.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=o):o=e[6],o}function w7(t){const e=z.c(58),{item:s,variant:n,onSelect:i}=t;let o;e[0]!==s.key?(o=zY(s.key),e[0]=s.key,e[1]=o):o=e[1];const l=o;if(n==="image"){let y;e[2]!==s.publicUrl||e[3]!==i?(y=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=y):y=e[4];let _;e[5]!==s.key||e[6]!==s.publicUrl?(_=r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:KY}),e[5]=s.key,e[6]=s.publicUrl,e[7]=_):_=e[7];let L;e[8]!==s.key||e[9]!==y||e[10]!==_?(L=r.jsx("button",{type:"button",onClick:y,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:_}),e[8]=s.key,e[9]=y,e[10]=_,e[11]=L):L=e[11];let w;e[12]!==l?(w=r.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]=w):w=e[13];let S;e[14]!==s||e[15]!==i?(S=r.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:r.jsx(M3,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=S):S=e[16];let k;e[17]!==s.key?(k=$3(s.key),e[17]=s.key,e[18]=k):k=e[18];let j;e[19]!==k?(j=r.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:r.jsx("p",{className:"truncate text-xs text-white",children:k})}),e[19]=k,e[20]=j):j=e[20];let T;return e[21]!==L||e[22]!==w||e[23]!==S||e[24]!==j?(T=r.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[L,w,S,j]}),e[21]=L,e[22]=w,e[23]=S,e[24]=j,e[25]=T):T=e[25],T}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=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:L7(s.key)?r.jsx(Pi,{size:16,className:"text-muted-foreground"}):r.jsx(Ri,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=$3(s.key),e[31]=s.key,e[32]=d):d=e[32];let u;e[33]!==d?(u=r.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=r.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=r.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=r.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=GY(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=r.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=r.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=r.jsx(M3,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let v;return e[55]!==x||e[56]!==b?(v=r.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]=v):v=e[57],v}function KY(t){t.target.style.display="none"}function M3(t){const e=z.c(39),{item:s,onSelect:n}=t,i=se(),[o,l]=V.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(T){T.preventDefault(),T.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{me.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=r.jsx(k0,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:qY,"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=r.jsx(Ut,{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=r.jsxs(Ze,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==o?(x=o?r.jsx(Ut,{size:14}):r.jsx(on,{size:14}),e[17]=o,e[18]=x):x=e[18];let b;e[19]!==o||e[20]!==i?(b=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=o,e[20]=i,e[21]=b):b=e[21];let v;e[22]!==c||e[23]!==b||e[24]!==x?(v=r.jsxs(Ze,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const y=s.publicUrl;let _;e[26]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(hn,{size:14}),e[26]=_):_=e[26];let L;e[27]!==i?(L=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=L):L=e[28];let w;e[29]!==s.publicUrl||e[30]!==L?(w=r.jsx(Ze,{asChild:!0,children:r.jsxs("a",{href:y,target:"_blank",rel:"noreferrer",onClick:HY,children:[_,L]})}),e[29]=s.publicUrl,e[30]=L,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w||e[34]!==g?(S=r.jsxs(Yt,{align:"end",onClick:WY,children:[g,v,w]}),e[32]=v,e[33]=w,e[34]=g,e[35]=S):S=e[35];let k;return e[36]!==S||e[37]!==h?(k=r.jsxs(qt,{children:[h,S]}),e[36]=S,e[37]=h,e[38]=k):k=e[38],k}function HY(t){return t.stopPropagation()}function WY(t){return t.stopPropagation()}function qY(t){return t.stopPropagation()}function $3(t){const e=t.split("/");return e[e.length-1]??t}function GY(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function S7(t,e){if(!e)return null;const s=e.toLowerCase();return t.find(n=>{const i=n.bucket.toLowerCase();return n.siteSlug?.toLowerCase()===s||i===s||i===`deco-assets-${s}`})??null}function k7(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.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:r.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[r.jsx(Wn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function j7(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function C7(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const YY=["low","medium","high","original"];function N7(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function V7(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=QY(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 T7(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",o=n>=0?t.slice(0,n):t,l=o.indexOf("?"),a=l>=0?o.slice(0,l):o,c=(l>=0?o.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 QY(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 XY(t){if(!t)return;const e=V7(t,"quality");return N7(e)?e:void 0}function JY(t,e){return T7(t,"quality",e)}function ZY(t){return t?V7(t,"muted")!=="false":!0}function eQ(t,e){return T7(t,"muted",e?void 0:"false")}function E7(t){const e=z.c(36),{value:s,onChange:n,showMuted:i}=t,o=i===void 0?!1:i,l=se(),a=V.useId();let c;e[0]!==s?(c=XY(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==s?(u=ZY(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=r.jsx(k0,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=r.jsx(us,{asChild:!0,children:r.jsx(ae,{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=r.jsx(Et,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let v;e[13]!==n||e[14]!==s?(v=j=>n(JY(s,N7(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=YY.map(tQ),e[16]=y):y=e[16];let _;e[17]!==v||e[18]!==b?(_=r.jsx(T1,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:y}),e[17]=v,e[18]=b,e[19]=_):_=e[19];let L;e[20]!==_||e[21]!==x?(L=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,_]}),e[20]=_,e[21]=x,e[22]=L):L=e[22];let w;e[23]!==h||e[24]!==a||e[25]!==n||e[26]!==o||e[27]!==l||e[28]!==s?(w=o&&r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Et,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),r.jsx(Mi,{id:a,checked:h,onCheckedChange:j=>n(eQ(s,j))})]}),e[23]=h,e[24]=a,e[25]=n,e[26]=o,e[27]=l,e[28]=s,e[29]=w):w=e[29];let S;e[30]!==L||e[31]!==w?(S=r.jsx(ys,{align:"end",className:"w-auto min-w-52 p-3",children:r.jsxs("div",{className:"flex flex-col gap-3",children:[L,w]})}),e[30]=L,e[31]=w,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==p?(k=r.jsxs(_s,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function tQ(t){return r.jsx(xc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function A7(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function O3(t){const e=z.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=r.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 sQ(t){const e=z.c(81),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=s.format==="video-uri",u=xp(n),[h,f]=V.useState(!1),[m,p]=V.useState(!1),g=u?j7(u):"",x=g?C7(g):"",b=H5(),v=_p();let y;e[0]!==b.data?.configs?(y=b.data?.configs??[],e[0]=b.data?.configs,e[1]=y):y=e[1];const _=a?.siteSlug;let L;e[2]!==y||e[3]!==_?(L=S7(y,_),e[2]=y,e[3]=_,e[4]=L):L=e[4];const w=L;let S;e[5]!==b.data?.configs||e[6]!==d||e[7]!==w?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==v?(S=async function(le){if(!le)return;let Q=Array.from(le);if(Q.length===0)return;if(d&&(Q=Q.filter(nQ),Q.length===0)){me.error(c("sectionsEditor.fileField.videoFileError"));return}const K=A7(b.data?.configs??[],w?.id,typeof window<"u"?window.localStorage.getItem(l9):null);if(!K){f(!0);return}try{const te=await v.mutateAsync({configId:K,file:Q[0]});i(te.publicUrl),Q.length>1&&me.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:Q[0].name}))}catch(te){const ne=te;me.error(ne instanceof Error?ne.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=w?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=v,e[12]=S):S=e[12];const k=S;let j;e[13]!==p?(j=function(le){le.preventDefault(),le.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const T=j;let N;e[15]!==p?(N=function(le){le.currentTarget===le.target&&p(!1)},e[15]=p,e[16]=N):N=e[16];const C=N;let A;e[17]!==k||e[18]!==p?(A=function(le){le.preventDefault(),p(!1),k(le.dataTransfer.files)},e[17]=k,e[18]=p,e[19]=A):A=e[19];const P=A,R=a?.virtualMcpId;let E;e[20]!==l||e[21]!==o||e[22]!==s.description||e[23]!==R?(E=r.jsx("div",{className:"min-w-0",children:r.jsx(Ps,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:R})}),e[20]=l,e[21]=o,e[22]=s.description,e[23]=R,e[24]=E):E=e[24];const M=m&&"border-primary ring-2 ring-primary/30",I=v.isPending&&"pointer-events-none opacity-60";let $;e[25]!==M||e[26]!==I?($=ie("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]=$):$=e[27];let O;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==u||e[33]!==c||e[34]!==v.isPending?(O=u?d?r.jsxs(r.Fragment,{children:[r.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:[r.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u),r.jsx(k7,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(qp,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),r.jsx(O3,{ext:x})]})]}):r.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:[r.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:r.jsx(Ri,{size:18,className:"text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium",children:g}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),r.jsx(O3,{ext:x})]}):r.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?r.jsx(qp,{size:20}):r.jsx(Ri,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),r.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]=v.isPending,e[35]=O):O=e[35];let D;e[36]!==m||e[37]!==c?(D=m&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.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]=D):D=e[38];let B;e[39]!==C||e[40]!==T||e[41]!==P||e[42]!==$||e[43]!==O||e[44]!==D?(B=r.jsxs("div",{onDragOver:T,onDragLeave:C,onDrop:P,className:$,children:[O,D]}),e[39]=C,e[40]=T,e[41]=P,e[42]=$,e[43]=O,e[44]=D,e[45]=B):B=e[45];let F;e[46]!==i?(F=oe=>i(oe.target.value),e[46]=i,e[47]=F):F=e[47];let U;e[48]!==o||e[49]!==u||e[50]!==F?(U=r.jsx(rt,{id:o,type:"url",value:u,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=o,e[49]=u,e[50]=F,e[51]=U):U=e[51];let H;e[52]!==f||e[53]!==u||e[54]!==c?(H=!u&&r.jsxs(ae,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[r.jsx(Wn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=u,e[54]=c,e[55]=H):H=e[55];let W;e[56]!==d||e[57]!==i||e[58]!==u?(W=d&&u&&r.jsx(E7,{value:u,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=u,e[59]=W):W=e[59];let q;e[60]!==i||e[61]!==u||e[62]!==c?(q=u&&r.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:r.jsx(Ks,{size:14})}),e[60]=i,e[61]=u,e[62]=c,e[63]=q):q=e[63];let ee;e[64]!==U||e[65]!==H||e[66]!==W||e[67]!==q?(ee=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,H,W,q]}),e[64]=U,e[65]=H,e[66]=W,e[67]=q,e[68]=ee):ee=e[68];let X;e[69]!==i?(X=oe=>i(oe),e[69]=i,e[70]=X):X=e[70];const Y=w?.id??null;let G;e[71]!==h||e[72]!==f||e[73]!==X||e[74]!==Y?(G=r.jsx(_7,{open:h,onOpenChange:f,mode:"any",onSelect:X,lockedConfigId:Y}),e[71]=h,e[72]=f,e[73]=X,e[74]=Y,e[75]=G):G=e[75];let J;return e[76]!==B||e[77]!==ee||e[78]!==G||e[79]!==E?(J=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[E,B,ee,G]}),e[76]=B,e[77]=ee,e[78]=G,e[79]=E,e[80]=J):J=e[80],J}function nQ(t){return t.type.startsWith("video/")}const iQ=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function rQ(t){const e=z.c(86),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=xp(n),[u,h]=V.useState(!1),[f,m]=V.useState(!1),[p,g]=V.useState(!1),[x,b]=V.useState(!1),v=d?j7(d):"",y=v?C7(v):"",_=H5(),L=_p();let w;e[0]!==_.data?.configs?(w=_.data?.configs??[],e[0]=_.data?.configs,e[1]=w):w=e[1];const S=a?.siteSlug;let k;e[2]!==w||e[3]!==S?(k=S7(w,S),e[2]=w,e[3]=S,e[4]=k):k=e[4];const j=k;let T;e[5]!==i||e[6]!==b||e[7]!==g?(T=function(re){g(!1),b(!1),i(re)},e[5]=i,e[6]=b,e[7]=g,e[8]=T):T=e[8];const N=T;let C;e[9]!==_.data?.configs||e[10]!==j?.id||e[11]!==h||e[12]!==N||e[13]!==c||e[14]!==L?(C=async function(re){if(!re)return;const he=Array.from(re).filter(oQ);if(he.length===0){me.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const pe=A7(_.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(l9):null);if(!pe){h(!0);return}try{const de=await L.mutateAsync({configId:pe,file:he[0]});N(de.publicUrl),he.length>1&&me.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:he[0].name}))}catch(de){const Z=de;me.error(Z instanceof Error?Z.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=_.data?.configs,e[10]=j?.id,e[11]=h,e[12]=N,e[13]=c,e[14]=L,e[15]=C):C=e[15];const A=C;let P;e[16]!==m?(P=function(re){re.preventDefault(),re.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=P):P=e[17];const R=P;let E;e[18]!==m?(E=function(re){re.currentTarget===re.target&&m(!1)},e[18]=m,e[19]=E):E=e[19];const M=E;let I;e[20]!==A||e[21]!==m?(I=function(re){re.preventDefault(),m(!1),A(re.dataTransfer.files)},e[20]=A,e[21]=m,e[22]=I):I=e[22];const $=I,O=a?.virtualMcpId;let D;e[23]!==l||e[24]!==o||e[25]!==s.description||e[26]!==O?(D=r.jsx("div",{className:"min-w-0",children:r.jsx(Ps,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:O})}),e[23]=l,e[24]=o,e[25]=s.description,e[26]=O,e[27]=D):D=e[27];const B=f&&"border-primary ring-2 ring-primary/30",F=L.isPending&&"pointer-events-none opacity-60";let U;e[28]!==B||e[29]!==F?(U=ie("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]=U):U=e[30];let H;e[31]!==y||e[32]!==v||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]!==L.isPending?(H=d?r.jsxs(r.Fragment,{children:[r.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&&r.jsx("img",{src:d,alt:l,className:ie("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[r.jsx(Pi,{size:20}),r.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&r.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),r.jsx(k7,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:v}),y&&r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:y})]})]}):r.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:[r.jsx(Pi,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:L.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=y,e[32]=v,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]=L.isPending,e[42]=H):H=e[42];let W;e[43]!==f||e[44]!==c?(W=f&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.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]=W):W=e[45];let q;e[46]!==M||e[47]!==R||e[48]!==$||e[49]!==U||e[50]!==H||e[51]!==W?(q=r.jsxs("div",{onDragOver:R,onDragLeave:M,onDrop:$,className:U,children:[H,W]}),e[46]=M,e[47]=R,e[48]=$,e[49]=U,e[50]=H,e[51]=W,e[52]=q):q=e[52];let ee;e[53]!==N?(ee=ne=>N(ne.target.value),e[53]=N,e[54]=ee):ee=e[54];let X;e[55]!==c?(X=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=X):X=e[56];let Y;e[57]!==o||e[58]!==d||e[59]!==ee||e[60]!==X?(Y=r.jsx(rt,{id:o,type:"url",value:d,onChange:ee,placeholder:X,className:"h-9 min-w-0 flex-1"}),e[57]=o,e[58]=d,e[59]=ee,e[60]=X,e[61]=Y):Y=e[61];let G;e[62]!==h||e[63]!==d||e[64]!==c?(G=!d&&r.jsxs(ae,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[r.jsx(Wn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=h,e[63]=d,e[64]=c,e[65]=G):G=e[65];let J;e[66]!==N||e[67]!==d||e[68]!==c?(J=d&&r.jsxs(r.Fragment,{children:[r.jsx(E7,{value:d,onChange:N}),r.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>N(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:r.jsx(Ks,{size:14})})]}),e[66]=N,e[67]=d,e[68]=c,e[69]=J):J=e[69];let oe;e[70]!==Y||e[71]!==G||e[72]!==J?(oe=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[Y,G,J]}),e[70]=Y,e[71]=G,e[72]=J,e[73]=oe):oe=e[73];let le;e[74]!==N?(le=ne=>N(ne),e[74]=N,e[75]=le):le=e[75];const Q=j?.id??null;let K;e[76]!==u||e[77]!==h||e[78]!==le||e[79]!==Q?(K=r.jsx(_7,{open:u,onOpenChange:h,mode:"image",onSelect:le,lockedConfigId:Q}),e[76]=u,e[77]=h,e[78]=le,e[79]=Q,e[80]=K):K=e[80];let te;return e[81]!==D||e[82]!==q||e[83]!==oe||e[84]!==K?(te=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[D,q,oe,K]}),e[81]=D,e[82]=q,e[83]=oe,e[84]=K,e[85]=te):te=e[85],te}function oQ(t){return iQ.has(t.type||"")}function P7(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function lQ(t,e){if(e.length===0)return 0;const s=P7(t);for(let o=0;o<e.length;o++){const l=e[o].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return o}let n=0,i=-1;for(let o=0;o<e.length;o++){const l=e[o],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=o)}return n}function aQ(t,e){const s=P7(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}const cQ="0 0 1080 1080",dQ="matrix(1 0 0 1 540 540)",Lp=[{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 uQ({selected:t,onSelect:e}){const s=se(),[n,i]=V.useState(cQ),o=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 r.jsx("svg",{ref:o,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:r.jsx("g",{transform:dQ,children:Lp.map(l=>{const a=l.code===t;return r.jsx("g",{transform:l.gTransform,children:r.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:ie("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 hQ=[{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"}],fQ="BR";function mQ(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 pQ(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 gQ(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function B3(t){const e=z.c(37),{id:s,options:n,value:i,placeholder:o,emptyMessage:l,onChange:a}=t,[c,d]=V.useState(!1);let u;if(e[0]!==n||e[1]!==i){let S;e[3]!==i?(S=k=>k.value===i,e[3]=i,e[4]=S):S=e[4],u=n.find(S),e[0]=n,e[1]=i,e[2]=u}else u=e[2];const h=u;let f;e[5]!==o||e[6]!==h?(f=h?r.jsx("span",{className:"truncate",children:h.label}):r.jsx("span",{className:"text-muted-foreground",children:o}),e[5]=o,e[6]=h,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(m0,{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=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{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]!==o?(x=r.jsx(Wi,{placeholder:o,className:"h-9"}),e[14]=o,e[15]=x):x=e[15];let b;e[16]!==l?(b=r.jsx(si,{children:l}),e[16]=l,e[17]=b):b=e[17];let v;if(e[18]!==a||e[19]!==n||e[20]!==i){let S;e[22]!==a||e[23]!==i?(S=k=>r.jsxs(Jt,{value:`${k.label} ${k.value}`,onSelect:()=>{a(k.value===i?"":k.value),d(!1)},children:[r.jsx("span",{className:"truncate",children:k.label}),r.jsx(Ut,{className:ie("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=a,e[23]=i,e[24]=S):S=e[24],v=n.map(S),e[18]=a,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let y;e[25]!==v?(y=r.jsx(ks,{children:v}),e[25]=v,e[26]=y):y=e[26];let _;e[27]!==b||e[28]!==y?(_=r.jsxs(qi,{children:[b,y]}),e[27]=b,e[28]=y,e[29]=_):_=e[29];let L;e[30]!==_||e[31]!==x?(L=r.jsx(ys,{className:"p-0",style:g,children:r.jsxs(pr,{children:[x,_]})}),e[30]=_,e[31]=x,e[32]=L):L=e[32];let w;return e[33]!==c||e[34]!==L||e[35]!==p?(w=r.jsxs(_s,{open:c,onOpenChange:d,children:[p,L]}),e[33]=c,e[34]=L,e[35]=p,e[36]=w):w=e[36],w}const xQ=hQ.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),bQ=Lp.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function R7(t){const e=z.c(66),{schema:s,value:n,onChange:i,path:o,sandbox:l}=t,a=se();let c;e[0]!==n?(c=pQ(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 v=b;let y;e[10]!==p.city?.title||e[11]!==a?(y=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=y):y=e[12];const _=y;let L;e[13]!==d||e[14]!==i?(L=j=>{i(gQ(d,j))},e[13]=d,e[14]=i,e[15]=L):L=e[15];const w=L,S=f===fQ;let k;if(e[16]!==u||e[17]!==_||e[18]!==f||e[19]!==x||e[20]!==w||e[21]!==S||e[22]!==o||e[23]!==h||e[24]!==v||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==h?(j=U=>U.code===h,e[30]=h,e[31]=j):j=e[31];const T=Lp.find(j),N=`${o}.country`;let C;e[32]!==s.title||e[33]!==a?(C=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=C):C=e[34];const A=l?.virtualMcpId;let P;e[35]!==s.description||e[36]!==C||e[37]!==A||e[38]!==N?(P=r.jsx(Ps,{htmlFor:N,label:C,description:s.description,virtualMcpId:A}),e[35]=s.description,e[36]=C,e[37]=A,e[38]=N,e[39]=P):P=e[39];const R=`${o}.country`;let E;e[40]!==x||e[41]!==R?(E=r.jsx(Et,{htmlFor:R,className:"text-xs",children:x}),e[40]=x,e[41]=R,e[42]=E):E=e[42];const M=`${o}.country`;let I;e[43]!==a?(I=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=I):I=e[44];let $;e[45]!==a?($=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=$):$=e[46];let O;e[47]!==w?(O=U=>w({country:U,regionCode:"",city:""}),e[47]=w,e[48]=O):O=e[48];let D;e[49]!==f||e[50]!==M||e[51]!==I||e[52]!==$||e[53]!==O?(D=r.jsx(B3,{id:M,options:xQ,value:f,placeholder:I,emptyMessage:$,onChange:O}),e[49]=f,e[50]=M,e[51]=I,e[52]=$,e[53]=O,e[54]=D):D=e[54];let B;e[55]!==E||e[56]!==D?(B=r.jsxs("div",{className:"space-y-1.5",children:[E,D]}),e[55]=E,e[56]=D,e[57]=B):B=e[57];let F;e[58]!==f||e[59]!==w||e[60]!==S||e[61]!==o||e[62]!==h||e[63]!==v||e[64]!==a?(F=f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Et,{htmlFor:`${o}.regionCode`,className:"text-xs",children:v}),S?r.jsxs("div",{className:"space-y-2",children:[r.jsx(uQ,{selected:h,onSelect:U=>w({regionCode:U===h?"":U,city:""})}),r.jsx(B3,{id:`${o}.regionCode`,options:bQ,value:h,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>w({regionCode:U,city:""})})]}):r.jsxs(r.Fragment,{children:[r.jsx(rt,{id:`${o}.regionCode`,type:"text",value:h,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>w({regionCode:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=w,e[60]=S,e[61]=o,e[62]=h,e[63]=v,e[64]=a,e[65]=F):F=e[65],k=r.jsxs("div",{className:"space-y-4",children:[P,B,F,f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Et,{htmlFor:`${o}.city`,className:"text-xs",children:_}),r.jsx(rt,{id:`${o}.city`,type:"text",value:u,placeholder:S&&T?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:T.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>w({city:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=u,e[17]=_,e[18]=f,e[19]=x,e[20]=w,e[21]=S,e[22]=o,e[23]=h,e[24]=v,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 vQ(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,o]of Object.entries(e.properties))s.has(i)||(n[i]=o);return Object.keys(n).length===0?null:{...e,properties:n}}function yQ(t){const e=z.c(49),s=se(),{schema:n,value:i,onChange:o,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=lQ(i,c.map(LQ)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const u=d,[h,f]=V.useState(u),[m,p]=V.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]!==o?(b=I=>{const $=Number(I);f($),o({...c[$]?.discriminators??{}})},e[4]=c,e[5]=o,e[6]=b):b=e[6];const v=b;if(c.length===0)return null;let y;e[7]!==x?(y=x?vQ(x):null,e[7]=x,e[8]=y):y=e[8];const _=y;let L;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],L=aQ(i,Object.keys(I)),e[9]=x?.schema?.properties,e[10]=i,e[11]=L}else L=e[11];const w=L;let S;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=a&&r.jsx(Ps,{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]=S):S=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 T;e[21]!==j?(T=r.jsx(js,{placeholder:j}),e[21]=j,e[22]=T):T=e[22];let N;e[23]!==l||e[24]!==T?(N=r.jsx(bs,{id:l,children:T}),e[23]=l,e[24]=T,e[25]=N):N=e[25];let C;e[26]!==c?(C=c.map(_Q),e[26]=c,e[27]=C):C=e[27];let A;e[28]!==C?(A=r.jsx(vs,{children:C}),e[28]=C,e[29]=A):A=e[29];let P;e[30]!==v||e[31]!==A||e[32]!==k||e[33]!==N?(P=r.jsxs(xs,{value:k,onValueChange:v,children:[N,A]}),e[30]=v,e[31]=A,e[32]=k,e[33]=N,e[34]=P):P=e[34];let R;e[35]!==P||e[36]!==S?(R=r.jsxs("div",{className:"space-y-1.5",children:[S,P]}),e[35]=P,e[36]=S,e[37]=R):R=e[37];let E;e[38]!==x||e[39]!==_||e[40]!==o||e[41]!==l||e[42]!==w||e[43]!==t||e[44]!==i?(E=x&&(mQ(x.schema?.properties)?r.jsx(R7,{...t,schema:x.schema,onChange:I=>o({...w,...I,...x.discriminators??{}})}):_?r.jsx(gr,{schema:_,value:i,onChange:I=>o({...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[38]=x,e[39]=_,e[40]=o,e[41]=l,e[42]=w,e[43]=t,e[44]=i,e[45]=E):E=e[45];let M;return e[46]!==R||e[47]!==E?(M=r.jsxs("div",{className:"space-y-3",children:[R,E]}),e[46]=R,e[47]=E,e[48]=M):M=e[48],M}function _Q(t,e){return r.jsx(kt,{value:String(e),children:t.title},t.title)}function LQ(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const wQ={lat:-21.9,lng:-41.42},df=1e5;let Xd=null;function SQ(t){return Xd||(Xd=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"))},o=document.querySelector("script[data-google-maps-loader]");if(o){o.addEventListener("load",i),o.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)}),Xd)}function kQ(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:df}}function jQ({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o}){const l=TL().googleMapsApiKey,a=V.useRef(s);a.current=s;const c=V.useRef(kQ(e)),[d,u]=V.useState(null),h=V.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return SQ(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:wQ,v=x?.radius??df,y=new g.Map(m,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),_=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:y,center:b,radius:v});p.circle=_;const L=()=>{const S=_.getCenter(),k=_.getRadius();S&&a.current(`${S.lat()},${S.lng()},${k}`)},w=S=>{S&&p.listeners.push(S)};w(y.addListener("click",S=>{S.latLng&&(_.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),_.getRadius()||_.setRadius(df),L())})),w(_.addListener("radius_changed",L)),w(_.addListener("dragend",L))},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),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ps,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),l?d?r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):r.jsx("div",{ref:h.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):r.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"," ",r.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const CQ="oklch(0.65 0.15 160)",NQ="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)]",D7="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)]",Hae="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 z3(t){return t.map(e=>e.label).join(`
|
|
532
|
-
`)}function Y9(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function VQ(t){return t.map((e,s)=>({...e,index:s}))}function I7(t){const e=z.c(19),{label:s,canDelete:n,dragging:i,onRename:o,onDuplicate:l,onDelete:a}=t,c=se(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=ie("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=r.jsx(Hl,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(or,{className:"h-4 w-4 shrink-0",style:{color:CQ}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=r.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]!==o||e[13]!==c?(p=!i&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{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 data-[state=open]:opacity-100",onClick:EQ,onPointerDown:TQ,children:r.jsx(Hi,{size:14})})}),r.jsxs(Yt,{align:"end",children:[o&&r.jsxs(Ze,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(y5,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(Ze,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(on,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(Ze,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(Ks,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=o,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function TQ(t){return t.stopPropagation()}function EQ(t){return t.stopPropagation()}function AQ(t){const e=z.c(27),{entry:s,selected:n,canDelete:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:PQ},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=H0(d);let g;e[2]!==m?(g=ri.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 v=b;let y;e[7]!==o?(y=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=y):y=e[8];const _=p?"cursor-grabbing":"cursor-grab",L=n?D7:NQ;let w;e[9]!==_||e[10]!==L?(w=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",_,L),e[9]=_,e[10]=L,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=r.jsx(I7,{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]=S):S=e[17];let k;return e[18]!==u||e[19]!==h||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==y||e[24]!==w||e[25]!==S?(k=r.jsx("div",{ref:f,style:v,...u,...h,onClick:o,onKeyDown:y,className:w,children:S}),e[18]=u,e[19]=h,e[20]=o,e[21]=f,e[22]=v,e[23]=y,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function PQ(){return!1}function RQ(t){const e=z.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=se(),m=n.length>1;let p;e[0]!==n?(p=()=>Y9(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=V.useState(p),[b,v]=V.useState(null),[y,_]=V.useState(s),[L,w]=V.useState(n.length);let S;e[2]!==n?(S=()=>z3(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=V.useState(S),T=V.useRef(!1),N=z3(n);y!==s?(_(s),w(n.length),j(N),x(Y9(n))):L!==n.length?(w(n.length),j(N),x(Y9(n))):k!==N&&(j(N),x(de=>n.map((Z,fe)=>({id:de[fe]?.id??crypto.randomUUID(),index:Z.index,label:Z.label}))));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A={coordinateGetter:W0},e[5]=A):A=e[5];const P=od(zi(Ho,C),zi(Ko,A));let R;e[6]!==g?(R=g.map(DQ),e[6]=g,e[7]=R):R=e[7];const E=R;let M;e[8]!==g?(M=de=>{const Z=String(de.active.id);v(g.find(fe=>fe.id===Z)??null)},e[8]=g,e[9]=M):M=e[9];const I=M;let $;e[10]!==E||e[11]!==u?($=de=>{v(null);const{active:Z,over:fe}=de;if(!fe||Z.id===fe.id)return;const ue=E.indexOf(String(Z.id)),ye=E.indexOf(String(fe.id));ue===-1||ye===-1||(x(Le=>VQ(No([...Le],ue,ye))),T.current=!0,requestAnimationFrame(()=>{T.current=!1}),u(ue,ye))},e[10]=E,e[11]=u,e[12]=$):$=e[12];const O=$;let D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{v(null)},e[13]=D):D=e[13];const B=D;let F,U,H,W,q,ee,X,Y,G,J,oe,le,Q;if(e[14]!==m||e[15]!==g||e[16]!==E||e[17]!==O||e[18]!==I||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==P||e[27]!==f){const de=xe=>{T.current||o(xe)};oe="space-y-1 border-b p-2";let Z;e[41]!==f?(Z=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=Z):Z=e[42];let fe;e[43]!==Z?(fe=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:Z}),e[43]=Z,e[44]=fe):fe=e[44];let ue;e[45]!==f?(ue=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=ue):ue=e[46];let ye;e[47]===Symbol.for("react.memo_cache_sentinel")?(ye=r.jsx(Nt,{size:14}),e[47]=ye):ye=e[47];let Le;e[48]!==h||e[49]!==ue?(Le=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":ue,className:"size-6",onClick:h,children:ye})}),e[48]=h,e[49]=ue,e[50]=Le):Le=e[50];let Re;e[51]!==f?(Re=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=Re):Re=e[52];let De;e[53]!==Re?(De=r.jsx(qe,{children:Re}),e[53]=Re,e[54]=De):De=e[54];let Ue;e[55]!==Le||e[56]!==De?(Ue=r.jsxs(Ge,{children:[Le,De]}),e[55]=Le,e[56]=De,e[57]=Ue):Ue=e[57];let $e;e[58]!==f?($e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=$e):$e=e[59];let je;e[60]===Symbol.for("react.memo_cache_sentinel")?(je=r.jsx(Ks,{size:14}),e[60]=je):je=e[60];let be;e[61]!==d||e[62]!==$e?(be=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":$e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:je})}),e[61]=d,e[62]=$e,e[63]=be):be=e[63];let Ee;e[64]!==f?(Ee=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Ee):Ee=e[65];let _e;e[66]!==Ee?(_e=r.jsx(qe,{children:Ee}),e[66]=Ee,e[67]=_e):_e=e[67];let Ae;e[68]!==be||e[69]!==_e?(Ae=r.jsxs(Ge,{children:[be,_e]}),e[68]=be,e[69]=_e,e[70]=Ae):Ae=e[70];let Ce;e[71]!==Ue||e[72]!==Ae?(Ce=r.jsxs("div",{className:"flex items-center gap-0.5",children:[Ue,Ae]}),e[71]=Ue,e[72]=Ae,e[73]=Ce):Ce=e[73],e[74]!==fe||e[75]!==Ce?(le=r.jsxs("div",{className:"flex items-center justify-between",children:[fe,Ce]}),e[74]=fe,e[75]=Ce,e[76]=le):le=e[76],U=ad,ee=P,X=Nm,Y=I,G=O,J=B,F=K0,W=E,q=U0,Q="space-y-0.5",H=g.map(xe=>r.jsx(AQ,{entry:xe,selected:xe.index===i,canDelete:m,onSelect:()=>de(xe.index),onRename:l?()=>l(xe.index):void 0,onDuplicate:()=>a(xe.index),onDelete:()=>c(xe.index)},xe.id)),e[14]=m,e[15]=g,e[16]=E,e[17]=O,e[18]=I,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=P,e[27]=f,e[28]=F,e[29]=U,e[30]=H,e[31]=W,e[32]=q,e[33]=ee,e[34]=X,e[35]=Y,e[36]=G,e[37]=J,e[38]=oe,e[39]=le,e[40]=Q}else F=e[28],U=e[29],H=e[30],W=e[31],q=e[32],ee=e[33],X=e[34],Y=e[35],G=e[36],J=e[37],oe=e[38],le=e[39],Q=e[40];let K;e[77]!==H||e[78]!==Q?(K=r.jsx("div",{className:Q,children:H}),e[77]=H,e[78]=Q,e[79]=K):K=e[79];let te;e[80]!==F||e[81]!==W||e[82]!==q||e[83]!==K?(te=r.jsx(F,{items:W,strategy:q,children:K}),e[80]=F,e[81]=W,e[82]=q,e[83]=K,e[84]=te):te=e[84];let ne;e[85]!==b||e[86]!==m?(ne=b?r.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",D7),children:r.jsx(I7,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=ne):ne=e[87];let re;e[88]!==ne?(re=bn.createPortal(r.jsx(F0,{dropAnimation:l7,children:ne}),document.body),e[88]=ne,e[89]=re):re=e[89];let he;e[90]!==U||e[91]!==ee||e[92]!==X||e[93]!==Y||e[94]!==G||e[95]!==J||e[96]!==te||e[97]!==re?(he=r.jsxs(U,{sensors:ee,collisionDetection:X,onDragStart:Y,onDragEnd:G,onDragCancel:J,children:[te,re]}),e[90]=U,e[91]=ee,e[92]=X,e[93]=Y,e[94]=G,e[95]=J,e[96]=te,e[97]=re,e[98]=he):he=e[98];let pe;return e[99]!==oe||e[100]!==le||e[101]!==he?(pe=r.jsxs("div",{className:oe,children:[le,he]}),e[99]=oe,e[100]=le,e[101]=he,e[102]=pe):pe=e[102],pe}function DQ(t){return t.id}const IQ=[[/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"]],MQ={"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 Q9(t){return Mo(t)!==void 0}function wp(t,e){if(e){if(Q9(e))return e;const s=MQ[e];if(s&&Q9(s))return s}for(const[s,n]of IQ)if(s.test(t)&&Q9(n))return n;return"FilterLines"}function $Q(t){return Mo(t)??K1}function X9(t){const e=z.c(11),{iconName:s,size:n,className:i}=t,o=n===void 0?"md":n;let l;e[0]!==s?(l=$Q(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",d=o==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=ie("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=r.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=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}const OQ=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),BQ=5,zQ=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function F3(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const o=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:zQ.format(d)},l=o(n),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function Ju(t,e=0){if(!t)return"Default";if(e>BQ)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:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(OQ).join(" & "):ds(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return F3(t)??ds(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`:ds(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):ds(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:ds(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=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=o?.[0];if(c){const d=(o?.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:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>Ju(a,e+1)).join(` ${l} `)}return ds(s)}default:{const i=F3(t);return i||ds(s)||"Default"}}}function Wae(t,e){return PK(t,e).map(s=>{const n=e[s.blockKey]??{},i=p8(IK(s.blockKey),e,t);return{blockKey:s.blockKey,title:D0(s.blockKey,n),description:Ju(i),iconName:wp(s.matcherResolveType)}})}const M7="Users03";function FQ(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function UQ(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,o]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(o)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=to(l,t);s.push({resolveType:l,title:a.title??ds(l),description:a.description,iconName:wp(l,a.icon)})}return s}function KQ(t,e){if(!t)return M7;const s=e.find(n=>n.resolveType===t);return s?s.iconName:wp(t)}function HQ(t){const e=z.c(80),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=V.useState(!1),f=se(),p=(i?d.find(G=>G.blockKey===i):void 0)?.iconName??KQ(s,o),g=Mo(p);let x;e[0]!==a||e[1]!==h?(x=G=>{a(G),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=G=>{c?.(G),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const y=v;let _;e[6]!==h?(_=()=>h(!0),e[6]=h,e[7]=_):_=e[7];let L;e[8]!==g?(L=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=L):L=e[9];let w;e[10]!==n?(w=r.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(fs,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==_||e[14]!==L||e[15]!==w?(k=r.jsxs("button",{type:"button",onClick:_,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:[L,w,S]}),e[13]=_,e[14]=L,e[15]=w,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 T;e[19]!==f?(T=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=T):T=e[20];let N;e[21]!==f?(N=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=N):N=e[22];let C;e[23]!==N?(C=r.jsx(Wi,{placeholder:N}),e[23]=N,e[24]=C):C=e[24];let A;e[25]!==f?(A=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=A):A=e[26];let P;e[27]!==A?(P=r.jsx(si,{children:A}),e[27]=A,e[28]=P):P=e[28];let R;e[29]!==b?(R=()=>b(""),e[29]=b,e[30]=R):R=e[30];const E=!s&&!i&&"bg-accent/60";let M;e[31]!==E?(M=ie("gap-2.5",E),e[31]=E,e[32]=M):M=e[32];let I;e[33]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(X9,{iconName:M7,size:"sm"}),e[33]=I):I=e[33];let $;e[34]!==f?($=f("sectionsEditor.matcherPicker.alwaysLabel"),e[34]=f,e[35]=$):$=e[35];let O;e[36]!==$?(O=r.jsx("span",{className:"text-sm",children:$}),e[36]=$,e[37]=O):O=e[37];let D;e[38]!==f?(D=f("sectionsEditor.matcherPicker.targetAllUsers"),e[38]=f,e[39]=D):D=e[39];let B;e[40]!==D?(B=r.jsx("span",{className:"text-xs text-muted-foreground",children:D}),e[40]=D,e[41]=B):B=e[41];let F;e[42]!==O||e[43]!==B?(F=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[O,B]}),e[42]=O,e[43]=B,e[44]=F):F=e[44];let U;e[45]!==R||e[46]!==M||e[47]!==F?(U=r.jsxs(Jt,{value:"always Target all users",onSelect:R,className:M,children:[I,F]}),e[45]=R,e[46]=M,e[47]=F,e[48]=U):U=e[48];let H;if(e[49]!==i||e[50]!==s||e[51]!==b||e[52]!==o){let G;e[54]!==i||e[55]!==s||e[56]!==b?(G=J=>r.jsxs(Jt,{value:`${J.title} ${J.resolveType} ${J.description??""}`,onSelect:()=>b(J.resolveType),className:ie("gap-2.5",!i&&s===J.resolveType&&"bg-accent/60"),children:[r.jsx(X9,{iconName:J.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:J.title}),J.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.resolveType),e[54]=i,e[55]=s,e[56]=b,e[57]=G):G=e[57],H=o.map(G),e[49]=i,e[50]=s,e[51]=b,e[52]=o,e[53]=H}else H=e[53];let W;e[58]!==U||e[59]!==H?(W=r.jsxs(ks,{children:[U,H]}),e[58]=U,e[59]=H,e[60]=W):W=e[60];let q;e[61]!==i||e[62]!==d||e[63]!==y||e[64]!==f?(q=d.length>0&&r.jsx(ks,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(G=>r.jsxs(Jt,{value:`${G.title} ${G.blockKey} ${G.description??""}`,onSelect:()=>y(G.blockKey),className:ie("gap-2.5",i===G.blockKey&&"bg-accent/60"),children:[r.jsx(X9,{iconName:G.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:G.title}),G.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:G.description})]})]},G.blockKey))}),e[61]=i,e[62]=d,e[63]=y,e[64]=f,e[65]=q):q=e[65];let ee;e[66]!==P||e[67]!==W||e[68]!==q?(ee=r.jsxs(qi,{children:[P,W,q]}),e[66]=P,e[67]=W,e[68]=q,e[69]=ee):ee=e[69];let X;e[70]!==u||e[71]!==h||e[72]!==T||e[73]!==C||e[74]!==ee||e[75]!==j?(X=r.jsxs(rj,{open:u,onOpenChange:h,title:j,description:T,className:"sm:max-w-lg",filter:FQ,children:[C,ee]}),e[70]=u,e[71]=h,e[72]=T,e[73]=C,e[74]=ee,e[75]=j,e[76]=X):X=e[76];let Y;return e[77]!==X||e[78]!==k?(Y=r.jsxs(r.Fragment,{children:[k,X]}),e[77]=X,e[78]=k,e[79]=Y):Y=e[79],Y}const U3=new WeakMap;function WQ(t,e){let s=U3.get(e);s||(s=new Map,U3.set(e,s));let n=s.get(t);return n===void 0&&(n=ni(t,e),s.set(t,n)),n}function qQ(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function GQ(t,e){return{__resolveType:e,variants:[{rule:Il(),value:structuredClone(t)},{rule:Il(),value:structuredClone(t)}]}}function YQ(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>lp(n.rule));return s?s.value:e[e.length-1]?.value}function QQ(t){const e=[...t.variants],s=e[e.length-1],n={rule:Il(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function XQ(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function JQ(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function ZQ(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 eX(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function K3(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const H3=new WeakMap;function tX(t){let e=H3.get(t);return e||(e=UQ(t),H3.set(t,e)),e}function $7(t){const e=z.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=se(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=V.useState(0);if(!qQ(l)){let O;e[0]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=O):O=e[1];let D;e[2]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(S0,{size:14}),e[2]=D):D=e[2];let B;e[3]!==o?(B=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=B):B=e[4];let F;return e[5]!==B?(F=r.jsx(qe,{children:B}),e[5]=B,e[6]=F):F=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":O,onClick:()=>{a(GQ(l,s)),h(0)},children:D})}),F]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==o?(g=(O,D)=>({index:D,label:Ju(O.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(D+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},y=v.__resolveType??"",_=b?.value,L=c?tX(c):[],w=y&&c?WQ(y,c):null,{__resolveType:S,...k}=v,j=()=>{a(YQ(f)),h(0)},T=()=>{const O=QQ(f);a(O),h(O.variants.length-1)},N=O=>{const D=XQ(f,O);D&&(a(D),p>=D.variants.length&&h(D.variants.length-1))},C=O=>{const D=JQ(f,O);a(D),h(O+1)},A=(O,D)=>{const B=ZQ(f,O,D);a(B),p===O&&h(D)},P=O=>{const D=O?MK(O,c):{__resolveType:_v};a(K3(f,p,D))},R=O=>{const D=O,B=y?{...D,__resolveType:y}:{...D};a(K3(f,p,B))},E=O=>{a(eX(f,p,O))},M=`${d}-${f.__resolveType}`;let I;e[9]!==o?(I=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=I):I=e[10];let $;return e[11]!==I?($=r.jsx(Et,{className:"text-xs text-muted-foreground",children:I}),e[11]=I,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(RQ,{listKey:M,variants:x,selectedIndex:p,onSelect:h,onDuplicate:C,onDelete:N,onRemoveAll:j,onReorder:A,onAdd:T}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(HQ,{currentRt:y,currentLabel:Ju(v),matchers:L,onSelect:P}),w&&r.jsx("div",{className:"pt-1",children:r.jsx(gr,{schema:w,value:k,onChange:R,basePath:""})})]}),n({...i,value:_,onChange:E})]})]})}const sX="website/loaders/secret.ts";function lc(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 nX(){return{__resolveType:sX,name:"",encrypted:""}}function iX(t){const{value:e,...s}=t;return s}function J9(t){const e=z.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=se();if(typeof n=="string"||n==null&&!lc(n)){const T=typeof n=="string"?n:"",N=a?.virtualMcpId;let C;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==N?(C=r.jsx(Ps,{htmlFor:l,label:o,description:s.description,virtualMcpId:N}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=N,e[4]=C):C=e[4];let A;e[5]!==c?(A=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=A):A=e[6];let P;e[7]!==i?(P=M=>i(M.target.value),e[7]=i,e[8]=P):P=e[8];let R;e[9]!==l||e[10]!==T||e[11]!==A||e[12]!==P?(R=r.jsx(rt,{id:l,type:"password",value:T,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:A,onChange:P,className:"h-10"}),e[9]=l,e[10]=T,e[11]=A,e[12]=P,e[13]=R):R=e[13];let E;return e[14]!==C||e[15]!==R?(E=r.jsxs("div",{className:"space-y-2",children:[C,R]}),e[14]=C,e[15]=R,e[16]=E):E=e[16],E}let d;e[17]!==n?(d=lc(n)?n:nX(),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]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx(Ps,{htmlFor:m,label:o,description:s.description,virtualMcpId:p}),e[19]=o,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 v;e[26]!==u||e[27]!==i?(v=T=>i({...u,name:T.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let y;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(y=r.jsx(rt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=y):y=e[33];const _=`${l}-value`;let L;e[34]!==f||e[35]!==c?(L=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=L):L=e[36];let w;e[37]!==u||e[38]!==f||e[39]!==i?(w=T=>{const N=T.target.value;if(!N){i(f?iX(u):u);return}i({...u,value:N})},e[37]=u,e[38]=f,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==L||e[42]!==w||e[43]!==_?(S=r.jsx(rt,{id:_,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:L,onChange:w,className:"h-10"}),e[41]=L,e[42]=w,e[43]=_,e[44]=S):S=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&r.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]!==S||e[49]!==k||e[50]!==g||e[51]!==y?(j=r.jsxs("div",{className:"space-y-2",children:[g,y,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=y,e[52]=j):j=e[52],j}function rX(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("__")):[],o=[],l=d=>{d?.type==="object"&&d.properties&&o.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(o.length===0)return;if(i.length===0)return o.length===1?o[0]:void 0;let a,c=-1;for(const d of o){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 oX(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 lX=new Set(["__resolveType","@type"]);function aX(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 cX(t){if(t9(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 W3(t){if(t.type==="array"&&t.items)return t;const e=t.items??cX(t);return e?{...t,type:"array",items:e}:null}function dX(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 Ol(t){const{schema:e,value:s}=t;if(Yu(s)){const l=lH(s),a=W3(e);if(l!==null&&a)return r.jsx(Qd,{...t,schema:a,value:l,onChange:c=>t.onChange(aH(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&t9(e)){const l=W3(e);if(l)return r.jsx(Qd,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Yu(s)&&e.type==="block-ref"){const l=rX(e,s)??oX(s);if(l){const a={...e,type:"array",items:l};return r.jsx(Qd,{...t,schema:a,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(aX(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=u=>Ol({...u,schema:c});return r.jsx($7,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(D3,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(yQ,{...t},t.path);if(e.format==="image-uri")return r.jsx(rQ,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(sQ,{...t},t.path);if(e.format==="map")return r.jsx(jQ,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(NY,{...t},t.path);if(e.format==="location")return r.jsx(R7,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(SG,{...t},t.path);if(e.type==="anyOf")return r.jsx(D3,{...t},t.path);if(lc(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(J9,{...t},t.path);const n=s??dX(e.type,e.default);if(n==null)return lc(s)?r.jsx(J9,{...t},t.path):null;if(lc(n))return r.jsx(J9,{...t,value:n},t.path);const i={...t,value:n},o=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(o==="array"||Array.isArray(n))return r.jsx(Qd,{...i},t.path);switch(o){case"boolean":return r.jsx(yG,{...i},t.path);case"number":case"integer":return r.jsx(vG,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(qd,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(qd,{...i},t.path):r.jsx(qd,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(dY,{...i},t.path):null;default:return r.jsx(qd,{...i},t.path)}}function uX(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ol({...t,schema:e});const s=t.value;if(s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&t.meta){const n=ni(s.__resolveType,t.meta);if(n)return r.jsx(gr,{schema:n,value:s,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onRequestAddSection:t.onRequestAddSection})}return Ol(e?{...t,schema:e}:t)}function gr(t){const e=z.c(6),{schema:s,value:n,onChange:i,basePath:o,breadcrumbPath:l,onBreadcrumbChange:a,meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p}=t,g=l===void 0?[]:l,x=se(),b=s.properties;if(!b)return s.type==="inline-union"?Ol({schema:s,value:n,onChange:i,path:o,label:s.title??"",breadcrumbPath:g,onBreadcrumbChange:a,meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p}):null;if(oH(n)&&b.variants){const E=b.variants.items?.properties?.value;let M;return e[0]!==E?(M=I=>uX(I,E),e[0]=E,e[1]=M):M=e[1],r.jsx($7,{schema:s,value:n,onChange:i,path:o,label:s.title??"",breadcrumbPath:g,onBreadcrumbChange:a,meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p,multivariateResolveType:n.__resolveType,renderInnerField:M},o)}const v=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},y=Object.keys(b).filter(E=>!lX.has(E)&&b[E]?.hidden!==!0);if(y.length===0){let E;return e[2]!==x?(E=x("sectionsEditor.sectionsEditor.noEditableFields"),e[2]=x,e[3]=E):E=e[3],r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:E})}const _=(E,M)=>{i({...v,[E]:M})},L=typeof v.__resolveType=="string"?v.__resolveType:void 0,w=y.filter(E=>{const M=b[E];return M!=null&&af(M,v[E])}).length>1,S=g.length>0?KG(y,b,v,g,d):null,k=S?b[S]:null,j=S&&k?[S]:y,T=S&&k?zG(S,k,g):g,N=BG(g,T),C=N.length>0&&a?E=>a([...N,...E]):a,A="min-w-0 space-y-6",P=j.map(E=>{const M=b[E];if(!M)return null;const I=o?`${o}.${E}`:E,$=_l(E,M);return Ol({schema:M,value:v[E],onChange:O=>_(E,O),path:I,label:$,breadcrumbPath:T,onBreadcrumbChange:C,hasSiblingDrillDownFields:w,meta:c,decofile:d,onSaveReferencedBlock:u,containerResolveType:L,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p})});let R;return e[4]!==P?(R=r.jsx("div",{className:A,children:P}),e[4]=P,e[5]=R):R=e[5],R}function hX(t){const e=z.c(3),{isPending:s,isError:n}=t;if(n){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[r.jsx(fn,{size:13}),"Couldn't save"]}),e[0]=o):o=e[0],o}if(s){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(it,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[r.jsx(Ut,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}function fX({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f}){const m=se(),p=vr(),g=p?.entity?.id===e?p.entity.metadata?.siteSlug??null:null,x=ni(a.resolveType,i),b=!x&&FA(a.resolveType,i),v=b?UA(c):null,y=x??v,[_,L]=V.useState(c),[w,S]=V.useState([]),[k,j]=V.useState(0),[T,N]=V.useState(!1),[C,A]=V.useState(null),[P,R]=V.useState(!1),[E,M]=V.useState(!1),[I,$]=V.useState(!1),O=C!==null,{save:D,flush:B,isPending:F}=y8({orgSlug:t,virtualMcpId:e,branch:s}),U=eW({orgSlug:t,virtualMcpId:e,branch:s});V.useEffect(()=>()=>{B()},[]);const H=z8(l),W=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,q={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:g},ee=K=>{L(K),a.mode==="saved"&&D(a.blockKey,{__resolveType:a.resolveType,...K})},X=()=>{O?(A(null),N(!1),j(K=>K+1)):A(JSON.stringify(_,null,2))},Y=K=>{const te=K??"";try{const ne=JSON.parse(te);if(ne&&typeof ne=="object"&&!Array.isArray(ne)){N(!1),ee(ne);return}N(!0)}catch{N(!0)}},G=async K=>{const te=vp(K,o);if(te){me.error(te);return}await u(K,{__resolveType:a.resolveType,..._}),R(!1)},J=()=>{M(!0),U.mutate({resolveType:a.resolveType,props:_})},oe=()=>{n&&window.open(JH(n,a.resolveType,_,Date.now()),"_blank","noopener")},le=[a.title,...w],Q=K=>{S(w.slice(0,K)),j(te=>te+1)};return r.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&r.jsx(ae,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":m("sandbox.runnableBlockEditor.backToList"),children:r.jsx(b0,{size:14})}),r.jsx("nav",{"aria-label":m("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:le.map((K,te)=>{const ne=te===le.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[te>0&&r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>Q(te),title:K,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ne?"font-medium text-foreground":"text-muted-foreground"),children:K})]},`${K}-${te}`)})}),a.mode==="saved"&&r.jsx(hX,{isPending:F,isError:!1}),r.jsxs(ae,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:U.isPending,"aria-label":m("sandbox.runnableBlockEditor.runAriaLabel",{singular:H}),children:[U.isPending?r.jsx(it,{size:14,className:"animate-spin"}):r.jsx(So,{size:14}),m("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>R(!0),"aria-label":m("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:H}),children:r.jsx(g1,{size:14})})}),r.jsx(qe,{side:"bottom",children:m("sandbox.runnableBlockEditor.saveAsGlobal",{singular:H})})]}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:O?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:X,"aria-label":m(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":O,children:O?r.jsx(hs,{size:14}):r.jsx($o,{size:14})})}),r.jsx(qe,{side:"bottom",children:m(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?m("sandbox.runnableBlockEditor.savedModeDescription",{singular:H}):m("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:W,singular:H})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:ie("relative min-h-0 flex-1",E&&I&&"hidden"),children:[r.jsx(Yr,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[v&&y===v&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:m("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:H})}),y?r.jsx(gr,{schema:y,value:_,onChange:K=>ee(K),basePath:"",breadcrumbPath:w,onBreadcrumbChange:S,meta:i,decofile:o,onSaveReferencedBlock:h,sandbox:q},k):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:b?m("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:H}):m("sandbox.runnableBlockEditor.noInputEmptyState",{singular:H})})]})})}),C!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[T&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:m("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Qc,{language:"json",height:"100%",code:C,onChange:Y,onSave:K=>{Y(K),B()}})})]})]}),E&&r.jsx(mX,{singular:H,result:{isPending:U.isPending,error:U.error,data:U.data,hasRun:U.status!=="idle"},expanded:I,onToggleExpand:()=>$(K=>!K),onOpenInNewTab:n?oe:void 0,onClose:()=>{M(!1),$(!1)}})]}),r.jsx(yp,{open:P,onOpenChange:R,defaultBlockId:"",isPending:d,onSubmit:G})]})}function mX(t){const e=z.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,onOpenInNewTab:l,onClose:a}=t,c=se();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=ie("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=r.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&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(hn,{size:14})})}),r.jsx(qe,{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?r.jsx(US,{size:14}):r.jsx(f5,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==o||e[19]!==x||e[20]!==b?(v=r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-7",onClick:o,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=o,e[19]=x,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==i||e[23]!==c?(y=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=y):y=e[24];let _;e[25]!==y?(_=r.jsx(qe,{side:"bottom",children:y}),e[25]=y,e[26]=_):_=e[26];let L;e[27]!==_||e[28]!==v?(L=r.jsxs(Ge,{children:[v,_]}),e[27]=_,e[28]=v,e[29]=L):L=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(hs,{size:14}),e[32]=S):S=e[32];let k;e[33]!==a||e[34]!==w?(k=r.jsx(ae,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":w,children:S}),e[33]=a,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==L||e[37]!==k||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,L,k]}),e[36]=L,e[37]=k,e[38]=g,e[39]=j):j=e[39];let T;e[40]!==j||e[41]!==p?(T=r.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]=T):T=e[42];let N;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(N=r.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?r.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[r.jsx(it,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?r.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[r.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?r.jsx(Qc,{language:"json",height:"100%",code:u,readOnly:!0}):r.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]=N):N=e[49];let C;return e[50]!==T||e[51]!==N||e[52]!==f?(C=r.jsxs("div",{className:f,children:[T,N]}),e[50]=T,e[51]=N,e[52]=f,e[53]=C):C=e[53],C}const pX={loaders:_u,actions:$i},gX={loaders:"Loaders",actions:"Actions"},xX={analytics:Sk,blog:Pl,commerce:O1,site:KS,website:kn};function bX(t,e){return e===0?xX[t.toLowerCase()]??Di:Di}function Jd(t,e){return e===0?SW(t):t}function vX(t){const e=z.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c}=t,d=se();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=V.useState(u),[m,p]=V.useState(null),[g,x]=V.useState(""),[b,v]=V.useState(CX),[y,_]=V.useState(c);y!==c&&(_(c),f([]),p(null),x(""),v(new Set));let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=U=>{v(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=L):L=e[1];const w=L;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=e9(S);let j;e[6]!==k?(j=Q8((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const T=j;let N;e[8]!==c?(N=z8(c),e[8]=c,e[9]=N):N=e[9];const C=N,A=pX[c];let P,R,E,M,I,$,O;if(e[10]!==A||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==o||e[19]!==k||e[20]!==T||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){E=Symbol.for("react.early_return_sentinel");e:{const U=[...kW(l,a,c).map(jX),...F8(l,c).map(kX)],H=g.trim().toLowerCase(),W=H.length>0,q=W?U.filter(be=>be.title.toLowerCase().includes(H)||be.resolveType.toLowerCase().includes(H)):[],ee=new Map,X=[],Y=new Map;if(!W){for(const be of U){const Ee=be.folderPath;if(!(Ee.length<h.length)&&h.every((_e,Ae)=>Ee[Ae]===_e))if(Ee.length===h.length)if(be.savedKey!==void 0){const _e=Y.get(be.resolveType);_e?_e.push(be):Y.set(be.resolveType,[be])}else X.push(be);else{const _e=Ee[h.length],Ae=ee.get(_e)??{count:0,savedCount:0};be.savedKey!==void 0?Ae.savedCount=Ae.savedCount+1:Ae.count=Ae.count+1,ee.set(_e,Ae)}}X.sort(SX);for(const be of Y.values())be.sort(wX)}const G=[...Y.entries()].filter(be=>{const[Ee]=be;return!X.some(_e=>_e.resolveType===Ee)}).flatMap(LX).sort(_X);let J;e[33]!==h?(J=(be,Ee)=>Jd(be.name,h.length).localeCompare(Jd(Ee.name,h.length)),e[33]=h,e[34]=J):J=e[34];const oe=[...ee.entries()].map(yX).sort(J);let le;e[35]===Symbol.for("react.memo_cache_sentinel")?(le=be=>{p(be.savedKey!==void 0?{mode:"saved",key:be.savedKey}:{mode:"available",resolveType:be.resolveType,title:be.title})},e[35]=le):le=e[35];const Q=le;let K;e[36]!==k||e[37]!==C||e[38]!==d?(K=async(be,Ee)=>{await k.mutateAsync({blockKey:be,data:Ee}),me.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:be})),p({mode:"saved",key:be})},e[36]=k,e[37]=C,e[38]=d,e[39]=K):K=e[39];const te=K;let ne;e[40]!==a||e[41]!==m?(ne=NX(m,a),e[40]=a,e[41]=m,e[42]=ne):ne=e[42];const re=ne;if(re){const be=`${re.mode}:${re.mode==="saved"?re.blockKey:re.resolveType}`;let Ee;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ee=()=>p(null),e[43]=Ee):Ee=e[43];let _e;e[44]!==i||e[45]!==a||e[46]!==te||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==k.isPending||e[52]!==T||e[53]!==be||e[54]!==re.editorTarget||e[55]!==re.initialValue||e[56]!==n?(_e=r.jsx(fX,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:re.editorTarget,initialValue:re.initialValue,isCreating:k.isPending,onCreate:te,onSaveReferencedBlock:T,onBack:Ee},be),e[44]=i,e[45]=a,e[46]=te,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=k.isPending,e[52]=T,e[53]=be,e[54]=re.editorTarget,e[55]=re.initialValue,e[56]=n,e[57]=_e):_e=e[57],E=_e;break e}O="flex h-full w-full min-w-0 flex-col";let he;e[58]!==d?(he=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=he):he=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>f([]),e[60]=pe):pe=e[60];const de=h.length===0?"font-medium text-foreground":"text-muted-foreground";let Z;e[61]!==de?(Z=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",de),e[61]=de,e[62]=Z):Z=e[62];const fe=gX[c];let ue;e[63]!==Z||e[64]!==fe?(ue=r.jsx("button",{type:"button",onClick:pe,className:Z,children:fe}),e[63]=Z,e[64]=fe,e[65]=ue):ue=e[65];let ye;e[66]!==h?(ye=h.map((be,Ee)=>{const _e=Ee===h.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Ee+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:Jd(be,Ee)})]},`${be}-${Ee}`)}),e[66]=h,e[67]=ye):ye=e[67];let Le;e[68]!==he||e[69]!==ue||e[70]!==ye?(Le=r.jsxs("nav",{"aria-label":he,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[ue,ye]}),e[68]=he,e[69]=ue,e[70]=ye,e[71]=Le):Le=e[71];let Re;e[72]===Symbol.for("react.memo_cache_sentinel")?(Re=r.jsx(C0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Re):Re=e[72];let De;e[73]===Symbol.for("react.memo_cache_sentinel")?(De=be=>x(be.target.value),e[73]=De):De=e[73];let Ue;e[74]!==c||e[75]!==d?(Ue=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Ue):Ue=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 je;e[80]!==g||e[81]!==Ue||e[82]!==$e?(je=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Re,r.jsx("input",{type:"text",value:g,onChange:De,placeholder:Ue,"aria-label":$e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Ue,e[82]=$e,e[83]=je):je=e[83],e[84]!==Le||e[85]!==je?(R=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Le,je]}),e[84]=Le,e[85]=je,e[86]=R):R=e[86],P=Yr,$="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=W?q.length===0?r.jsx(Dr,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):r.jsx("div",{className:"flex flex-col gap-1",children:q.map(be=>r.jsx(Yn,{icon:A,accent:be.savedKey!==void 0?"global":void 0,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>Q(be)},be.savedKey??be.resolveType))}):oe.length===0&&X.length===0&&G.length===0?r.jsx(Dr,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[oe.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:oe.map(be=>{const Ee=bX(be.name,h.length);return r.jsxs("button",{type:"button",onClick:()=>f([...h,be.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:[r.jsx(Ee,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:Jd(be.name,h.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[be.count," ",be.count===1?C:c,be.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:be.savedCount})]})]})]})]},be.name)})}),(X.length>0||G.length>0)&&r.jsxs("div",{className:ie("flex flex-col gap-1",oe.length>0&&"mt-4"),children:[X.map(be=>{const Ee=Y.get(be.resolveType)??[],_e=b.has(be.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(Yn,{icon:A,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>Q(be)}),Ee.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>w(be.resolveType),"aria-expanded":_e,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:fm},children:[_e?r.jsx(fs,{size:12,className:"shrink-0"}):r.jsx(wn,{size:12,className:"shrink-0"}),d(_e?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ee.length,")"]}),_e&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ee.map(Ae=>r.jsx(Yn,{icon:A,accent:"global",title:Ae.title,subtitle:Ae.resolveType,active:!1,onClick:()=>Q(Ae)},Ae.savedKey))})]})]},be.resolveType)}),G.map(be=>r.jsx(Yn,{icon:A,accent:"global",title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>Q(be)},be.savedKey))]})]})}e[10]=A,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=o,e[19]=k,e[20]=T,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=P,e[27]=R,e[28]=E,e[29]=M,e[30]=I,e[31]=$,e[32]=O}else P=e[26],R=e[27],E=e[28],M=e[29],I=e[30],$=e[31],O=e[32];if(E!==Symbol.for("react.early_return_sentinel"))return E;let D;e[87]!==M||e[88]!==I?(D=r.jsx("div",{className:M,children:I}),e[87]=M,e[88]=I,e[89]=D):D=e[89];let B;e[90]!==P||e[91]!==D||e[92]!==$?(B=r.jsx(P,{className:$,children:D}),e[90]=P,e[91]=D,e[92]=$,e[93]=B):B=e[93];let F;return e[94]!==R||e[95]!==B||e[96]!==O?(F=r.jsxs("div",{className:O,children:[R,B]}),e[94]=R,e[95]=B,e[96]=O,e[97]=F):F=e[97],F}function yX(t){const[e,s]=t;return{name:e,...s}}function _X(t,e){return t.title.localeCompare(e.title)}function LX(t){const[,e]=t;return e}function wX(t,e){return t.title.localeCompare(e.title)}function SX(t,e){return t.title.localeCompare(e.title)}function kX(t){return{resolveType:t.resolveType,title:t.title,folderPath:U8(t.resolveType)}}function jX(t){return{resolveType:t.resolveType,title:t.title,folderPath:U8(t.resolveType),savedKey:t.key}}function CX(){return new Set}function NX(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 s=e[t.key],n=s&&typeof s.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...o}=s??{},l=s&&typeof s.name=="string"&&s.name?s.name:t.key;return{mode:"saved",blockKey:t.key,resolveType:n,editorTarget:{mode:"saved",blockKey:t.key,resolveType:n,title:l},initialValue:o}}function VX(t){const e=z.c(96),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=se(),g=vr(),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[v,y]=V.useState(b);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[1]=_):_=e[1];const[L,w]=V.useState(_),[S,k]=V.useState(0),[j,T]=V.useState(!1);let N;e[2]!==l||e[3]!==c?(N=ni(c,l),e[2]=l,e[3]=c,e[4]=N):N=e[4];const C=N;let A,P,R,E,M,I,$,O;if(e[5]!==x||e[6]!==i||e[7]!==a||e[8]!==L||e[9]!==v||e[10]!==h||e[11]!==f||e[12]!==s||e[13]!==o||e[14]!==c||e[15]!==p||e[16]!==d||e[17]!==n){const q=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,ee=o??void 0;let X;e[26]!==x||e[27]!==i||e[28]!==s||e[29]!==ee||e[30]!==n?(X={orgSlug:s,virtualMcpId:n,branch:i,previewUrl:ee,siteSlug:x},e[26]=x,e[27]=i,e[28]=s,e[29]=ee,e[30]=n,e[31]=X):X=e[31],P=X;let Y;e[32]!==L||e[33]!==d?(Y=[d,...L],e[32]=L,e[33]=d,e[34]=Y):Y=e[34];const G=Y;let J;e[35]!==L?(J=ue=>{w(L.slice(0,ue)),k(TX)},e[35]=L,e[36]=J):J=e[36];const oe=J;let le;e[37]!==a||e[38]!==v||e[39]!==f?(le=async ue=>{const ye=vp(ue,a);if(ye){me.error(ye);return}await f(ue,v),T(!1)},e[37]=a,e[38]=v,e[39]=f,e[40]=le):le=e[40],A=le,O="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",M="shrink-0 border-b px-3 py-2.5";let Q;e[41]!==p?(Q=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[41]=p,e[42]=Q):Q=e[42];let K;e[43]!==oe||e[44]!==G?(K=G.map((ue,ye)=>{const Le=ye===G.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ye>0&&r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>oe(ye),title:ue,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",Le?"font-medium text-foreground":"text-muted-foreground"),children:ue})]},`${ue}-${ye}`)}),e[43]=oe,e[44]=G,e[45]=K):K=e[45];let te;e[46]!==Q||e[47]!==K?(te=r.jsx("nav",{"aria-label":Q,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:K}),e[46]=Q,e[47]=K,e[48]=te):te=e[48];let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>T(!0),e[49]=ne):ne=e[49];let re;e[50]!==p?(re=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[50]=p,e[51]=re):re=e[51];let he;e[52]===Symbol.for("react.memo_cache_sentinel")?(he=r.jsx(g1,{size:14}),e[52]=he):he=e[52];let pe;e[53]!==h||e[54]!==re?(pe=r.jsx(We,{asChild:!0,children:r.jsx(ae,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:ne,"aria-label":re,children:he})}),e[53]=h,e[54]=re,e[55]=pe):pe=e[55];let de;e[56]!==p?(de=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[56]=p,e[57]=de):de=e[57];let Z;e[58]!==de?(Z=r.jsx(qe,{side:"bottom",children:de}),e[58]=de,e[59]=Z):Z=e[59];let fe;e[60]!==pe||e[61]!==Z?(fe=r.jsxs(Ge,{children:[pe,Z]}),e[60]=pe,e[61]=Z,e[62]=fe):fe=e[62],e[63]!==te||e[64]!==fe?(I=r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[te,fe]}),e[63]=te,e[64]=fe,e[65]=I):I=e[65],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",E=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:q}),e[5]=x,e[6]=i,e[7]=a,e[8]=L,e[9]=v,e[10]=h,e[11]=f,e[12]=s,e[13]=o,e[14]=c,e[15]=p,e[16]=d,e[17]=n,e[18]=A,e[19]=P,e[20]=R,e[21]=E,e[22]=M,e[23]=I,e[24]=$,e[25]=O}else A=e[18],P=e[19],R=e[20],E=e[21],M=e[22],I=e[23],$=e[24],O=e[25];let D;e[66]!==R||e[67]!==E?(D=r.jsx("p",{className:R,children:E}),e[66]=R,e[67]=E,e[68]=D):D=e[68];let B;e[69]!==D||e[70]!==M||e[71]!==I?(B=r.jsxs("div",{className:M,children:[I,D]}),e[69]=D,e[70]=M,e[71]=I,e[72]=B):B=e[72];let F;e[73]!==a||e[74]!==L||e[75]!==S||e[76]!==v||e[77]!==l||e[78]!==m||e[79]!==P||e[80]!==C||e[81]!==p?(F=r.jsx(Yr,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:C?r.jsx(gr,{schema:C,value:v,onChange:q=>y(q),basePath:"",breadcrumbPath:L,onBreadcrumbChange:w,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:P},S):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[73]=a,e[74]=L,e[75]=S,e[76]=v,e[77]=l,e[78]=m,e[79]=P,e[80]=C,e[81]=p,e[82]=F):F=e[82];let U;e[83]!==B||e[84]!==F||e[85]!==$?(U=r.jsxs("div",{className:$,children:[B,F]}),e[83]=B,e[84]=F,e[85]=$,e[86]=U):U=e[86];let H;e[87]!==u||e[88]!==A||e[89]!==h||e[90]!==j?(H=r.jsx(yp,{open:j,onOpenChange:T,defaultBlockId:u,isPending:h,onSubmit:A}),e[87]=u,e[88]=A,e[89]=h,e[90]=j,e[91]=H):H=e[91];let W;return e[92]!==U||e[93]!==H||e[94]!==O?(W=r.jsxs("div",{className:O,children:[U,H]}),e[92]=U,e[93]=H,e[94]=O,e[95]=W):W=e[95],W}function TX(t){return t+1}function EX(t,e){const s={__resolveType:t},n=L8([s],e)[0];return n?$G(s,n,e):null}function AX({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=se(),d=vr(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=V.useState(()=>EX(l,o)),[f,m]=V.useState(h?.data??{}),[p,g]=V.useState([]),[x,b]=V.useState(0),[v,y]=V.useState(!1),[_,L]=V.useState(null),w=_!==null,{save:S,flush:k}=y8({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?ni(h.resolveType,i):null,T=o[l],N=T?D0(l,T):l,C={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:u},A=I=>{m(I),S(l,I)},P=()=>{w?(L(null),y(!1),b(I=>I+1)):L(JSON.stringify(f,null,2))},R=I=>{const $=I??"";try{const O=JSON.parse($);if(O&&typeof O=="object"&&!Array.isArray(O)){y(!1),A(O);return}y(!0)}catch{y(!0)}},E=[N,...p],M=I=>{g(p.slice(0,I)),b($=>$+1)};return r.jsx("div",{className:"flex h-full w-full min-w-0",children:r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:fm},"aria-hidden":!0}),r.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((I,$)=>{const O=$===E.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>M($),title:I,className:ie("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:I})]},`${I}-${$}`)})}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:P,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?r.jsx(hs,{size:14}):r.jsx($o,{size:14})})}),r.jsx(qe,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),r.jsxs("div",{className:"relative min-h-0 flex-1",children:[r.jsx(Yr,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:j?r.jsx(gr,{schema:j,value:f,onChange:I=>A(I),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:C},x):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),_!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Qc,{language:"json",height:"100%",code:_,onChange:R,onSave:I=>{R(I),k()}})})]})]})]})})}function PX(t){const e=z.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=se();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=r.jsx(Dr,{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 v;e[7]!==s.title?(v=v7(s.title),e[7]=s.title,e[8]=v):v=e[8];let y;e[9]!==u||e[10]!==s.resolveType?(y=(L,w)=>u(s.resolveType,L,w),e[9]=u,e[10]=s.resolveType,e[11]=y):y=e[11];let _;return e[12]!==o||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]!==v||e[23]!==y||e[24]!==i?(_=r.jsx(VX,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:y,onSaveReferencedBlock:h},g),e[12]=o,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]=v,e[23]=y,e[24]=i,e[25]=_):_=e[25],_}const m=`saved:${s.key}`;let p;return e[26]!==o||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=r.jsx(AX,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=o,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 q3="__all__",G3={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},RX={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Y3=V.forwardRef(function(e,s){const n=z.c(20);let i,o,l,a,c;n[0]!==e?({icon:i,active:o,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=l,n[4]=a,n[5]=c):(i=n[1],o=n[2],l=n[3],a=n[4],c=n[5]);const d=o?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=ie("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=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=n[10];let f;n[11]!==c?(f=c&&r.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=r.jsx(fs,{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=r.jsxs(ae,{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 O7(t){const e=z.c(2),{count:s}=t;let n;return e[0]!==s?(n=r.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 DX(t){const e=z.c(88),{categories:s,authors:n,categoryFilter:i,authorFilter:o,sort:l,onCategoryFilterChange:a,onAuthorFilterChange:c,onSortChange:d}=t,u=se();let h;if(e[0]!==s||e[1]!==i){let J;e[3]!==i?(J=oe=>oe.slug===i,e[3]=i,e[4]=J):J=e[4],h=s.find(J),e[0]=s,e[1]=i,e[2]=h}else h=e[2];const f=h;let m;if(e[5]!==o||e[6]!==n){let J;e[8]!==o?(J=oe=>oe.email===o,e[8]=o,e[9]=J):J=e[9],m=n.find(J),e[5]=o,e[6]=n,e[7]=m}else m=e[7];const p=m,g=!!(i||o);let x;e[10]!==p?.name||e[11]!==f?.name||e[12]!==u?(x=f?.name??p?.name??u("sandbox.postToolbar.filterLabel"),e[10]=p?.name,e[11]=f?.name,e[12]=u,e[13]=x):x=e[13];const b=x,v=i?`cat:${i}`:o?`author:${o}`:q3;let y;e[14]!==c||e[15]!==a?(y=()=>{a(null),c(null)},e[14]=c,e[15]=a,e[16]=y):y=e[16];const _=y;let L;e[17]!==_||e[18]!==c||e[19]!==a?(L=J=>{J.startsWith("cat:")?(c(null),a(J.slice(4))):J.startsWith("author:")?(a(null),c(J.slice(7))):_()},e[17]=_,e[18]=c,e[19]=a,e[20]=L):L=e[20];const w=L;let S;e[21]!==b||e[22]!==g?(S=r.jsx(Gt,{asChild:!0,children:r.jsx(Y3,{icon:HS,active:g,value:b,className:"min-w-0 shrink"})}),e[21]=b,e[22]=g,e[23]=S):S=e[23];let k;e[24]!==u?(k=u("sandbox.postToolbar.filterBy"),e[24]=u,e[25]=k):k=e[25];let j;e[26]!==k?(j=r.jsx(_d,{children:k}),e[26]=k,e[27]=j):j=e[27];let T;e[28]!==u?(T=u("sandbox.postToolbar.allPosts"),e[28]=u,e[29]=T):T=e[29];let N;e[30]!==T?(N=r.jsx(bc,{value:q3,children:T}),e[30]=T,e[31]=N):N=e[31];let C;e[32]!==s.length||e[33]!==u?(C=s.length>0&&r.jsx(_d,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.categoryLabel")}),e[32]=s.length,e[33]=u,e[34]=C):C=e[34];let A;e[35]!==s?(A=s.map(MX),e[35]=s,e[36]=A):A=e[36];let P;e[37]!==n.length||e[38]!==u?(P=n.length>0&&r.jsx(_d,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.authorLabel")}),e[37]=n.length,e[38]=u,e[39]=P):P=e[39];let R;e[40]!==n?(R=n.map(IX),e[40]=n,e[41]=R):R=e[41];let E;e[42]!==v||e[43]!==w||e[44]!==N||e[45]!==C||e[46]!==A||e[47]!==P||e[48]!==R?(E=r.jsxs(wh,{value:v,onValueChange:w,children:[N,C,A,P,R]}),e[42]=v,e[43]=w,e[44]=N,e[45]=C,e[46]=A,e[47]=P,e[48]=R,e[49]=E):E=e[49];let M;e[50]!==E||e[51]!==j?(M=r.jsxs(Yt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[j,E]}),e[50]=E,e[51]=j,e[52]=M):M=e[52];let I;e[53]!==M||e[54]!==S?(I=r.jsxs(qt,{children:[S,M]}),e[53]=M,e[54]=S,e[55]=I):I=e[55];let $;e[56]!==_||e[57]!==g||e[58]!==u?($=g&&r.jsx($X,{label:u("sandbox.postToolbar.clearFilter"),onClick:_}),e[56]=_,e[57]=g,e[58]=u,e[59]=$):$=e[59];const O=RX[l];let D;e[60]!==u||e[61]!==O?(D=u(O),e[60]=u,e[61]=O,e[62]=D):D=e[62];let B;e[63]!==D?(B=r.jsx(Gt,{asChild:!0,children:r.jsx(Y3,{icon:WS,active:!0,value:D})}),e[63]=D,e[64]=B):B=e[64];let F;e[65]!==u?(F=u("sandbox.postToolbar.sortBy"),e[65]=u,e[66]=F):F=e[66];let U;e[67]!==F?(U=r.jsx(_d,{children:F}),e[67]=F,e[68]=U):U=e[68];let H;e[69]!==d?(H=J=>d(J),e[69]=d,e[70]=H):H=e[70];let W;e[71]===Symbol.for("react.memo_cache_sentinel")?(W=Object.keys(G3),e[71]=W):W=e[71];let q;e[72]!==u?(q=W.map(J=>r.jsx(bc,{value:J,children:u(G3[J])},J)),e[72]=u,e[73]=q):q=e[73];let ee;e[74]!==l||e[75]!==H||e[76]!==q?(ee=r.jsx(wh,{value:l,onValueChange:H,children:q}),e[74]=l,e[75]=H,e[76]=q,e[77]=ee):ee=e[77];let X;e[78]!==U||e[79]!==ee?(X=r.jsxs(Yt,{align:"end",className:"w-44",children:[U,ee]}),e[78]=U,e[79]=ee,e[80]=X):X=e[80];let Y;e[81]!==B||e[82]!==X?(Y=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(qt,{children:[B,X]})}),e[81]=B,e[82]=X,e[83]=Y):Y=e[83];let G;return e[84]!==I||e[85]!==$||e[86]!==Y?(G=r.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[I,$,Y]}),e[84]=I,e[85]=$,e[86]=Y,e[87]=G):G=e[87],G}function IX(t){return r.jsxs(bc,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(O7,{count:t.count})]},`author:${t.email}`)}function MX(t){return r.jsxs(bc,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(O7,{count:t.count})]},`cat:${t.slug}`)}function $X(t){const e=z.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(hs,{size:12}),e[0]=i):i=e[0];let o;return e[1]!==s||e[2]!==n?(o=r.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]=o):o=e[3],o}function OX(t){const e=z.c(18),{checked:s,disabled:n,onToggle:i}=t,o=se();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o?(a=o(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=r.jsx(We,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:BX,children:r.jsx(Gl,{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]!==o?(d=o(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=o,e[12]=d):d=e[12];let u;e[13]!==d?(u=r.jsx(qe,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=r.jsxs(Ge,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function BX(t){return t.stopPropagation()}function zX(t){const e=z.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=se();let c;e[0]!==n||e[1]!==i?(c=r.jsx(OX,{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=r.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=r.jsx(Ks,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==h||e[13]!==f?(p=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:o,"aria-label":f,children:m})}),e[11]=o,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=r.jsx(qe,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(Ge,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(hs,{size:14}),e[24]=y):y=e[24];let _;e[25]!==l||e[26]!==v?(_=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:y})}),e[25]=l,e[26]=v,e[27]=_):_=e[27];let L;e[28]!==a?(L=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=L):L=e[29];let w;e[30]!==L?(w=r.jsx(qe,{side:"bottom",children:L}),e[30]=L,e[31]=w):w=e[31];let S;e[32]!==_||e[33]!==w?(S=r.jsxs(Ge,{children:[_,w]}),e[32]=_,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==u?(j=r.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 wa(t){const e=z.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,onViewJson:l,onDelete:a}=t,c=se();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=r.jsx(Hi,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=r.jsx(Gt,{asChild:!0,children:r.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:FX,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(Ze,{onClick:n,children:[r.jsx(d1,{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&&r.jsxs(Ze,{onClick:s,children:[r.jsx(on,{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&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),r.jsxs(Ze,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(S0,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==o||e[15]!==l||e[16]!==c?(g=(o||l)&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),o&&r.jsxs(Ze,{onClick:o,children:[r.jsx(S1,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(Ze,{onClick:l,children:[r.jsx($o,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=o,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(ki,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Ks,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let y;e[22]!==a||e[23]!==v?(y=r.jsxs(Ze,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=y):y=e[24];let _;e[25]!==y||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(_=r.jsxs(Yt,{align:"end",className:"w-44",children:[f,m,p,g,x,y]}),e[25]=y,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=_):_=e[30];let L;return e[31]!==_||e[32]!==h?(L=r.jsxs(qt,{children:[h,_]}),e[31]=_,e[32]=h,e[33]=L):L=e[33],L}function FX(t){return t.stopPropagation()}function UX(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function KX(t){const e=new Map;for(const s of t){const n=UX(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 Q3(t){const e=z.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=ie("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]=o):o=e[1];let l;e[2]!==s?(l=r.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:o,children:[l,n]}),e[4]=n,e[5]=o,e[6]=l,e[7]=a):a=e[7],a}const X3=V.lazy(()=>Sn(()=>import("./app-editor-CoeeWDoR.js"),__vite__mapDeps([150,1,2,17,49,50,51,16,3,18,4,5,6,7,8,9,10,11,12,13,14,15,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,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,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,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.AppEditor}))),HX=V.lazy(()=>Sn(()=>import("./post-editor-DWPT6Z4F.js"),__vite__mapDeps([151,1,2,5,32,4,6,7,8,9,10,11,12,13,14,15,16,3,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,96,95,152,126,129,145,146,73,106,103,99,123,51,153,49,50,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,154,155,101,102,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,124,125,127,128,130,131,97,132,133,134,135,136,137,138,139,140,141,142,143,144,147,148])).then(t=>({default:t.PostEditor}))),WX=V.lazy(()=>Sn(()=>import("./record-editor-DTL4fK9u.js"),__vite__mapDeps([156,1,2,96,95,50,51,16,3,18,123,154,4,5,6,7,8,9,10,11,12,13,14,15,17,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,155,79,74,73,75,55,56,76,77,78,80,57,81,67,82,83,49,52,53,54,58,59,60,61,62,63,64,65,66,68,69,70,71,72,84,85,86,87,88,89,90,91,92,93,94,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.RecordEditor}))),qX=V.lazy(()=>Sn(()=>import("./category-editor-DBmpWkQa.js"),__vite__mapDeps([157,1,2,10,4,5,6,7,8,9,11,12,13,14,15,16,3,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,107,96,95,153,145,146,73,106,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,154,155,101,102,103,104,105,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,147,148])).then(t=>({default:t.CategoryEditor}))),GX=V.lazy(()=>Sn(()=>import("./bulk-category-panel-AUMFMltr.js"),__vite__mapDeps([158,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,95,50,51,79,74,73,75,55,56,76,77,78,80,57,81,67,82,83,49,52,53,54,58,59,60,61,62,63,64,65,66,68,69,70,71,72,84,85,86,87,88,89,90,91,92,93,94,96,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,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.BulkCategoryPanel}))),YX=V.lazy(()=>Sn(()=>import("./sections-editor-BZXWTjdM.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])).then(t=>({default:t.SectionsEditor}))),QX=V.lazy(()=>Sn(()=>import("./seo-editor-CVxqqAo5.js"),__vite__mapDeps([159,1,2,17,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,98,99,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,97,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.SeoEditor}))),XX=V.lazy(()=>Sn(()=>import("./variant-calendar-BNSYoLxT.js"),__vite__mapDeps([160,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,95,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,96,99,161])).then(t=>({default:t.VariantCalendar}))),JX=V.lazy(()=>Sn(()=>import("./redirect-editor-B9KcZF24.js"),__vite__mapDeps([162,1,2,129,16,96,95,50,51,3,18,155,7,79,74,73,47,21,75,55,56,76,77,78,80,57,81,67,82,83,49,4,5,6,8,9,10,11,12,13,14,15,17,19,20,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,48,52,53,54,58,59,60,61,62,63,64,65,66,68,69,70,71,72,84,85,86,87,88,89,90,91,92,93,94,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,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.RedirectEditor})));function Z9(t){return t?t.kind==="page"?{collection:"pages",key:t.key,path:t.path}:{collection:"sections",key:t.key}:null}function ZX(t){return t?t.kind==="page"?`page:${t.key}:${t.path}`:`section:${t.key}`:null}function eJ(t){const e=z.c(15),{mode:s}=t,n=s===void 0?"content":s,i=vr(),{currentBranch:o}=Qs(),{org:l}=Me(),a=i?.entity?.id??null,c=jn(),d=Uo(),u=d.previewUrl,h=d.previewState;if(h.kind!=="iframe"){const x=`/${l.slug}/settings/connections`;let b;return e[0]!==d.start||e[1]!==h||e[2]!==x||e[3]!==c.lifecycle||e[4]!==c.phase?(b=r.jsx(lq,{state:h,claimPhase:c.phase,lifecycle:c.lifecycle,onStart:d.start,connectionsHref:x}),e[0]=d.start,e[1]=h,e[2]=x,e[3]=c.lifecycle,e[4]=c.phase,e[5]=b):b=e[5],b}if(!a||!o){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Dr,{title:"Waiting for sandbox context…"}),e[6]=x):x=e[6],x}const f=c.lifecycle.phase,m=f==="running",p=!m&&f!=="clone-failed"&&f!=="install-failed"&&f!=="start-failed"&&f!=="crashed";let g;return e[7]!==o||e[8]!==m||e[9]!==n||e[10]!==l.slug||e[11]!==u||e[12]!==p||e[13]!==a?(g=r.jsx(sJ,{orgSlug:l.slug,virtualMcpId:a,branch:o,previewUrl:u,mode:n,devServerReady:m,sandboxWarming:p}),e[7]=o,e[8]=m,e[9]=n,e[10]=l.slug,e[11]=u,e[12]=p,e[13]=a,e[14]=g):g=e[14],g}const J3=2e3,tJ=15;function Z3(t,e,s,n){return typeof e!="string"||s&&(W8(e,s,n)||t.state.dataUpdateCount>=tJ)?!1:J3}function sJ({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,mode:i,devServerReady:o,sandboxWarming:l}){const a=dp(),c={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n},d=qW(e),{data:u,isLoading:h}=T0(c,{fetchEnabled:o}),[f,m]=V.useState("pages"),[p,g]=V.useState(()=>i==="blocks"?Z9(a.state.target):null),[x,b]=V.useState(()=>i==="blocks"?a.state.editSeoPageKey:null),v=ZX(a.state.target),[y,_]=V.useState(v);if(i==="blocks"&&y!==v){_(v);const ce=Z9(a.state.target);g(ce),(ce?.collection==="pages"||ce?.collection==="sections")&&m(ce.collection)}const[L,w]=V.useState(a.state.editSeoPageKey);if(i==="blocks"&&L!==a.state.editSeoPageKey&&(w(a.state.editSeoPageKey),a.state.editSeoPageKey)){const ce=a.state.target;ce?.kind==="page"&&(m("pages"),g(Z9(ce)),b(ce.key))}const[S,k]=V.useState(""),[j,T]=V.useState(null),[N,C]=V.useState(null),[A,P]=V.useState("date-desc"),[R,E]=V.useState(()=>new Set),[M,I]=V.useState(null),$=()=>{E(new Set),I(null)},O=ce=>{g(ce),b(null),!(i!=="blocks"||!ce)&&(ce.collection==="pages"?a.selectTarget({kind:"page",key:ce.key,path:ce.path}):ce.collection==="sections"&&a.selectTarget({kind:"section",key:ce.key}))},[D,B]=V.useState(f);D!==f&&(B(f),k(""),T(null),C(null),P("date-desc"),E(new Set),I(null));const{data:F,isLoading:U,isFetching:H}=E0(c,{fetchEnabled:o,refetchInterval:ce=>{const Pe=ce.state.data;if(f==="apps"&&p&&p.collection==="apps"){const He=u?.[p.key];return Z3(ce,typeof He?.__resolveType=="string"?He.__resolveType:void 0,Pe)}if(f==="site"&&u){const He=Pe?Ih(u,Pe):null,Qe=u.site,Ne=He?.resolveType??(typeof Qe?.__resolveType=="string"?Qe.__resolveType:void 0);return Z3(ce,Ne,Pe,["seo"])}return!1}}),W=(ce,Pe)=>!W8(ce,F,Pe)&&(U||H),{catalog:q,isLoading:ee}=rq(F??void 0,u??void 0,{enabled:f==="apps"}),X=e9(c),Y=QW(c),G=$q({...c,packagePath:d}),J=Oq({...c,packagePath:d}),[oe,le]=V.useState(null),[Q,K]=V.useState(),[te,ne]=V.useState(null),[re,he]=V.useState(null),[pe,de]=V.useState(null),Z=!u||!F;if(h||U||Z&&l)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})});if(Z)return r.jsx(Dr,{title:"Could not load site data."});const fe=ym(u).sort((ce,Pe)=>ce.name.localeCompare(Pe.name)),ue=Rv(u).sort((ce,Pe)=>ce.from.localeCompare(Pe.from)),ye=_m(u,F),Le=f==="sections"?GA(F):[],Re=Ih(u,F),De=J8(u),Ue=up.some(ce=>De[ce].length>0),$e=rc(f)?De[f]:[],je=(Ue?Ic(u,"categories"):[]).map(({key:ce,payload:Pe})=>{const He=typeof Pe.slug=="string"?Pe.slug:"",Qe=typeof Pe.name=="string"?Pe.name:"";return{slug:He||ce,name:Qe||He||ce}}).filter(ce=>ce.slug).sort((ce,Pe)=>ce.name.localeCompare(Pe.name)),be=f==="posts"&&(R.size>0||M!==null),Ee=be?e7(u).filter(ce=>R.has(ce.key)):[],_e=g3(F,"loaders"),Ae=g3(F,"actions");if(!R0(u,F)&&!Ue&&_e===0&&Ae===0)return r.jsx(Dr,{icon:fn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Ce={pages:fe.length,sections:ye.length,apps:q.length,loaders:_e,actions:Ae,redirects:ue.length,posts:De.posts.length,authors:De.authors.length,categories:De.categories.length},xe=new Set(fe.map(ce=>$r(ce.path))),Se=new Set(fe.map(ce=>ce.name)),we=new Set(ye.map(ce=>ce.name)),ze=async ce=>{const Pe=u[ce.key];if(!Pe)return;const He=j8(u,ce.key),Qe=C8(u,ce.key,Math.max(0,He-1)),Ne=dH(Pe.sections,Qe);if(Ne)try{await X.mutateAsync({blockKey:ce.key,data:{...Pe,sections:Ne}}),me.success(`Variant added to "${ce.name}"`),g({collection:"pages",key:ce.key,path:ce.path})}catch(lt){me.error(lt instanceof Error?lt.message:"Could not add variant")}},Be=()=>{K(void 0),le({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},Xe=ce=>{K(void 0),le({mode:"duplicate",sourceKey:ce.key,initialName:y3(Se,ce.name),initialPath:aq(xe,ce.path)})},Ve=ce=>{K(void 0),le({mode:"rename",sourceKey:ce.key,initialName:ce.name,initialPath:ce.path})},ot=async ce=>{if(!oe)return;const{mode:Pe,sourceKey:He}=oe;try{if(Pe==="create"){let Qe;if(ce.templateKey){const lt=u[ce.templateKey];if(!lt)throw new Error("Selected template no longer exists.");Qe={...lt,name:ce.name,path:ce.path}}else Qe=uq(ce.name,ce.path);const Ne=fq(u,ce.name);await X.mutateAsync({blockKey:Ne,data:Qe}),me.success(`Created "${ce.name}"`),g({collection:"pages",key:Ne,path:ce.path})}else if(Pe==="duplicate"&&He){const Qe=u[He];if(!Qe)throw new Error("Source page not found");const{key:Ne,data:lt}=dq({source:Qe,pages:fe,newName:ce.name,newPath:ce.path});await X.mutateAsync({blockKey:Ne,data:lt}),me.success(`Duplicated as "${ce.name}"`),g({collection:"pages",key:Ne,path:ce.path})}else if(Pe==="rename"&&He){const Qe=u[He];if(!Qe)throw new Error("Page not found");const Ne={...Qe,name:ce.name,path:ce.path};await X.mutateAsync({blockKey:He,data:Ne}),me.success("Page updated"),p?.collection==="pages"&&p.key===He&&g({collection:"pages",key:He,path:ce.path})}le(null)}catch(Qe){K(Qe instanceof Error?Qe.message:"Save failed")}},gt=({path:ce})=>{if(!oe)return null;const Pe=$r(ce);return(oe.mode==="rename"?$r(oe.initialPath):null)!==Pe&&xe.has(Pe)?`A page with path "${ce}" already exists.`:null},ct=async(ce,Pe,He)=>{await X.mutateAsync({blockKey:Pe,data:{...He,name:Pe,__resolveType:ce}}),me.success(`Created section "${Pe}"`),g({collection:"sections",key:Pe})},dt=Q8((ce,Pe)=>X.mutate({blockKey:ce,data:Pe})),mt=async ce=>{const Pe=u[ce.key];if(!Pe){me.error("Section not found.");return}const He=cq(u,ce.key),Qe=y3(we,ce.name),Ne={...Pe,name:Qe};try{await X.mutateAsync({blockKey:He,data:Ne}),me.success(`Duplicated "${ce.name}"`),g({collection:"sections",key:He})}catch(lt){me.error(lt instanceof Error?lt.message:"Duplicate failed")}},ge=async ce=>{if(!te)return;const Pe=u[te];if(!Pe){me.error("Section not found.");return}try{await X.mutateAsync({blockKey:te,data:{...Pe,name:ce}}),me.success("Section renamed"),ne(null)}catch(He){me.error(He instanceof Error?He.message:"Rename failed")}},Ye=async()=>{const ce="/redirect-from",Pe=tP(u,ce),He=JA({from:ce,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await X.mutateAsync({blockKey:Pe,data:He}),me.success("Created redirect"),g({collection:"redirects",key:Pe})}catch(Qe){me.error(Qe instanceof Error?Qe.message:"Could not create redirect")}},tt=async ce=>{const Pe=w3(u,ce),He=Hd(Pe,ce,Vq(ce));try{await G.mutateAsync({blockKey:Pe,data:He}),me.success(`Created ${ic[ce]}`),g({collection:ce,key:Pe})}catch(Qe){me.error(Qe instanceof Error?Qe.message:"Could not create")}},ut=async ce=>{const Pe=u[ce.key];if(!Pe){me.error("Record not found.");return}const He=w3(u,ce.kind),Qe=ce.kind==="posts"?"title":"name",Ne={...structuredClone(uu(Pe,ce.kind)),[Qe]:`${ce.label} (copy)`};try{await G.mutateAsync({blockKey:He,data:Hd(He,ce.kind,Ne)}),me.success(`Duplicated "${ce.label}"`),g({collection:ce.kind,key:He})}catch(lt){me.error(lt instanceof Error?lt.message:"Duplicate failed")}},bt=ce=>{E(Pe=>{const He=new Set(Pe);return He.has(ce)?He.delete(ce):He.add(ce),He})},Vt=ce=>{m("posts"),B("posts"),g(null),b(null),k(""),T(null),C(null),P("date-desc"),E(new Set),I(ce||null)},St=async(ce,Pe)=>{const He=[...R];let Qe=0;for(const Ne of He){const lt=u[Ne],Bt=uu(lt,"posts"),Ns=ce==="add"?jq(Bt,Pe):Cq(Bt,Pe);Ns!==Bt&&(await G.mutateAsync({blockKey:Ne,data:Hd(Ne,"posts",L3(Ns))}),Qe+=1)}return Qe},Tt=async(ce,Pe)=>{const He=R.size;try{const Qe=await St(ce,Pe),Ne=ce==="add"?"Added to":"Moved",lt=He-Qe;me.success(`${Ne} ${Qe} ${Qe===1?"post":"posts"}`+(lt>0?` (${lt} already set)`:"")),$()}catch(Qe){me.error(Qe instanceof Error?Qe.message:"Bulk update failed")}},Kt=async()=>{if(re)try{if(re.kind==="blog-bulk"){for(const Qe of re.keys)await J.mutateAsync({blockKey:Qe});me.success(`Deleted ${re.count} ${re.count===1?"post":"posts"}`),p&&p.collection!=="available-section"&&re.keys.includes(p.key)&&g(null),$(),he(null);return}const{kind:ce,key:Pe,label:He}=re;if(ce==="blog"){if(re.blogKind==="categories"){const Qe=uu(u[Pe],"categories").slug,Ne=typeof Qe=="string"?Qe:"";if(Ne)for(const{key:lt,payload:Bt}of Ic(u,"posts")){const Ns=Nq(Bt,Ne);Ns!==Bt&&await G.mutateAsync({blockKey:lt,data:Hd(lt,"posts",L3(Ns))})}}await J.mutateAsync({blockKey:Pe})}else await Y.mutateAsync({blockKey:Pe});me.success(`Deleted "${He}"`),p&&p.collection!=="available-section"&&p.key===Pe&&g(null),he(null)}catch(ce){me.error(ce instanceof Error?ce.message:"Delete failed")}},es=Y.isPending||J.isPending||G.isPending,Mt=re?.kind==="blog"?ic[re.blogKind]:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"}`:re?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[i==="content"&&r.jsx(oq,{active:f,counts:Ce,showBlog:Ue,onSelect:ce=>{m(ce),g(null),b(null)}}),f!=="seo"&&f!=="site"&&f!=="calendar"&&f!=="loaders"&&f!=="actions"&&r.jsx(nJ,{blocksMode:i==="blocks",activeCollection:f,pages:fe,redirects:ue,sections:ye,availableSections:Le,appCatalog:q,appCatalogLoading:ee,blogEntries:$e,decofile:u,searchQuery:S,onSearchChange:k,postCategoryFilter:j,postAuthorFilter:N,postSort:A,onPostCategoryFilterChange:ce=>{T(ce),E(new Set)},onPostAuthorFilterChange:ce=>{C(ce),E(new Set)},onPostSortChange:P,selectedPostKeys:R,postBulkPanelOpen:be,onTogglePostSelect:bt,onSelectAllPosts:ce=>E(new Set(ce)),onClearPostSelection:()=>E(new Set),onExitPostSelection:$,onBulkDeletePosts:()=>he({kind:"blog-bulk",keys:[...R],count:R.size}),selection:p,onSelect:O,onCollectionSelect:ce=>{m(ce),g(null),b(null)},onCreate:()=>{f==="pages"?Be():f==="redirects"?Ye():rc(f)&&tt(f)},onDuplicatePage:Xe,onRenamePage:Ve,onAddPageVariant:ze,onDeletePage:ce=>he({kind:"page",key:ce.key,label:ce.name}),onEditPageSeo:ce=>{const Pe={collection:"pages",key:ce.key,path:ce.path};g(Pe),b(ce.key),i==="blocks"&&a.editSeo({kind:"page",key:ce.key,path:ce.path})},onViewPageJson:ce=>de(ce.key),onDuplicateSection:mt,onRenameSection:ce=>ne(ce.key),onDeleteSection:ce=>he({kind:"section",key:ce.key,label:ce.name}),onDeleteRedirect:ce=>he({kind:"redirect",key:ce.key,label:ce.from||ce.key}),onDuplicateBlog:ut,onDeleteBlog:ce=>he({kind:"blog",blogKind:ce.kind,key:ce.key,label:ce.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?r.jsx(vX,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:F,decofile:u,kind:f}):r.jsx(V.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),children:f==="calendar"?r.jsx(XX,{decofile:u}):f==="site"?Re?r.jsx(X3,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:Re.key,block:u[Re.key],decofile:u,meta:F,title:"Site",excludeFields:["seo"],schemaPending:W(Re.resolveType,["seo"]),previewBaseUrl:n},`site:${Re.key}`):r.jsx(Dr,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="seo"?r.jsx(QX,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:F,target:{kind:"site"},previewBaseUrl:n}):f==="sections"?r.jsx(PX,{selection:p?.collection==="sections"||p?.collection==="available-section"?p:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:F,decofile:u,isCreating:X.isPending,onCreateAvailable:ct,onSaveReferencedBlock:dt}):be?r.jsx(GX,{posts:Ee,categories:je,initialSlug:M,isPending:G.isPending,onApply:(ce,Pe)=>{Tt(ce,Pe)},onClose:$},M??"selection"):p&&p.collection!=="available-section"?p.collection==="apps"?r.jsx(X3,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key],decofile:u,meta:F,previewBaseUrl:n,schemaPending:W(typeof u[p.key]?.__resolveType=="string"?String(u[p.key].__resolveType):void 0)},`app:${p.key}`):p.collection==="posts"?r.jsx(HX,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key],decofile:u,meta:F,previewBaseUrl:n},`post:${p.key}`):p.collection==="categories"?r.jsx(qX,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key],decofile:u,meta:F,onManagePosts:Vt,onOpenPost:ce=>{m("posts"),B("posts"),g({collection:"posts",key:ce}),b(null)},previewBaseUrl:n},`category:${p.key}`):p.collection==="authors"?r.jsx(WX,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:p.key,block:u[p.key]},`authors:${p.key}`):p.collection==="redirects"?r.jsx(JX,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key]},`redirect:${p.key}`):r.jsx(YX,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:p.collection==="pages"?p.path:"/",activePageBlockKey:p.collection==="pages"?p.key:null,activeGlobalBlockKey:p.collection==="sections"?p.key:null,initialEditSeo:p.collection==="pages"&&x===p.key,onExitSeo:()=>{b(null),i==="blocks"&&a.consumeEditSeo()}},p.collection==="pages"?`page:${p.key}`:`section:${p.key}`):r.jsx(Dr,{title:`Select ${rc(f)?`a ${ic[f]}`:f==="pages"?"a page":f==="apps"?"an app":f==="redirects"?"a redirect":"a section"} to edit`,description:f==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),oe&&r.jsx(xq,{open:!!oe,mode:oe.mode,initialName:oe.initialName,initialPath:oe.initialPath,isPending:X.isPending,error:Q,templates:fe,validate:gt,onSubmit:ot,onOpenChange:ce=>{ce||(le(null),K(void 0))}}),te&&r.jsx(bq,{open:!!te,blockKey:te,initialName:ye.find(ce=>ce.key===te)?.name??te,isPending:X.isPending,onSubmit:ge,onOpenChange:ce=>{ce||ne(null)}}),pe&&r.jsx(Bq,{open:!!pe,onOpenChange:ce=>{ce||de(null)},pageKey:pe,decofile:u,onSave:ce=>X.mutateAsync({blockKey:pe,data:ce})}),r.jsx(vc,{open:!!re,onOpenChange:ce=>{!ce&&!es&&he(null)},children:r.jsxs(yc,{children:[r.jsxs(_c,{children:[r.jsx(Lc,{children:`Delete ${Mt}?`}),r.jsx(wc,{children:re?.kind==="section"?`"${re.label}" will be removed. Pages that still reference it will lose this section.`:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:re?`"${re.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(Sc,{children:[r.jsx(kc,{disabled:es,children:"Cancel"}),r.jsx(jc,{onClick:ce=>{ce.preventDefault(),Kt()},disabled:es,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:es?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function nJ(t){const e=z.c(88),{blocksMode:s,activeCollection:n,pages:i,redirects:o,sections:l,availableSections:a,appCatalog:c,appCatalogLoading:d,blogEntries:u,decofile:h,searchQuery:f,onSearchChange:m,postCategoryFilter:p,postAuthorFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostSortChange:y,selectedPostKeys:_,postBulkPanelOpen:L,onTogglePostSelect:w,onSelectAllPosts:S,onClearPostSelection:k,onExitPostSelection:j,onBulkDeletePosts:T,selection:N,onSelect:C,onCollectionSelect:A,onCreate:P,onDuplicatePage:R,onRenamePage:E,onAddPageVariant:M,onDeletePage:I,onEditPageSeo:$,onViewPageJson:O,onDuplicateSection:D,onRenameSection:B,onDeleteSection:F,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let q,ee,X,Y,G,J,oe,le;if(e[0]!==n||e[1]!==c||e[2]!==d||e[3]!==a||e[4]!==s||e[5]!==u||e[6]!==h||e[7]!==M||e[8]!==T||e[9]!==k||e[10]!==A||e[11]!==P||e[12]!==W||e[13]!==I||e[14]!==U||e[15]!==F||e[16]!==H||e[17]!==R||e[18]!==D||e[19]!==$||e[20]!==j||e[21]!==v||e[22]!==b||e[23]!==y||e[24]!==E||e[25]!==B||e[26]!==m||e[27]!==C||e[28]!==S||e[29]!==w||e[30]!==O||e[31]!==i||e[32]!==g||e[33]!==L||e[34]!==p||e[35]!==x||e[36]!==o||e[37]!==f||e[38]!==l||e[39]!==_||e[40]!==N){const ne=f.toLowerCase(),re=i.filter(ge=>!ne||ge.name.toLowerCase().includes(ne)||ge.path.toLowerCase().includes(ne)),he=o.filter(ge=>!ne||ge.from.toLowerCase().includes(ne)||ge.to.toLowerCase().includes(ne)),pe=l.filter(ge=>!ne||ge.name.toLowerCase().includes(ne)||ge.key.toLowerCase().includes(ne)||ge.resolveType.toLowerCase().includes(ne)),de=a.filter(ge=>!ne||ge.title.toLowerCase().includes(ne)||ge.resolveType.toLowerCase().includes(ne)||(ge.description?.toLowerCase().includes(ne)??!1)),Z=KX(pe),fe=c.filter(ge=>!ne||ge.title.toLowerCase().includes(ne)||ge.app.toLowerCase().includes(ne)||ge.vendor.toLowerCase().includes(ne)||ge.category.toLowerCase().includes(ne)),ue=u.filter(ge=>!ne||ge.label.toLowerCase().includes(ne)||ge.subtitle.toLowerCase().includes(ne)),ye=n==="posts",Le=lJ,Re=ye?e7(h):[],De=new Map,Ue=new Map;for(const ge of Re){for(const Ye of ge.categorySlugs)De.set(Ye,(De.get(Ye)??0)+1);for(const Ye of ge.authorEmails)Ue.set(Ye,(Ue.get(Ye)??0)+1)}const $e=(ye?Ic(h,"categories"):[]).map(ge=>{const{key:Ye,payload:tt}=ge,ut=Le(tt.slug)||Ye;return{slug:ut,name:Le(tt.name)||Le(tt.slug)||Ye,count:De.get(ut)??0}}).filter(oJ),je=(ye?Ic(h,"authors"):[]).map(ge=>{const{key:Ye,payload:tt}=ge,ut=Le(tt.email);return{email:ut,name:Le(tt.name)||Le(tt.email)||Ye,count:Ue.get(ut)??0}}).filter(rJ);let be;e[49]!==p?(be=ge=>!p||ge.categorySlugs.includes(p),e[49]=p,e[50]=be):be=e[50];let Ee;e[51]!==g?(Ee=ge=>!g||ge.authorEmails.includes(g),e[51]=g,e[52]=Ee):Ee=e[52];let _e;e[53]!==x?(_e=(ge,Ye)=>{if(x==="az")return ge.title.localeCompare(Ye.title);if(x==="za")return Ye.title.localeCompare(ge.title);const tt=ge.date.localeCompare(Ye.date);return x==="date-asc"?tt:-tt},e[53]=x,e[54]=_e):_e=e[54];const Ae=Re.filter(ge=>!ne||ge.title.toLowerCase().includes(ne)||ge.slug.toLowerCase().includes(ne)).filter(be).filter(Ee).sort(_e),Ce=_.size,xe=Ae.map(iJ),Se=xe.length>0&&xe.every(ge=>_.has(ge)),we=Ce>0||L,ze=()=>{Se?k():S(xe)},Be=`Search ${n}…`,Xe=rc(n)?`Create new ${ic[n]}`:n==="redirects"?"Create new redirect":"Create new page",Ve=n!=="apps"&&n!=="sections",ot=s?"w-[240px]":"w-[300px]";e[55]!==ot?(G=ie("shrink-0 border-r flex flex-col min-h-0",ot),e[55]=ot,e[56]=G):G=e[56],e[57]!==n||e[58]!==s||e[59]!==A?(J=s&&r.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[r.jsxs(ae,{variant:n==="pages"?"secondary":"ghost",size:"sm",className:"h-7 flex-1",onClick:()=>A("pages"),children:[r.jsx(or,{size:14}),"Pages"]}),r.jsxs(ae,{variant:n==="sections"?"secondary":"ghost",size:"sm",className:"h-7 flex-1",onClick:()=>A("sections"),children:[r.jsx(Vi,{size:14}),"Sections"]})]}),e[57]=n,e[58]=s,e[59]=A,e[60]=J):J=e[60];let gt;e[61]===Symbol.for("react.memo_cache_sentinel")?(gt=r.jsx(C0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[61]=gt):gt=e[61];let ct;e[62]!==m?(ct=ge=>m(ge.target.value),e[62]=m,e[63]=ct):ct=e[63];let dt;e[64]!==Be||e[65]!==f||e[66]!==ct?(dt=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[gt,r.jsx("input",{type:"text",value:f,onChange:ct,placeholder:Be,"aria-label":Be,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[64]=Be,e[65]=f,e[66]=ct,e[67]=dt):dt=e[67];let mt;e[68]!==Xe||e[69]!==P||e[70]!==Ve?(mt=Ve&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",onClick:P,"aria-label":Xe,children:r.jsx(Nt,{size:14})})}),r.jsx(qe,{side:"bottom",children:Xe})]}),e[68]=Xe,e[69]=P,e[70]=Ve,e[71]=mt):mt=e[71],e[72]!==dt||e[73]!==mt?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[dt,mt]}),e[72]=dt,e[73]=mt,e[74]=oe):oe=e[74],le=ye&&(we?r.jsx(zX,{count:Ce,allSelected:Se,onToggleSelectAll:ze,onDelete:T,onExit:j}):r.jsx(DX,{categories:$e,authors:je,categoryFilter:p,authorFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onSortChange:y})),q=Yr,Y="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",ee="flex flex-col gap-1 p-1.5",X=n==="pages"?re.length===0?r.jsx(hl,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):re.map(ge=>{const Ye=N?.collection==="pages"&&N.key===ge.key,tt=j8(h,ge.key);return r.jsx(Yn,{icon:or,title:ge.name,subtitle:ge.path,active:Ye,variantCount:tt,onClick:()=>C({collection:"pages",key:ge.key,path:ge.path}),menu:r.jsx(wa,{onDuplicate:()=>R(ge),onRename:()=>E(ge),onAddVariant:()=>M(ge),onEditSeo:()=>$(ge),onViewJson:()=>O(ge),onDelete:()=>I(ge)})},ge.key)}):n==="sections"?pe.length===0&&de.length===0?r.jsx(hl,{hasItems:l.length>0||a.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):r.jsxs(r.Fragment,{children:[Z.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Q3,{icon:Vi,label:"Saved sections"}),Z.map(ge=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ge.label}),ge.sections.map(Ye=>{const tt=N?.collection==="sections"&&N.key===Ye.key;return r.jsx(Yn,{icon:Vi,accent:"global",title:Ye.name,subtitle:ge.label,active:tt,onClick:()=>C({collection:"sections",key:Ye.key}),menu:r.jsx(wa,{onDuplicate:()=>D(Ye),onRename:()=>B(Ye),onDelete:()=>F(Ye)})},Ye.key)})]},ge.label))]}),de.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Q3,{icon:or,label:"Available sections",className:ie(Z.length>0&&"mt-3")}),de.map(ge=>{const Ye=N?.collection==="available-section"&&N.resolveType===ge.resolveType,tt=ge.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(Yn,{icon:or,title:ge.title,subtitle:tt??ge.resolveType,active:Ye,onClick:()=>C({collection:"available-section",resolveType:ge.resolveType,title:ge.title})},ge.resolveType)})]})]}):n==="apps"?d?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(it,{size:18,className:"animate-spin text-muted-foreground"})}):fe.length===0?r.jsx(hl,{hasItems:c.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):fe.map(ge=>{const Ye=N?.collection==="apps"&&ge.blockKey!==null&&N.key===ge.blockKey;return r.jsx(Yn,{icon:F5,logoUrl:ge.logo,title:ge.title,subtitle:ge.category,active:Ye,trailing:ge.installed?r.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(!ge.installed||!ge.blockKey){me.message(`${ge.title} is not installed on this site.`);return}C({collection:"apps",key:ge.blockKey})}},ge.id)}):n==="redirects"?he.length===0?r.jsx(hl,{hasItems:o.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):he.map(ge=>r.jsx(Yn,{icon:v5,title:ge.from||"(no source)",subtitle:`→ ${ge.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===ge.key,trailing:r.jsx(vq,{type:ge.type}),onClick:()=>C({collection:"redirects",key:ge.key}),menu:r.jsx(wa,{onDelete:()=>U(ge)})},ge.key)):ye?Ae.length===0?r.jsx(hl,{hasItems:Re.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ae.map(ge=>{const Ye={key:ge.key,kind:"posts",label:ge.title,subtitle:ge.slug};return r.jsx(Yn,{icon:Ri,title:ge.title,subtitle:ge.slug||"no slug",invalid:ge.missing.length>0,invalidReason:`Missing: ${ge.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===ge.key,selectable:!0,selectionActive:we,selected:_.has(ge.key),onToggleSelect:()=>w(ge.key),onClick:()=>we?w(ge.key):C({collection:"posts",key:ge.key}),menu:r.jsx(wa,{onDuplicate:()=>H(Ye),onDelete:()=>W(Ye)})},ge.key)}):ue.length===0?r.jsx(hl,{hasItems:u.length>0,emptyLabel:`No ${n} yet.`,emptyHint:`Click "+" to create your first ${rc(n)?ic[n]:"item"}.`}):ue.map(ge=>{const Ye=N?.collection===ge.kind&&N.key===ge.key;return r.jsx(Yn,{icon:ge.kind==="posts"?Ri:ge.kind==="authors"?F1:_1,title:ge.label,subtitle:ge.subtitle,active:Ye,onClick:()=>C({collection:ge.kind,key:ge.key}),menu:r.jsx(wa,{onDuplicate:()=>H(ge),onDelete:()=>W(ge)})},ge.key)}),e[0]=n,e[1]=c,e[2]=d,e[3]=a,e[4]=s,e[5]=u,e[6]=h,e[7]=M,e[8]=T,e[9]=k,e[10]=A,e[11]=P,e[12]=W,e[13]=I,e[14]=U,e[15]=F,e[16]=H,e[17]=R,e[18]=D,e[19]=$,e[20]=j,e[21]=v,e[22]=b,e[23]=y,e[24]=E,e[25]=B,e[26]=m,e[27]=C,e[28]=S,e[29]=w,e[30]=O,e[31]=i,e[32]=g,e[33]=L,e[34]=p,e[35]=x,e[36]=o,e[37]=f,e[38]=l,e[39]=_,e[40]=N,e[41]=q,e[42]=ee,e[43]=X,e[44]=Y,e[45]=G,e[46]=J,e[47]=oe,e[48]=le}else q=e[41],ee=e[42],X=e[43],Y=e[44],G=e[45],J=e[46],oe=e[47],le=e[48];let Q;e[75]!==ee||e[76]!==X?(Q=r.jsx("div",{className:ee,children:X}),e[75]=ee,e[76]=X,e[77]=Q):Q=e[77];let K;e[78]!==q||e[79]!==Y||e[80]!==Q?(K=r.jsx(q,{className:Y,children:Q}),e[78]=q,e[79]=Y,e[80]=Q,e[81]=K):K=e[81];let te;return e[82]!==G||e[83]!==J||e[84]!==oe||e[85]!==le||e[86]!==K?(te=r.jsxs("div",{className:G,children:[J,oe,le,K]}),e[82]=G,e[83]=J,e[84]=oe,e[85]=le,e[86]=K,e[87]=te):te=e[87],te}function iJ(t){return t.key}function rJ(t){return t.email}function oJ(t){return t.slug}function lJ(t){return typeof t=="string"?t:""}function aJ(t){const e=z.c(13),{virtualMcpId:s}=t,n=se(),i=Hs(s),{activeTask:o}=Qs();if(!(Ln(i?.metadata)||Ln(o?.metadata))){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(fn,{size:24,className:"text-muted-foreground/60"}),e[0]=c):c=e[0];let d;e[1]!==n?(d=n("mainPanelTabs.contentTab.noContentToEdit"),e[1]=n,e[2]=d):d=e[2];let u;e[3]!==d?(u=r.jsx("div",{children:d}),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=n("mainPanelTabs.contentTab.connectGithubDescription"),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("div",{className:"text-xs text-muted-foreground/80",children:h}),e[7]=h,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[c,u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}let a;return e[12]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(eJ,{}),e[12]=a):a=e[12],a}const eh={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:Jr},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:cr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:r5}},cJ=["fast","smart","thinking"];function dJ(t){const e=z.c(19),{tier:s,onSelect:n}=t,i=se(),[o,l]=V.useState(!1),a=eh[s].icon;let c;e[0]!==a?(c=r.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=eh[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=r.jsx(fs,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{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=cJ.map(x=>{const b=eh[x],v=b.icon;return r.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[r.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm",children:i(b.labelKey)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&r.jsx(Ut,{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=r.jsx(ys,{align:"start",className:"p-1 w-64",children:r.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==o||e[16]!==f||e[17]!==p?(g=r.jsxs(_s,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function uJ(t){const e=z.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=se(),[a,c]=V.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=r.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]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?r.jsx(V.Suspense,{fallback:r.jsx(ae,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(hJ,{override:i,onOverrideChange:o})}):r.jsx(dJ,{tier:s,onSelect:n}),e[4]=o,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]!==o?(f=v=>{c(v),v||o(null)},e[11]=o,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=r.jsx(Mi,{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=r.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=r.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=r.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 hJ(t){const e=z.c(25),{override:s,onOverrideChange:n}=t,i=se(),o=y0(),l=o[0]?.id??null;let a;e[0]!==l||e[1]!==o||e[2]!==s?.credentialId?(a=o.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=o,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=V.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==o?(u=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=u):u=e[7];const h=u;let f;e[8]!==o||e[9]!==s?(f=s&&o.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]=o,e[9]=s,e[10]=f):f=e[10];const m=f;if(o.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=r.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}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 v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,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=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(ck,{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 B7=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:u1,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:kn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:Pi},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:Jn},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:x0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Di,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:w1},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:d1},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:h1},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Cc},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Di},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:qS}]},{key:"context",headingKey:"automations.automationConfig.context",icon:_u,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:_u},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Pl},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Pl}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Vi,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:N5},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Vi},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:$o}]}],fJ=B7.flatMap(t=>t.tools.map(e=>e.name));function mJ(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function pJ(t){const e=z.c(12),{agentId:s,value:n,onChange:i}=t,o=se();let l;e[0]!==o?(l=o("automations.automationConfig.toolsLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.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]!==o||e[7]!==n?(c=s?r.jsx(V.Suspense,{fallback:r.jsxs(ae,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(u1,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(gJ,{agentId:s,value:n,onChange:i})}):r.jsx("span",{className:"text-xs text-muted-foreground italic",children:o("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=o,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=r.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 ex(t){const e=z.c(17),{value:s,checked:n,onToggle:i,title:o,description:l,leading:a}=t;let c;e[0]!==n?(c=r.jsx(Gl,{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&&r.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==o?(u=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&r.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=r.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=r.jsxs(Jt,{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 tx(t){const e=z.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=se(),d=o===l;let u;e[0]!==i||e[1]!==s?(u=s?r.jsx(ai,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(GS,{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=r.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==l?(m=r.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",l]}),e[9]=o,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=y=>{y.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=r.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=r.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 v;return e[23]!==u||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function gJ(t){const e=z.c(83),{agentId:s,value:n,onChange:i}=t,o=se(),{org:l}=Me(),[a,c]=V.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=Pt(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=$1(h),p=Ii();let g,x,b,v,y,_,L,w,S,k,j,T,N;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const E=new Map(p.map(_J)),M=new Map;for(const de of f?.tools??[]){const Z=Ni(de._meta)??"__other__",fe=Fl(de.name,Z==="__other__"?void 0:Z),ue=de.title,ye=ue&&ue!==de.name?ue:mJ(fe);M.has(Z)||M.set(Z,{clientId:Z,conn:E.get(Z),tools:[]}),M.get(Z).tools.push({name:de.name,display:ye,description:de.description})}const I=[...M.values()].sort(yJ),$=(f?.tools??[]).map(vJ),O=[...fJ,...$],D=n===null?new Set(O):new Set(n),B=O.every(de=>D.has(de)),F=de=>i(O.every(Z=>de.has(Z))?null:[...de]),U=de=>{const Z=new Set(D);Z.has(de)?Z.delete(de):Z.add(de),F(Z)},H=(de,Z)=>{const fe=new Set(D);for(const ue of de)Z?fe.add(ue):fe.delete(ue);F(fe)};v=_s,N=a,y=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsx(u1,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let q;e[27]!==B||e[28]!==o?(q=o(B?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=B,e[28]=o,e[29]=q):q=e[29];const ee=!B&&r.jsxs(lj,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[D.size,"/",O.length]});let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx(fs,{size:14,className:"text-muted-foreground"}),e[30]=X):X=e[30],e[31]!==q||e[32]!==ee?(_=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,q,ee,X]})}),e[31]=q,e[32]=ee,e[33]=_):_=e[33],b=ys,j="p-0 w-80",T="start",x=pr;let Y;e[34]!==o?(Y=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=Y):Y=e[35],e[36]!==Y?(S=r.jsx(Wi,{placeholder:Y}),e[36]=Y,e[37]=S):S=e[37];const G=B?o("automations.automationConfig.allToolsEnabled",{count:O.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:D.size,total:O.length});let J;e[38]!==G?(J=r.jsx("span",{className:"text-xs text-muted-foreground",children:G}),e[38]=G,e[39]=J):J=e[39];let oe;e[40]!==i?(oe=()=>i(null),e[40]=i,e[41]=oe):oe=e[41];let le;e[42]!==o?(le=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=le):le=e[43];let Q;e[44]!==B||e[45]!==oe||e[46]!==le?(Q=r.jsx("button",{type:"button",onClick:oe,disabled:B,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:le}),e[44]=B,e[45]=oe,e[46]=le,e[47]=Q):Q=e[47];let K;e[48]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=K):K=e[48];let te;e[49]!==i?(te=()=>i([]),e[49]=i,e[50]=te):te=e[50];const ne=D.size===0;let re;e[51]!==o?(re=o("automations.automationConfig.clear"),e[51]=o,e[52]=re):re=e[52];let he;e[53]!==te||e[54]!==ne||e[55]!==re?(he=r.jsx("button",{type:"button",onClick:te,disabled:ne,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:re}),e[53]=te,e[54]=ne,e[55]=re,e[56]=he):he=e[56];let pe;e[57]!==Q||e[58]!==he?(pe=r.jsxs("div",{className:"flex items-center gap-2",children:[Q,K,he]}),e[57]=Q,e[58]=he,e[59]=pe):pe=e[59],e[60]!==J||e[61]!==pe?(k=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[J,pe]}),e[60]=J,e[61]=pe,e[62]=k):k=e[62],g=qi,L="max-h-80",w=m?r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("automations.automationConfig.loadingTools")}):r.jsxs(r.Fragment,{children:[r.jsx(si,{children:o("automations.automationConfig.noToolsFound")}),B7.map(de=>{const Z=de.tools.map(bJ),fe=Z.filter(ue=>D.has(ue)).length;return r.jsx(ks,{heading:r.jsx(tx,{label:o(de.headingKey),icon:de.icon,on:fe,total:Z.length,onToggle:()=>H(Z,fe!==Z.length)}),children:de.tools.map(ue=>r.jsx(ex,{value:`${o(ue.titleKey)} ${ue.name}`,checked:D.has(ue.name),onToggle:()=>U(ue.name),title:o(ue.titleKey),description:o(ue.descriptionKey),leading:r.jsx(ue.icon,{size:16,className:"text-muted-foreground"})},ue.name))},de.key)}),I.map(de=>{const Z=de.tools.map(xJ),fe=Z.filter(ue=>D.has(ue)).length;return r.jsx(ks,{heading:r.jsx(tx,{conn:de.conn,on:fe,total:Z.length,onToggle:()=>H(Z,fe!==Z.length)}),children:de.tools.map(ue=>r.jsx(ex,{value:`${ue.display} ${ue.name} ${de.conn?.title??""}`,checked:D.has(ue.name),onToggle:()=>U(ue.name),title:ue.display,description:ue.description},ue.name))},de.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=o,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=y,e[18]=_,e[19]=L,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=T,e[25]=N}else g=e[13],x=e[14],b=e[15],v=e[16],y=e[17],_=e[18],L=e[19],w=e[20],S=e[21],k=e[22],j=e[23],T=e[24],N=e[25];let C;e[63]!==g||e[64]!==L||e[65]!==w?(C=r.jsx(g,{className:L,children:w}),e[63]=g,e[64]=L,e[65]=w,e[66]=C):C=e[66];let A;e[67]!==x||e[68]!==C||e[69]!==S||e[70]!==k?(A=r.jsxs(x,{children:[S,k,C]}),e[67]=x,e[68]=C,e[69]=S,e[70]=k,e[71]=A):A=e[71];let P;e[72]!==b||e[73]!==A||e[74]!==j||e[75]!==T?(P=r.jsx(b,{className:j,align:T,children:A}),e[72]=b,e[73]=A,e[74]=j,e[75]=T,e[76]=P):P=e[76];let R;return e[77]!==v||e[78]!==y||e[79]!==_||e[80]!==P||e[81]!==N?(R=r.jsxs(v,{open:N,onOpenChange:y,children:[_,P]}),e[77]=v,e[78]=y,e[79]=_,e[80]=P,e[81]=N,e[82]=R):R=e[82],R}function xJ(t){return t.name}function bJ(t){return t.name}function vJ(t){return t.name}function yJ(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function _J(t){return[t.id,t]}function ac(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function LJ(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 o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const a=(o[2]??"0").padStart(2,"0"),c=(o[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 wJ(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 SJ(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 kJ(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const jJ=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function CJ({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=se(),{triggerAdd:a}=ed(),[c,d]=V.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}),me.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");me.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?o?.(p.webhook):me.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");me.error(g)}};return r.jsxs(qt,{open:u,onOpenChange:h,children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",children:[r.jsx(Nt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(Yt,{align:"end",className:"w-[200px]",children:[r.jsxs(Li,{children:[r.jsxs(wi,{className:"gap-2.5",children:[r.jsx(Ja,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(Si,{className:"w-[160px]",children:jJ.map(p=>r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(Ja,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[r.jsx(Ja,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[r.jsx($i,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(kn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function z7(t){const e=z.c(39),{open:s,onOpenChange:n,url:i,token:o,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=se(),[h,f]=V.useState(null),[m,p]=V.useState("curl"),[g,x]=V.useState("header"),b=V.useId();let v;e[0]!==u?(v=async(I,$)=>{try{await navigator.clipboard.writeText(I),f($),me.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{me.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const y=v;let _;e[2]!==g||e[3]!==o||e[4]!==i?(_=i&&o&&g==="url"?`${i.replace(/\/$/,"")}/${o}`:i??"",e[2]=g,e[3]=o,e[4]=i,e[5]=_):_=e[5];const L=_,w=i&&o?g==="header"?`curl -X POST "${L}" \\
|
|
531
|
+
`}),e[26]=_):_=e[26];let L;return e[27]!==y||e[28]!==u?(L=r.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:[u,y,_]}),e[27]=y,e[28]=u,e[29]=L):L=e[29],L}function Fd(t){const e=z.c(10),{phase:s,current:n,children:i}=t,o=s-n,l=o<0,a=o===0,c=l?90:o*-22,d=l?.94:1-Math.max(o,0)*.04,u=l?0:a?1:o===1?.8:.55,h=l?10:30-o,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ie("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=r.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 s9(t){const e=z.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,o,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:ie("size-2.5 rounded-full",Un)}),o=r.jsx("div",{className:ie("size-2.5 rounded-full",Un)}),l=r.jsx("div",{className:ie("size-2.5 rounded-full",Un)}),e[0]=i,e[1]=o,e[2]=l):(i=e[0],o=e[1],l=e[2]);let a;e[3]!==n?(a=n&&r.jsx("div",{className:ie("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",yi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,o,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function wH(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"flex flex-1 px-8 py-5",children:r.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:xH.map(SH)})})]}),t[1]=s):s=t[1],s}function SH(t,e){if(e===T8)return r.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 r.jsx("div",{className:ie("relative rounded-md",Un),children:r.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${E8}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function kH(){const t=z.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:ie("w-[18%] rounded-md",yi),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=r.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=r.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 o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[r.jsx("div",{className:ie("rounded-md",yi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),r.jsx("div",{className:ie("rounded-md",yi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function jH(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:r.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:yH.map(CH)})})]}),t[1]=s):s=t[1],s}function CH(t,e){return r.jsx("div",{className:ie("aspect-square rounded-md",_H[e]?"bg-chart-2/70":Un),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function NH(){const t=z.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(s9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,o,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=r.jsx("div",{className:ie("h-1.5 w-[70%] rounded-sm",Un)}),i=r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",Un)}),o=r.jsx("div",{className:ie("h-1.5 w-[80%] rounded-sm",Un)}),l=r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",Un)}),t[1]=s,t[2]=n,t[3]=i,t[4]=o,t[5]=l):(s=t[1],n=t[2],i=t[3],o=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=r.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,o,l,r.jsx("div",{className:"mt-auto",children:r.jsx("div",{className:ie("h-4 rounded-md",Un)})})]}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:r.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[r.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",yi)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[r.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),r.jsx("div",{className:ie("h-4 w-10 rounded-full",yi)}),r.jsx("div",{className:ie("h-4 w-14 rounded-full",yi)})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsxs("div",{className:ie("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",yi),children:[r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",Un)}),r.jsx("div",{className:ie("h-1 w-[75%] rounded-sm",Un)})]}),t[9]=u):u=t[9];let h;return t[10]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[u,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[r.jsx("div",{className:ie("rounded-md",yi)}),r.jsx("div",{className:ie("rounded-md",yi)})]})]})]})]})]})]}),t[10]=h):h=t[10],h}function Vl(t){const e=z.c(42),s=se();if(t.kind==="starting"){let f;return e[0]!==t.claimPhase||e[1]!==t.progress?(f=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsx(LH,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=f):f=e[2],f}if(t.kind==="errored"){const f=t.error.code===Ov.githubNotAuthenticated;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Do,{className:"size-12 text-destructive"}),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("h3",{className:"text-lg font-medium",children:d3("errored")}),e[4]=p):p=e[4];let g;e[5]!==f||e[6]!==t.error.message||e[7]!==s?(g=f?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[5]=f,e[6]=t.error.message,e[7]=s,e[8]=g):g=e[8];let x;e[9]!==g?(x=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:g}),e[9]=g,e[10]=x):x=e[10];let b;e[11]!==f||e[12]!==t.connectionsHref||e[13]!==s?(b=f&&t.connectionsHref&&r.jsx(ae,{asChild:!0,children:r.jsx("a",{href:t.connectionsHref,children:s("sandbox.stateCard.reconnectGithub")})}),e[11]=f,e[12]=t.connectionsHref,e[13]=s,e[14]=b):b=e[14];const v=t.onRetry;let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(vn,{className:"size-4"}),e[15]=y):y=e[15];let _;e[16]!==s?(_=s("sandbox.stateCard.retry"),e[16]=s,e[17]=_):_=e[17];let L;e[18]!==t.onRetry||e[19]!==_?(L=r.jsxs(ae,{variant:"outline",onClick:v,children:[y," ",_]}),e[18]=t.onRetry,e[19]=_,e[20]=L):L=e[20];let w;e[21]!==b||e[22]!==L?(w=r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[b,L]}),e[21]=b,e[22]=L,e[23]=w):w=e[23];let S;return e[24]!==x||e[25]!==w?(S=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[m,p,x,w]})}),e[24]=x,e[25]=w,e[26]=S):S=e[26],S}let n;e[27]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(ES,{className:"size-12 text-blue-500"}),e[27]=n):n=e[27];let i;e[28]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("h3",{className:"text-lg font-medium",children:d3("suspended")}),e[28]=i):i=e[28];let o;e[29]!==s?(o=s("sandbox.stateCard.resumeToContinue"),e[29]=s,e[30]=o):o=e[30];let l;e[31]!==o?(l=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:o}),e[31]=o,e[32]=l):l=e[32];const a=t.onResume;let c;e[33]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(So,{className:"size-4"}),e[33]=c):c=e[33];let d;e[34]!==s?(d=s("sandbox.stateCard.resume"),e[34]=s,e[35]=d):d=e[35];let u;e[36]!==t.onResume||e[37]!==d?(u=r.jsxs(ae,{onClick:a,className:"mt-2",children:[c," ",d]}),e[36]=t.onResume,e[37]=d,e[38]=u):u=e[38];let h;return e[39]!==l||e[40]!==u?(h=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,i,l,u]})}),e[39]=l,e[40]=u,e[41]=h):h=e[41],h}function A8(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function VH(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,o]of Object.entries(e.params))typeof o=="string"&&(n[i]=o);return{path:e.path,pageKey:s,params:n}}catch{return null}}function P8(t){try{return VH(localStorage.getItem(t))}catch{return null}}function TH(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function Qu(t,e){const n=e.replace(/\\/g,"/").replace(/^(?!\/)/,"/").split("/").map(i=>encodeURIComponent(i).replace(/%3A/gi,":")).join("/");return`${t}://file${n}?windowId=_blank`}const h3="site-links",EH=/details?page|\bpdp\b/i,AH=/listingpage|\bplp\b/i;function PH(t,e,s){const n=new Set;for(const a of s)EH.test(a)&&n.add("product"),AH.test(a)&&n.add("category");const i=Tu($r(t)),o=i[i.length-1],l=i[i.length-2];return o?.type==="text"&&o.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 RH=["rosa","preto","pink","black"];function Ud(t,e){const s=e.trim();return s?t(s):RH.flatMap(n=>t(n))}function DH(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const o=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:o,count:10}}),n}const R8=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function ap(t){return t.split("/")[0]??""}function IH(t){const e=new Set;for(const s of t){const n=ap(s);R8.has(n)&&e.add(n)}return e}function MH(t,e){const s=ap(t);return!R8.has(s)||e.size===0?!0:e.has(s)}const $H=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>Ud(s=>DH(t,s),e),optionsFromPayload:Kd},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ud(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:Kd},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ud(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:Kd},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Ud(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:Kd},{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:HH}];function OH(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of $H){if(d.kind!==a)continue;const u=n.find(h=>d.test(h)&&MH(h,s));u&&c.push({cand:d,resolveType:u})}return c.find(d=>s.has(ap(d.resolveType)))??c[0]},o=(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(o(c.cand,c.resolveType,!1))}return t.size>0&&l.push(BH(t.has("category")?"category":"product")),l}function BH(t){return{kind:t,id:h3,resolveType:h3,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>QH(e,s)}}function fo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function zH(t,e,s){const n=new Set,i=new Set,o=l=>{if(Array.isArray(l)){for(const d of l)o(d);return}const a=fo(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=fo(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),o(e[c])}}for(const d of Object.values(a))o(d)};return o(t),n}function D8(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 I8(t){try{return decodeURIComponent(t)}catch{return t}}function FH(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function UH(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=FH(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function M8(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=Tu($r(e)),{pattern:o,order:l}=UH(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(o);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?I8(d):null}function Kd(t,e){const s=fo(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],o=new Set;for(const l of n){const a=fo(l);if(!a)continue;const c=M8(a.url,e.template,e.paramName);if(!c||o.has(c))continue;o.add(c);const d=fo(a.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,h=Array.isArray(a.image)?fo(a.image[0]):null,f=typeof h?.url=="string"?h.url:void 0;i.push({value:c,label:u,image:f})}return i}function KH(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?I8(s):null}function HH(t){const e=[],s=new Set,n=(i,o)=>{const l=fo(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...o,a]:o,d=KH(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 WH=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 qH(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function GH(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 o=n[1]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:o,text:l})}return e}function YH(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 o,l=0;for(;(o=n.exec(t))!==null&&l++<3e3;){const a=(o[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(o.index,o.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:o[2]??"",image:c||void 0})}return e}function QH(t,e){const s=[],n=new Set,i=(o,l,a,c)=>{if(s.length>=200)return;const d=M8(o,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&WH.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:qH(d),kind:a,image:c}))};for(const{url:o,name:l,image:a}of YH(t))i(o,l,"product",a);for(const{href:o,text:l}of GH(t))o.startsWith("/")&&!o.startsWith("//")&&i(o,l,"category");return s}function va(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(o=>o.label.toLowerCase().includes(n)||o.value.toLowerCase().includes(n)):t).slice(0,s)}const f3=3e4;function $8(t){return`/api/${t.orgSlug}/sandbox/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}/preview-invoke`}function XH(t,e){return`${`/api/${t.orgSlug}/sandbox/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}/preview-fetch`}?path=${encodeURIComponent(e)}`}function JH(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 ZH(t,{resolveType:e,props:s}){let n;try{n=await fetch($8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(f3)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${f3/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let o=null,l=!1;try{o=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&o&&typeof o=="object"&&"error"in o&&typeof o.error=="string"?o.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?o:i}function eW(t){const e=z.c(2);let s;return e[0]!==t?(s={mutationFn:n=>ZH(t,n)},e[0]=t,e[1]=s):s=e[1],Rt(s)}const O8=1e4;function tW(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 sW(t,{resolveType:e,props:s}){const n=await fetch($8(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(O8)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function m3(t,e){const s=await fetch(XH(t,e),{signal:AbortSignal.timeout(O8)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function nW(t,e,s){const n=e.optionsFromPayload(await m3(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const o=Pr(s.template,{[s.paramName]:i.value});if(o==="/")return n;try{const l=e.optionsFromPayload(await m3(t,o),s).filter(a=>a.kind==="product");return D8([n,l])}catch{return n}}function iW(t,e,s){return Fe.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function rW(t,e,s,n){if(e.homepageLinks)return nW(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const o=await Promise.allSettled(i.map(a=>sW(t,a))),l=o.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=o.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return D8(l.map(a=>e.optionsFromPayload(a,n)))}function rf(t,e,s,n,i){return{queryKey:iW(t,e,s),queryFn:()=>rW(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function ya(t){const e=z.c(16),{heading:s,iconKind:n,options:i,template:o,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]!==o){let h;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==o?(h=f=>r.jsxs(Jt,{value:`${a}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&r.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?r.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):r.jsx(v1,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:f.label}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Pr(o,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=o,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]=o,e[6]=d}else d=e[6];let u;return e[13]!==s||e[14]!==d?(u=r.jsx(ks,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=u):u=e[15],u}function p3(t){const e=z.c(2),{text:s}=t;let n;return e[0]!==s?(n=r.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 oW(t){const e=z.c(52),{sources:s,template:n,paramName:i,value:o,sandboxRef:l,onCommit:a}=t,c=se(),[d,u]=V.useState(!1),[h,f]=V.useState(""),[m,p]=V.useState(""),g=V.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=tW(c),y=[...new Set(s.map(_e=>b[_e.kind].noun))].join(" or ");let _;e[0]!==c||e[1]!==y?(_=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=c,e[1]=y,e[2]=_):_=e[2];const L=_,w={template:n,paramName:i};let S;e[3]!==h?(S=(_e,Ae)=>({source:_e,query:Ae,options:_e.clientFilter?va(Ae.data??[],h):Ae.data??[]}),e[3]=h,e[4]=S):S=e[4];const k=S,j=s.filter(mW),T=s.filter(fW),N=kh({queries:j.map(_e=>rf(l,_e,m,w,d))});let C;e[5]!==N||e[6]!==k?(C=(_e,Ae)=>k(_e,N[Ae]),e[5]=N,e[6]=k,e[7]=C):C=e[7];const A=j.map(C),P=A.length===0||A.every(hW),R=kh({queries:T.map(_e=>rf(l,_e,m,w,d&&P))});let E;e[8]!==R||e[9]!==k?(E=(_e,Ae)=>k(_e,R[Ae]),e[8]=R,e[9]=k,e[10]=E):E=e[10];const M=T.map(E),I=P?M:A,$=I.length===1&&I[0]?.source.homepageLinks?I[0]:null,D=$&&!$.query.isLoading&&!$.query.isError?$?.query.data??[]:[],B=va(D.filter(uW),h),F=va(D.filter(dW),h),U=B.length>0&&F.length>0,H=_e=>{u(_e),g.current&&clearTimeout(g.current),f(_e?o:""),p(_e?o:"")};let W;e[11]===Symbol.for("react.memo_cache_sentinel")?(W=_e=>{f(_e),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(_e)},300)},e[11]=W):W=e[11];const q=W,ee=_e=>{a(_e),H(!1)},X=jv(h),Y=Pr(n,{[i]:X}),G=Ct,J=jt,oe="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",le=cW;let Q;e[12]!==x||e[13]!==c?(Q=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=Q):Q=e[14];let K;e[15]!==Q?(K=r.jsx(os,{className:"sr-only",children:r.jsx(At,{children:Q})}),e[15]=Q,e[16]=K):K=e[16];let te;e[17]===Symbol.for("react.memo_cache_sentinel")?(te=r.jsx(v1,{size:16,className:"shrink-0 text-foreground"}),e[17]=te):te=e[17];let ne;e[18]!==c?(ne=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=ne):ne=e[19];let re;e[20]!==x?(re=r.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]=re):re=e[21];let he;e[22]!==ne||e[23]!==re?(he=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[te,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[ne," ",re]})]}),e[22]=ne,e[23]=re,e[24]=he):he=e[24];const pe=pr,de=!1,Z="min-h-0 flex-1";let fe;e[25]!==L||e[26]!==h?(fe=r.jsx(Wi,{autoFocus:!0,placeholder:L,value:h,onValueChange:q}),e[25]=L,e[26]=h,e[27]=fe):fe=e[27];const ue=qi,ye="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Le;e[28]!==c?(Le=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=Le):Le=e[29];let Re;e[30]!==Le?(Re=r.jsx(si,{children:Le}),e[30]=Le,e[31]=Re):Re=e[31];const De=X&&r.jsx(ks,{className:"shrink-0",children:r.jsxs(Jt,{value:`__raw__:${X}`,className:"gap-3 py-2",onSelect:()=>ee(X),children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:r.jsx(Zr,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:X,paramLabel:x})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Y})]})]})}),Ue=U?r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:r.jsx(ya,{heading:b.category.heading,iconKind:"category",options:B,template:n,paramName:i,keyPrefix:`${$?.source.id}:cat`,onSelect:ee})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(ya,{heading:b.product.heading,iconKind:"product",options:F,template:n,paramName:i,keyPrefix:`${$?.source.id}:prod`,onSelect:ee})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:I.map(_e=>{const{source:Ae,query:Ce,options:xe}=_e,{noun:Se}=b[Ae.kind];if(Ce.isLoading)return r.jsx(p3,{text:c("sandbox.pathParamPickerChip.loading",{noun:Se})},Ae.id);if(Ce.isError)return r.jsx(p3,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ae.id);if(Ae.homepageLinks){const we=Ce.data??[];return r.jsxs(V.Fragment,{children:[r.jsx(ya,{heading:b.category.heading,iconKind:"category",options:va(we.filter(aW),h),template:n,paramName:i,keyPrefix:`${Ae.id}:cat`,onSelect:ee}),r.jsx(ya,{heading:b.product.heading,iconKind:"product",options:va(we.filter(lW),h),template:n,paramName:i,keyPrefix:`${Ae.id}:prod`,onSelect:ee})]},Ae.id)}return r.jsx(ya,{heading:I.length>1?b[Ae.kind].heading:void 0,iconKind:Ae.kind,options:xe,template:n,paramName:i,keyPrefix:Ae.id,onSelect:ee},Ae.id)})});let $e;e[32]!==ue||e[33]!==Re||e[34]!==De||e[35]!==Ue?($e=r.jsxs(ue,{className:ye,children:[Re,De,Ue]}),e[32]=ue,e[33]=Re,e[34]=De,e[35]=Ue,e[36]=$e):$e=e[36];let je;e[37]!==pe||e[38]!==fe||e[39]!==$e?(je=r.jsxs(pe,{shouldFilter:de,className:Z,children:[fe,$e]}),e[37]=pe,e[38]=fe,e[39]=$e,e[40]=je):je=e[40];let be;e[41]!==J||e[42]!==K||e[43]!==he||e[44]!==je||e[45]!==le?(be=r.jsxs(J,{className:oe,onClick:le,children:[K,he,je]}),e[41]=J,e[42]=K,e[43]=he,e[44]=je,e[45]=le,e[46]=be):be=e[46];let Ee;return e[47]!==G||e[48]!==H||e[49]!==d||e[50]!==be?(Ee=r.jsx(G,{open:d,onOpenChange:H,children:be}),e[47]=G,e[48]=H,e[49]=d,e[50]=be,e[51]=Ee):Ee=e[51],r.jsxs(r.Fragment,{children:[r.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:_e=>{_e.stopPropagation(),H(!0)},children:o||x}),Ee]})}function lW(t){return t.kind==="product"}function aW(t){return t.kind!=="product"}function cW(t){return t.stopPropagation()}function dW(t){return t.kind==="product"}function uW(t){return t.kind!=="product"}function hW(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function fW(t){return t.isFallback}function mW(t){return!t.isFallback}function pW(t){const e=z.c(8),{sources:s,template:n,paramName:i,sandboxRef:o,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==o||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(gW);c=kh,a=p.map(g=>rf(o,g,"",m,!0)),e[0]=i,e[1]=o,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]=V.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 gW(t){return!t.isFallback}function xW(t){const e=z.c(31),{name:s,value:n,onCommit:i}=t,o=se(),[l,a]=V.useState(n),[c,d]=V.useState(!1),u=V.useRef(!1);let h;e[0]!==s||e[1]!==o?(h=s==="*"?o("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=o,e[2]=h):h=e[2];const f=h,m=l||f;let p;e[3]!==m?(p=r.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]!==o?(g=o("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=o,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 v;e[10]!==n?(v=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(u.current=!0,a(n),k.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let y;e[12]!==l||e[13]!==i||e[14]!==n?(y=()=>{if(d(!1),u.current){u.current=!1;return}const k=jv(l);a(k),k!==n&&i(k)},e[12]=l,e[13]=i,e[14]=n,e[15]=y):y=e[15];let _;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==y?(_=r.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:bW,onChange:x,onFocus:b,onKeyDown:v,onBlur:y}),e[16]=l,e[17]=f,e[18]=g,e[19]=v,e[20]=y,e[21]=_):_=e[21];let L;e[22]!==p||e[23]!==_?(L=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,_]}),e[22]=p,e[23]=_,e[24]=L):L=e[24];let w;e[25]!==c||e[26]!==o?(w=c&&r.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:[r.jsx(AS,{size:10}),o("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=o,e[27]=w):w=e[27];let S;return e[28]!==w||e[29]!==L?(S=r.jsxs(r.Fragment,{children:[L,w]}),e[28]=w,e[29]=L,e[30]=S):S=e[30],S}function bW(t){return t.stopPropagation()}const vW={loaders:"loader",actions:"action"},B8=new Set(["workflows"]);function z8(t){return vW[t]}function yW(t,e,s){const n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(s)&&e in o)return!0;return!1}function _W(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(o))s.add(l);return s}function LW(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function F8(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[o,l]of Object.entries(s))if(o.includes(e))for(const a of Object.keys(l))i.add(a);for(const o of i){if(o.toLowerCase().includes("preview")||Av.has(o)||B8.has(cp(o))||LW(o,i))continue;const l=to(o,t);if(l.hidden)continue;const a=l.title&&l.title!==o?l.title:ds(o);n.push({resolveType:o,title:a})}return n.sort((o,l)=>o.title.localeCompare(l.title))}function g3(t,e){return F8(t,e).length}function cp(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const wW={deco:"Deco",std:"Deco Standard",website:"Website"};function SW(t){return wW[t]??t}function U8(t){const e=cp(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 kW(t,e,s){const n=[];for(const[i,o]of Object.entries(e)){if(i.includes("/")||A0(i)||!o||typeof o!="object"||Array.isArray(o))continue;const l=o,a=l.__resolveType;typeof a=="string"&&(Av.has(a)||B8.has(cp(a))||yW(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,o)=>i.title.localeCompare(o.title))}function K8(t){const e=z.c(12),{orgSlug:s,virtualMcpId:n,branch:i,enabled:o}=t,l=o===void 0?!0:o;let a;e[0]!==i||e[1]!==s||e[2]!==n?(a=Fe.sandboxRepoDir(s,n,i),e[0]=i,e[1]=s,e[2]=n,e[3]=a):a=e[3];let c;e[4]!==i||e[5]!==s||e[6]!==n?(c=async()=>{const h=`/api/${s}/sandbox/${encodeURIComponent(n)}/${encodeURIComponent(i)}/config`,f=await fetch(h);return f.ok?(await f.json()).repoDir??null:null},e[4]=i,e[5]=s,e[6]=n,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d={queryKey:a,queryFn:c,enabled:l,staleTime:1/0},e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],xt(d).data??null}const jW={target:null,editSeoPageKey:null,variantOverride:null};function CW(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const H8=V.createContext(null);function NW(t){const e=z.c(9),{children:s}=t,[n,i]=V.useReducer(CW,jW);let o,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o,e[1]=l,e[2]=a,e[3]=c):(o=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:o,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=r.jsx(H8,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=u):u=e[8],u}function dp(){const t=V.use(H8);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}const VW="https://github.com/decocms/blocks";function TW(){const t=z.c(14),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(PS,{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 o;t[5]!==e?(o=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=o):o=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(hn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(ae,{size:"sm",asChild:!0,children:r.jsxs("a",{href:VW,target:"_blank",rel:"noreferrer",children:[o,l]})}),t[8]=o,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=r.jsx(Fr,{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 EW(t){const e=z.c(15),{source:s,onRetry:n}=t,i=se();let o;e[0]!==s||e[1]!==i?(o=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(fn,{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=r.jsx(ae,{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=r.jsx(Fr,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}function To(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const AW=V.lazy(()=>Sn(()=>import("./sections-editor-3J6fiIE3.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])).then(t=>({default:t.SectionsEditor})));function x3(t){const e=z.c(42),{virtualMcpId:s,externalSelectedIndex:n}=t,i=n===void 0?null:n,{org:o}=Me(),{currentBranch:l}=Qs(),a=jn(),c=Uo(),d=dp(),u=a.lifecycle.phase==="running",h=c.previewUrl;let f;e[0]!==l||e[1]!==o||e[2]!==h||e[3]!==s?(f=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,previewUrl:h}:null,e[0]=l,e[1]=o,e[2]=h,e[3]=s,e[4]=f):f=e[4];const m=f;let p;e[5]!==u?(p={fetchEnabled:u},e[5]=u,e[6]=p):p=e[6];const g=T0(m,p);let x;e[7]!==u?(x={fetchEnabled:u},e[7]=u,e[8]=x):x=e[8];const b=E0(m,x);let v;e[9]!==g||e[10]!==b||e[11]!==a.lifecycle.phase?(v=x8({lifecyclePhase:a.lifecycle.phase,decofile:qu(g),meta:qu(b),hasEditableContent:R0(g.data,b.data)}),e[9]=g,e[10]=b,e[11]=a.lifecycle.phase,e[12]=v):v=e[12];const y=v;if(y.kind==="loading"){let M;return e[13]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(To,{}),e[13]=M):M=e[13],M}if(y.kind==="empty"){let M;return e[14]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(TW,{}),e[14]=M):M=e[14],M}if(y.kind==="error"){let M;e[15]!==g||e[16]!==c||e[17]!==b||e[18]!==y.source?(M=()=>{if(y.source==="sandbox"){c.retry();return}Promise.all([g.refetch(),b.refetch()])},e[15]=g,e[16]=c,e[17]=b,e[18]=y.source,e[19]=M):M=e[19];const I=M;let $;return e[20]!==I||e[21]!==y.source?($=r.jsx(EW,{source:y.source,onRetry:I}),e[20]=I,e[21]=y.source,e[22]=$):$=e[22],$}const _=d.state.target;let L;e[23]!==l||e[24]!==o.slug||e[25]!==_||e[26]!==s?(L=_||!l?null:P8(A8(o.slug,s,l)),e[23]=l,e[24]=o.slug,e[25]=_,e[26]=s,e[27]=L):L=e[27];const w=L;let S="/",k=null,j=null;_?.kind==="page"?(S=_.path,k=_.key):_?.kind==="section"?j=_.key:w&&(S=w.path,k=w.pageKey);const T=k?`page:${k}`:j?`section:${j}`:`path:${S}`;let N;e[28]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),e[28]=N):N=e[28];const C=l??"",A=h??void 0,P=j?null:i,R=!!k&&d.state.editSeoPageKey===k;let E;return e[29]!==j||e[30]!==k||e[31]!==S||e[32]!==T||e[33]!==o.slug||e[34]!==P||e[35]!==R||e[36]!==C||e[37]!==A||e[38]!==s||e[39]!==d.consumeEditSeo||e[40]!==d.setVariantOverride?(E=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(V.Suspense,{fallback:N,children:r.jsx(AW,{orgSlug:o.slug,virtualMcpId:s,branch:C,previewReady:!0,previewUrl:A,currentPath:S,activePageBlockKey:k,activeGlobalBlockKey:j,externalSelectedIndex:P,initialEditSeo:R,onExitSeo:d.consumeEditSeo,onVariantPreviewOverride:d.setVariantOverride},T)})}),e[29]=j,e[30]=k,e[31]=S,e[32]=T,e[33]=o.slug,e[34]=P,e[35]=R,e[36]=C,e[37]=A,e[38]=s,e[39]=d.consumeEditSeo,e[40]=d.setVariantOverride,e[41]=E):E=e[41],E}function PW(t,e){return t===e?"preview":e}function RW(t){return t.cmsDefaultOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const DW="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",IW="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",MW=500,$W={mobile:375,tablet:768,desktop:null},U9=["desktop","mobile","tablet"],b3={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function v3(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function _a(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function OW(t){const{onOpen:e}=t,[s,n]=V.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function BW(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function zW({virtualMcpId:t}){const e=se(),s=_0(),n=Xr(),i=CK(),o=It(),{currentBranch:l}=Qs(),a=dp(),c=h8(),d=ve=>{o({to:".",search:Ie=>({...Ie,main:ve}),replace:!0})},[u,h]=V.useState("preview"),[f,m]=V.useState(!1),[p,g]=V.useState("desktop"),[x,b]=V.useState(null),[v,y]=V.useState(null),_=V.useRef(null),L=V.useRef(null),[w,S]=V.useState(null),[k,j]=V.useState(!1),[T,N]=V.useState(""),C=V.useRef(null),[A,P]=V.useState(!1),[R,E]=V.useState(),[M,I]=V.useState(null),[$,O]=V.useState(null),[D,B]=V.useState("/"),[F,U]=V.useState(null),[H,W]=V.useState({}),[q,ee]=V.useState(!1),X=V.useRef(null),Y=()=>{ee(!0),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>ee(!1),15e3)},G=()=>{X.current&&(clearTimeout(X.current),X.current=null),ee(!1)},{org:J}=Me(),oe=jn(),le=Uo(),Q=le.vmEntry,K=le.previewUrl,te=oe.lifecycle.phase,ne=oe.decofileVersion,re=te==="running",he=Q?.sandboxProviderKind==="user-desktop",pe=K8({orgSlug:J.slug,virtualMcpId:t??"",branch:l??"",enabled:he&&re&&!!t&&!!l}),de=he?pe:null,Z=t&&l?{orgSlug:J.slug,virtualMcpId:t,branch:l,previewUrl:K}:null,fe=T0(Z,{fetchEnabled:re}),ue=E0(Z,{fetchEnabled:re}),ye=fe.data,Le=ue.data,Re=x8({lifecyclePhase:te,decofile:qu(fe),meta:qu(ue),hasEditableContent:R0(ye,Le)}).kind==="content",De=t&&l?{orgSlug:J.slug,virtualMcpId:t,branch:l}:null,Ue=HK(De),$e=ye?ym(ye).sort((ve,Ie)=>ve.name.localeCompare(Ie.name)):[],je=ye&&Le?_m(ye,Le):[],be=$r,Ee=$e.filter(ve=>{if(!T)return!0;const Ie=T.toLowerCase();return ve.name.toLowerCase().includes(Ie)||ve.path.toLowerCase().includes(Ie)}),_e=je.filter(ve=>{if(!T)return!0;const Ie=T.toLowerCase();return ve.name.toLowerCase().includes(Ie)||ve.key.toLowerCase().includes(Ie)||ve.resolveType.toLowerCase().includes(Ie)}),Ae=M?null:nP($e,D,F),Ce=M?M.name:Ae?.name,xe=Ae?.key??null,Se=Ae?.path??null,we=(xe?H[xe]:void 0)??{},ze=Pr(D,we),Be={};if(re&&K&&Le&&ye){const ve=_W(Le,"loaders"),Ie=xe?ye[xe]:void 0,vt=zH(Ie,ye,ls=>ve.has(ls)),wt=IH(vt);for(const ls of Tu(D)){if(ls.type!=="param")continue;const tn=PH(D,ls.name,vt),Is=OH(tn,ve,wt);Is.length>0&&(Be[ls.name]=Is)}}const Xe=t&&l?{orgSlug:J.slug,virtualMcpId:t,branch:l}:null,Ve=ye&&xe?C8(ye,xe,0):[],ot=ye?L8(Ve,ye):[],gt=ot.map(ve=>ve.isSavedBlock?ve.label:""),ct=ot.map(ve=>ve.isSavedBlock?"global":ve.isMultivariate?"variant":"normal"),dt=Ve.map(ve=>sf(ve,ye??{})),mt=V.useRef(null),ge=V.useRef(null),Ye=oe.status.state==="paused",tt=oe.phase,ut=V8({claimPhase:tt,lifecycle:oe.lifecycle}),bt=le.previewState,Vt=le.userStopped,St=vr(),Tt=St?.entity?.id===t?w0(St.entity.metadata?.productionUrl):null,Kt=(St?.entity?.id===t?St.entity.metadata?.ui?.layout?.cmsDefaultOpen:null)??!1,es=!!Tt&&St?.entity?.metadata?.fastPreview===!0,Mt=es&&Tt&&K&&ne?zK({productionUrl:Tt,previewUrl:K,version:ne,path:ze}):null,ce=pK({previewState:bt,progressStatus:ut.status,productionUrl:Tt,fastPreviewActive:es,fastPreviewReady:!!Mt}),Pe=ce.mode!=="none",He=ce.mode==="production"&&ce.iframeBase?new URL(ce.iframeBase).origin:null,Qe=!s,Ne=ce.mode==="sandbox"?$K(v3($??new URL(ze,ce.iframeBase).href,p),a.state.variantOverride??[]):ce.mode==="production"&&Qe?v3(Mt??new URL(ze,ce.iframeBase).href,p):null;V.useEffect(()=>{},[s,He,w]);const lt="sandbox.preview.openInNewTab",Bt=ce.mode==="production"?Mt??(ce.iframeBase?new URL(ze,ce.iframeBase).href:null):Ne??ce.iframeBase,Ns=async()=>{const ve=Bt;if(ve){window.open(ve,"_blank","noopener");return}},an=t&&l?A8(J.slug,t,l):null,Ds=ve=>{an&&TH(an,ve)},Ft=a.state.target;V.useEffect(()=>{if(!(!Ft||!K||!Le))if(Ft.kind==="page"){const ve=H[Ft.key]??{};ge.current=Pr(Ft.path,ve),I(null),O(null),U(Ft.key),B(Ft.path),Ds({path:Ft.path,pageKey:Ft.key,params:ve})}else{const ve=je.find(Ie=>Ie.key===Ft.key);if(ve){ge.current=null;const Ie=Rh(Le);I(ve),O(l3(K,Ie,ve.key))}}},[Ft,K,Le,H]),V.useEffect(()=>{!xe||Se===null||Ft?.kind==="page"&&Ft.key===xe&&Ft.path===Se||a.selectTarget({kind:"page",key:xe,path:Se})},[xe,Se,Ft]);const[Xs,Cn]=V.useState(null);if(bt.kind==="iframe"&&Xs!==bt.previewUrl){const ve=Xs!==null;Cn(bt.previewUrl);const Ie=an?P8(an):null;if(Ie){if(ge.current=Pr(Ie.path,Ie.params),B(Ie.path),U(Ie.pageKey),O(null),I(null),Ie.pageKey&&Object.keys(Ie.params).length>0){const vt=Ie.pageKey;W(wt=>({...wt,[vt]:Ie.params}))}}else ve&&(ge.current=null,B("/"),O(null),U(null),I(null))}mt.current=Ne;const Js=vK({iframeRef:_,src:ce.mode==="sandbox"?Ne:null,active:ce.mode==="sandbox"}),Zs=V.useRef(null);V.useEffect(()=>{if(!Mt||!Ne||Zs.current===Mt)return;Zs.current=Mt;const ve=_.current;ve&&ve.getAttribute("src")!==Ne&&(Y(),ve.src=Ne)},[Mt,Ne]);const di=!!t&&!!l&&!oe.notFound&&!Vt&&!Ye&&(tt?.kind==="ready"||te!=="idle"),Te=ce.mode!=="sandbox"&&u==="visual"?"preview":u;V.useEffect(()=>{const ve=_a(K);if(!ve)return;const Ie=vt=>{if(vt.origin===ve){if(vt.data?.type==="visual-editor::element-clicked"){const wt=GK.safeParse(vt.data.payload);wt.success&&b(wt.data)}else if(vt.data?.type==="cms-editor::section-clicked"){const wt=QK.safeParse(vt.data.payload);wt.success&&y(wt.data.sectionIndex)}}};return window.addEventListener("message",Ie),()=>window.removeEventListener("message",Ie)},[K]),V.useEffect(()=>{if(!k)return;const ve=Ie=>{C.current?.contains(Ie.target)||(j(!1),N(""))};return document.addEventListener("pointerdown",ve),()=>document.removeEventListener("pointerdown",ve)},[k]);const st=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||ve.postMessage({type:"visual-editor::activate",script:YK},Ie)},Lt=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||ve.postMessage({type:"visual-editor::deactivate"},Ie)},ts=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||(ve.postMessage({type:"visual-editor::activate",script:XK},Ie),ve.postMessage({type:"cms-editor::set-labels",labels:gt,kinds:ct,keys:dt},Ie))},en=()=>{const ve=_.current?.contentWindow,Ie=_a(K);!ve||!Ie||ve.postMessage({type:"cms-editor::deactivate"},Ie)},qs=ve=>{const Ie=u;!n&&ve!==Ie&&(ve==="blocks"?L.current?.resize("30%"):L.current?.collapse()),h(ve),b(null),y(null),Ie==="visual"&&Lt(),ve==="visual"&&st(),Ie==="blocks"&&ve!=="blocks"&&en(),ve==="blocks"&&ts()},Gi=ve=>{m(!0),qs(PW(u,ve))},ca=RW({cmsDefaultOpen:Kt,blocksReady:Re,autoOpenResolved:f,editingMode:u}),yr=()=>{m(!0),qs("blocks")},_r=()=>{if(!_.current||!Ne)return;const ve=_.current;ve.src=Ne},Lr=()=>{const ve=_.current;if(!ve)return;Y();const Ie=document.activeElement,vt=ve.tabIndex;ve.tabIndex=-1,ve.style.pointerEvents="none",ve.blur(),BW(ve,mt.current);let wt;const ls=()=>{clearTimeout(wt),ve.tabIndex=vt,ve.style.pointerEvents="";const tn=document.activeElement;(!tn||tn===document.body||tn===ve)&&Ie?.focus(),ve.removeEventListener("load",ls)};ve.addEventListener("load",ls),wt=setTimeout(ls,3e3)};gP(()=>{Mt||Lr()}),xP(()=>{Y()});const Xo=()=>{const ve=U9.indexOf(p);g(U9[(ve+1)%U9.length])},wr=async()=>{let ve=null;try{ve=_.current?.contentWindow?.location?.href??null}catch{}const Ie=ve??Ne??K;if(Ie)try{await navigator.clipboard.writeText(Ie),me.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{me.error(e("sandbox.preview.failedToCopyUrl"))}},Sr=yK({iframeBase:ce.iframeBase,resolvedPath:ze,activeGlobalSectionName:M?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),ui=ve=>{const Ie=H[ve.key]??{},vt=Pr(ve.path,Ie);(M||be(vt)!==be(ze))&&Y(),ge.current=vt,I(null),O(null),y(null),U(ve.key),B(ve.path),Ds({path:ve.path,pageKey:ve.key,params:Ie}),a.selectTarget({kind:"page",key:ve.key,path:ve.path})},hi=(ve,Ie)=>{if(!xe)return;const vt=xe,wt={...we,[ve]:Ie};ge.current=Pr(D,wt),W(ls=>({...ls,[vt]:wt})),Ds({path:D,pageKey:vt,params:wt})},da=ve=>{if(!K||!Le){me.error(e("sandbox.preview.previewMetadataNotReady"));return}Y(),ge.current=null;const Ie=Rh(Le),vt=l3(K,Ie,ve.key);I(ve),O(vt),y(null),a.selectTarget({kind:"section",key:ve.key})},kr=async({name:ve,path:Ie,templateKey:vt})=>{if(!t||!l)return;const wt=xm(Ie);if(wt){E(wt);return}const ls=Ie.trim().startsWith("/")?Ie.trim():`/${Ie.trim()}`;if($e.some(Is=>be(Is.path)===be(ls))){E(e("sandbox.preview.pageAlreadyExists",{path:ls}));return}let tn;if(vt&&(tn=ye?.[vt],!tn)){E(e("sandbox.preview.templateNoLongerExists"));return}E(void 0);try{const Is=await Ue.mutateAsync({name:ve,path:ls,template:tn});P(!1),me.success(e("sandbox.preview.pageCreated",{name:ve})),await Yl(MW),ui({key:Is.key,name:Is.name,path:Is.path}),qs("blocks")}catch(Is){E(Is instanceof Error?Is.message:e("sandbox.preview.failedToCreatePage"))}},Mn=Pe&&(di||ce.mode==="production"),Yi=u==="blocks",Qi=Mn?r.jsx(rp,{title:e("sandbox.preview.cms"),tooltip:e(Yi?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:RS},active:Yi,onClick:()=>Gi("blocks"),testId:"preview-blocks-toggle",dataTour:dr.edit}):null,Xi=Mn?r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{onClick:_r,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(vn,{size:16})})}),r.jsx(qe,{side:"bottom",children:e("sandbox.preview.refresh")})]}),r.jsxs("div",{ref:C,className:"relative min-w-0 w-64 shrink",children:[r.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:[r.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>j(ve=>!ve),children:[M&&r.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:[r.jsx(Vi,{size:11}),"Global"]}),r.jsx("span",{className:ie("text-[13px] font-medium text-foreground",Ce==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:Ce??Sr}),!M&&Ce!=null&&D&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:Tu(D).map((ve,Ie)=>{if(ve.type==="text")return r.jsx("span",{className:ie(Ie===0?"min-w-0 truncate":"shrink-0"),children:ve.text},`text-${Ie}`);const vt=Be[ve.name];return vt&&Xe?r.jsx(oW,{sources:vt,template:D,paramName:ve.name,value:we[ve.name]??"",sandboxRef:Xe,onCommit:wt=>hi(ve.name,wt)},`${xe}:${ve.name}`):r.jsx(xW,{name:ve.name,value:we[ve.name]??"",onCommit:wt=>hi(ve.name,wt)},`${xe}:${ve.name}`)})})]}),r.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>j(ve=>!ve),"aria-label":e("sandbox.preview.choosePage"),children:r.jsx(fs,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",k&&"rotate-180")})})]}),k&&r.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:[r.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[r.jsx(C0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:T,onChange:ve=>N(ve.target.value),onKeyDown:ve=>{if(ve.key!=="Enter")return;const Ie=T.trim();if(!Ie)return;const vt=Ee.find(wt=>be(wt.path)===be(Ie));vt&&(ve.preventDefault(),j(!1),N(""),ui(vt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),r.jsx("div",{className:"p-1.5 border-b",children:r.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:ve=>{ve.preventDefault(),j(!1),N(""),E(void 0),P(!0)},children:[r.jsx(Nt,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),Ee.length===0&&_e.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:$e.length===0&&je.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[Ee.length>0&&r.jsx("div",{className:"p-1.5",children:Ee.map(ve=>r.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:Ie=>{Ie.preventDefault(),j(!1),N(""),ui(ve)},children:[r.jsx(or,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.path})]},ve.key))}),_e.length>0&&r.jsxs("div",{className:ie("p-1.5",Ee.length>0&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),_e.map(ve=>r.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:Ie=>{Ie.preventDefault(),j(!1),N(""),da(ve)},children:[r.jsx(Vi,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]})]})]})]}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{"aria-label":e(lt),onClick:()=>{Ns()},children:r.jsx(hn,{size:16})})}),r.jsx(qe,{side:"bottom",children:e(lt)})]})]}):null,ua=Mn?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Qi,r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Xi]}):null,jr=Mn||c?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(Hi,{size:14})})}),r.jsxs(Yt,{align:"end",className:"w-44",children:[c&&r.jsxs(Ze,{onClick:()=>c.setVisible(!c.visible),children:[r.jsx(b5,{size:14}),c.visible?e("sandbox.preview.hideTerminal"):e("sandbox.preview.showTerminal")]}),Mn&&r.jsxs(r.Fragment,{children:[c&&r.jsx(ki,{}),r.jsxs(Ze,{onClick:wr,children:[r.jsx(on,{size:14}),e("sandbox.preview.copyCurrentUrl")]})]}),ye&&Le&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),xe&&r.jsxs(Ze,{onClick:()=>{a.editSeo({kind:"page",key:xe,path:D}),qs("blocks")},children:[r.jsx(S1,{size:14}),e("sandbox.preview.editSeo")]}),xe&&r.jsxs(Ze,{onClick:()=>{try{d(oS(vA(xe)))}catch{me.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx($o,{size:14}),e("sandbox.preview.viewJson")]})]}),de&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),r.jsxs(Ze,{onClick:()=>window.open(Qu("vscode",de)),children:[r.jsx("img",{src:DW,alt:"VSCode",width:14,height:14}),e("sandbox.preview.openInVscode")]}),r.jsxs(Ze,{onClick:()=>window.open(Qu("cursor",de)),children:[r.jsx("img",{src:IW,alt:"Cursor",width:14,height:14}),e("sandbox.preview.openInCursor")]})]}),r.jsx(ki,{}),r.jsxs(Ze,{onClick:()=>hK(e),children:[r.jsx(DS,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,fi=ce.mode==="sandbox",Ji=fi?r.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:r.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{onClick:()=>Gi("visual"),"aria-pressed":u==="visual","aria-label":e("sandbox.preview.visualEditor"),active:u==="visual",disabled:!fi,className:"rounded-full","data-tour":dr.visualEditor,children:r.jsx(Wp,{size:16})})}),r.jsx(qe,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(Ra,{onClick:Xo,"aria-label":e(b3[p]),disabled:!fi,className:"rounded-full","data-tour":dr.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&r.jsx(IS,{size:16}),p==="tablet"&&r.jsx(MS,{size:16}),p==="desktop"&&r.jsx($S,{size:16})]},p)})}),r.jsx(qe,{side:"top",children:e(b3[p])})]})]})}):null;return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[ca&&r.jsx(OW,{onOpen:yr}),Xe&&Object.entries(Be).map(([ve,Ie])=>(we[ve]??"")===""?r.jsx(pW,{sources:Ie,template:D,paramName:ve,sandboxRef:Xe,onFill:vt=>hi(ve,vt)},`${xe}:${ve}`):null),i?r.jsxs(r.Fragment,{children:[Mn&&r.jsx(kK,{children:ua}),r.jsx(jK,{children:jr})]}):(Mn||jr)&&r.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:[r.jsx("div",{className:"flex flex-1 items-center justify-start",children:Qi}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Xi}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:jr})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:n&&Te==="blocks"?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(x3,{virtualMcpId:t,externalSelectedIndex:v}),Ji]}):r.jsxs(rv,{orientation:"horizontal",disabled:Te!=="blocks",children:[r.jsx(Vu,{ref:L,id:"preview-blocks-editor",defaultSize:Te==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Te==="blocks"&&r.jsx(x3,{virtualMcpId:t,externalSelectedIndex:v})}),Te==="blocks"&&r.jsx(ov,{withHandle:!0}),r.jsx(Vu,{id:"preview-canvas",defaultSize:Te==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{className:ie("h-full relative overflow-hidden",p!=="desktop"&&Pe&&"flex justify-center bg-muted/30"),children:[q&&Pe&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-0.5 overflow-hidden bg-primary/15",children:r.jsx("div",{className:"absolute inset-y-0 w-2/5 rounded-full bg-primary animate-preview-nav"})}),ce.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Vl,{kind:"starting",progress:ut,claimPhase:tt})}),bt.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Vl,{kind:"suspended",onResume:le.resume})}),bt.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Vl,{kind:"errored",error:bt.error,onRetry:le.retry,connectionsHref:`/${J.slug}/settings/connections`})}),ce.showWakingPill&&r.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:[r.jsx(it,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Te==="visual"&&!x&&r.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:[r.jsx(Wp,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Te==="visual"&&x&&r.jsx(mH,{element:x,onDismiss:()=>b(null)}),Ji,Pe&&Ne&&r.jsx("div",{className:ie("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",p!=="desktop"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:p==="desktop"?"100%":`${$W[p]}px`},children:r.jsx("iframe",{ref:_,src:Ne,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Js.handleError,onLoad:()=>{if(Js.handleLoad(),G(),ce.mode==="sandbox"){if(Je("vm_preview_loaded",{view_mode:u,vm_id:Q?.sandboxHandle??null}),!M)try{const ve=_.current?.contentWindow?.location?.pathname;if(!ve)return;const Ie=ge.current;if(Ie!==null&&(ge.current=null,be(ve)!==be(Ie))||be(ve)===be(ze))return;B(ve),Ds({path:ve,pageKey:F,params:we})}catch{}u==="visual"&&st(),u==="blocks"&&ts()}}},ce.iframeBase)})]})})]})}),r.jsx(qK,{open:A,onOpenChange:P,isPending:Ue.isPending,error:R,templates:$e,onSubmit:kr})]})}function FW(t){const e=z.c(22),{virtualMcpId:s}=t,n=se(),i=Hs(s),{activeTask:o}=Qs(),[l,a]=V.useState(!1);if(!(Ln(i?.metadata)||Ln(o?.metadata))){let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(Kr,{className:"size-7 text-foreground"})}),e[0]=u):u=e[0];let h;e[1]!==n?(h=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=h):h=e[2];let f;e[3]!==n?(f=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=f):f=e[4];let m,p;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),p=r.jsx(Kr,{className:"size-4"}),e[5]=m,e[6]=p):(m=e[5],p=e[6]);let g;e[7]!==n?(g=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=g):g=e[8];let x;e[9]!==g?(x=r.jsxs(ae,{onClick:m,children:[p,g]}),e[9]=g,e[10]=x):x=e[10];let b;e[11]!==h||e[12]!==f||e[13]!==x?(b=r.jsx(Fr,{className:"h-full",image:u,title:h,description:f,actions:x}),e[11]=h,e[12]=f,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==l?(v=r.jsx(z1,{open:l,onOpenChange:a,mode:"agent"}),e[15]=l,e[16]=v):v=e[16];let y;return e[17]!==b||e[18]!==v?(y=r.jsxs(r.Fragment,{children:[b,v]}),e[17]=b,e[18]=v,e[19]=y):y=e[19],y}let d;return e[20]!==s?(d=r.jsx(zW,{virtualMcpId:s}),e[20]=s,e[21]=d):d=e[21],d}const UW="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",KW="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",HW=V.lazy(()=>Sn(()=>import("./file-explorer-BDrfu6vK.js"),__vite__mapDeps([149,1,2,84,85,78,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,79,80,81,82,83,86,87,88,89,90,91,92,93,94,95,96,107,101,102,103,104,105,106,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.FileExplorer})));function WW(t){const e=z.c(21),{openPath:s}=t,n=se(),i=vr(),{org:o}=Me(),{currentBranch:l}=Qs(),a=i?.entity?.id??null,c=Uo(),d=jn(),u=c.vmEntry,h=d.lifecycle.phase==="running",f=u?.sandboxProviderKind==="user-desktop",m=a??"",p=l??"",g=f&&h&&!!a&&!!l;let x;e[0]!==o.slug||e[1]!==m||e[2]!==p||e[3]!==g?(x={orgSlug:o.slug,virtualMcpId:m,branch:p,enabled:g},e[0]=o.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x):x=e[4];const b=K8(x),v=f?b:null;if(!a||!l){let S;e[5]!==n?(S=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[5]=n,e[6]=S):S=e[6];let k;return e[7]!==S?(k=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:S}),e[7]=S,e[8]=k):k=e[8],k}let y;e[9]!==v||e[10]!==n?(y=v&&r.jsx("div",{className:"relative flex h-12 shrink-0 items-center border-b border-border/60 px-3 md:px-4",children:r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInVscode"),onClick:()=>window.open(Qu("vscode",v)),children:r.jsx("img",{src:UW,alt:"VSCode",width:14,height:14})})}),r.jsx(qe,{side:"bottom",children:n("mainPanelTabs.codeTab.openInVscode")})]}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon","aria-label":n("mainPanelTabs.codeTab.openInCursor"),onClick:()=>window.open(Qu("cursor",v)),children:r.jsx("img",{src:KW,alt:"Cursor",width:14,height:14})})}),r.jsx(qe,{side:"bottom",children:n("mainPanelTabs.codeTab.openInCursor")})]})]})}),e[9]=v,e[10]=n,e[11]=y):y=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),e[12]=_):_=e[12];let L;e[13]!==l||e[14]!==s||e[15]!==o.slug||e[16]!==a?(L=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(V.Suspense,{fallback:_,children:r.jsx(HW,{orgSlug:o.slug,virtualMcpId:a,branch:l,openPath:s})})}),e[13]=l,e[14]=s,e[15]=o.slug,e[16]=a,e[17]=L):L=e[17];let w;return e[18]!==y||e[19]!==L?(w=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[y,L]}),e[18]=y,e[19]=L,e[20]=w):w=e[20],w}function qW(t){return Hs(t)?.metadata?.runtime?.path??null}function GW(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 YW(t,e,s){return typeof t!="string"?null:GW(ni(t,e),s)}function W8(t,e,s){if(!e||typeof t!="string")return!1;const n=YW(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function QW({orgSlug:t,virtualMcpId:e,branch:s}){const n=Qt(),i=Hs(e)?.metadata?.runtime?.path??null;return Rt({mutationFn:async({blockKey:o})=>{const l=Xl(i,um(o)),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:l})});if(!a.ok){const c=await a.json().catch(()=>({}));throw new Error(c.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:o})=>{const l=`${t}/${e}/${s}`,a=Fe.decofile(l);await n.cancelQueries({queryKey:a});const c=n.getQueryData(a);return n.setQueryData(a,d=>{if(!d)return d;const{[o]:u,...h}=d;return h}),{previous:c,queryKey:a}},onError:(o,l,a)=>{a?.queryKey&&n.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:Fe.liveMeta(t,e,s)})}})}function hl(t){const e=z.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let o;e[0]!==i||e[1]!==n||e[2]!==s?(o=s?"No results match your search.":r.jsxs(r.Fragment,{children:[r.jsx("div",{children:n}),r.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==o?(l=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=l):l=e[5],l}function n9(t,e){return`${t}-${e}`}function q8(t,e){return`site/apps/${t}/${e}.ts`}function G8(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 XW(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function JW(t){return t==="local"?"Custom":"Installed"}function Y8(t,e,s){const n=new Set([n9(t,e),e].map(o=>o.toLowerCase())),i=q8(t,e);for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(o.toLowerCase())||a.__resolveType===i)return o}return null}function ZW(t,e){const s=t.vendor.alias,n=t.name,i=Y8(s,n,e);return{id:n9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:q8(s,n),blockKey:i,installed:i!==null}}function eq(t,e,s){if(t===vm)return null;const n=G8(t);if(!n)return null;const{vendor:i,app:o}=n,l=Y8(i,o,s),a=to(t,e);return{id:n9(i,o),app:o,vendor:i,title:a.title??o,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function tq(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Eu(t,e)||!kv(n))return null;const i=G8(n)??XW(t);if(!i)return null;const o=to(n,s),{vendor:l,app:a}=i;return{id:n9(l,a),app:a,vendor:l,title:o.title??Au(t,e,s),description:o.description??"",category:JW(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function sq(t,e,s){const n=new Map;for(const o of t){const l=ZW(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=eq(o,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=tq(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(nq)}function nq(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function iq(){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 rq(t,e,s){const n=z.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=Fe.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:iq,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=xt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?sq(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 Q8(t){return(e,s)=>{xv(e),t(e,s)}}function oq(t){const e=z.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=t,l=se();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=r.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:r.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]!==o||e[8]!==d||e[9]!==u?(h=r.jsx(On,{id:"pages",icon:or,label:d,count:n.pages,active:u,onSelect:o}),e[6]=n.pages,e[7]=o,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]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(On,{id:"sections",icon:Vi,label:f,count:n.sections,active:m,onSelect:o}),e[13]=n.sections,e[14]=o,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]!==o||e[22]!==x||e[23]!==g?(b=r.jsx(On,{id:"apps",icon:F5,label:g,count:n.apps,active:x,onSelect:o}),e[20]=n.apps,e[21]=o,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const y=s==="redirects";let _;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==y?(_=r.jsx(On,{id:"redirects",icon:v5,label:v,count:n.redirects,active:y,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=y,e[31]=_):_=e[31];let L;e[32]!==l?(L=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=L):L=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==o||e[36]!==L||e[37]!==w?(S=r.jsx(On,{id:"loaders",icon:_u,label:L,count:n.loaders,active:w,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=L,e[37]=w,e[38]=S):S=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 T;e[41]!==n.actions||e[42]!==o||e[43]!==k||e[44]!==j?(T=r.jsx(On,{id:"actions",icon:$i,label:k,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=k,e[44]=j,e[45]=T):T=e[45];let N;e[46]!==l?(N=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=N):N=e[47];const C=s==="site";let A;e[48]!==o||e[49]!==N||e[50]!==C?(A=r.jsx(On,{id:"site",icon:f1,label:N,active:C,onSelect:o}),e[48]=o,e[49]=N,e[50]=C,e[51]=A):A=e[51];let P;e[52]!==l?(P=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=P):P=e[53];const R=s==="seo";let E;e[54]!==o||e[55]!==P||e[56]!==R?(E=r.jsx(On,{id:"seo",icon:S1,label:P,active:R,onSelect:o}),e[54]=o,e[55]=P,e[56]=R,e[57]=E):E=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 $;e[60]!==o||e[61]!==M||e[62]!==I?($=r.jsx(On,{id:"calendar",icon:ar,label:M,active:I,onSelect:o}),e[60]=o,e[61]=M,e[62]=I,e[63]=$):$=e[63];let O;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(O=i&&r.jsxs(r.Fragment,{children:[r.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:[r.jsx(Pl,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(On,{id:"posts",icon:Ri,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(On,{id:"authors",icon:F1,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(On,{id:"categories",icon:_1,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=o,e[69]=i,e[70]=l,e[71]=O):O=e[71];let D;e[72]!==b||e[73]!==_||e[74]!==S||e[75]!==T||e[76]!==A||e[77]!==E||e[78]!==$||e[79]!==O||e[80]!==h||e[81]!==p?(D=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,_,S,T,A,E,$,O]}),e[72]=b,e[73]=_,e[74]=S,e[75]=T,e[76]=A,e[77]=E,e[78]=$,e[79]=O,e[80]=h,e[81]=p,e[82]=D):D=e[82];let B;return e[83]!==c||e[84]!==D?(B=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,D]}),e[83]=c,e[84]=D,e[85]=B):B=e[85],B}function On(t){const e=z.c(18),{id:s,icon:n,label:i,count:o,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=ie("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=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=r.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==o?(m=o!==void 0&&r.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=l,e[10]=o,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=r.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 lq(t){const e=z.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:o,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=V8({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=r.jsx(Vl,{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]!==o?(a=r.jsx(Vl,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==o||e[10]!==s.error?(a=r.jsx(Vl,{kind:"errored",error:s.error,onRetry:o,connectionsHref:l}),e[8]=l,e[9]=o,e[10]=s.error,e[11]=a):a=e[11],a}}}function y3(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 o=`${s} (copy ${i})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function aq(t,e){const s=$r,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let o=2;o<1e3;o++){const l=`${n}-copy-${o}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function cq(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 o=`${s}_copy_${i}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function dq(t){const e=op(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function uq(t,e){return v8(t,e)}const hq=1e3;function fq(t,e){for(let s=0;s<hq;s++){const n=op(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const mq={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},pq={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},gq={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function xq(t){const e=z.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=se(),[p,g]=V.useState(i),[x,b]=V.useState(o),[v,y]=V.useState(Or),[_,L]=V.useState(null),[w,S]=V.useState(s);s!==w&&(S(s),s&&(g(i),b(o),y(Or),L(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=pe=>{!pe&&!f&&(L(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const T=j;let N;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(N=async pe=>{pe.preventDefault();const de=p.trim(),Z=x.trim();if(!de||!Z||f)return;const fe=xm(Z);if(fe){L(fe);return}const ue=d?.({name:de,path:Z});if(ue){L(ue);return}L(null),await u({name:de,path:Z,templateKey:k&&v!==Or?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=N):N=e[10];const C=N,A=_??a,P=mq[n];let R;e[11]!==m||e[12]!==P?(R=m(P),e[11]=m,e[12]=P,e[13]=R):R=e[13];let E;e[14]!==R?(E=r.jsx(os,{children:r.jsx(At,{children:R})}),e[14]=R,e[15]=E):E=e[15];let M;e[16]!==f||e[17]!==k||e[18]!==m||e[19]!==v||e[20]!==c?(M=k&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),r.jsx(_8,{id:"page-form-template",value:v,onChange:y,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=v,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 $;e[24]!==I?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:I}),e[24]=I,e[25]=$):$=e[25];let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=pe=>g(pe.target.value),e[26]=O):O=e[26];let D;e[27]!==m?(D=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=D):D=e[28];let B;e[29]!==f||e[30]!==p||e[31]!==D?(B=r.jsx(rt,{id:"page-form-name",value:p,onChange:O,placeholder:D,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=D,e[32]=B):B=e[32];let F;e[33]!==B||e[34]!==$?(F=r.jsxs("div",{className:"space-y-1.5",children:[$,B]}),e[33]=B,e[34]=$,e[35]=F):F=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let H;e[38]!==U?(H=r.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>b(pe.target.value),e[40]=W):W=e[40];let q;e[41]!==m?(q=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=q):q=e[42];let ee;e[43]!==f||e[44]!==x||e[45]!==q?(ee=r.jsx(rt,{id:"page-form-path",value:x,onChange:W,placeholder:q,disabled:f}),e[43]=f,e[44]=x,e[45]=q,e[46]=ee):ee=e[46];let X;e[47]!==H||e[48]!==ee?(X=r.jsxs("div",{className:"space-y-1.5",children:[H,ee]}),e[47]=H,e[48]=ee,e[49]=X):X=e[49];let Y;e[50]!==A?(Y=A&&r.jsx("p",{className:"text-xs text-destructive",children:A}),e[50]=A,e[51]=Y):Y=e[51];let G;e[52]!==F||e[53]!==X||e[54]!==Y||e[55]!==M?(G=r.jsxs("div",{className:"space-y-4 py-4",children:[M,F,X,Y]}),e[52]=F,e[53]=X,e[54]=Y,e[55]=M,e[56]=G):G=e[56];let J;e[57]!==h?(J=()=>h(!1),e[57]=h,e[58]=J):J=e[58];let oe;e[59]!==m?(oe=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=oe):oe=e[60];let le;e[61]!==f||e[62]!==J||e[63]!==oe?(le=r.jsx(ae,{type:"button",variant:"outline",onClick:J,disabled:f,children:oe}),e[61]=f,e[62]=J,e[63]=oe,e[64]=le):le=e[64];let Q;e[65]!==f||e[66]!==p||e[67]!==x?(Q=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=Q):Q=e[68];let K;e[69]!==f||e[70]!==n||e[71]!==m?(K=f?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),m(gq[n])]}):m(pq[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=K):K=e[72];let te;e[73]!==Q||e[74]!==K?(te=r.jsx(ae,{type:"submit",disabled:Q,children:K}),e[73]=Q,e[74]=K,e[75]=te):te=e[75];let ne;e[76]!==le||e[77]!==te?(ne=r.jsxs(In,{children:[le,te]}),e[76]=le,e[77]=te,e[78]=ne):ne=e[78];let re;e[79]!==C||e[80]!==G||e[81]!==ne||e[82]!==E?(re=r.jsx(jt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:C,children:[E,G,ne]})}),e[79]=C,e[80]=G,e[81]=ne,e[82]=E,e[83]=re):re=e[83];let he;return e[84]!==T||e[85]!==s||e[86]!==re?(he=r.jsx(Ct,{open:s,onOpenChange:T,children:re}),e[84]=T,e[85]=s,e[86]=re,e[87]=he):he=e[87],he}function bq(t){const e=z.c(70),{open:s,blockKey:n,initialName:i,isPending:o,onSubmit:l,onOpenChange:a}=t,c=o===void 0?!1:o,d=se(),[u,h]=V.useState(i),[f,m]=V.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=W=>{!W&&!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 W=>{W.preventDefault();const q=u.trim();!q||c||await l(q)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx(At,{children:v}),e[9]=v,e[10]=y):y=e[10];let _;e[11]!==d?(_=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=_):_=e[12];let L;e[13]!==_?(L=r.jsx(_n,{children:_}),e[13]=_,e[14]=L):L=e[14];let w;e[15]!==y||e[16]!==L?(w=r.jsxs(os,{children:[y,L]}),e[15]=y,e[16]=L,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>h(W.target.value),e[22]=j):j=e[22];let T;e[23]!==c||e[24]!==u?(T=r.jsx(rt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=T):T=e[25];let N;e[26]!==k||e[27]!==T?(N=r.jsxs("div",{className:"space-y-1.5",children:[k,T]}),e[26]=k,e[27]=T,e[28]=N):N=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let A;e[31]!==C?(A=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=A):A=e[32];let P;e[33]!==n?(P=r.jsx(rt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=P):P=e[34];let R;e[35]!==A||e[36]!==P?(R=r.jsxs("div",{className:"space-y-1.5",children:[A,P]}),e[35]=A,e[36]=P,e[37]=R):R=e[37];let E;e[38]!==N||e[39]!==R?(E=r.jsxs("div",{className:"space-y-4 py-4",children:[N,R]}),e[38]=N,e[39]=R,e[40]=E):E=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 $;e[45]!==c||e[46]!==M||e[47]!==I?($=r.jsx(ae,{type:"button",variant:"outline",onClick:M,disabled:c,children:I}),e[45]=c,e[46]=M,e[47]=I,e[48]=$):$=e[48];let O;e[49]!==c||e[50]!==u?(O=!u.trim()||c,e[49]=c,e[50]=u,e[51]=O):O=e[51];let D;e[52]!==c||e[53]!==d?(D=c?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=D):D=e[54];let B;e[55]!==O||e[56]!==D?(B=r.jsx(ae,{type:"submit",disabled:O,children:D}),e[55]=O,e[56]=D,e[57]=B):B=e[57];let F;e[58]!==$||e[59]!==B?(F=r.jsxs(In,{children:[$,B]}),e[58]=$,e[59]=B,e[60]=F):F=e[60];let U;e[61]!==b||e[62]!==E||e[63]!==F||e[64]!==w?(U=r.jsx(jt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[w,E,F]})}),e[61]=b,e[62]=E,e[63]=F,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=r.jsx(Ct,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function vq(t){const e=z.c(7),{type:s}=t,n=QA[s];let i;e[0]!==n?(i=r.jsx(We,{asChild:!0,children:r.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 o=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==o?(l=r.jsx(qe,{side:"left",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs(Ge,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const K9={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},up=["posts","authors","categories"],ic={posts:"post",authors:"author",categories:"category"};function rc(t){return up.includes(t)}const hp={posts:"post",authors:"author",categories:"category"},X8={posts:K9.post,authors:K9.author,categories:K9.category},yq=Object.fromEntries(Object.entries(X8).map(([t,e])=>[e,t]));function _q(t){return typeof t=="string"?yq[t]??null:null}function Wr(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function gs(t){return typeof t=="string"?t:""}function Lq(t,e){switch(t){case"posts":return{label:gs(e.title)||"Untitled post",subtitle:gs(e.slug)};case"authors":return{label:gs(e.name)||"Unnamed author",subtitle:gs(e.email)};case"categories":return{label:gs(e.name)||"Unnamed category",subtitle:gs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function J8(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Wr(n);if(!i)continue;const o=_q(i.__resolveType);if(!o)continue;const l=Wr(i[hp[o]])??{},{label:a,subtitle:c}=Lq(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of up)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function wq(t,e){return J8(t)[e]}function Ic(t,e){return wq(t,e).map(s=>({key:s.key,payload:uu(Wr(t[s.key])??void 0,e)}))}const _3=Object.freeze({});function uu(t,e){return t?Wr(t[hp[e]])??_3:_3}function Hd(t,e,s){return{name:t,__resolveType:X8[e],[hp[e]]:s}}function Z8(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function Mae({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:gs(Wr(f)?.[s]),l=f=>typeof f=="string"?f:gs(Wr(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>gs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>gs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:gs(m.name)||gs(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)||o(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 Eo(t){return Array.isArray(t)?t:[]}function ur(t){if(typeof t=="string")return t;const e=Wr(t);return e?gs(e.slug):""}function Sq(t){if(typeof t=="string")return t;const e=Wr(t);return e?gs(e.email):""}function kq(t){const e=[];return gs(t.title).trim()||e.push("Title"),gs(t.slug).trim()||e.push("Slug"),Eo(t.categories).map(ur).filter(Boolean).length===0&&e.push("Category"),gs(t.excerpt).trim()||e.push("Excerpt"),gs(t.image).trim()||e.push("Cover image"),e}function e7(t){return Ic(t,"posts").map(({key:e,payload:s})=>({key:e,title:gs(s.title)||"Untitled post",slug:gs(s.slug),date:gs(s.date),categorySlugs:Eo(s.categories).map(ur).filter(Boolean),authorEmails:Eo(s.authors).map(Sq).filter(Boolean),missing:kq(s)}))}function jq(t,e){const s=Eo(t.categories);return s.some(n=>ur(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Cq(t,e){const s=Eo(t.categories);return s.length===1&&ur(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function $ae(t,e,s){const n=Eo(t.categories);if(!n.some(a=>ur(a)===e))return t;const i=n.map(a=>{const c=ur(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=ur(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function Nq(t,e){const s=Eo(t.categories);return s.some(n=>ur(n)===e)?{...t,categories:s.filter(n=>ur(n)!==e)}:t}function L3(t){return{...t,dateModified:new Date().toISOString()}}function of(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 w3(t,e){const s=`collections/blog/${e}/${of(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Vq(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${of(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${of(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Tq={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"}},S3="Box";function Eq(t){return t.startsWith("site/")?"site":"app"}function Aq(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function La(...t){for(const e of t)if(e!==void 0)return e}function Oae(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const o of Object.keys(i)){if(!Dq(o)||e.has(o))continue;e.add(o);const l=to(o,t),a=Pq(o),c=Tq[a],d=Eq(o),u=(d==="site"?La(l.title,c?.title):La(c?.title,l.title))??a,h=d==="site"?La(l.description,c?.description):La(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Aq(f)?f:void 0,p=m!==void 0?c?.iconName??S3:La(f,c?.iconName)??S3;s.push({resolveType:o,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function Pq(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Rq=["blog/sections/blocks/","site/sections/Blog/Post/"];function Dq(t){return Rq.some(e=>t.startsWith(e))}function t7({orgSlug:t,virtualMcpId:e,branch:s}){return Fe.decofile(`${t}/${e}/${s}`)}function Iq({orgSlug:t,virtualMcpId:e,branch:s}){return Fe.liveMeta(t,e,s)}function Mq({orgSlug:t,virtualMcpId:e,branch:s},n){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${n}`}async function s7(t,e,s,n){const i=await fetch(Mq(t,e),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s)});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error??`${n} (${i.status})`)}return i.json()}function $q(t){const e=z.c(11),s=Qt();let n;e[0]!==t?(n=a=>{const{blockKey:c,data:d}=a;return s7(t,"write",{path:Xl(t.packagePath,Z8(c)),content:JSON.stringify(d,null,2)},"Write failed")},e[0]=t,e[1]=n):n=e[1];let i;e[2]!==t||e[3]!==s?(i=async a=>{const{blockKey:c,data:d}=a,u=t7(t);await s.cancelQueries({queryKey:u});const h=s.getQueryData(u);return s.setQueryData(u,f=>({...f??{},[c]:d})),{previous:h,queryKey:u}},e[2]=t,e[3]=s,e[4]=i):i=e[4];let o;e[5]!==s?(o=(a,c,d)=>{d?.queryKey&&s.setQueryData(d.queryKey,d.previous)},e[5]=s,e[6]=o):o=e[6];let l;return e[7]!==n||e[8]!==i||e[9]!==o?(l={mutationFn:n,onMutate:i,onError:o},e[7]=n,e[8]=i,e[9]=o,e[10]=l):l=e[10],Rt(l)}function Oq(t){const e=Qt();return Rt({mutationFn:({blockKey:s})=>s7(t,"unlink",{path:Xl(t.packagePath,Z8(s))},"Delete failed"),onMutate:async({blockKey:s})=>{const n=t7(t);await e.cancelQueries({queryKey:n});const i=e.getQueryData(n);return e.setQueryData(n,o=>{if(!o)return o;const{[s]:l,...a}=o;return a}),{previous:i,queryKey:n}},onError:(s,n,i)=>{i?.queryKey&&e.setQueryData(i.queryKey,i.previous)},onSuccess:()=>{e.invalidateQueries({queryKey:Iq(t)})}})}function Bq({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=se(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=V.useState(!1),[h,f]=V.useState(c),[m,p]=V.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async y=>{if(!i||m)return;let _;try{_=JSON.parse(y)}catch{me.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(_),me.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(L){me.error(o("sectionsEditor.pageJsonDialog.saveError",{error:L instanceof Error?L.message:String(L)}))}finally{p(!1)}};return r.jsx(Ct,{open:t,onOpenChange:e,children:r.jsxs(jt,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(os,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx(At,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(ae,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(Gn,{size:12}):r.jsx(on,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(ae,{size:"sm",onClick:()=>v(h),disabled:!x||m,className:"h-7 text-xs",children:o(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",o("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"h-[70vh]",children:r.jsx(Qc,{code:c,language:"json",readOnly:g,height:"100%",onChange:y=>f(y??""),onSave:y=>{v(y)}})})]})})}function Yn(t){const e=z.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,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,v=a==="global";let y;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(y=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(qe,{side:"right",children:[c," variants"]})]})}):n?r.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):r.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",v?"bg-global-section/15":"bg-muted"),children:r.jsx(s,{size:16,className:ie("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:fm}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=y):y=e[5];const _=y,L=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==L?(w=ie("group relative flex min-w-0 items-center rounded-md transition-colors",L),e[6]=L,e[7]=w):w=e[7];let S;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(S=u&&r.jsx("span",{className:ie("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:zq,children:r.jsx(Gl,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=S):S=e[13];const k=m&&!l&&"text-destructive";let j;e[14]!==k?(j=ie("block truncate text-sm font-medium",k),e[14]=k,e[15]=j):j=e[15];let T;e[16]!==j||e[17]!==i?(T=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=T):T=e[18];const N=l?"text-accent-foreground/70":"text-muted-foreground";let C;e[19]!==N?(C=ie("block truncate text-xs",N),e[19]=N,e[20]=C):C=e[20];let A;e[21]!==o||e[22]!==C?(A=r.jsx("span",{className:C,children:o}),e[21]=o,e[22]=C,e[23]=A):A=e[23];let P;e[24]!==A||e[25]!==T?(P=r.jsxs("span",{className:"min-w-0 flex-1",children:[T,A]}),e[24]=A,e[25]=T,e[26]=P):P=e[26];let R;e[27]!==l||e[28]!==m||e[29]!==p?(R=m&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(fn,{size:14})})}),p&&r.jsx(qe,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=R):R=e[30];let E;e[31]!==x||e[32]!==_||e[33]!==P||e[34]!==R||e[35]!==d?(E=r.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:[_,P,R,d]}),e[31]=x,e[32]=_,e[33]=P,e[34]=R,e[35]=d,e[36]=E):E=e[36];let M;e[37]!==l||e[38]!==b?(M=b&&r.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=M):M=e[39];let I;return e[40]!==E||e[41]!==M||e[42]!==w||e[43]!==S?(I=r.jsxs("div",{className:w,children:[S,E,M]}),e[40]=E,e[41]=M,e[42]=w,e[43]=S,e[44]=I):I=e[44],I}function zq(t){return t.stopPropagation()}function Dr(t){const e=z.c(10),{icon:s,title:n,description:i}=t;let o;e[0]!==s?(o=s&&r.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==n?(l=r.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&r.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]!==o||e[7]!==l||e[8]!==a?(c=r.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:[o,l,a]}),e[6]=o,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Fq="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function i9(t){return Hs(t)?.metadata?.fieldDescriptionTooltips??!1}function fp(t){const e=z.c(9),{description:s,virtualMcpId:n,children:i}=t,o=i9(n);if(!s||!o)return i;let l;e[0]!==i?(l=V.cloneElement(i,{className:ie(i.props.className,Fq)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx(We,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=r.jsx(qe,{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=r.jsxs(Ge,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Ps(t){const e=z.c(17),{htmlFor:s,label:n,description:i,labelClassName:o,virtualMcpId:l}=t;if(!i9(l)){let u;e[0]!==s||e[1]!==n||e[2]!==o?(u=r.jsx(Et,{htmlFor:s,className:o,children:n}),e[0]=s,e[1]=n,e[2]=o,e[3]=u):u=e[3];let h;e[4]!==i?(h=i&&r.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=r.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]!==o?(c=r.jsx(Et,{htmlFor:s,className:o,children:n}),e[9]=s,e[10]=n,e[11]=o,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==l?(d=r.jsx(fp,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}var Uq=Ki.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")}}}),Kq=Uq,Hq=20,n7=(t,e=0)=>{const s=[];return!t.children.length||e>Hq||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...n7(n,e+1))}),s},Wq=t=>{if(!t.children.length)return;const e=n7(t);e&&e.forEach(s=>{var n,i;const o=s.getAttribute("style"),l=(i=(n=s.parentElement)==null?void 0:n.closest("span"))==null?void 0:i.getAttribute("style");s.setAttribute("style",`${l};${o}`)})},i7=Cw.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Wq(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",o1(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.isTextblock)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),qq=Ki.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.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()}}}),r7=Ki.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.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()}}}),Gq=Ki.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>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()}}}),o7=Ki.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>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()}}}),Yq=Ki.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>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()}}});Ki.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(qq.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(r7.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Gq.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(o7.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Yq.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(i7.configure(this.options.textStyle)),t}});const Qq=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function Xq(t){const e=z.c(30),{editor:s,currentColor:n,open:i,onOpenChange:o}=t,l=se(),[a,c]=V.useState("#000000");let d;e[0]!==s||e[1]!==o?(d=w=>{s.chain().focus().setColor(w).run(),o(!1)},e[0]=s,e[1]=o,e[2]=d):d=e[2];const u=d;let h;e[3]!==s||e[4]!==o?(h=()=>{s.chain().focus().unsetColor().run(),o(!1)},e[3]=s,e[4]=o,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]!==o||e[9]!==i?(g=()=>o(!i),e[8]=o,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(ku,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let v;e[12]!==b?(v=r.jsxs("span",{className:"relative flex flex-col items-center",children:[x,r.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=v):v=e[13];let y;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(y=r.jsx(zt,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=y):y=e[18];let _;e[19]!==u||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==o||e[24]!==i||e[25]!==l?(_=i&&r.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:w=>{w.currentTarget.contains(w.relatedTarget)||o(!1)},children:[r.jsx("div",{className:"grid grid-cols-6 gap-1",children:Qq.map(w=>r.jsx("button",{type:"button","aria-label":w,"aria-pressed":n===w,onMouseDown:eG,onClick:()=>u(w),className:ie("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===w&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:w}},w))}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.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:[r.jsx("input",{type:"color",value:a,onMouseDown:Zq,onChange:w=>c(w.target.value),onBlur:()=>u(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),r.jsx("button",{type:"button",onMouseDown:Jq,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]=o,e[24]=i,e[25]=l,e[26]=_):_=e[26];let L;return e[27]!==_||e[28]!==y?(L=r.jsxs("div",{className:"relative",children:[y,_]}),e[27]=_,e[28]=y,e[29]=L):L=e[29],L}function Jq(t){return t.preventDefault()}function Zq(t){return t.stopPropagation()}function eG(t){return t.preventDefault()}const Wd=[1,2,3,4,5,6];function tG(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 sG=8,nG=128,iG=16,k3=1;function rG({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o,inline:l=!1}){const a=se(),c=typeof e=="string"?e:"",d=V.useRef(s);d.current=s;const[u,h]=V.useState(!1),[f,m]=V.useState(!1),p=n1({extensions:[i1.configure({heading:l?!1:{levels:[...Wd]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[Kq.configure({types:["heading","paragraph"]})],i7,o7,r7],content:c||"",editorProps:{attributes:{class:ie("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:L})=>{const w=L.getHTML(),S=l?tG(w):w;d.current(S==="<p></p>"||S===""?"":S)}}),g=$4({editor:p,selector:({editor:L})=>({bold:L?.isActive("bold")??!1,italic:L?.isActive("italic")??!1,underline:L?.isActive("underline")??!1,strike:L?.isActive("strike")??!1,headingLevel:Wd.find(w=>L?.isActive("heading",{level:w})??!1)??0,fontSize:L?.getAttributes("textStyle").fontSize??null,color:L?.getAttributes("textStyle").color??null,bulletList:L?.isActive("bulletList")??!1,orderedList:L?.isActive("orderedList")??!1,link:L?.isActive("link")??!1,alignLeft:L?.isActive({textAlign:"left"})??!1,alignCenter:L?.isActive({textAlign:"center"})??!1,alignRight:L?.isActive({textAlign:"right"})??!1,alignJustify:L?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=L=>{const w=p.chain().focus();if(L==="paragraph"){w.setParagraph().run();return}const S=Wd.find(k=>`h${k}`===L);S&&w.setHeading({level:S}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,y=Number.isFinite(v)?v:iG,_=L=>{const w=Math.min(nG,Math.max(sG,L));p.chain().focus().setFontSize(`${w}px`).run()};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ps,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),r.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[r.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:[r.jsx(zt,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:r.jsx(m5,{size:14})}),r.jsx(zt,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:r.jsx(p5,{size:14})}),r.jsx(zt,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:r.jsx(OS,{size:14})}),r.jsx(zt,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:r.jsx(g5,{size:14})}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs(xs,{value:x,onValueChange:b,children:[r.jsx(bs,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:L=>L.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:r.jsx(js,{})}),r.jsxs(vs,{children:[r.jsx(kt,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),Wd.map(L=>r.jsx(kt,{value:`h${L}`,children:a("sectionsEditor.richTextField.styleHeading",{level:L})},L))]})]})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(zt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>_(y-k3),children:r.jsx(b1,{size:14})}),r.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:y}),r.jsx(zt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>_(y+k3),children:r.jsx(Nt,{size:14})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(Xq,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(zt,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:r.jsx(U1,{size:14})}),r.jsx(zt,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:r.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(EO,{editor:p,active:g.link,open:u,onOpenChange:h}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(zt,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:r.jsx(mS,{size:14})}),r.jsx(zt,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:r.jsx(BS,{size:14})}),r.jsx(zt,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:r.jsx(zS,{size:14})}),r.jsx(zt,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:r.jsx(FS,{size:14})})]})]}),r.jsx(r1,{editor:p})]})]})}const yl=t=>String(t).padStart(2,"0"),oG="1900-01-01",lG="2099-12-31",aG="1900-01-01T00:00",cG="2099-12-31T23:59";function dG(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()}-${yl(s.getUTCMonth()+1)}-${yl(s.getUTCDate())}`}function uG(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function hG(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${yl(e.getMonth()+1)}-${yl(e.getDate())}T${yl(e.getHours())}:${yl(e.getMinutes())}`}function fG(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function mG(t){const e=z.c(41),{id:s,withTime:n,value:i,onChange:o,calendarLabel:l}=t,[a,c]=V.useState(!1);let d;e[0]!==n?(d=$=>n?hG($):dG($),e[0]=n,e[1]=d):d=e[1];const u=d;let h;e[2]!==n?(h=$=>n?fG($):uG($),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]=V.useState(m),[x,b]=V.useState(i);if(i!==x){b(i);const $=u(i);$!==p&&g($)}let v;e[7]!==o||e[8]!==f?(v=$=>{g($.target.value),o(f($.target.value))},e[7]=o,e[8]=f,e[9]=v):v=e[9];const y=v;let _;if(e[10]!==i){const $=i?new Date(i):null;_=$&&!Number.isNaN($.getTime())?$:null,e[10]=i,e[11]=_}else _=e[11];const L=_;let w;e[12]!==o||e[13]!==L||e[14]!==u||e[15]!==n?(w=$=>{if(!$)return;n&&L?$.setHours(L.getHours(),L.getMinutes(),0,0):$.setHours(0,0,0,0);const O=$.toISOString();g(u(O)),b(O),o(O),c(!1)},e[12]=o,e[13]=L,e[14]=u,e[15]=n,e[16]=w):w=e[16];const S=w,k=n?"datetime-local":"date",j=n?aG:oG,T=n?cG:lG;let N;e[17]!==u||e[18]!==i?(N=()=>g(u(i)),e[17]=u,e[18]=i,e[19]=N):N=e[19];let C;e[20]!==y||e[21]!==s||e[22]!==p||e[23]!==N||e[24]!==k||e[25]!==j||e[26]!==T?(C=r.jsx(rt,{id:s,type:k,min:j,max:T,value:p,onChange:y,onBlur:N,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=y,e[21]=s,e[22]=p,e[23]=N,e[24]=k,e[25]=j,e[26]=T,e[27]=C):C=e[27];let A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(ar,{className:"h-4 w-4"}),e[28]=A):A=e[28];let P;e[29]!==l?(P=r.jsx(us,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:A})}),e[29]=l,e[30]=P):P=e[30];const R=L??void 0;let E;e[31]!==S||e[32]!==R?(E=r.jsx(ys,{className:"w-auto p-0",align:"end",onCloseAutoFocus:pG,children:r.jsx(l1,{mode:"single",selected:R,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=R,e[33]=E):E=e[33];let M;e[34]!==a||e[35]!==P||e[36]!==E?(M=r.jsxs(_s,{open:a,onOpenChange:c,children:[P,E]}),e[34]=a,e[35]=P,e[36]=E,e[37]=M):M=e[37];let I;return e[38]!==C||e[39]!==M?(I=r.jsxs("div",{className:"flex gap-1",children:[C,M]}),e[38]=C,e[39]=M,e[40]=I):I=e[40],I}function pG(t){return t.preventDefault()}function qd(t){const e=z.c(76),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=typeof n=="string"?n:"",u=s.format;if(u==="rich-text"||u==="rich-text-inline"||u==="html"){const v=u==="rich-text-inline";let y;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==a||e[4]!==s||e[5]!==v||e[6]!==n?(y=r.jsx(rG,{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a,inline:v}),e[0]=l,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=v,e[6]=n,e[7]=y):y=e[7],y}if(u==="textarea"||u==="markdown"){const v=a?.virtualMcpId;let y;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==v?(y=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=v,e[12]=y):y=e[12];let _;e[13]!==i?(_=S=>i(S.target.value),e[13]=i,e[14]=_):_=e[14];let L;e[15]!==o||e[16]!==d||e[17]!==_?(L=r.jsx(Ur,{id:o,value:d,onChange:_,rows:4}),e[15]=o,e[16]=d,e[17]=_,e[18]=L):L=e[18];let w;return e[19]!==y||e[20]!==L?(w=r.jsxs("div",{className:"space-y-2",children:[y,L]}),e[19]=y,e[20]=L,e[21]=w):w=e[21],w}if(u==="date"||u==="date-time"){const v=a?.virtualMcpId;let y;e[22]!==l||e[23]!==o||e[24]!==s.description||e[25]!==v?(y=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[22]=l,e[23]=o,e[24]=s.description,e[25]=v,e[26]=y):y=e[26];const _=u==="date-time";let L;e[27]!==c?(L=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=L):L=e[28];let w;e[29]!==i||e[30]!==o||e[31]!==d||e[32]!==_||e[33]!==L?(w=r.jsx(mG,{id:o,withTime:_,value:d,onChange:i,calendarLabel:L}),e[29]=i,e[30]=o,e[31]=d,e[32]=_,e[33]=L,e[34]=w):w=e[34];let S;return e[35]!==y||e[36]!==w?(S=r.jsxs("div",{className:"space-y-2",children:[y,w]}),e[35]=y,e[36]=w,e[37]=S):S=e[37],S}if(u==="color-input"||u==="color"){const v=a?.virtualMcpId;let y;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==v?(y=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:v}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=v,e[42]=y):y=e[42];const _=d||"#000000";let L;e[43]!==i?(L=N=>i(N.target.value),e[43]=i,e[44]=L):L=e[44];let w;e[45]!==_||e[46]!==L?(w=r.jsx("input",{type:"color",value:_,onChange:L,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=_,e[46]=L,e[47]=w):w=e[47];let S;e[48]!==i?(S=N=>i(N.target.value),e[48]=i,e[49]=S):S=e[49];let k;e[50]!==o||e[51]!==d||e[52]!==S?(k=r.jsx(rt,{id:o,value:d,onChange:S,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=o,e[51]=d,e[52]=S,e[53]=k):k=e[53];let j;e[54]!==w||e[55]!==k?(j=r.jsxs("div",{className:"flex items-center gap-2",children:[w,k]}),e[54]=w,e[55]=k,e[56]=j):j=e[56];let T;return e[57]!==y||e[58]!==j?(T=r.jsxs("div",{className:"space-y-2",children:[y,j]}),e[57]=y,e[58]=j,e[59]=T):T=e[59],T}const h=a?.virtualMcpId;let f;e[60]!==l||e[61]!==o||e[62]!==s.description||e[63]!==h?(f=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:h}),e[60]=l,e[61]=o,e[62]=s.description,e[63]=h,e[64]=f):f=e[64];const m=u==="url"?"url":"text";let p;e[65]!==i?(p=v=>i(v.target.value),e[65]=i,e[66]=p):p=e[66];const g=s.default!=null?String(s.default):void 0;let x;e[67]!==o||e[68]!==d||e[69]!==m||e[70]!==p||e[71]!==g?(x=r.jsx(rt,{id:o,type:m,value:d,onChange:p,placeholder:g,className:"h-10"}),e[67]=o,e[68]=d,e[69]=m,e[70]=p,e[71]=g,e[72]=x):x=e[72];let b;return e[73]!==f||e[74]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[f,x]}),e[73]=f,e[74]=x,e[75]=b):b=e[75],b}const gG=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,xG=/^[+-]?\d*$/;function bG(t,e){return(e?xG:gG).test(t)}function vG(t){const e=z.c(16),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,u]=V.useState(c),[h,f]=V.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]!==o||e[2]!==s.description||e[3]!==m?(p=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=o,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=y=>{const _=y.target.value,L=s.type==="integer";if(_!==""&&!bG(_,L))return;u(_);const w=Number(_);i(_===""||Number.isNaN(w)?void 0:w)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==o||e[9]!==d||e[10]!==g||e[11]!==x?(b=r.jsx(rt,{id:o,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=o,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let v;return e[13]!==p||e[14]!==b?(v=r.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=v):v=e[15],v}function yG(t){const e=z.c(14),{value:s,onChange:n,path:i,label:o,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let u;e[0]!==o||e[1]!==i||e[2]!==l.description||e[3]!==d?(u=r.jsx(Ps,{htmlFor:i,label:o,description:l.description,virtualMcpId:d}),e[0]=o,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=r.jsx(Mi,{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=r.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 mp="__enum_empty__";function pp(t){return t===""?mp:String(t)}function _G(t,e){if(t===mp)return"";const s=e.find(n=>pp(n)===t);return s!==void 0?s:t}function LG(t,e){return t==null?e.some(s=>s==="")?mp:void 0:pp(t)}function wG(t){return t===""?"":String(t)}function SG(t){const e=z.c(32),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se();let d;e[0]!==s.enum?(d=s.enum??[],e[0]=s.enum,e[1]=d):d=e[1];const u=d;let h;e[2]!==u||e[3]!==n?(h=LG(n,u),e[2]=u,e[3]=n,e[4]=h):h=e[4];const f=h,m=a?.virtualMcpId;let p;e[5]!==l||e[6]!==o||e[7]!==s.description||e[8]!==m?(p=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:m}),e[5]=l,e[6]=o,e[7]=s.description,e[8]=m,e[9]=p):p=e[9];let g;e[10]!==i||e[11]!==u?(g=S=>i(_G(S,u)),e[10]=i,e[11]=u,e[12]=g):g=e[12];let x;e[13]!==c?(x=c("sectionsEditor.enumField.selectPlaceholder"),e[13]=c,e[14]=x):x=e[14];let b;e[15]!==x?(b=r.jsx(js,{placeholder:x}),e[15]=x,e[16]=b):b=e[16];let v;e[17]!==o||e[18]!==b?(v=r.jsx(bs,{id:o,className:"h-10",children:b}),e[17]=o,e[18]=b,e[19]=v):v=e[19];let y;e[20]!==u?(y=u.map(kG),e[20]=u,e[21]=y):y=e[21];let _;e[22]!==y?(_=r.jsx(vs,{children:y}),e[22]=y,e[23]=_):_=e[23];let L;e[24]!==f||e[25]!==_||e[26]!==g||e[27]!==v?(L=r.jsxs(xs,{value:f,onValueChange:g,children:[v,_]}),e[24]=f,e[25]=_,e[26]=g,e[27]=v,e[28]=L):L=e[28];let w;return e[29]!==L||e[30]!==p?(w=r.jsxs("div",{className:"space-y-2",children:[p,L]}),e[29]=L,e[30]=p,e[31]=w):w=e[31],w}function kG(t){const e=pp(t);return r.jsx(kt,{value:e,children:wG(t)},e)}const l7={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function a7(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function oc(t){return a7(t)?.variants?.[0]?.rule?.__resolveType===Jl}function j3(t){return{__resolveType:Fo,variants:[{value:t,rule:{__resolveType:Jl}}]}}function c7(t){return oc(t)?a7(t)?.variants?.[0]?.value:t}function za(t){return oc(t)?c7(t):t}function gp(t){const e=t.__resolveType;if(typeof e!="string")return null;if(ln(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function jG(t){return t.includes("flags/multivariate")}function CG(t){return ds(t)}function NG(t,e){const s=[...t],n=new Set(s.map(o=>o.resolveType)),i=(o,l)=>{!o||n.has(o)||(n.add(o),s.push({resolveType:o,title:l??CG(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=gp(e.editorValue);o?.includes("/")&&i(o)}return s}function VG(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,o=i.__resolveType;if(typeof o=="string"){if(Bi(o)){const h=e.find(f=>f.resolveType===o);return h?h.resolveType:o}const d=e.find(h=>K2(h.resolveType,o));if(d)return d.resolveType;const u=e.find(h=>h.resolveType===o);if(u)return u.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(u=>u.discriminatorValue===l||u.resolveType===l||K2(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 C3(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=gp(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=ni(n,e);return i||(n.includes("/")?null:s??null)}function TG(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 d7(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!ln(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function EG(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=gp(s);return n&&jG(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function xp(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(o=>o.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(o=>typeof o.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:""}function AG(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function PG(t){if(Array.isArray(t.variants)){const e=t.variants,s=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof s?.value=="string")return s.value;const n=e.find(i=>typeof i.value=="string");if(n)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 u7(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(u7);const e=t;return e.__resolveType?PG(e)??t:h7(e)}function h7(t){const e={};for(const[s,n]of Object.entries(t))e[s]=u7(n);return e}function RG(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function f7(t){return t==null?"":Array.isArray(t)?t.map(f7).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function bp(t,e){if(!t.includes("{"))return;const s=h7(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return f7(RG(s,a))}).trim()||void 0}function DG(t){return t.replace(/<[^>]*>/g,"").trim()}function IG(t,e){if(e.includes("{"))return bp(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 lf(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=za(t);const i=d7(n);if(i&&(n=i),s?.titleBy){const l=IG(n,s.titleBy);if(l)return l}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=DG(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 o=n.__resolveType;if(typeof o=="string"&&o)return ds(o);if(s?.title){const l=bp(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function Gd(t){return t.normalize("NFC").trim()}function r9(t,e){const s=t.map((o,l)=>lf(o,l,e)),n=new Map;for(const o of s){const l=Gd(o);n.set(l,(n.get(l)??0)+1)}const i=new Set;return s.map((o,l)=>{let a=(n.get(Gd(o))??0)>1?`${o} ${l+1}`:o;for(;i.has(Gd(a));)a=`${a} ${l+1}`;return i.add(Gd(a)),a})}function H9(t,e,s,n){return!n||n.length<2?lf(t,e,s):r9(n,s)[e]??lf(t,e,s)}function MG(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 N3(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=MG(e);if(!s)return;const n=bp(s,t);if(!n)return;const i=xp(n)||n;return AG(i)}function m7(t){return t===Zl||t===Fo}function o9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function Xu(t,e){const s=t.__resolveType??"";if(!s)return null;if(ln(s)){const n=t.section??{};return p7(n,e)}if(m7(s)){const n=t.variants?.[0]?.value;return n?Xu(n,e):null}return!Bi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:o9(s,e)}function p7(t,e){const s=t.__resolveType??"";if(!s)return null;if(m7(s)){const n=t.variants?.[0]?.value;return n?Xu(n,e):null}return!Bi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:o9(s,e)}function g7(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!Bi(n)||!Object.hasOwn(e,n))return null;const i=o9(n,e);return i?{blockKey:n,...i}:null}function $G(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return o9(n,s)}if(e.isHidden){const o=(ln(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return Xu(o,s)}if(e.isLazy||ln(t.__resolveType)){const n=t.section??{};return p7(n,s)}return Xu(t,s)}function x7(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ao(t){return t.normalize("NFC").trim()}function rs(t,e){return Ao(t)===Ao(e)}function V3(t,e){return Ao(t).replace(/\s+/g,"").toLowerCase()===Ao(e).replace(/\s+/g,"").toLowerCase()}function OG(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||rs(e,t)||s?.arrayKey!=null&&rs(e,s.arrayKey)}function Yd(t,e,s,n){const i=Ao(s);if(t.some(l=>rs(l,i)||rs(l,s)))return t;const o=[...t];return OG(e,s,n)&&!o.some(l=>rs(l,e))&&o.push(e),o.push(s),o}function BG(t,e){return t.slice(0,t.length-e.length)}function zG(t,e,s){if(s.length===0)return s;const n=_l(t,e),i=s[0];return rs(i,n)||rs(i,t)?s.slice(1):s}function _l(t,e){return e.title??x7(t)}function Bae(t,e){return e.isMultivariateSectionTop?0:t-2}function zae(t,e){return e<=0?[]:t.slice(0,e)}function T3(t,e){const s=Ao(e);return t.findIndex(n=>Ao(n)===s)}function af(t,e){return t.type==="array"&&t.items||t9(t)?!0:Array.isArray(e)}function E3(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}const FG=["name","label","title","alt"];function UG(t){if(t==null||typeof t!="object"||Array.isArray(t))return;const e=t;for(const s of FG){const n=e[s];if(typeof n=="string"&&n.trim())return n}}function cf(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;const i=e.replace(/\s+\d+$/,"");if(Array.isArray(t)){for(const o of t){if(--s.n<=0)return!1;const l=UG(o);if(l&&(rs(l,e)||rs(l,i))||cf(o,e,s,n+1))return!0}return!1}for(const[o,l]of Object.entries(t))if(!o.startsWith("__")){if(--s.n<=0)return!1;if(cf(l,e,s,n+1))return!0}return!1}function mo(t,e,s,n,i){if(n.length===0)return null;const o=n[0];for(const a of t){const c=e[a];if(!c||!af(c,s[a]))continue;const d=_l(a,c);if(rs(o,d)||rs(o,a)||n.some(u=>rs(u,d)||rs(u,a)))return a}for(const a of t){const c=e[a];if(!c||!af(c,s[a]))continue;const d=s[a];if(!Array.isArray(d))continue;if(r9(d,c.items).some(h=>rs(h,o)))return a}for(const a of t){const c=e[a];if(c?.type!=="object"||!c.properties)continue;const d=Object.keys(c.properties),u=E3(s[a]),h=_l(a,c);if(mo(d,c.properties,u,n,i)||(rs(o,h)||rs(o,a))&&mo(d,c.properties,u,n.slice(1),i))return a}for(const a of t){const c=e[a];if(c?.type!=="inline-union"||!c.inlineUnionBranches?.length)continue;const d=E3(s[a]),u=_l(a,c);for(const h of c.inlineUnionBranches){const f=h.schema?.properties;if(!f)continue;const m=Object.keys(f);if(mo(m,f,d,n,i)||(rs(o,u)||rs(o,a))&&mo(m,f,d,n.slice(1),i))return a}}let l=null;for(const a of t){const c=e[a];if(c?.type!=="block-ref")continue;const d=_l(a,c);if(o!==d&&o!==a){const u=s[a],h=i?g7(u,i):null;if(cf(h?.data??u,o))return a;continue}if(n.length>1){const u=s[a];if(u&&typeof u=="object"&&!Array.isArray(u)){const h=n[1];if(Object.keys(u).some(m=>!m.startsWith("__")&&(V3(x7(m),h)||V3(m,h))))return a}}l||(l=a)}return l||null}function KG(t,e,s,n,i){return mo(t,e,s,n,i)}function HG(t,e,s,n,i,o){if(i.length===0||!s.properties)return!1;const l=Object.keys(s.properties);if(mo(l,s.properties,n,i,o))return!0;const a=i[0];return!rs(a,e)&&!rs(a,t)?!1:i.length>1||mo(l,s.properties,n,i.slice(1),o)!==null}function A3(t,e,s,n){const i=r9(t,e),o=n!=null?i[n]:void 0;return o!==void 0&&rs(o,s)?n:i.findIndex(l=>rs(l,s))}function WG(t,e,s,n,i){if(e.length===0)return null;for(let l=0;l<e.length;l++){const a=e[l],c=A3(s,n,a,i);if(c>=0)return{index:c,innerPath:e.slice(l+1)}}const o=e.findIndex(l=>rs(l,t));if(o>=0&&e.length>o+1){const l=e[o+1],a=A3(s,n,l,i);if(a>=0)return{index:a,innerPath:e.slice(o+2)}}return null}function W9(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===Zl}function qG(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>W9(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>W9(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>W9(s.resolveType)):!1}function GG(t,e){if(e==="global"||e==="sections"||t9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?qG(s):!1}function P3(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function b7(t){return t.map((e,s)=>({...e,index:s}))}function YG(t,e){if(e===t.length)return t;if(e<t.length)return b7(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 QG(t,e){const s=t.findIndex(o=>o.index===e),n=t.map(o=>o.index>e?{...o,index:o.index+1}:o),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function XG(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const JG="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ZG="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]",eY="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 R3(t,e){return ie("h-6 shrink-0 overflow-hidden",e?JG:t?eY:ZG)}function tY(t){const e=z.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Hl,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n&&r.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==s?(l=r.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs(r.Fragment,{children:[i,r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[o,l]})]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function sY(t){const e=z.c(63),{sortableId:s,labelText:n,imageSrc:i,hidden:o,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,u=se();let h;e[0]!==s?(h={id:s,animateLayoutChanges:oY},e[0]=s,e[1]=h):h=e[1];const{attributes:f,listeners:m,setNodeRef:p,transform:g,isDragging:x}=H0(h);let b;e[2]!==g?(b=ri.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let y;e[4]!==b||e[5]!==v?(y={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=y):y=e[6];const _=y;let L;e[7]!==a?(L=q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),a())},e[7]=a,e[8]=L):L=e[8];const w=x?"cursor-grabbing":"cursor-pointer";let S;e[9]!==w?(S=ie("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",w),e[9]=w,e[10]=S):S=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Hl,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let j;e[12]!==i?(j=i&&r.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=j):j=e[13];const T=o&&"line-through opacity-50";let N;e[14]!==T?(N=ie("min-w-0 flex-1 truncate text-sm",T),e[14]=T,e[15]=N):N=e[15];let C;e[16]!==n||e[17]!==N?(C=r.jsx("span",{className:N,children:n}),e[16]=n,e[17]=N,e[18]=C):C=e[18];let A;e[19]!==o||e[20]!==l||e[21]!==u?(A=l&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ie(R3(o===!0,o===!0)),onClick:q=>{q.stopPropagation(),l()},onPointerDown:rY,children:o?r.jsx(ZS,{size:14}):r.jsx(Zc,{size:14})})}),r.jsx(qe,{side:"bottom",children:u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=o,e[20]=l,e[21]=u,e[22]=A):A=e[22];let P;e[23]!==n||e[24]!==u?(P=u("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=u,e[25]=P):P=e[25];let R;e[26]!==o?(R=ie(R3(o===!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[26]=o,e[27]=R):R=e[27];let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(Hi,{size:14}),e[28]=E):E=e[28];let M;e[29]!==P||e[30]!==R?(M=r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":P,className:R,onClick:iY,onPointerDown:nY,children:E})}),e[29]=P,e[30]=R,e[31]=M):M=e[31];let I;e[32]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(on,{size:14}),e[32]=I):I=e[32];let $;e[33]!==u?($=u("sectionsEditor.arrayField.duplicate"),e[33]=u,e[34]=$):$=e[34];let O;e[35]!==c||e[36]!==$?(O=r.jsxs(Ze,{onClick:c,children:[I,$]}),e[35]=c,e[36]=$,e[37]=O):O=e[37];let D;e[38]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(Ks,{size:14}),e[38]=D):D=e[38];let B;e[39]!==u?(B=u("sectionsEditor.arrayField.delete"),e[39]=u,e[40]=B):B=e[40];let F;e[41]!==d||e[42]!==B?(F=r.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:d,children:[D,B]}),e[41]=d,e[42]=B,e[43]=F):F=e[43];let U;e[44]!==O||e[45]!==F?(U=r.jsxs(Yt,{align:"end",children:[O,F]}),e[44]=O,e[45]=F,e[46]=U):U=e[46];let H;e[47]!==M||e[48]!==U?(H=r.jsxs(qt,{children:[M,U]}),e[47]=M,e[48]=U,e[49]=H):H=e[49];let W;return e[50]!==f||e[51]!==n||e[52]!==m||e[53]!==a||e[54]!==p||e[55]!==_||e[56]!==C||e[57]!==A||e[58]!==H||e[59]!==L||e[60]!==S||e[61]!==j?(W=r.jsxs("div",{ref:p,style:_,...f,...m,role:"button",tabIndex:0,onClick:a,onKeyDown:L,className:S,title:n,children:[k,j,C,A,H]}),e[50]=f,e[51]=n,e[52]=m,e[53]=a,e[54]=p,e[55]=_,e[56]=C,e[57]=A,e[58]=H,e[59]=L,e[60]=S,e[61]=j,e[62]=W):W=e[62],W}function nY(t){return t.stopPropagation()}function iY(t){return t.stopPropagation()}function rY(t){return t.stopPropagation()}function oY(){return!1}function lY(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 o=t.__resolveType;if(typeof o=="string"&&s){const l=ni(o,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=ni(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function aY(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function Qd(t){const e=z.c(28),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,hasSiblingDrillDownFields:d,meta:u,decofile:h,onSaveReferencedBlock:f,containerResolveType:m,previewBaseUrl:p,onAddSectionItem:g,onRequestAddSection:x,sandbox:b}=t,v=a===void 0?[]:a,y=se(),_=i9(b?.virtualMcpId),L=Array.isArray(n)?n:[],w=s.items,S=aY(o),k={arrayKey:S,hasSiblingDrillDownFields:d},j=GG(s,S),T=!j&&w?.type==="object",[N,C]=V.useState(null),A=WG(l,v,L,w,N),P=A?.index??null;A===null?N!==null&&C(null):A.index!==N&&C(A.index);const[R,E]=V.useState(()=>P3(L.length)),[M,I]=V.useState(null),[$,O]=V.useState(o),[D,B]=V.useState(L.length),F=V.useRef(!1);$!==o?(O(o),B(L.length),E(P3(L.length)),C(null)):D!==L.length&&(B(L.length),E(xe=>YG(xe,L.length)));const U=(xe,Se,we)=>{const ze=we===void 0?L:we;return H9(za(xe),Se,w,ze)},H=xe=>{if(F.current)return;const Se=U(L[xe],xe);C(xe),c?.(Yd(v,l,Se,k))},W=xe=>{const Se=[...L,xe];i(Se);const we=Se.length-1;C(we);const ze=H9(xe,we,w,Se);c?.(Yd(v,l,ze,k))},q=()=>{const xe=w?.type,Se=w?.default!==void 0?w.default:xe==="object"?{}:xe==="block-ref"?(()=>{const Xe=w?.anyOfRefs?.[0]?.resolveType;return typeof Xe!="string"||ec(Xe)?{}:{__resolveType:Xe}})():xe==="number"||xe==="integer"?0:xe==="boolean"?!1:xe==="array"?[]:"",we=[...L,Se];i(we);const ze=we.length-1;C(ze);const Be=H9(Se,ze,w,we);c?.(Yd(v,l,Be,k))},ee=()=>{if(j){if(!p){me.error(y("sectionsEditor.arrayField.startPreviewServer"));return}if(x){x({append:W});return}me.error(y("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}q()},X=xe=>{const Se=L[xe],we=typeof structuredClone=="function"?structuredClone(Se):JSON.parse(JSON.stringify(Se??null)),ze=[...L.slice(0,xe+1),we,...L.slice(xe+1)];i(ze),E(Be=>QG(Be,xe))},Y=xe=>{const Se=L[xe],we=[...L];we[xe]=oc(Se)?c7(Se):j3(Se),i(we)},G=xe=>{i(L.filter((Se,we)=>we!==xe)),E(Se=>XG(Se,xe))},J=(xe,Se)=>{const we=[...L];if(we[xe]=oc(L[xe])?j3(Se):Se,i(we),xe===P&&P!==null){const ze=U(L[xe],xe),Be=U(we[xe],xe,we);if(ze!==Be){const Xe=T3(v,ze);if(Xe>=0){const Ve=[...v];Ve[Xe]=Be,c?.(Ve)}}}};let oe;e[0]===Symbol.for("react.memo_cache_sentinel")?(oe={activationConstraint:{distance:8}},e[0]=oe):oe=e[0];let le;e[1]===Symbol.for("react.memo_cache_sentinel")?(le={coordinateGetter:W0},e[1]=le):le=e[1];const Q=od(zi(Ho,oe),zi(Ko,le)),K=R.map(cY);let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te=xe=>{I(String(xe.active.id))},e[2]=te):te=e[2];const ne=te,re=xe=>{I(null);const{active:Se,over:we}=xe;if(!we||Se.id===we.id)return;const ze=K.indexOf(String(Se.id)),Be=K.indexOf(String(we.id));ze===-1||Be===-1||(E(Xe=>b7(No([...Xe],ze,Be))),i(No([...L],ze,Be)),F.current=!0,requestAnimationFrame(()=>{F.current=!1}))};let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he=()=>{I(null)},e[3]=he):he=e[3];const pe=he,de=M?R.find(xe=>xe.id===M):null,Z=de!=null?L[de.index]:void 0,fe=de!=null&&Z!==void 0?U(Z,de.index):null,ue=de!=null&&Z!==void 0?N3(za(Z),w):void 0;if(P!==null&&P<L.length){const xe=za(L[P]),Se=lY(xe,w,u,m,S),we=()=>{const ze=U(xe,P),Be=Yd(v,l,ze,k),Xe=T3(Be,ze);return Xe>=0?Be.slice(0,Xe+1):Be};return r.jsx("div",{className:"min-w-0",children:Se?.type==="object"&&Se.properties?r.jsx(gr,{schema:Se,value:xe,onChange:ze=>J(P,ze),basePath:`${o}.${P}`,breadcrumbPath:A?.innerPath??[],onBreadcrumbChange:ze=>{c?.([...we(),...ze])},meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:g,onRequestAddSection:x,sandbox:b}):Se?Ol({schema:Se,value:xe,onChange:ze=>J(P,ze),path:`${o}.${P}`,label:Se.title&&!Se.title.includes("{{")?Se.title:U(xe,P),breadcrumbPath:A?.innerPath??[],onBreadcrumbChange:ze=>{c?.([...we(),...ze])},meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:g,onRequestAddSection:x,sandbox:b}):null})}const ye="space-y-2",Le=b?.virtualMcpId;let Re;e[4]!==l?(Re=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[4]=l,e[5]=Re):Re=e[5];let De;e[6]!==s.description||e[7]!==Le||e[8]!==Re?(De=r.jsx(fp,{description:s.description,virtualMcpId:Le,children:Re}),e[6]=s.description,e[7]=Le,e[8]=Re,e[9]=De):De=e[9];const Ue=L.length>0&&r.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:L.length});let $e;e[10]!==De||e[11]!==Ue?($e=r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[De,Ue]}),e[10]=De,e[11]=Ue,e[12]=$e):$e=e[12];let je;e[13]!==s.description||e[14]!==_?(je=!_&&s.description&&r.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:s.description}),e[13]=s.description,e[14]=_,e[15]=je):je=e[15];const be=L.length>0&&r.jsx("div",{className:ie(M&&"cursor-grabbing"),children:r.jsxs(ad,{sensors:Q,collisionDetection:Nm,onDragStart:ne,onDragEnd:re,onDragCancel:pe,children:[r.jsx(K0,{items:K,strategy:U0,children:r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const xe=r9(L,w);return R.map(Se=>{const we=L[Se.index];if(we===void 0)return null;const ze=xe[Se.index]??U(we,Se.index),Be=N3(za(we),w);return r.jsx(sY,{sortableId:Se.id,labelText:ze,imageSrc:Be,hidden:oc(we),onToggleHidden:T?()=>Y(Se.index):void 0,onOpen:()=>H(Se.index),onDuplicate:()=>X(Se.index),onRemove:()=>G(Se.index)},Se.id)})})()})}),bn.createPortal(r.jsx(F0,{dropAnimation:l7,children:fe?r.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:r.jsx(tY,{labelText:fe,imageSrc:ue})}):null}),document.body)]})});let Ee;e[16]===Symbol.for("react.memo_cache_sentinel")?(Ee=r.jsx(Nt,{size:14}),e[16]=Ee):Ee=e[16];let _e;e[17]!==y||e[18]!==j?(_e=y(j?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem"),e[17]=y,e[18]=j,e[19]=_e):_e=e[19];let Ae;e[20]!==ee||e[21]!==_e?(Ae=r.jsxs("button",{type:"button",onClick:ee,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",children:[Ee,_e]}),e[20]=ee,e[21]=_e,e[22]=Ae):Ae=e[22];let Ce;return e[23]!==$e||e[24]!==je||e[25]!==be||e[26]!==Ae?(Ce=r.jsxs("div",{className:ye,children:[$e,je,be,Ae]}),e[23]=$e,e[24]=je,e[25]=be,e[26]=Ae,e[27]=Ce):Ce=e[27],Ce}function cY(t){return t.id}function dY(t){const e=z.c(50),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}=t;let x;e[0]!==a?(x=a===void 0?[]:a,e[0]=a,e[1]=x):x=e[1];const b=x,[v,y]=V.useState(!1),_=i9(g?.virtualMcpId);let L;e[2]!==n?(L=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=L):L=e[3];const w=L;if(!s.properties)return null;let S;e[4]!==o?(S=o.split(".").pop()??o,e[4]=o,e[5]=S):S=e[5];const k=S;let j;e[6]!==b||e[7]!==u||e[8]!==k||e[9]!==l||e[10]!==w||e[11]!==s?(j=HG(k,l,s,w,b,u),e[6]=b,e[7]=u,e[8]=k,e[9]=l,e[10]=w,e[11]=s,e[12]=j):j=e[12];const N=v||j,C=`${o}-fields`;let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=()=>y(uY),e[13]=A):A=e[13];let P;e[14]!==N?(P=r.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:N?r.jsx(fs,{size:16}):r.jsx(wn,{size:16})}),e[14]=N,e[15]=P):P=e[15];const R=g?.virtualMcpId;let E;e[16]!==l?(E=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[16]=l,e[17]=E):E=e[17];let M;e[18]!==s.description||e[19]!==R||e[20]!==E?(M=r.jsx(fp,{description:s.description,virtualMcpId:R,children:E}),e[18]=s.description,e[19]=R,e[20]=E,e[21]=M):M=e[21];let I;e[22]!==C||e[23]!==N||e[24]!==M||e[25]!==P?(I=r.jsxs("button",{type:"button","aria-expanded":N,"aria-controls":C,onClick:A,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:[P,M]}),e[22]=C,e[23]=N,e[24]=M,e[25]=P,e[26]=I):I=e[26];let $;e[27]!==s.description||e[28]!==_?($=!_&&s.description&&r.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[27]=s.description,e[28]=_,e[29]=$):$=e[29];let O;e[30]!==b||e[31]!==C||e[32]!==u||e[33]!==N||e[34]!==d||e[35]!==w||e[36]!==m||e[37]!==c||e[38]!==i||e[39]!==p||e[40]!==h||e[41]!==o||e[42]!==f||e[43]!==g||e[44]!==s?(O=N&&r.jsx("div",{id:C,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:r.jsx(gr,{schema:s,value:w,onChange:i,basePath:o,breadcrumbPath:b,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g})}),e[30]=b,e[31]=C,e[32]=u,e[33]=N,e[34]=d,e[35]=w,e[36]=m,e[37]=c,e[38]=i,e[39]=p,e[40]=h,e[41]=o,e[42]=f,e[43]=g,e[44]=s,e[45]=O):O=e[45];let D;return e[46]!==I||e[47]!==$||e[48]!==O?(D=r.jsxs("div",{className:"min-w-0 space-y-2",children:[I,$,O]}),e[46]=I,e[47]=$,e[48]=O,e[49]=D):D=e[49],D}function uY(t){return!t}function Fae(t,e,s,n,i){const o={...t[e]};if(i.length>1){const l=o.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),o.sections={...l,variants:a}}else o.sections=s;return o}function Uae(t){return structuredClone(t)}function Kae(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function v7(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 vp(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 yp(t){const e=z.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:o,onSubmit:l}=t,a=i===void 0?"":i,c=o===void 0?!1:o,[d,u]=V.useState(a),[h,f]=V.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=se();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let y;e[9]!==v?(y=r.jsx(At,{children:v}),e[9]=v,e[10]=y):y=e[10];let _;e[11]!==b?(_=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=_):_=e[12];let L;e[13]!==_?(L=r.jsx(_n,{children:_}),e[13]=_,e[14]=L):L=e[14];let w;e[15]!==y||e[16]!==L?(w=r.jsxs(os,{children:[y,L]}),e[15]=y,e[16]=L,e[17]=w):w=e[17];let S;e[18]!==b?(S=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=S):S=e[19];let k;e[20]!==S?(k=r.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:S}),e[20]=S,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 T;e[23]!==b?(T=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=T):T=e[24];let N;e[25]!==d||e[26]!==c||e[27]!==T?(N=r.jsx(rt,{id:"block-id",value:d,onChange:j,placeholder:T,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=T,e[28]=N):N=e[28];let C;e[29]!==k||e[30]!==N?(C=r.jsxs("div",{className:"py-4 space-y-2",children:[k,N]}),e[29]=k,e[30]=N,e[31]=C):C=e[31];let A;e[32]!==n?(A=()=>n(!1),e[32]=n,e[33]=A):A=e[33];let P;e[34]!==b?(P=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=P):P=e[35];let R;e[36]!==c||e[37]!==A||e[38]!==P?(R=r.jsx(ae,{type:"button",variant:"outline",onClick:A,disabled:c,children:P}),e[36]=c,e[37]=A,e[38]=P,e[39]=R):R=e[39];let E;e[40]!==d||e[41]!==c?(E=!d.trim()||c,e[40]=d,e[41]=c,e[42]=E):E=e[42];let M;e[43]!==c||e[44]!==b?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=M):M=e[45];let I;e[46]!==E||e[47]!==M?(I=r.jsx(ae,{type:"submit",disabled:E,children:M}),e[46]=E,e[47]=M,e[48]=I):I=e[48];let $;e[49]!==R||e[50]!==I?($=r.jsxs(In,{children:[R,I]}),e[49]=R,e[50]=I,e[51]=$):$=e[51];let O;e[52]!==x||e[53]!==C||e[54]!==$||e[55]!==w?(O=r.jsx(jt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:x,children:[w,C,$]})}),e[52]=x,e[53]=C,e[54]=$,e[55]=w,e[56]=O):O=e[56];let D;return e[57]!==p||e[58]!==s||e[59]!==O?(D=r.jsx(Ct,{open:s,onOpenChange:p,children:O}),e[57]=p,e[58]=s,e[59]=O,e[60]=D):D=e[60],D}function hY(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 fY(t){const e=z.c(13),{blockKey:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(kn,{size:11}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(We,{asChild:!0,children:r.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,o]})}),e[3]=o,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=r.jsx(qe,{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=r.jsxs(Ge,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function mY(t){const e=z.c(36),{path:s,open:n,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:u}=t,h=se(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=ie("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=r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?r.jsx(fs,{size:16}):r.jsx(wn,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==o?(b=r.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:o}),e[7]=o,e[8]=b):b=e[8];let v;e[9]!==c?(v=c&&r.jsx(fY,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let y;e[11]!==b||e[12]!==v?(y=r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=y):y=e[13];let _;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==y?(_=r.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,y]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=y,e[19]=_):_=e[19];let L;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(L=(d||u)&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":h("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:r.jsx(Hi,{size:16})})}),r.jsxs(Yt,{align:"end",className:"w-48",children:[c&&d&&r.jsxs(Ze,{onClick:d,children:[r.jsx(or,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.detach")]}),!c&&u&&r.jsxs(Ze,{onClick:u,children:[r.jsx(kn,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=L):L=e[24];let w;e[25]!==_||e[26]!==L?(w=r.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]}),e[25]=_,e[26]=L,e[27]=w):w=e[27];let S;e[28]!==f||e[29]!==l||e[30]!==n?(S=n&&r.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:r.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[28]=f,e[29]=l,e[30]=n,e[31]=S):S=e[31];let k;return e[32]!==w||e[33]!==S||e[34]!==p?(k=r.jsxs("div",{className:p,children:[w,S]}),e[32]=w,e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function D3(t){const e=z.c(42),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=se(),x=(s.anyOfRefs??[]).filter(xY),b=u&&n?g7(n,u):null,v=b?.data??n,y=b?null:d7(v),_=y??v,L=NG(x,{savedBlockKey:b?.blockKey,editorValue:v}),w=L.length>0?VG(v,L,b?.blockKey):L[0]?.resolveType??"",k=s.type==="block-ref"&&L.some(gY);let j;e[0]!==l||e[1]!==o?(j=l??(o.includes(".")?o.split(".")[0]:o),e[0]=l,e[1]=o,e[2]=j):j=e[2];const T=j;let N;e[3]!==a?(N=a??[],e[3]=a,e[4]=N):N=e[4];const C=N,A=k&&C[0]===T,P=A?C.slice(1):C,R=A?G=>{c?.([T,...G])}:c,[E,M]=V.useState(w),[I,$]=V.useState(w);I!==w&&($(w),M(w));const[O,D]=V.useState(()=>EG(v,b?.blockKey)),[B,F]=V.useState(!1);if(L.length>0){const G=E||w;let J;e[5]!==G?(J=je=>je.resolveType===G,e[5]=G,e[6]=J):J=e[6];const oe=L.find(J),le=C3(v,d,oe?.schema),Q=TG(le??oe?.schema??null,s.discriminatorKey),K=s.discriminatorKey,te=je=>{M(je);const be=L.find(Se=>Se.resolveType===je),Ee=C3(v,d,be?.schema),_e=new Set(Object.keys((Ee??be?.schema)?.properties??{})),Ae=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Ce=Object.fromEntries(Object.entries(Ae).filter(Se=>{const[we]=Se;return _e.has(we)})),xe={...hY(be?.schema),...Ce};if(K){const Se=be?.discriminatorValue??je;i({...xe,[K]:Se});return}if(ec(je)){i(xe);return}i({...xe,__resolveType:je})};let ne;e[7]!==G||e[8]!==K||e[9]!==i?(ne=je=>{if(K||!ec(G)||je===null||typeof je!="object"||Array.isArray(je)){i(je);return}const{__resolveType:be,...Ee}=je;i(Ee)},e[7]=G,e[8]=K,e[9]=i,e[10]=ne):ne=e[10];const re=ne,he=Q?.properties?r.jsx(gr,{schema:Q,value:_,onChange:je=>{if(b&&h){h(b.blockKey,je);return}if(y){i({...v,section:je});return}re(je)},basePath:o,breadcrumbPath:P,onBreadcrumbChange:R,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(k&&he&&P.length>0){let je;return e[11]!==he?(je=r.jsx("div",{className:"min-w-0",children:he}),e[11]=he,e[12]=je):je=e[12],je}let pe;e[13]!==o?(pe=o.includes("."),e[13]=o,e[14]=pe):pe=e[14];const de=pe,Z=b?()=>{const{name:je,...be}=b.data;i(be)}:void 0,fe=!b&&!y&&!!h&&k&&!ec(G)&&G.includes("/"),ue=_&&typeof _=="object"&&!Array.isArray(_)?_:{},ye=je=>{if(!h)return;const be=je.trim(),Ee=u?vp(be,u):null;if(Ee){me.error(Ee);return}h(be,{...ue,__resolveType:G,name:be}),i({__resolveType:be}),F(!1),me.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:be}))},Le=f?.virtualMcpId;let Re;e[15]!==l||e[16]!==o||e[17]!==s.description||e[18]!==Le?(Re=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:Le}),e[15]=l,e[16]=o,e[17]=s.description,e[18]=Le,e[19]=Re):Re=e[19];let De;e[20]!==g?(De=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=De):De=e[21];let Ue;e[22]!==De?(Ue=r.jsx(js,{placeholder:De}),e[22]=De,e[23]=Ue):Ue=e[23];let $e;return e[24]!==o||e[25]!==Ue?($e=r.jsx(bs,{id:o,children:Ue}),e[24]=o,e[25]=Ue,e[26]=$e):$e=e[26],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[Re,r.jsxs(xs,{value:G||void 0,onValueChange:te,children:[$e,r.jsx(vs,{children:L.map(pY)})]})]}),he&&(k?r.jsx(mY,{path:o,open:O,onOpenChange:D,title:g(de?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:he,nestedBlockRef:de,globalBlockKey:b?.blockKey,onDetach:Z,onMakeGlobal:fe?()=>F(!0):void 0}):he),fe&&r.jsx(yp,{open:B,onOpenChange:F,defaultBlockId:v7(ds(G)),onSubmit:ye})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=f?.virtualMcpId;let H;e[27]!==l||e[28]!==o||e[29]!==s.description||e[30]!==U?(H=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:U}),e[27]=l,e[28]=o,e[29]=s.description,e[30]=U,e[31]=H):H=e[31];const W=n!=null?String(n):"";let q;e[32]!==i?(q=G=>i(G.target.value),e[32]=i,e[33]=q):q=e[33];const ee=s.description??"";let X;e[34]!==o||e[35]!==W||e[36]!==q||e[37]!==ee?(X=r.jsx("input",{id:o,type:"text",value:W,onChange:q,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:ee}),e[34]=o,e[35]=W,e[36]=q,e[37]=ee,e[38]=X):X=e[38];let Y;return e[39]!==H||e[40]!==X?(Y=r.jsxs("div",{className:"space-y-1.5",children:[H,X]}),e[39]=H,e[40]=X,e[41]=Y):Y=e[41],Y}function pY(t){const e=t.title&&!t.title.includes("/")?t.title:Ph(t.resolveType)??ds(t.resolveType);return r.jsx(kt,{value:t.resolveType,children:e},t.resolveType)}function gY(t){return t.resolveType.includes("/")&&!ec(t.resolveType)}function xY(t){return t.resolveType!==""}const q9=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function bY(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]??"",o=n[2]??"",l=q9(i,"id");if(!l)continue;const a=q9(i,"viewBox"),c=q9(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${o}</svg>`}return e}async function vY(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return bY(await e.text())}function yY(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 _Y(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 LY(t,e){return t.length>0?t:e}function wY(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function SY({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:o}){return!!t&&!e&&s===0&&o&&n.length>0&&!i.includes(n)}function y7(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 kY(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function jY(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return y7(t.icon,e)}async function CY(t,e,s){const n={};s&&(n.term=s);const o=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(o,{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 yY(a)}function I3(t){const e=z.c(9),{option:s,className:n,fg:i}=t;let o;e[0]!==i||e[1]!==s?(o=jY(s,i),e[0]=i,e[1]=s,e[2]=o):o=e[2];const l=o;if(!l)return null;const a=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==a?(c=ie("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=r.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function NY(t){const e=z.c(53),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=s.options,u=a?.previewUrl,[h,f]=V.useState(!1),[m,p]=V.useState(""),[g,x]=V.useState(""),b=V.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=re=>{p(re),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(re)},300)},e[0]=v):v=e[0];const y=v,_=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",L=typeof n=="string"?n:"",w=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==_?(S=Fe.sandboxInvoke(_,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=_,e[4]=S):S=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==u?(k=()=>CY(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||!!L);let T;e[9]!==S||e[10]!==k||e[11]!==j?(T={queryKey:S,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=S,e[10]=k,e[11]=j,e[12]=T):T=e[12];const N=xt(T),C=N.data??[];let A;e[13]!==_?(A=Fe.sandboxSprite(_),e[13]=_,e[14]=A):A=e[14];let P;e[15]!==u||e[16]!==a?(P=()=>vY(gv({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,previewUrl:u},"/sprites.svg")),e[15]=u,e[16]=a,e[17]=P):P=e[17];const R=w&&!!a&&(h||!!L)&&(!d||N.isFetched&&C.length===0);let E;e[18]!==A||e[19]!==P||e[20]!==R?(E={queryKey:A,queryFn:P,enabled:R,staleTime:3e5,retry:1},e[18]=A,e[19]=P,e[20]=R,e[21]=E):E=e[21];const M=xt(E),I=_Y(s.enum),$=M.data??{},O=kY(),D=Object.fromEntries(Object.entries($).map(re=>{const[he,pe]=re;return[he,y7(pe,O)]})),B=w&&Object.keys(D).length>0?I.map(re=>({...re,previewSrc:D[re.value]})):I,F=LY(C,B),U=wY(F,m);let H;e[22]!==L?(H=re=>re.value===L,e[22]=L,e[23]=H):H=e[23];const W=F.find(H),q=m.trim(),ee=N.isFetched&&!N.isFetching&&m===g,X=SY({loaderPath:d,isIconSelect:w,enumFallbackCount:I.length,trimmedSearch:q,optionValues:F.map(VY),optionsSettled:ee});if((!u||!d)&&I.length===0){const re=a?.virtualMcpId;let he;e[24]!==l||e[25]!==o||e[26]!==s.description||e[27]!==re?(he=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:re}),e[24]=l,e[25]=o,e[26]=s.description,e[27]=re,e[28]=he):he=e[28];let pe;e[29]!==i?(pe=fe=>i(fe.target.value),e[29]=i,e[30]=pe):pe=e[30];let de;e[31]!==L||e[32]!==o||e[33]!==pe?(de=r.jsx(rt,{id:o,type:"text",value:L,onChange:pe}),e[31]=L,e[32]=o,e[33]=pe,e[34]=de):de=e[34];let Z;return e[35]!==he||e[36]!==de?(Z=r.jsxs("div",{className:"space-y-2",children:[he,de]}),e[35]=he,e[36]=de,e[37]=Z):Z=e[37],Z}const G=a?.virtualMcpId;let J;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==G?(J=r.jsx(Ps,{htmlFor:o,label:l,description:s.description,virtualMcpId:G}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=G,e[42]=J):J=e[42];const oe=W?r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(I3,{option:W,className:"h-6 w-6",fg:O}),r.jsx("span",{className:"truncate",children:W.label??W.value})]}):L?r.jsx("span",{className:"truncate",children:L}):r.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let le;e[43]===Symbol.for("react.memo_cache_sentinel")?(le=r.jsx(m0,{className:"size-4 shrink-0 opacity-50"}),e[43]=le):le=e[43];let Q;e[44]!==h||e[45]!==oe?(Q=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{variant:"outline",role:"combobox","aria-expanded":h,className:"h-10 w-full justify-between font-normal",children:[oe,le]})}),e[44]=h,e[45]=oe,e[46]=Q):Q=e[46];let K;e[47]===Symbol.for("react.memo_cache_sentinel")?(K={width:"var(--radix-popover-trigger-width)"},e[47]=K):K=e[47];let te;e[48]!==c?(te=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=te):te=e[49];let ne;return e[50]!==m||e[51]!==te?(ne=r.jsx(Wi,{placeholder:te,className:"h-9",value:m,onValueChange:y}),e[50]=m,e[51]=te,e[52]=ne):ne=e[52],r.jsxs("div",{className:"space-y-2",children:[J,r.jsxs(_s,{open:h,onOpenChange:f,children:[Q,r.jsx(ys,{className:"p-0",style:K,children:r.jsxs(pr,{shouldFilter:!1,children:[ne,r.jsxs(qi,{children:[!X&&r.jsx(si,{children:N.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),r.jsx(ks,{children:U.map(re=>r.jsxs(Jt,{value:re.value,className:"cursor-pointer",onSelect:()=>{i(re.value===L?"":re.value),f(!1)},children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(I3,{option:re,className:ie(re.image?"h-9 w-9":"h-6 w-6"),fg:O}),r.jsx("span",{className:"truncate",children:re.label??re.value})]}),r.jsx(Ut,{className:ie("ml-auto size-4 shrink-0",L===re.value?"opacity-100":"opacity-0")})]},re.value))}),X&&r.jsx(ks,{children:r.jsx(Jt,{value:q,className:"cursor-pointer",onSelect:()=>{i(q),p(""),x(""),f(!1)},children:r.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:q})})})})]})]})})]})]})}function VY(t){return t.value}function TY(t){const e=z.c(17),{org:s}=Me(),n=Cs();let i,o,l,a;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(o=t.search?.trim()||void 0,i=t.imageOnly??!1,a=W5,l=Fe.filePickerObjects(s.id,t.configId,o,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=o,e[6]=l,e[7]=a):(i=e[4],o=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]!==o||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:o,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=o,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:EY},e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],a(u)}function EY(t){return t.nextCursor??void 0}function _p(){const t=z.c(2),{org:e}=Me();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",o=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(!o.ok){const l=await o.text().catch(AY);let a=`${o.status} ${o.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 o.json()}},t[0]=e,t[1]=s):s=t[1],Rt(s)}function AY(){return""}const l9="file-picker:last-config-id";function _7(t){const e=z.c(31),s=se(),n=t.open,i=t.onOpenChange;let o;e[0]!==t.mode||e[1]!==s?(o=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(At,{children:o}),e[3]=o,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=r.jsx(_n,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.jsxs(os,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==s?(u=b=>{const{error:v}=b;return r.jsx(PY,{error:v??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=r.jsx(at,{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=r.jsx(V.Suspense,{fallback:h,children:r.jsx(RY,{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=r.jsx(Fs,{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=r.jsxs(jt,{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=r.jsx(Ct,{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 PY(t){const e=z.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(fn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=r.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,r.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function RY(t){const e=z.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,o=oj();if(o.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(MY,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==o||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=o.find(x),e[1]=o,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=r.jsx(G9,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(o.length===1){const p=o[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=r.jsx(G9,{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(l9):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==o?(c=o.find(p=>p.id===a)?.id??o[0].id,e[15]=o,e[16]=c):c=e[16];const d=c;let u;e[17]!==o?(u=o.map(DY),e[17]=o,e[18]=u):u=e[18];let h;e[19]!==u?(h=r.jsx(Hc,{className:"self-start",children:u}),e[19]=u,e[20]=h):h=e[20];let f;if(e[21]!==o||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>r.jsx(go,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:r.jsx(G9,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],f=o.map(p),e[21]=o,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=r.jsxs(Wl,{defaultValue:d,onValueChange:IY,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 DY(t){return r.jsx(Ti,{value:t.id,children:t.name},t.id)}function IY(t){typeof window<"u"&&window.localStorage.setItem(l9,t)}function MY(){const t=z.c(12),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Wn,{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=r.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function G9({config:t,mode:e,onSelect:s}){const n=se(),[i,o]=V.useState(""),l=K5(i,300),a=TY({configId:t.id,search:l,imageOnly:e==="image"}),c=_p(),[d,u]=V.useState(!1),h=V.useRef(null),f=e==="image"?"image/*":void 0;async function m(S){if(!S)return;const k=Array.from(S);if(k.length===0)return;let j=null;const T=[];for(const N of k)try{const C=await c.mutateAsync({configId:t.id,file:N});j??=C.publicUrl}catch(C){T.push(`${N.name} (${C instanceof Error?C.message:"upload failed"})`)}await a.refetch(),T.length>0&&me.error(T.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:T.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:T.join("; ")})),j&&s(j)}function p(S){S.preventDefault(),u(!0)}function g(){u(!1)}function x(S){S.preventDefault(),u(!1),m(S.dataTransfer.files)}const v=(a.data?.pages??[]).flatMap(S=>S.items),y=v.filter(S=>e==="image"?L7(S.key):!0),_=l.trim(),L=v.length>0||i.trim().length>0,w=i!==l||a.isFetching&&!a.isFetchingNextPage;return r.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[r.jsxs("button",{type:"button",onClick:()=>h.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:ie("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:[r.jsx(Wn,{size:18,className:"text-muted-foreground"}),r.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),r.jsx("input",{ref:h,type:"file",accept:f,multiple:!0,className:"hidden",onChange:S=>{const k=Array.from(S.target.files??[]);S.target.value="",m(k)}})]}),L?r.jsx(B1,{value:i,onChange:o,isSearching:w,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[y.length===0?_?r.jsx(BY,{query:_}):e==="image"&&v.length>0?r.jsx(OY,{}):r.jsx($Y,{}):e==="image"?r.jsx(FY,{items:y,onSelect:s}):r.jsx(UY,{items:y,onSelect:s}),a.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(ae,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function $Y(){const t=z.c(12),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(Pi,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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 OY(){const t=z.c(12),e=se();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(Pi,{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=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.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 BY(t){const e=z.c(13),{query:s}=t,n=se();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(Pi,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s||e[2]!==n?(o=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==o?(l=r.jsx("p",{className:"text-sm font-medium",children:o}),e[4]=o,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=r.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=r.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 L7(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function zY(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function FY(t){const e=z.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx(w7,{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 o;return e[5]!==i?(o=r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=o):o=e[6],o}function UY(t){const e=z.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx("li",{children:r.jsx(w7,{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 o;return e[5]!==i?(o=r.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=o):o=e[6],o}function w7(t){const e=z.c(58),{item:s,variant:n,onSelect:i}=t;let o;e[0]!==s.key?(o=zY(s.key),e[0]=s.key,e[1]=o):o=e[1];const l=o;if(n==="image"){let y;e[2]!==s.publicUrl||e[3]!==i?(y=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=y):y=e[4];let _;e[5]!==s.key||e[6]!==s.publicUrl?(_=r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:KY}),e[5]=s.key,e[6]=s.publicUrl,e[7]=_):_=e[7];let L;e[8]!==s.key||e[9]!==y||e[10]!==_?(L=r.jsx("button",{type:"button",onClick:y,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:_}),e[8]=s.key,e[9]=y,e[10]=_,e[11]=L):L=e[11];let w;e[12]!==l?(w=r.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]=w):w=e[13];let S;e[14]!==s||e[15]!==i?(S=r.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:r.jsx(M3,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=S):S=e[16];let k;e[17]!==s.key?(k=$3(s.key),e[17]=s.key,e[18]=k):k=e[18];let j;e[19]!==k?(j=r.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:r.jsx("p",{className:"truncate text-xs text-white",children:k})}),e[19]=k,e[20]=j):j=e[20];let T;return e[21]!==L||e[22]!==w||e[23]!==S||e[24]!==j?(T=r.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[L,w,S,j]}),e[21]=L,e[22]=w,e[23]=S,e[24]=j,e[25]=T):T=e[25],T}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=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:L7(s.key)?r.jsx(Pi,{size:16,className:"text-muted-foreground"}):r.jsx(Ri,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=$3(s.key),e[31]=s.key,e[32]=d):d=e[32];let u;e[33]!==d?(u=r.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=r.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=r.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=r.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=GY(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=r.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=r.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=r.jsx(M3,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let v;return e[55]!==x||e[56]!==b?(v=r.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]=v):v=e[57],v}function KY(t){t.target.style.display="none"}function M3(t){const e=z.c(39),{item:s,onSelect:n}=t,i=se(),[o,l]=V.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(T){T.preventDefault(),T.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{me.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=r.jsx(k0,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:qY,"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=r.jsx(Ut,{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=r.jsxs(Ze,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==o?(x=o?r.jsx(Ut,{size:14}):r.jsx(on,{size:14}),e[17]=o,e[18]=x):x=e[18];let b;e[19]!==o||e[20]!==i?(b=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=o,e[20]=i,e[21]=b):b=e[21];let v;e[22]!==c||e[23]!==b||e[24]!==x?(v=r.jsxs(Ze,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const y=s.publicUrl;let _;e[26]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(hn,{size:14}),e[26]=_):_=e[26];let L;e[27]!==i?(L=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=L):L=e[28];let w;e[29]!==s.publicUrl||e[30]!==L?(w=r.jsx(Ze,{asChild:!0,children:r.jsxs("a",{href:y,target:"_blank",rel:"noreferrer",onClick:HY,children:[_,L]})}),e[29]=s.publicUrl,e[30]=L,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w||e[34]!==g?(S=r.jsxs(Yt,{align:"end",onClick:WY,children:[g,v,w]}),e[32]=v,e[33]=w,e[34]=g,e[35]=S):S=e[35];let k;return e[36]!==S||e[37]!==h?(k=r.jsxs(qt,{children:[h,S]}),e[36]=S,e[37]=h,e[38]=k):k=e[38],k}function HY(t){return t.stopPropagation()}function WY(t){return t.stopPropagation()}function qY(t){return t.stopPropagation()}function $3(t){const e=t.split("/");return e[e.length-1]??t}function GY(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function S7(t,e){if(!e)return null;const s=e.toLowerCase();return t.find(n=>{const i=n.bucket.toLowerCase();return n.siteSlug?.toLowerCase()===s||i===s||i===`deco-assets-${s}`})??null}function k7(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.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:r.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[r.jsx(Wn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function j7(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function C7(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const YY=["low","medium","high","original"];function N7(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function V7(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=QY(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 T7(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",o=n>=0?t.slice(0,n):t,l=o.indexOf("?"),a=l>=0?o.slice(0,l):o,c=(l>=0?o.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 QY(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 XY(t){if(!t)return;const e=V7(t,"quality");return N7(e)?e:void 0}function JY(t,e){return T7(t,"quality",e)}function ZY(t){return t?V7(t,"muted")!=="false":!0}function eQ(t,e){return T7(t,"muted",e?void 0:"false")}function E7(t){const e=z.c(36),{value:s,onChange:n,showMuted:i}=t,o=i===void 0?!1:i,l=se(),a=V.useId();let c;e[0]!==s?(c=XY(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==s?(u=ZY(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=r.jsx(k0,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=r.jsx(us,{asChild:!0,children:r.jsx(ae,{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=r.jsx(Et,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let v;e[13]!==n||e[14]!==s?(v=j=>n(JY(s,N7(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=YY.map(tQ),e[16]=y):y=e[16];let _;e[17]!==v||e[18]!==b?(_=r.jsx(T1,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:y}),e[17]=v,e[18]=b,e[19]=_):_=e[19];let L;e[20]!==_||e[21]!==x?(L=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,_]}),e[20]=_,e[21]=x,e[22]=L):L=e[22];let w;e[23]!==h||e[24]!==a||e[25]!==n||e[26]!==o||e[27]!==l||e[28]!==s?(w=o&&r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Et,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),r.jsx(Mi,{id:a,checked:h,onCheckedChange:j=>n(eQ(s,j))})]}),e[23]=h,e[24]=a,e[25]=n,e[26]=o,e[27]=l,e[28]=s,e[29]=w):w=e[29];let S;e[30]!==L||e[31]!==w?(S=r.jsx(ys,{align:"end",className:"w-auto min-w-52 p-3",children:r.jsxs("div",{className:"flex flex-col gap-3",children:[L,w]})}),e[30]=L,e[31]=w,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==p?(k=r.jsxs(_s,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function tQ(t){return r.jsx(xc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function A7(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function O3(t){const e=z.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=r.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 sQ(t){const e=z.c(81),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=s.format==="video-uri",u=xp(n),[h,f]=V.useState(!1),[m,p]=V.useState(!1),g=u?j7(u):"",x=g?C7(g):"",b=H5(),v=_p();let y;e[0]!==b.data?.configs?(y=b.data?.configs??[],e[0]=b.data?.configs,e[1]=y):y=e[1];const _=a?.siteSlug;let L;e[2]!==y||e[3]!==_?(L=S7(y,_),e[2]=y,e[3]=_,e[4]=L):L=e[4];const w=L;let S;e[5]!==b.data?.configs||e[6]!==d||e[7]!==w?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==v?(S=async function(le){if(!le)return;let Q=Array.from(le);if(Q.length===0)return;if(d&&(Q=Q.filter(nQ),Q.length===0)){me.error(c("sectionsEditor.fileField.videoFileError"));return}const K=A7(b.data?.configs??[],w?.id,typeof window<"u"?window.localStorage.getItem(l9):null);if(!K){f(!0);return}try{const te=await v.mutateAsync({configId:K,file:Q[0]});i(te.publicUrl),Q.length>1&&me.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:Q[0].name}))}catch(te){const ne=te;me.error(ne instanceof Error?ne.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=w?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=v,e[12]=S):S=e[12];const k=S;let j;e[13]!==p?(j=function(le){le.preventDefault(),le.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const T=j;let N;e[15]!==p?(N=function(le){le.currentTarget===le.target&&p(!1)},e[15]=p,e[16]=N):N=e[16];const C=N;let A;e[17]!==k||e[18]!==p?(A=function(le){le.preventDefault(),p(!1),k(le.dataTransfer.files)},e[17]=k,e[18]=p,e[19]=A):A=e[19];const P=A,R=a?.virtualMcpId;let E;e[20]!==l||e[21]!==o||e[22]!==s.description||e[23]!==R?(E=r.jsx("div",{className:"min-w-0",children:r.jsx(Ps,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:R})}),e[20]=l,e[21]=o,e[22]=s.description,e[23]=R,e[24]=E):E=e[24];const M=m&&"border-primary ring-2 ring-primary/30",I=v.isPending&&"pointer-events-none opacity-60";let $;e[25]!==M||e[26]!==I?($=ie("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]=$):$=e[27];let O;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==u||e[33]!==c||e[34]!==v.isPending?(O=u?d?r.jsxs(r.Fragment,{children:[r.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:[r.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u),r.jsx(k7,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(qp,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),r.jsx(O3,{ext:x})]})]}):r.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:[r.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:r.jsx(Ri,{size:18,className:"text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium",children:g}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),r.jsx(O3,{ext:x})]}):r.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?r.jsx(qp,{size:20}):r.jsx(Ri,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),r.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]=v.isPending,e[35]=O):O=e[35];let D;e[36]!==m||e[37]!==c?(D=m&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.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]=D):D=e[38];let B;e[39]!==C||e[40]!==T||e[41]!==P||e[42]!==$||e[43]!==O||e[44]!==D?(B=r.jsxs("div",{onDragOver:T,onDragLeave:C,onDrop:P,className:$,children:[O,D]}),e[39]=C,e[40]=T,e[41]=P,e[42]=$,e[43]=O,e[44]=D,e[45]=B):B=e[45];let F;e[46]!==i?(F=oe=>i(oe.target.value),e[46]=i,e[47]=F):F=e[47];let U;e[48]!==o||e[49]!==u||e[50]!==F?(U=r.jsx(rt,{id:o,type:"url",value:u,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=o,e[49]=u,e[50]=F,e[51]=U):U=e[51];let H;e[52]!==f||e[53]!==u||e[54]!==c?(H=!u&&r.jsxs(ae,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[r.jsx(Wn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=u,e[54]=c,e[55]=H):H=e[55];let W;e[56]!==d||e[57]!==i||e[58]!==u?(W=d&&u&&r.jsx(E7,{value:u,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=u,e[59]=W):W=e[59];let q;e[60]!==i||e[61]!==u||e[62]!==c?(q=u&&r.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:r.jsx(Ks,{size:14})}),e[60]=i,e[61]=u,e[62]=c,e[63]=q):q=e[63];let ee;e[64]!==U||e[65]!==H||e[66]!==W||e[67]!==q?(ee=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,H,W,q]}),e[64]=U,e[65]=H,e[66]=W,e[67]=q,e[68]=ee):ee=e[68];let X;e[69]!==i?(X=oe=>i(oe),e[69]=i,e[70]=X):X=e[70];const Y=w?.id??null;let G;e[71]!==h||e[72]!==f||e[73]!==X||e[74]!==Y?(G=r.jsx(_7,{open:h,onOpenChange:f,mode:"any",onSelect:X,lockedConfigId:Y}),e[71]=h,e[72]=f,e[73]=X,e[74]=Y,e[75]=G):G=e[75];let J;return e[76]!==B||e[77]!==ee||e[78]!==G||e[79]!==E?(J=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[E,B,ee,G]}),e[76]=B,e[77]=ee,e[78]=G,e[79]=E,e[80]=J):J=e[80],J}function nQ(t){return t.type.startsWith("video/")}const iQ=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function rQ(t){const e=z.c(86),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=se(),d=xp(n),[u,h]=V.useState(!1),[f,m]=V.useState(!1),[p,g]=V.useState(!1),[x,b]=V.useState(!1),v=d?j7(d):"",y=v?C7(v):"",_=H5(),L=_p();let w;e[0]!==_.data?.configs?(w=_.data?.configs??[],e[0]=_.data?.configs,e[1]=w):w=e[1];const S=a?.siteSlug;let k;e[2]!==w||e[3]!==S?(k=S7(w,S),e[2]=w,e[3]=S,e[4]=k):k=e[4];const j=k;let T;e[5]!==i||e[6]!==b||e[7]!==g?(T=function(re){g(!1),b(!1),i(re)},e[5]=i,e[6]=b,e[7]=g,e[8]=T):T=e[8];const N=T;let C;e[9]!==_.data?.configs||e[10]!==j?.id||e[11]!==h||e[12]!==N||e[13]!==c||e[14]!==L?(C=async function(re){if(!re)return;const he=Array.from(re).filter(oQ);if(he.length===0){me.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const pe=A7(_.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(l9):null);if(!pe){h(!0);return}try{const de=await L.mutateAsync({configId:pe,file:he[0]});N(de.publicUrl),he.length>1&&me.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:he[0].name}))}catch(de){const Z=de;me.error(Z instanceof Error?Z.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=_.data?.configs,e[10]=j?.id,e[11]=h,e[12]=N,e[13]=c,e[14]=L,e[15]=C):C=e[15];const A=C;let P;e[16]!==m?(P=function(re){re.preventDefault(),re.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=P):P=e[17];const R=P;let E;e[18]!==m?(E=function(re){re.currentTarget===re.target&&m(!1)},e[18]=m,e[19]=E):E=e[19];const M=E;let I;e[20]!==A||e[21]!==m?(I=function(re){re.preventDefault(),m(!1),A(re.dataTransfer.files)},e[20]=A,e[21]=m,e[22]=I):I=e[22];const $=I,O=a?.virtualMcpId;let D;e[23]!==l||e[24]!==o||e[25]!==s.description||e[26]!==O?(D=r.jsx("div",{className:"min-w-0",children:r.jsx(Ps,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:O})}),e[23]=l,e[24]=o,e[25]=s.description,e[26]=O,e[27]=D):D=e[27];const B=f&&"border-primary ring-2 ring-primary/30",F=L.isPending&&"pointer-events-none opacity-60";let U;e[28]!==B||e[29]!==F?(U=ie("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]=U):U=e[30];let H;e[31]!==y||e[32]!==v||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]!==L.isPending?(H=d?r.jsxs(r.Fragment,{children:[r.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&&r.jsx("img",{src:d,alt:l,className:ie("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[r.jsx(Pi,{size:20}),r.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&r.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),r.jsx(k7,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:v}),y&&r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:y})]})]}):r.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:[r.jsx(Pi,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:L.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=y,e[32]=v,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]=L.isPending,e[42]=H):H=e[42];let W;e[43]!==f||e[44]!==c?(W=f&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.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]=W):W=e[45];let q;e[46]!==M||e[47]!==R||e[48]!==$||e[49]!==U||e[50]!==H||e[51]!==W?(q=r.jsxs("div",{onDragOver:R,onDragLeave:M,onDrop:$,className:U,children:[H,W]}),e[46]=M,e[47]=R,e[48]=$,e[49]=U,e[50]=H,e[51]=W,e[52]=q):q=e[52];let ee;e[53]!==N?(ee=ne=>N(ne.target.value),e[53]=N,e[54]=ee):ee=e[54];let X;e[55]!==c?(X=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=X):X=e[56];let Y;e[57]!==o||e[58]!==d||e[59]!==ee||e[60]!==X?(Y=r.jsx(rt,{id:o,type:"url",value:d,onChange:ee,placeholder:X,className:"h-9 min-w-0 flex-1"}),e[57]=o,e[58]=d,e[59]=ee,e[60]=X,e[61]=Y):Y=e[61];let G;e[62]!==h||e[63]!==d||e[64]!==c?(G=!d&&r.jsxs(ae,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[r.jsx(Wn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=h,e[63]=d,e[64]=c,e[65]=G):G=e[65];let J;e[66]!==N||e[67]!==d||e[68]!==c?(J=d&&r.jsxs(r.Fragment,{children:[r.jsx(E7,{value:d,onChange:N}),r.jsx(ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>N(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:r.jsx(Ks,{size:14})})]}),e[66]=N,e[67]=d,e[68]=c,e[69]=J):J=e[69];let oe;e[70]!==Y||e[71]!==G||e[72]!==J?(oe=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[Y,G,J]}),e[70]=Y,e[71]=G,e[72]=J,e[73]=oe):oe=e[73];let le;e[74]!==N?(le=ne=>N(ne),e[74]=N,e[75]=le):le=e[75];const Q=j?.id??null;let K;e[76]!==u||e[77]!==h||e[78]!==le||e[79]!==Q?(K=r.jsx(_7,{open:u,onOpenChange:h,mode:"image",onSelect:le,lockedConfigId:Q}),e[76]=u,e[77]=h,e[78]=le,e[79]=Q,e[80]=K):K=e[80];let te;return e[81]!==D||e[82]!==q||e[83]!==oe||e[84]!==K?(te=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[D,q,oe,K]}),e[81]=D,e[82]=q,e[83]=oe,e[84]=K,e[85]=te):te=e[85],te}function oQ(t){return iQ.has(t.type||"")}function P7(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function lQ(t,e){if(e.length===0)return 0;const s=P7(t);for(let o=0;o<e.length;o++){const l=e[o].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return o}let n=0,i=-1;for(let o=0;o<e.length;o++){const l=e[o],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=o)}return n}function aQ(t,e){const s=P7(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}const cQ="0 0 1080 1080",dQ="matrix(1 0 0 1 540 540)",Lp=[{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 uQ({selected:t,onSelect:e}){const s=se(),[n,i]=V.useState(cQ),o=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 r.jsx("svg",{ref:o,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:r.jsx("g",{transform:dQ,children:Lp.map(l=>{const a=l.code===t;return r.jsx("g",{transform:l.gTransform,children:r.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:ie("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 hQ=[{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"}],fQ="BR";function mQ(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 pQ(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 gQ(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function B3(t){const e=z.c(37),{id:s,options:n,value:i,placeholder:o,emptyMessage:l,onChange:a}=t,[c,d]=V.useState(!1);let u;if(e[0]!==n||e[1]!==i){let S;e[3]!==i?(S=k=>k.value===i,e[3]=i,e[4]=S):S=e[4],u=n.find(S),e[0]=n,e[1]=i,e[2]=u}else u=e[2];const h=u;let f;e[5]!==o||e[6]!==h?(f=h?r.jsx("span",{className:"truncate",children:h.label}):r.jsx("span",{className:"text-muted-foreground",children:o}),e[5]=o,e[6]=h,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(m0,{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=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{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]!==o?(x=r.jsx(Wi,{placeholder:o,className:"h-9"}),e[14]=o,e[15]=x):x=e[15];let b;e[16]!==l?(b=r.jsx(si,{children:l}),e[16]=l,e[17]=b):b=e[17];let v;if(e[18]!==a||e[19]!==n||e[20]!==i){let S;e[22]!==a||e[23]!==i?(S=k=>r.jsxs(Jt,{value:`${k.label} ${k.value}`,onSelect:()=>{a(k.value===i?"":k.value),d(!1)},children:[r.jsx("span",{className:"truncate",children:k.label}),r.jsx(Ut,{className:ie("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=a,e[23]=i,e[24]=S):S=e[24],v=n.map(S),e[18]=a,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let y;e[25]!==v?(y=r.jsx(ks,{children:v}),e[25]=v,e[26]=y):y=e[26];let _;e[27]!==b||e[28]!==y?(_=r.jsxs(qi,{children:[b,y]}),e[27]=b,e[28]=y,e[29]=_):_=e[29];let L;e[30]!==_||e[31]!==x?(L=r.jsx(ys,{className:"p-0",style:g,children:r.jsxs(pr,{children:[x,_]})}),e[30]=_,e[31]=x,e[32]=L):L=e[32];let w;return e[33]!==c||e[34]!==L||e[35]!==p?(w=r.jsxs(_s,{open:c,onOpenChange:d,children:[p,L]}),e[33]=c,e[34]=L,e[35]=p,e[36]=w):w=e[36],w}const xQ=hQ.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),bQ=Lp.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function R7(t){const e=z.c(66),{schema:s,value:n,onChange:i,path:o,sandbox:l}=t,a=se();let c;e[0]!==n?(c=pQ(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 v=b;let y;e[10]!==p.city?.title||e[11]!==a?(y=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=y):y=e[12];const _=y;let L;e[13]!==d||e[14]!==i?(L=j=>{i(gQ(d,j))},e[13]=d,e[14]=i,e[15]=L):L=e[15];const w=L,S=f===fQ;let k;if(e[16]!==u||e[17]!==_||e[18]!==f||e[19]!==x||e[20]!==w||e[21]!==S||e[22]!==o||e[23]!==h||e[24]!==v||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==h?(j=U=>U.code===h,e[30]=h,e[31]=j):j=e[31];const T=Lp.find(j),N=`${o}.country`;let C;e[32]!==s.title||e[33]!==a?(C=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=C):C=e[34];const A=l?.virtualMcpId;let P;e[35]!==s.description||e[36]!==C||e[37]!==A||e[38]!==N?(P=r.jsx(Ps,{htmlFor:N,label:C,description:s.description,virtualMcpId:A}),e[35]=s.description,e[36]=C,e[37]=A,e[38]=N,e[39]=P):P=e[39];const R=`${o}.country`;let E;e[40]!==x||e[41]!==R?(E=r.jsx(Et,{htmlFor:R,className:"text-xs",children:x}),e[40]=x,e[41]=R,e[42]=E):E=e[42];const M=`${o}.country`;let I;e[43]!==a?(I=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=I):I=e[44];let $;e[45]!==a?($=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=$):$=e[46];let O;e[47]!==w?(O=U=>w({country:U,regionCode:"",city:""}),e[47]=w,e[48]=O):O=e[48];let D;e[49]!==f||e[50]!==M||e[51]!==I||e[52]!==$||e[53]!==O?(D=r.jsx(B3,{id:M,options:xQ,value:f,placeholder:I,emptyMessage:$,onChange:O}),e[49]=f,e[50]=M,e[51]=I,e[52]=$,e[53]=O,e[54]=D):D=e[54];let B;e[55]!==E||e[56]!==D?(B=r.jsxs("div",{className:"space-y-1.5",children:[E,D]}),e[55]=E,e[56]=D,e[57]=B):B=e[57];let F;e[58]!==f||e[59]!==w||e[60]!==S||e[61]!==o||e[62]!==h||e[63]!==v||e[64]!==a?(F=f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Et,{htmlFor:`${o}.regionCode`,className:"text-xs",children:v}),S?r.jsxs("div",{className:"space-y-2",children:[r.jsx(uQ,{selected:h,onSelect:U=>w({regionCode:U===h?"":U,city:""})}),r.jsx(B3,{id:`${o}.regionCode`,options:bQ,value:h,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>w({regionCode:U,city:""})})]}):r.jsxs(r.Fragment,{children:[r.jsx(rt,{id:`${o}.regionCode`,type:"text",value:h,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>w({regionCode:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=w,e[60]=S,e[61]=o,e[62]=h,e[63]=v,e[64]=a,e[65]=F):F=e[65],k=r.jsxs("div",{className:"space-y-4",children:[P,B,F,f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Et,{htmlFor:`${o}.city`,className:"text-xs",children:_}),r.jsx(rt,{id:`${o}.city`,type:"text",value:u,placeholder:S&&T?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:T.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>w({city:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=u,e[17]=_,e[18]=f,e[19]=x,e[20]=w,e[21]=S,e[22]=o,e[23]=h,e[24]=v,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 vQ(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,o]of Object.entries(e.properties))s.has(i)||(n[i]=o);return Object.keys(n).length===0?null:{...e,properties:n}}function yQ(t){const e=z.c(49),s=se(),{schema:n,value:i,onChange:o,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=lQ(i,c.map(LQ)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const u=d,[h,f]=V.useState(u),[m,p]=V.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]!==o?(b=I=>{const $=Number(I);f($),o({...c[$]?.discriminators??{}})},e[4]=c,e[5]=o,e[6]=b):b=e[6];const v=b;if(c.length===0)return null;let y;e[7]!==x?(y=x?vQ(x):null,e[7]=x,e[8]=y):y=e[8];const _=y;let L;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],L=aQ(i,Object.keys(I)),e[9]=x?.schema?.properties,e[10]=i,e[11]=L}else L=e[11];const w=L;let S;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=a&&r.jsx(Ps,{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]=S):S=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 T;e[21]!==j?(T=r.jsx(js,{placeholder:j}),e[21]=j,e[22]=T):T=e[22];let N;e[23]!==l||e[24]!==T?(N=r.jsx(bs,{id:l,children:T}),e[23]=l,e[24]=T,e[25]=N):N=e[25];let C;e[26]!==c?(C=c.map(_Q),e[26]=c,e[27]=C):C=e[27];let A;e[28]!==C?(A=r.jsx(vs,{children:C}),e[28]=C,e[29]=A):A=e[29];let P;e[30]!==v||e[31]!==A||e[32]!==k||e[33]!==N?(P=r.jsxs(xs,{value:k,onValueChange:v,children:[N,A]}),e[30]=v,e[31]=A,e[32]=k,e[33]=N,e[34]=P):P=e[34];let R;e[35]!==P||e[36]!==S?(R=r.jsxs("div",{className:"space-y-1.5",children:[S,P]}),e[35]=P,e[36]=S,e[37]=R):R=e[37];let E;e[38]!==x||e[39]!==_||e[40]!==o||e[41]!==l||e[42]!==w||e[43]!==t||e[44]!==i?(E=x&&(mQ(x.schema?.properties)?r.jsx(R7,{...t,schema:x.schema,onChange:I=>o({...w,...I,...x.discriminators??{}})}):_?r.jsx(gr,{schema:_,value:i,onChange:I=>o({...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[38]=x,e[39]=_,e[40]=o,e[41]=l,e[42]=w,e[43]=t,e[44]=i,e[45]=E):E=e[45];let M;return e[46]!==R||e[47]!==E?(M=r.jsxs("div",{className:"space-y-3",children:[R,E]}),e[46]=R,e[47]=E,e[48]=M):M=e[48],M}function _Q(t,e){return r.jsx(kt,{value:String(e),children:t.title},t.title)}function LQ(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const wQ={lat:-21.9,lng:-41.42},df=1e5;let Xd=null;function SQ(t){return Xd||(Xd=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"))},o=document.querySelector("script[data-google-maps-loader]");if(o){o.addEventListener("load",i),o.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)}),Xd)}function kQ(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:df}}function jQ({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o}){const l=TL().googleMapsApiKey,a=V.useRef(s);a.current=s;const c=V.useRef(kQ(e)),[d,u]=V.useState(null),h=V.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return SQ(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:wQ,v=x?.radius??df,y=new g.Map(m,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),_=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:y,center:b,radius:v});p.circle=_;const L=()=>{const S=_.getCenter(),k=_.getRadius();S&&a.current(`${S.lat()},${S.lng()},${k}`)},w=S=>{S&&p.listeners.push(S)};w(y.addListener("click",S=>{S.latLng&&(_.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),_.getRadius()||_.setRadius(df),L())})),w(_.addListener("radius_changed",L)),w(_.addListener("dragend",L))},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),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ps,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),l?d?r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):r.jsx("div",{ref:h.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):r.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"," ",r.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const CQ="oklch(0.65 0.15 160)",NQ="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)]",D7="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)]",Hae="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 z3(t){return t.map(e=>e.label).join(`
|
|
532
|
+
`)}function Y9(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function VQ(t){return t.map((e,s)=>({...e,index:s}))}function I7(t){const e=z.c(19),{label:s,canDelete:n,dragging:i,onRename:o,onDuplicate:l,onDelete:a}=t,c=se(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=ie("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=r.jsx(Hl,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(or,{className:"h-4 w-4 shrink-0",style:{color:CQ}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=r.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]!==o||e[13]!==c?(p=!i&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{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 data-[state=open]:opacity-100",onClick:EQ,onPointerDown:TQ,children:r.jsx(Hi,{size:14})})}),r.jsxs(Yt,{align:"end",children:[o&&r.jsxs(Ze,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(y5,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(Ze,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(on,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(Ze,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(Ks,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=o,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function TQ(t){return t.stopPropagation()}function EQ(t){return t.stopPropagation()}function AQ(t){const e=z.c(27),{entry:s,selected:n,canDelete:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:PQ},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=H0(d);let g;e[2]!==m?(g=ri.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 v=b;let y;e[7]!==o?(y=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=y):y=e[8];const _=p?"cursor-grabbing":"cursor-grab",L=n?D7:NQ;let w;e[9]!==_||e[10]!==L?(w=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",_,L),e[9]=_,e[10]=L,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=r.jsx(I7,{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]=S):S=e[17];let k;return e[18]!==u||e[19]!==h||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==y||e[24]!==w||e[25]!==S?(k=r.jsx("div",{ref:f,style:v,...u,...h,onClick:o,onKeyDown:y,className:w,children:S}),e[18]=u,e[19]=h,e[20]=o,e[21]=f,e[22]=v,e[23]=y,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function PQ(){return!1}function RQ(t){const e=z.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=se(),m=n.length>1;let p;e[0]!==n?(p=()=>Y9(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=V.useState(p),[b,v]=V.useState(null),[y,_]=V.useState(s),[L,w]=V.useState(n.length);let S;e[2]!==n?(S=()=>z3(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=V.useState(S),T=V.useRef(!1),N=z3(n);y!==s?(_(s),w(n.length),j(N),x(Y9(n))):L!==n.length?(w(n.length),j(N),x(Y9(n))):k!==N&&(j(N),x(de=>n.map((Z,fe)=>({id:de[fe]?.id??crypto.randomUUID(),index:Z.index,label:Z.label}))));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A={coordinateGetter:W0},e[5]=A):A=e[5];const P=od(zi(Ho,C),zi(Ko,A));let R;e[6]!==g?(R=g.map(DQ),e[6]=g,e[7]=R):R=e[7];const E=R;let M;e[8]!==g?(M=de=>{const Z=String(de.active.id);v(g.find(fe=>fe.id===Z)??null)},e[8]=g,e[9]=M):M=e[9];const I=M;let $;e[10]!==E||e[11]!==u?($=de=>{v(null);const{active:Z,over:fe}=de;if(!fe||Z.id===fe.id)return;const ue=E.indexOf(String(Z.id)),ye=E.indexOf(String(fe.id));ue===-1||ye===-1||(x(Le=>VQ(No([...Le],ue,ye))),T.current=!0,requestAnimationFrame(()=>{T.current=!1}),u(ue,ye))},e[10]=E,e[11]=u,e[12]=$):$=e[12];const O=$;let D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{v(null)},e[13]=D):D=e[13];const B=D;let F,U,H,W,q,ee,X,Y,G,J,oe,le,Q;if(e[14]!==m||e[15]!==g||e[16]!==E||e[17]!==O||e[18]!==I||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==P||e[27]!==f){const de=xe=>{T.current||o(xe)};oe="space-y-1 border-b p-2";let Z;e[41]!==f?(Z=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=Z):Z=e[42];let fe;e[43]!==Z?(fe=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:Z}),e[43]=Z,e[44]=fe):fe=e[44];let ue;e[45]!==f?(ue=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=ue):ue=e[46];let ye;e[47]===Symbol.for("react.memo_cache_sentinel")?(ye=r.jsx(Nt,{size:14}),e[47]=ye):ye=e[47];let Le;e[48]!==h||e[49]!==ue?(Le=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":ue,className:"size-6",onClick:h,children:ye})}),e[48]=h,e[49]=ue,e[50]=Le):Le=e[50];let Re;e[51]!==f?(Re=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=Re):Re=e[52];let De;e[53]!==Re?(De=r.jsx(qe,{children:Re}),e[53]=Re,e[54]=De):De=e[54];let Ue;e[55]!==Le||e[56]!==De?(Ue=r.jsxs(Ge,{children:[Le,De]}),e[55]=Le,e[56]=De,e[57]=Ue):Ue=e[57];let $e;e[58]!==f?($e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=$e):$e=e[59];let je;e[60]===Symbol.for("react.memo_cache_sentinel")?(je=r.jsx(Ks,{size:14}),e[60]=je):je=e[60];let be;e[61]!==d||e[62]!==$e?(be=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon","aria-label":$e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:je})}),e[61]=d,e[62]=$e,e[63]=be):be=e[63];let Ee;e[64]!==f?(Ee=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Ee):Ee=e[65];let _e;e[66]!==Ee?(_e=r.jsx(qe,{children:Ee}),e[66]=Ee,e[67]=_e):_e=e[67];let Ae;e[68]!==be||e[69]!==_e?(Ae=r.jsxs(Ge,{children:[be,_e]}),e[68]=be,e[69]=_e,e[70]=Ae):Ae=e[70];let Ce;e[71]!==Ue||e[72]!==Ae?(Ce=r.jsxs("div",{className:"flex items-center gap-0.5",children:[Ue,Ae]}),e[71]=Ue,e[72]=Ae,e[73]=Ce):Ce=e[73],e[74]!==fe||e[75]!==Ce?(le=r.jsxs("div",{className:"flex items-center justify-between",children:[fe,Ce]}),e[74]=fe,e[75]=Ce,e[76]=le):le=e[76],U=ad,ee=P,X=Nm,Y=I,G=O,J=B,F=K0,W=E,q=U0,Q="space-y-0.5",H=g.map(xe=>r.jsx(AQ,{entry:xe,selected:xe.index===i,canDelete:m,onSelect:()=>de(xe.index),onRename:l?()=>l(xe.index):void 0,onDuplicate:()=>a(xe.index),onDelete:()=>c(xe.index)},xe.id)),e[14]=m,e[15]=g,e[16]=E,e[17]=O,e[18]=I,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=P,e[27]=f,e[28]=F,e[29]=U,e[30]=H,e[31]=W,e[32]=q,e[33]=ee,e[34]=X,e[35]=Y,e[36]=G,e[37]=J,e[38]=oe,e[39]=le,e[40]=Q}else F=e[28],U=e[29],H=e[30],W=e[31],q=e[32],ee=e[33],X=e[34],Y=e[35],G=e[36],J=e[37],oe=e[38],le=e[39],Q=e[40];let K;e[77]!==H||e[78]!==Q?(K=r.jsx("div",{className:Q,children:H}),e[77]=H,e[78]=Q,e[79]=K):K=e[79];let te;e[80]!==F||e[81]!==W||e[82]!==q||e[83]!==K?(te=r.jsx(F,{items:W,strategy:q,children:K}),e[80]=F,e[81]=W,e[82]=q,e[83]=K,e[84]=te):te=e[84];let ne;e[85]!==b||e[86]!==m?(ne=b?r.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",D7),children:r.jsx(I7,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=ne):ne=e[87];let re;e[88]!==ne?(re=bn.createPortal(r.jsx(F0,{dropAnimation:l7,children:ne}),document.body),e[88]=ne,e[89]=re):re=e[89];let he;e[90]!==U||e[91]!==ee||e[92]!==X||e[93]!==Y||e[94]!==G||e[95]!==J||e[96]!==te||e[97]!==re?(he=r.jsxs(U,{sensors:ee,collisionDetection:X,onDragStart:Y,onDragEnd:G,onDragCancel:J,children:[te,re]}),e[90]=U,e[91]=ee,e[92]=X,e[93]=Y,e[94]=G,e[95]=J,e[96]=te,e[97]=re,e[98]=he):he=e[98];let pe;return e[99]!==oe||e[100]!==le||e[101]!==he?(pe=r.jsxs("div",{className:oe,children:[le,he]}),e[99]=oe,e[100]=le,e[101]=he,e[102]=pe):pe=e[102],pe}function DQ(t){return t.id}const IQ=[[/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"]],MQ={"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 Q9(t){return Mo(t)!==void 0}function wp(t,e){if(e){if(Q9(e))return e;const s=MQ[e];if(s&&Q9(s))return s}for(const[s,n]of IQ)if(s.test(t)&&Q9(n))return n;return"FilterLines"}function $Q(t){return Mo(t)??K1}function X9(t){const e=z.c(11),{iconName:s,size:n,className:i}=t,o=n===void 0?"md":n;let l;e[0]!==s?(l=$Q(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",d=o==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=ie("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=r.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=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}const OQ=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),BQ=5,zQ=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function F3(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const o=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:zQ.format(d)},l=o(n),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function Ju(t,e=0){if(!t)return"Default";if(e>BQ)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:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(OQ).join(" & "):ds(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return F3(t)??ds(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`:ds(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):ds(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:ds(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=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=o?.[0];if(c){const d=(o?.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:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>Ju(a,e+1)).join(` ${l} `)}return ds(s)}default:{const i=F3(t);return i||ds(s)||"Default"}}}function Wae(t,e){return PK(t,e).map(s=>{const n=e[s.blockKey]??{},i=p8(IK(s.blockKey),e,t);return{blockKey:s.blockKey,title:D0(s.blockKey,n),description:Ju(i),iconName:wp(s.matcherResolveType)}})}const M7="Users03";function FQ(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function UQ(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,o]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(o)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=to(l,t);s.push({resolveType:l,title:a.title??ds(l),description:a.description,iconName:wp(l,a.icon)})}return s}function KQ(t,e){if(!t)return M7;const s=e.find(n=>n.resolveType===t);return s?s.iconName:wp(t)}function HQ(t){const e=z.c(80),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=V.useState(!1),f=se(),p=(i?d.find(G=>G.blockKey===i):void 0)?.iconName??KQ(s,o),g=Mo(p);let x;e[0]!==a||e[1]!==h?(x=G=>{a(G),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=G=>{c?.(G),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const y=v;let _;e[6]!==h?(_=()=>h(!0),e[6]=h,e[7]=_):_=e[7];let L;e[8]!==g?(L=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=L):L=e[9];let w;e[10]!==n?(w=r.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(fs,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==_||e[14]!==L||e[15]!==w?(k=r.jsxs("button",{type:"button",onClick:_,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:[L,w,S]}),e[13]=_,e[14]=L,e[15]=w,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 T;e[19]!==f?(T=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=T):T=e[20];let N;e[21]!==f?(N=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=N):N=e[22];let C;e[23]!==N?(C=r.jsx(Wi,{placeholder:N}),e[23]=N,e[24]=C):C=e[24];let A;e[25]!==f?(A=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=A):A=e[26];let P;e[27]!==A?(P=r.jsx(si,{children:A}),e[27]=A,e[28]=P):P=e[28];let R;e[29]!==b?(R=()=>b(""),e[29]=b,e[30]=R):R=e[30];const E=!s&&!i&&"bg-accent/60";let M;e[31]!==E?(M=ie("gap-2.5",E),e[31]=E,e[32]=M):M=e[32];let I;e[33]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(X9,{iconName:M7,size:"sm"}),e[33]=I):I=e[33];let $;e[34]!==f?($=f("sectionsEditor.matcherPicker.alwaysLabel"),e[34]=f,e[35]=$):$=e[35];let O;e[36]!==$?(O=r.jsx("span",{className:"text-sm",children:$}),e[36]=$,e[37]=O):O=e[37];let D;e[38]!==f?(D=f("sectionsEditor.matcherPicker.targetAllUsers"),e[38]=f,e[39]=D):D=e[39];let B;e[40]!==D?(B=r.jsx("span",{className:"text-xs text-muted-foreground",children:D}),e[40]=D,e[41]=B):B=e[41];let F;e[42]!==O||e[43]!==B?(F=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[O,B]}),e[42]=O,e[43]=B,e[44]=F):F=e[44];let U;e[45]!==R||e[46]!==M||e[47]!==F?(U=r.jsxs(Jt,{value:"always Target all users",onSelect:R,className:M,children:[I,F]}),e[45]=R,e[46]=M,e[47]=F,e[48]=U):U=e[48];let H;if(e[49]!==i||e[50]!==s||e[51]!==b||e[52]!==o){let G;e[54]!==i||e[55]!==s||e[56]!==b?(G=J=>r.jsxs(Jt,{value:`${J.title} ${J.resolveType} ${J.description??""}`,onSelect:()=>b(J.resolveType),className:ie("gap-2.5",!i&&s===J.resolveType&&"bg-accent/60"),children:[r.jsx(X9,{iconName:J.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:J.title}),J.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.resolveType),e[54]=i,e[55]=s,e[56]=b,e[57]=G):G=e[57],H=o.map(G),e[49]=i,e[50]=s,e[51]=b,e[52]=o,e[53]=H}else H=e[53];let W;e[58]!==U||e[59]!==H?(W=r.jsxs(ks,{children:[U,H]}),e[58]=U,e[59]=H,e[60]=W):W=e[60];let q;e[61]!==i||e[62]!==d||e[63]!==y||e[64]!==f?(q=d.length>0&&r.jsx(ks,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(G=>r.jsxs(Jt,{value:`${G.title} ${G.blockKey} ${G.description??""}`,onSelect:()=>y(G.blockKey),className:ie("gap-2.5",i===G.blockKey&&"bg-accent/60"),children:[r.jsx(X9,{iconName:G.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:G.title}),G.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:G.description})]})]},G.blockKey))}),e[61]=i,e[62]=d,e[63]=y,e[64]=f,e[65]=q):q=e[65];let ee;e[66]!==P||e[67]!==W||e[68]!==q?(ee=r.jsxs(qi,{children:[P,W,q]}),e[66]=P,e[67]=W,e[68]=q,e[69]=ee):ee=e[69];let X;e[70]!==u||e[71]!==h||e[72]!==T||e[73]!==C||e[74]!==ee||e[75]!==j?(X=r.jsxs(rj,{open:u,onOpenChange:h,title:j,description:T,className:"sm:max-w-lg",filter:FQ,children:[C,ee]}),e[70]=u,e[71]=h,e[72]=T,e[73]=C,e[74]=ee,e[75]=j,e[76]=X):X=e[76];let Y;return e[77]!==X||e[78]!==k?(Y=r.jsxs(r.Fragment,{children:[k,X]}),e[77]=X,e[78]=k,e[79]=Y):Y=e[79],Y}const U3=new WeakMap;function WQ(t,e){let s=U3.get(e);s||(s=new Map,U3.set(e,s));let n=s.get(t);return n===void 0&&(n=ni(t,e),s.set(t,n)),n}function qQ(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function GQ(t,e){return{__resolveType:e,variants:[{rule:Il(),value:structuredClone(t)},{rule:Il(),value:structuredClone(t)}]}}function YQ(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>lp(n.rule));return s?s.value:e[e.length-1]?.value}function QQ(t){const e=[...t.variants],s=e[e.length-1],n={rule:Il(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function XQ(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function JQ(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function ZQ(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 eX(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function K3(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const H3=new WeakMap;function tX(t){let e=H3.get(t);return e||(e=UQ(t),H3.set(t,e)),e}function $7(t){const e=z.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=se(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=V.useState(0);if(!qQ(l)){let O;e[0]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=O):O=e[1];let D;e[2]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(S0,{size:14}),e[2]=D):D=e[2];let B;e[3]!==o?(B=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=B):B=e[4];let F;return e[5]!==B?(F=r.jsx(qe,{children:B}),e[5]=B,e[6]=F):F=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":O,onClick:()=>{a(GQ(l,s)),h(0)},children:D})}),F]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==o?(g=(O,D)=>({index:D,label:Ju(O.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(D+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},y=v.__resolveType??"",_=b?.value,L=c?tX(c):[],w=y&&c?WQ(y,c):null,{__resolveType:S,...k}=v,j=()=>{a(YQ(f)),h(0)},T=()=>{const O=QQ(f);a(O),h(O.variants.length-1)},N=O=>{const D=XQ(f,O);D&&(a(D),p>=D.variants.length&&h(D.variants.length-1))},C=O=>{const D=JQ(f,O);a(D),h(O+1)},A=(O,D)=>{const B=ZQ(f,O,D);a(B),p===O&&h(D)},P=O=>{const D=O?MK(O,c):{__resolveType:_v};a(K3(f,p,D))},R=O=>{const D=O,B=y?{...D,__resolveType:y}:{...D};a(K3(f,p,B))},E=O=>{a(eX(f,p,O))},M=`${d}-${f.__resolveType}`;let I;e[9]!==o?(I=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=I):I=e[10];let $;return e[11]!==I?($=r.jsx(Et,{className:"text-xs text-muted-foreground",children:I}),e[11]=I,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(RQ,{listKey:M,variants:x,selectedIndex:p,onSelect:h,onDuplicate:C,onDelete:N,onRemoveAll:j,onReorder:A,onAdd:T}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(HQ,{currentRt:y,currentLabel:Ju(v),matchers:L,onSelect:P}),w&&r.jsx("div",{className:"pt-1",children:r.jsx(gr,{schema:w,value:k,onChange:R,basePath:""})})]}),n({...i,value:_,onChange:E})]})]})}const sX="website/loaders/secret.ts";function lc(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 nX(){return{__resolveType:sX,name:"",encrypted:""}}function iX(t){const{value:e,...s}=t;return s}function J9(t){const e=z.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=se();if(typeof n=="string"||n==null&&!lc(n)){const T=typeof n=="string"?n:"",N=a?.virtualMcpId;let C;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==N?(C=r.jsx(Ps,{htmlFor:l,label:o,description:s.description,virtualMcpId:N}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=N,e[4]=C):C=e[4];let A;e[5]!==c?(A=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=A):A=e[6];let P;e[7]!==i?(P=M=>i(M.target.value),e[7]=i,e[8]=P):P=e[8];let R;e[9]!==l||e[10]!==T||e[11]!==A||e[12]!==P?(R=r.jsx(rt,{id:l,type:"password",value:T,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:A,onChange:P,className:"h-10"}),e[9]=l,e[10]=T,e[11]=A,e[12]=P,e[13]=R):R=e[13];let E;return e[14]!==C||e[15]!==R?(E=r.jsxs("div",{className:"space-y-2",children:[C,R]}),e[14]=C,e[15]=R,e[16]=E):E=e[16],E}let d;e[17]!==n?(d=lc(n)?n:nX(),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]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx(Ps,{htmlFor:m,label:o,description:s.description,virtualMcpId:p}),e[19]=o,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 v;e[26]!==u||e[27]!==i?(v=T=>i({...u,name:T.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let y;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(y=r.jsx(rt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=y):y=e[33];const _=`${l}-value`;let L;e[34]!==f||e[35]!==c?(L=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=L):L=e[36];let w;e[37]!==u||e[38]!==f||e[39]!==i?(w=T=>{const N=T.target.value;if(!N){i(f?iX(u):u);return}i({...u,value:N})},e[37]=u,e[38]=f,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==L||e[42]!==w||e[43]!==_?(S=r.jsx(rt,{id:_,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:L,onChange:w,className:"h-10"}),e[41]=L,e[42]=w,e[43]=_,e[44]=S):S=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&r.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]!==S||e[49]!==k||e[50]!==g||e[51]!==y?(j=r.jsxs("div",{className:"space-y-2",children:[g,y,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=y,e[52]=j):j=e[52],j}function rX(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("__")):[],o=[],l=d=>{d?.type==="object"&&d.properties&&o.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(o.length===0)return;if(i.length===0)return o.length===1?o[0]:void 0;let a,c=-1;for(const d of o){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 oX(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 lX=new Set(["__resolveType","@type"]);function aX(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 cX(t){if(t9(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 W3(t){if(t.type==="array"&&t.items)return t;const e=t.items??cX(t);return e?{...t,type:"array",items:e}:null}function dX(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 Ol(t){const{schema:e,value:s}=t;if(Yu(s)){const l=lH(s),a=W3(e);if(l!==null&&a)return r.jsx(Qd,{...t,schema:a,value:l,onChange:c=>t.onChange(aH(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&t9(e)){const l=W3(e);if(l)return r.jsx(Qd,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Yu(s)&&e.type==="block-ref"){const l=rX(e,s)??oX(s);if(l){const a={...e,type:"array",items:l};return r.jsx(Qd,{...t,schema:a,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(aX(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=u=>Ol({...u,schema:c});return r.jsx($7,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(D3,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(yQ,{...t},t.path);if(e.format==="image-uri")return r.jsx(rQ,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(sQ,{...t},t.path);if(e.format==="map")return r.jsx(jQ,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(NY,{...t},t.path);if(e.format==="location")return r.jsx(R7,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(SG,{...t},t.path);if(e.type==="anyOf")return r.jsx(D3,{...t},t.path);if(lc(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(J9,{...t},t.path);const n=s??dX(e.type,e.default);if(n==null)return lc(s)?r.jsx(J9,{...t},t.path):null;if(lc(n))return r.jsx(J9,{...t,value:n},t.path);const i={...t,value:n},o=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(o==="array"||Array.isArray(n))return r.jsx(Qd,{...i},t.path);switch(o){case"boolean":return r.jsx(yG,{...i},t.path);case"number":case"integer":return r.jsx(vG,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(qd,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(qd,{...i},t.path):r.jsx(qd,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(dY,{...i},t.path):null;default:return r.jsx(qd,{...i},t.path)}}function uX(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ol({...t,schema:e});const s=t.value;if(s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&t.meta){const n=ni(s.__resolveType,t.meta);if(n)return r.jsx(gr,{schema:n,value:s,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onRequestAddSection:t.onRequestAddSection})}return Ol(e?{...t,schema:e}:t)}function gr(t){const e=z.c(6),{schema:s,value:n,onChange:i,basePath:o,breadcrumbPath:l,onBreadcrumbChange:a,meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p}=t,g=l===void 0?[]:l,x=se(),b=s.properties;if(!b)return s.type==="inline-union"?Ol({schema:s,value:n,onChange:i,path:o,label:s.title??"",breadcrumbPath:g,onBreadcrumbChange:a,meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p}):null;if(oH(n)&&b.variants){const E=b.variants.items?.properties?.value;let M;return e[0]!==E?(M=I=>uX(I,E),e[0]=E,e[1]=M):M=e[1],r.jsx($7,{schema:s,value:n,onChange:i,path:o,label:s.title??"",breadcrumbPath:g,onBreadcrumbChange:a,meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p,multivariateResolveType:n.__resolveType,renderInnerField:M},o)}const v=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},y=Object.keys(b).filter(E=>!lX.has(E)&&b[E]?.hidden!==!0);if(y.length===0){let E;return e[2]!==x?(E=x("sectionsEditor.sectionsEditor.noEditableFields"),e[2]=x,e[3]=E):E=e[3],r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:E})}const _=(E,M)=>{i({...v,[E]:M})},L=typeof v.__resolveType=="string"?v.__resolveType:void 0,w=y.filter(E=>{const M=b[E];return M!=null&&af(M,v[E])}).length>1,S=g.length>0?KG(y,b,v,g,d):null,k=S?b[S]:null,j=S&&k?[S]:y,T=S&&k?zG(S,k,g):g,N=BG(g,T),C=N.length>0&&a?E=>a([...N,...E]):a,A="min-w-0 space-y-6",P=j.map(E=>{const M=b[E];if(!M)return null;const I=o?`${o}.${E}`:E,$=_l(E,M);return Ol({schema:M,value:v[E],onChange:O=>_(E,O),path:I,label:$,breadcrumbPath:T,onBreadcrumbChange:C,hasSiblingDrillDownFields:w,meta:c,decofile:d,onSaveReferencedBlock:u,containerResolveType:L,previewBaseUrl:h,onAddSectionItem:f,onRequestAddSection:m,sandbox:p})});let R;return e[4]!==P?(R=r.jsx("div",{className:A,children:P}),e[4]=P,e[5]=R):R=e[5],R}function hX(t){const e=z.c(3),{isPending:s,isError:n}=t;if(n){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[r.jsx(fn,{size:13}),"Couldn't save"]}),e[0]=o):o=e[0],o}if(s){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(it,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[r.jsx(Ut,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}function fX({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f}){const m=se(),p=vr(),g=p?.entity?.id===e?p.entity.metadata?.siteSlug??null:null,x=ni(a.resolveType,i),b=!x&&FA(a.resolveType,i),v=b?UA(c):null,y=x??v,[_,L]=V.useState(c),[w,S]=V.useState([]),[k,j]=V.useState(0),[T,N]=V.useState(!1),[C,A]=V.useState(null),[P,R]=V.useState(!1),[E,M]=V.useState(!1),[I,$]=V.useState(!1),O=C!==null,{save:D,flush:B,isPending:F}=y8({orgSlug:t,virtualMcpId:e,branch:s}),U=eW({orgSlug:t,virtualMcpId:e,branch:s});V.useEffect(()=>()=>{B()},[]);const H=z8(l),W=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,q={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:g},ee=K=>{L(K),a.mode==="saved"&&D(a.blockKey,{__resolveType:a.resolveType,...K})},X=()=>{O?(A(null),N(!1),j(K=>K+1)):A(JSON.stringify(_,null,2))},Y=K=>{const te=K??"";try{const ne=JSON.parse(te);if(ne&&typeof ne=="object"&&!Array.isArray(ne)){N(!1),ee(ne);return}N(!0)}catch{N(!0)}},G=async K=>{const te=vp(K,o);if(te){me.error(te);return}await u(K,{__resolveType:a.resolveType,..._}),R(!1)},J=()=>{M(!0),U.mutate({resolveType:a.resolveType,props:_})},oe=()=>{n&&window.open(JH(n,a.resolveType,_,Date.now()),"_blank","noopener")},le=[a.title,...w],Q=K=>{S(w.slice(0,K)),j(te=>te+1)};return r.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&r.jsx(ae,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":m("sandbox.runnableBlockEditor.backToList"),children:r.jsx(b0,{size:14})}),r.jsx("nav",{"aria-label":m("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:le.map((K,te)=>{const ne=te===le.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[te>0&&r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>Q(te),title:K,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ne?"font-medium text-foreground":"text-muted-foreground"),children:K})]},`${K}-${te}`)})}),a.mode==="saved"&&r.jsx(hX,{isPending:F,isError:!1}),r.jsxs(ae,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:U.isPending,"aria-label":m("sandbox.runnableBlockEditor.runAriaLabel",{singular:H}),children:[U.isPending?r.jsx(it,{size:14,className:"animate-spin"}):r.jsx(So,{size:14}),m("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>R(!0),"aria-label":m("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:H}),children:r.jsx(g1,{size:14})})}),r.jsx(qe,{side:"bottom",children:m("sandbox.runnableBlockEditor.saveAsGlobal",{singular:H})})]}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:O?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:X,"aria-label":m(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":O,children:O?r.jsx(hs,{size:14}):r.jsx($o,{size:14})})}),r.jsx(qe,{side:"bottom",children:m(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?m("sandbox.runnableBlockEditor.savedModeDescription",{singular:H}):m("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:W,singular:H})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:ie("relative min-h-0 flex-1",E&&I&&"hidden"),children:[r.jsx(Yr,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[v&&y===v&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:m("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:H})}),y?r.jsx(gr,{schema:y,value:_,onChange:K=>ee(K),basePath:"",breadcrumbPath:w,onBreadcrumbChange:S,meta:i,decofile:o,onSaveReferencedBlock:h,sandbox:q},k):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:b?m("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:H}):m("sandbox.runnableBlockEditor.noInputEmptyState",{singular:H})})]})})}),C!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[T&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:m("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Qc,{language:"json",height:"100%",code:C,onChange:Y,onSave:K=>{Y(K),B()}})})]})]}),E&&r.jsx(mX,{singular:H,result:{isPending:U.isPending,error:U.error,data:U.data,hasRun:U.status!=="idle"},expanded:I,onToggleExpand:()=>$(K=>!K),onOpenInNewTab:n?oe:void 0,onClose:()=>{M(!1),$(!1)}})]}),r.jsx(yp,{open:P,onOpenChange:R,defaultBlockId:"",isPending:d,onSubmit:G})]})}function mX(t){const e=z.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,onOpenInNewTab:l,onClose:a}=t,c=se();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=ie("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=r.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&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(hn,{size:14})})}),r.jsx(qe,{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?r.jsx(US,{size:14}):r.jsx(f5,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==o||e[19]!==x||e[20]!==b?(v=r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-7",onClick:o,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=o,e[19]=x,e[20]=b,e[21]=v):v=e[21];let y;e[22]!==i||e[23]!==c?(y=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=y):y=e[24];let _;e[25]!==y?(_=r.jsx(qe,{side:"bottom",children:y}),e[25]=y,e[26]=_):_=e[26];let L;e[27]!==_||e[28]!==v?(L=r.jsxs(Ge,{children:[v,_]}),e[27]=_,e[28]=v,e[29]=L):L=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(hs,{size:14}),e[32]=S):S=e[32];let k;e[33]!==a||e[34]!==w?(k=r.jsx(ae,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":w,children:S}),e[33]=a,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==L||e[37]!==k||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,L,k]}),e[36]=L,e[37]=k,e[38]=g,e[39]=j):j=e[39];let T;e[40]!==j||e[41]!==p?(T=r.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]=T):T=e[42];let N;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(N=r.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?r.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[r.jsx(it,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?r.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[r.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?r.jsx(Qc,{language:"json",height:"100%",code:u,readOnly:!0}):r.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]=N):N=e[49];let C;return e[50]!==T||e[51]!==N||e[52]!==f?(C=r.jsxs("div",{className:f,children:[T,N]}),e[50]=T,e[51]=N,e[52]=f,e[53]=C):C=e[53],C}const pX={loaders:_u,actions:$i},gX={loaders:"Loaders",actions:"Actions"},xX={analytics:Sk,blog:Pl,commerce:O1,site:KS,website:kn};function bX(t,e){return e===0?xX[t.toLowerCase()]??Di:Di}function Jd(t,e){return e===0?SW(t):t}function vX(t){const e=z.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c}=t,d=se();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=V.useState(u),[m,p]=V.useState(null),[g,x]=V.useState(""),[b,v]=V.useState(CX),[y,_]=V.useState(c);y!==c&&(_(c),f([]),p(null),x(""),v(new Set));let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=U=>{v(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=L):L=e[1];const w=L;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=e9(S);let j;e[6]!==k?(j=Q8((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const T=j;let N;e[8]!==c?(N=z8(c),e[8]=c,e[9]=N):N=e[9];const C=N,A=pX[c];let P,R,E,M,I,$,O;if(e[10]!==A||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==o||e[19]!==k||e[20]!==T||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){E=Symbol.for("react.early_return_sentinel");e:{const U=[...kW(l,a,c).map(jX),...F8(l,c).map(kX)],H=g.trim().toLowerCase(),W=H.length>0,q=W?U.filter(be=>be.title.toLowerCase().includes(H)||be.resolveType.toLowerCase().includes(H)):[],ee=new Map,X=[],Y=new Map;if(!W){for(const be of U){const Ee=be.folderPath;if(!(Ee.length<h.length)&&h.every((_e,Ae)=>Ee[Ae]===_e))if(Ee.length===h.length)if(be.savedKey!==void 0){const _e=Y.get(be.resolveType);_e?_e.push(be):Y.set(be.resolveType,[be])}else X.push(be);else{const _e=Ee[h.length],Ae=ee.get(_e)??{count:0,savedCount:0};be.savedKey!==void 0?Ae.savedCount=Ae.savedCount+1:Ae.count=Ae.count+1,ee.set(_e,Ae)}}X.sort(SX);for(const be of Y.values())be.sort(wX)}const G=[...Y.entries()].filter(be=>{const[Ee]=be;return!X.some(_e=>_e.resolveType===Ee)}).flatMap(LX).sort(_X);let J;e[33]!==h?(J=(be,Ee)=>Jd(be.name,h.length).localeCompare(Jd(Ee.name,h.length)),e[33]=h,e[34]=J):J=e[34];const oe=[...ee.entries()].map(yX).sort(J);let le;e[35]===Symbol.for("react.memo_cache_sentinel")?(le=be=>{p(be.savedKey!==void 0?{mode:"saved",key:be.savedKey}:{mode:"available",resolveType:be.resolveType,title:be.title})},e[35]=le):le=e[35];const Q=le;let K;e[36]!==k||e[37]!==C||e[38]!==d?(K=async(be,Ee)=>{await k.mutateAsync({blockKey:be,data:Ee}),me.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:be})),p({mode:"saved",key:be})},e[36]=k,e[37]=C,e[38]=d,e[39]=K):K=e[39];const te=K;let ne;e[40]!==a||e[41]!==m?(ne=NX(m,a),e[40]=a,e[41]=m,e[42]=ne):ne=e[42];const re=ne;if(re){const be=`${re.mode}:${re.mode==="saved"?re.blockKey:re.resolveType}`;let Ee;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ee=()=>p(null),e[43]=Ee):Ee=e[43];let _e;e[44]!==i||e[45]!==a||e[46]!==te||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==k.isPending||e[52]!==T||e[53]!==be||e[54]!==re.editorTarget||e[55]!==re.initialValue||e[56]!==n?(_e=r.jsx(fX,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:re.editorTarget,initialValue:re.initialValue,isCreating:k.isPending,onCreate:te,onSaveReferencedBlock:T,onBack:Ee},be),e[44]=i,e[45]=a,e[46]=te,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=k.isPending,e[52]=T,e[53]=be,e[54]=re.editorTarget,e[55]=re.initialValue,e[56]=n,e[57]=_e):_e=e[57],E=_e;break e}O="flex h-full w-full min-w-0 flex-col";let he;e[58]!==d?(he=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=he):he=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>f([]),e[60]=pe):pe=e[60];const de=h.length===0?"font-medium text-foreground":"text-muted-foreground";let Z;e[61]!==de?(Z=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",de),e[61]=de,e[62]=Z):Z=e[62];const fe=gX[c];let ue;e[63]!==Z||e[64]!==fe?(ue=r.jsx("button",{type:"button",onClick:pe,className:Z,children:fe}),e[63]=Z,e[64]=fe,e[65]=ue):ue=e[65];let ye;e[66]!==h?(ye=h.map((be,Ee)=>{const _e=Ee===h.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Ee+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:Jd(be,Ee)})]},`${be}-${Ee}`)}),e[66]=h,e[67]=ye):ye=e[67];let Le;e[68]!==he||e[69]!==ue||e[70]!==ye?(Le=r.jsxs("nav",{"aria-label":he,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[ue,ye]}),e[68]=he,e[69]=ue,e[70]=ye,e[71]=Le):Le=e[71];let Re;e[72]===Symbol.for("react.memo_cache_sentinel")?(Re=r.jsx(C0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Re):Re=e[72];let De;e[73]===Symbol.for("react.memo_cache_sentinel")?(De=be=>x(be.target.value),e[73]=De):De=e[73];let Ue;e[74]!==c||e[75]!==d?(Ue=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Ue):Ue=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 je;e[80]!==g||e[81]!==Ue||e[82]!==$e?(je=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Re,r.jsx("input",{type:"text",value:g,onChange:De,placeholder:Ue,"aria-label":$e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Ue,e[82]=$e,e[83]=je):je=e[83],e[84]!==Le||e[85]!==je?(R=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Le,je]}),e[84]=Le,e[85]=je,e[86]=R):R=e[86],P=Yr,$="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=W?q.length===0?r.jsx(Dr,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):r.jsx("div",{className:"flex flex-col gap-1",children:q.map(be=>r.jsx(Yn,{icon:A,accent:be.savedKey!==void 0?"global":void 0,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>Q(be)},be.savedKey??be.resolveType))}):oe.length===0&&X.length===0&&G.length===0?r.jsx(Dr,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[oe.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:oe.map(be=>{const Ee=bX(be.name,h.length);return r.jsxs("button",{type:"button",onClick:()=>f([...h,be.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:[r.jsx(Ee,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:Jd(be.name,h.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[be.count," ",be.count===1?C:c,be.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:be.savedCount})]})]})]})]},be.name)})}),(X.length>0||G.length>0)&&r.jsxs("div",{className:ie("flex flex-col gap-1",oe.length>0&&"mt-4"),children:[X.map(be=>{const Ee=Y.get(be.resolveType)??[],_e=b.has(be.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(Yn,{icon:A,title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>Q(be)}),Ee.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>w(be.resolveType),"aria-expanded":_e,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:fm},children:[_e?r.jsx(fs,{size:12,className:"shrink-0"}):r.jsx(wn,{size:12,className:"shrink-0"}),d(_e?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ee.length,")"]}),_e&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ee.map(Ae=>r.jsx(Yn,{icon:A,accent:"global",title:Ae.title,subtitle:Ae.resolveType,active:!1,onClick:()=>Q(Ae)},Ae.savedKey))})]})]},be.resolveType)}),G.map(be=>r.jsx(Yn,{icon:A,accent:"global",title:be.title,subtitle:be.resolveType,active:!1,onClick:()=>Q(be)},be.savedKey))]})]})}e[10]=A,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=o,e[19]=k,e[20]=T,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=P,e[27]=R,e[28]=E,e[29]=M,e[30]=I,e[31]=$,e[32]=O}else P=e[26],R=e[27],E=e[28],M=e[29],I=e[30],$=e[31],O=e[32];if(E!==Symbol.for("react.early_return_sentinel"))return E;let D;e[87]!==M||e[88]!==I?(D=r.jsx("div",{className:M,children:I}),e[87]=M,e[88]=I,e[89]=D):D=e[89];let B;e[90]!==P||e[91]!==D||e[92]!==$?(B=r.jsx(P,{className:$,children:D}),e[90]=P,e[91]=D,e[92]=$,e[93]=B):B=e[93];let F;return e[94]!==R||e[95]!==B||e[96]!==O?(F=r.jsxs("div",{className:O,children:[R,B]}),e[94]=R,e[95]=B,e[96]=O,e[97]=F):F=e[97],F}function yX(t){const[e,s]=t;return{name:e,...s}}function _X(t,e){return t.title.localeCompare(e.title)}function LX(t){const[,e]=t;return e}function wX(t,e){return t.title.localeCompare(e.title)}function SX(t,e){return t.title.localeCompare(e.title)}function kX(t){return{resolveType:t.resolveType,title:t.title,folderPath:U8(t.resolveType)}}function jX(t){return{resolveType:t.resolveType,title:t.title,folderPath:U8(t.resolveType),savedKey:t.key}}function CX(){return new Set}function NX(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 s=e[t.key],n=s&&typeof s.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...o}=s??{},l=s&&typeof s.name=="string"&&s.name?s.name:t.key;return{mode:"saved",blockKey:t.key,resolveType:n,editorTarget:{mode:"saved",blockKey:t.key,resolveType:n,title:l},initialValue:o}}function VX(t){const e=z.c(96),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=se(),g=vr(),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[v,y]=V.useState(b);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[1]=_):_=e[1];const[L,w]=V.useState(_),[S,k]=V.useState(0),[j,T]=V.useState(!1);let N;e[2]!==l||e[3]!==c?(N=ni(c,l),e[2]=l,e[3]=c,e[4]=N):N=e[4];const C=N;let A,P,R,E,M,I,$,O;if(e[5]!==x||e[6]!==i||e[7]!==a||e[8]!==L||e[9]!==v||e[10]!==h||e[11]!==f||e[12]!==s||e[13]!==o||e[14]!==c||e[15]!==p||e[16]!==d||e[17]!==n){const q=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,ee=o??void 0;let X;e[26]!==x||e[27]!==i||e[28]!==s||e[29]!==ee||e[30]!==n?(X={orgSlug:s,virtualMcpId:n,branch:i,previewUrl:ee,siteSlug:x},e[26]=x,e[27]=i,e[28]=s,e[29]=ee,e[30]=n,e[31]=X):X=e[31],P=X;let Y;e[32]!==L||e[33]!==d?(Y=[d,...L],e[32]=L,e[33]=d,e[34]=Y):Y=e[34];const G=Y;let J;e[35]!==L?(J=ue=>{w(L.slice(0,ue)),k(TX)},e[35]=L,e[36]=J):J=e[36];const oe=J;let le;e[37]!==a||e[38]!==v||e[39]!==f?(le=async ue=>{const ye=vp(ue,a);if(ye){me.error(ye);return}await f(ue,v),T(!1)},e[37]=a,e[38]=v,e[39]=f,e[40]=le):le=e[40],A=le,O="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",M="shrink-0 border-b px-3 py-2.5";let Q;e[41]!==p?(Q=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[41]=p,e[42]=Q):Q=e[42];let K;e[43]!==oe||e[44]!==G?(K=G.map((ue,ye)=>{const Le=ye===G.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ye>0&&r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>oe(ye),title:ue,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",Le?"font-medium text-foreground":"text-muted-foreground"),children:ue})]},`${ue}-${ye}`)}),e[43]=oe,e[44]=G,e[45]=K):K=e[45];let te;e[46]!==Q||e[47]!==K?(te=r.jsx("nav",{"aria-label":Q,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:K}),e[46]=Q,e[47]=K,e[48]=te):te=e[48];let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>T(!0),e[49]=ne):ne=e[49];let re;e[50]!==p?(re=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[50]=p,e[51]=re):re=e[51];let he;e[52]===Symbol.for("react.memo_cache_sentinel")?(he=r.jsx(g1,{size:14}),e[52]=he):he=e[52];let pe;e[53]!==h||e[54]!==re?(pe=r.jsx(We,{asChild:!0,children:r.jsx(ae,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:ne,"aria-label":re,children:he})}),e[53]=h,e[54]=re,e[55]=pe):pe=e[55];let de;e[56]!==p?(de=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[56]=p,e[57]=de):de=e[57];let Z;e[58]!==de?(Z=r.jsx(qe,{side:"bottom",children:de}),e[58]=de,e[59]=Z):Z=e[59];let fe;e[60]!==pe||e[61]!==Z?(fe=r.jsxs(Ge,{children:[pe,Z]}),e[60]=pe,e[61]=Z,e[62]=fe):fe=e[62],e[63]!==te||e[64]!==fe?(I=r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[te,fe]}),e[63]=te,e[64]=fe,e[65]=I):I=e[65],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",E=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:q}),e[5]=x,e[6]=i,e[7]=a,e[8]=L,e[9]=v,e[10]=h,e[11]=f,e[12]=s,e[13]=o,e[14]=c,e[15]=p,e[16]=d,e[17]=n,e[18]=A,e[19]=P,e[20]=R,e[21]=E,e[22]=M,e[23]=I,e[24]=$,e[25]=O}else A=e[18],P=e[19],R=e[20],E=e[21],M=e[22],I=e[23],$=e[24],O=e[25];let D;e[66]!==R||e[67]!==E?(D=r.jsx("p",{className:R,children:E}),e[66]=R,e[67]=E,e[68]=D):D=e[68];let B;e[69]!==D||e[70]!==M||e[71]!==I?(B=r.jsxs("div",{className:M,children:[I,D]}),e[69]=D,e[70]=M,e[71]=I,e[72]=B):B=e[72];let F;e[73]!==a||e[74]!==L||e[75]!==S||e[76]!==v||e[77]!==l||e[78]!==m||e[79]!==P||e[80]!==C||e[81]!==p?(F=r.jsx(Yr,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:C?r.jsx(gr,{schema:C,value:v,onChange:q=>y(q),basePath:"",breadcrumbPath:L,onBreadcrumbChange:w,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:P},S):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[73]=a,e[74]=L,e[75]=S,e[76]=v,e[77]=l,e[78]=m,e[79]=P,e[80]=C,e[81]=p,e[82]=F):F=e[82];let U;e[83]!==B||e[84]!==F||e[85]!==$?(U=r.jsxs("div",{className:$,children:[B,F]}),e[83]=B,e[84]=F,e[85]=$,e[86]=U):U=e[86];let H;e[87]!==u||e[88]!==A||e[89]!==h||e[90]!==j?(H=r.jsx(yp,{open:j,onOpenChange:T,defaultBlockId:u,isPending:h,onSubmit:A}),e[87]=u,e[88]=A,e[89]=h,e[90]=j,e[91]=H):H=e[91];let W;return e[92]!==U||e[93]!==H||e[94]!==O?(W=r.jsxs("div",{className:O,children:[U,H]}),e[92]=U,e[93]=H,e[94]=O,e[95]=W):W=e[95],W}function TX(t){return t+1}function EX(t,e){const s={__resolveType:t},n=L8([s],e)[0];return n?$G(s,n,e):null}function AX({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=se(),d=vr(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=V.useState(()=>EX(l,o)),[f,m]=V.useState(h?.data??{}),[p,g]=V.useState([]),[x,b]=V.useState(0),[v,y]=V.useState(!1),[_,L]=V.useState(null),w=_!==null,{save:S,flush:k}=y8({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?ni(h.resolveType,i):null,T=o[l],N=T?D0(l,T):l,C={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n??void 0,siteSlug:u},A=I=>{m(I),S(l,I)},P=()=>{w?(L(null),y(!1),b(I=>I+1)):L(JSON.stringify(f,null,2))},R=I=>{const $=I??"";try{const O=JSON.parse($);if(O&&typeof O=="object"&&!Array.isArray(O)){y(!1),A(O);return}y(!0)}catch{y(!0)}},E=[N,...p],M=I=>{g(p.slice(0,I)),b($=>$+1)};return r.jsx("div",{className:"flex h-full w-full min-w-0",children:r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:fm},"aria-hidden":!0}),r.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((I,$)=>{const O=$===E.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&r.jsx(wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>M($),title:I,className:ie("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:I})]},`${I}-${$}`)})}),r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:P,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?r.jsx(hs,{size:14}):r.jsx($o,{size:14})})}),r.jsx(qe,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),r.jsxs("div",{className:"relative min-h-0 flex-1",children:[r.jsx(Yr,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:j?r.jsx(gr,{schema:j,value:f,onChange:I=>A(I),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:C},x):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),_!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Qc,{language:"json",height:"100%",code:_,onChange:R,onSave:I=>{R(I),k()}})})]})]})]})})}function PX(t){const e=z.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=se();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=r.jsx(Dr,{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 v;e[7]!==s.title?(v=v7(s.title),e[7]=s.title,e[8]=v):v=e[8];let y;e[9]!==u||e[10]!==s.resolveType?(y=(L,w)=>u(s.resolveType,L,w),e[9]=u,e[10]=s.resolveType,e[11]=y):y=e[11];let _;return e[12]!==o||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]!==v||e[23]!==y||e[24]!==i?(_=r.jsx(VX,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:y,onSaveReferencedBlock:h},g),e[12]=o,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]=v,e[23]=y,e[24]=i,e[25]=_):_=e[25],_}const m=`saved:${s.key}`;let p;return e[26]!==o||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=r.jsx(AX,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=o,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 q3="__all__",G3={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},RX={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Y3=V.forwardRef(function(e,s){const n=z.c(20);let i,o,l,a,c;n[0]!==e?({icon:i,active:o,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=l,n[4]=a,n[5]=c):(i=n[1],o=n[2],l=n[3],a=n[4],c=n[5]);const d=o?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=ie("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=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=n[10];let f;n[11]!==c?(f=c&&r.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=r.jsx(fs,{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=r.jsxs(ae,{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 O7(t){const e=z.c(2),{count:s}=t;let n;return e[0]!==s?(n=r.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 DX(t){const e=z.c(88),{categories:s,authors:n,categoryFilter:i,authorFilter:o,sort:l,onCategoryFilterChange:a,onAuthorFilterChange:c,onSortChange:d}=t,u=se();let h;if(e[0]!==s||e[1]!==i){let J;e[3]!==i?(J=oe=>oe.slug===i,e[3]=i,e[4]=J):J=e[4],h=s.find(J),e[0]=s,e[1]=i,e[2]=h}else h=e[2];const f=h;let m;if(e[5]!==o||e[6]!==n){let J;e[8]!==o?(J=oe=>oe.email===o,e[8]=o,e[9]=J):J=e[9],m=n.find(J),e[5]=o,e[6]=n,e[7]=m}else m=e[7];const p=m,g=!!(i||o);let x;e[10]!==p?.name||e[11]!==f?.name||e[12]!==u?(x=f?.name??p?.name??u("sandbox.postToolbar.filterLabel"),e[10]=p?.name,e[11]=f?.name,e[12]=u,e[13]=x):x=e[13];const b=x,v=i?`cat:${i}`:o?`author:${o}`:q3;let y;e[14]!==c||e[15]!==a?(y=()=>{a(null),c(null)},e[14]=c,e[15]=a,e[16]=y):y=e[16];const _=y;let L;e[17]!==_||e[18]!==c||e[19]!==a?(L=J=>{J.startsWith("cat:")?(c(null),a(J.slice(4))):J.startsWith("author:")?(a(null),c(J.slice(7))):_()},e[17]=_,e[18]=c,e[19]=a,e[20]=L):L=e[20];const w=L;let S;e[21]!==b||e[22]!==g?(S=r.jsx(Gt,{asChild:!0,children:r.jsx(Y3,{icon:HS,active:g,value:b,className:"min-w-0 shrink"})}),e[21]=b,e[22]=g,e[23]=S):S=e[23];let k;e[24]!==u?(k=u("sandbox.postToolbar.filterBy"),e[24]=u,e[25]=k):k=e[25];let j;e[26]!==k?(j=r.jsx(_d,{children:k}),e[26]=k,e[27]=j):j=e[27];let T;e[28]!==u?(T=u("sandbox.postToolbar.allPosts"),e[28]=u,e[29]=T):T=e[29];let N;e[30]!==T?(N=r.jsx(bc,{value:q3,children:T}),e[30]=T,e[31]=N):N=e[31];let C;e[32]!==s.length||e[33]!==u?(C=s.length>0&&r.jsx(_d,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.categoryLabel")}),e[32]=s.length,e[33]=u,e[34]=C):C=e[34];let A;e[35]!==s?(A=s.map(MX),e[35]=s,e[36]=A):A=e[36];let P;e[37]!==n.length||e[38]!==u?(P=n.length>0&&r.jsx(_d,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.authorLabel")}),e[37]=n.length,e[38]=u,e[39]=P):P=e[39];let R;e[40]!==n?(R=n.map(IX),e[40]=n,e[41]=R):R=e[41];let E;e[42]!==v||e[43]!==w||e[44]!==N||e[45]!==C||e[46]!==A||e[47]!==P||e[48]!==R?(E=r.jsxs(wh,{value:v,onValueChange:w,children:[N,C,A,P,R]}),e[42]=v,e[43]=w,e[44]=N,e[45]=C,e[46]=A,e[47]=P,e[48]=R,e[49]=E):E=e[49];let M;e[50]!==E||e[51]!==j?(M=r.jsxs(Yt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[j,E]}),e[50]=E,e[51]=j,e[52]=M):M=e[52];let I;e[53]!==M||e[54]!==S?(I=r.jsxs(qt,{children:[S,M]}),e[53]=M,e[54]=S,e[55]=I):I=e[55];let $;e[56]!==_||e[57]!==g||e[58]!==u?($=g&&r.jsx($X,{label:u("sandbox.postToolbar.clearFilter"),onClick:_}),e[56]=_,e[57]=g,e[58]=u,e[59]=$):$=e[59];const O=RX[l];let D;e[60]!==u||e[61]!==O?(D=u(O),e[60]=u,e[61]=O,e[62]=D):D=e[62];let B;e[63]!==D?(B=r.jsx(Gt,{asChild:!0,children:r.jsx(Y3,{icon:WS,active:!0,value:D})}),e[63]=D,e[64]=B):B=e[64];let F;e[65]!==u?(F=u("sandbox.postToolbar.sortBy"),e[65]=u,e[66]=F):F=e[66];let U;e[67]!==F?(U=r.jsx(_d,{children:F}),e[67]=F,e[68]=U):U=e[68];let H;e[69]!==d?(H=J=>d(J),e[69]=d,e[70]=H):H=e[70];let W;e[71]===Symbol.for("react.memo_cache_sentinel")?(W=Object.keys(G3),e[71]=W):W=e[71];let q;e[72]!==u?(q=W.map(J=>r.jsx(bc,{value:J,children:u(G3[J])},J)),e[72]=u,e[73]=q):q=e[73];let ee;e[74]!==l||e[75]!==H||e[76]!==q?(ee=r.jsx(wh,{value:l,onValueChange:H,children:q}),e[74]=l,e[75]=H,e[76]=q,e[77]=ee):ee=e[77];let X;e[78]!==U||e[79]!==ee?(X=r.jsxs(Yt,{align:"end",className:"w-44",children:[U,ee]}),e[78]=U,e[79]=ee,e[80]=X):X=e[80];let Y;e[81]!==B||e[82]!==X?(Y=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(qt,{children:[B,X]})}),e[81]=B,e[82]=X,e[83]=Y):Y=e[83];let G;return e[84]!==I||e[85]!==$||e[86]!==Y?(G=r.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[I,$,Y]}),e[84]=I,e[85]=$,e[86]=Y,e[87]=G):G=e[87],G}function IX(t){return r.jsxs(bc,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(O7,{count:t.count})]},`author:${t.email}`)}function MX(t){return r.jsxs(bc,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(O7,{count:t.count})]},`cat:${t.slug}`)}function $X(t){const e=z.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(hs,{size:12}),e[0]=i):i=e[0];let o;return e[1]!==s||e[2]!==n?(o=r.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]=o):o=e[3],o}function OX(t){const e=z.c(18),{checked:s,disabled:n,onToggle:i}=t,o=se();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o?(a=o(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=r.jsx(We,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:BX,children:r.jsx(Gl,{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]!==o?(d=o(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=o,e[12]=d):d=e[12];let u;e[13]!==d?(u=r.jsx(qe,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=r.jsxs(Ge,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function BX(t){return t.stopPropagation()}function zX(t){const e=z.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=se();let c;e[0]!==n||e[1]!==i?(c=r.jsx(OX,{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=r.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=r.jsx(Ks,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==h||e[13]!==f?(p=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:o,"aria-label":f,children:m})}),e[11]=o,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=r.jsx(qe,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(Ge,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(hs,{size:14}),e[24]=y):y=e[24];let _;e[25]!==l||e[26]!==v?(_=r.jsx(We,{asChild:!0,children:r.jsx(ae,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:y})}),e[25]=l,e[26]=v,e[27]=_):_=e[27];let L;e[28]!==a?(L=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=L):L=e[29];let w;e[30]!==L?(w=r.jsx(qe,{side:"bottom",children:L}),e[30]=L,e[31]=w):w=e[31];let S;e[32]!==_||e[33]!==w?(S=r.jsxs(Ge,{children:[_,w]}),e[32]=_,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==u?(j=r.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 wa(t){const e=z.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,onViewJson:l,onDelete:a}=t,c=se();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=r.jsx(Hi,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=r.jsx(Gt,{asChild:!0,children:r.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:FX,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(Ze,{onClick:n,children:[r.jsx(d1,{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&&r.jsxs(Ze,{onClick:s,children:[r.jsx(on,{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&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),r.jsxs(Ze,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(S0,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==o||e[15]!==l||e[16]!==c?(g=(o||l)&&r.jsxs(r.Fragment,{children:[r.jsx(ki,{}),o&&r.jsxs(Ze,{onClick:o,children:[r.jsx(S1,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(Ze,{onClick:l,children:[r.jsx($o,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=o,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(ki,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Ks,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let y;e[22]!==a||e[23]!==v?(y=r.jsxs(Ze,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=y):y=e[24];let _;e[25]!==y||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(_=r.jsxs(Yt,{align:"end",className:"w-44",children:[f,m,p,g,x,y]}),e[25]=y,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=_):_=e[30];let L;return e[31]!==_||e[32]!==h?(L=r.jsxs(qt,{children:[h,_]}),e[31]=_,e[32]=h,e[33]=L):L=e[33],L}function FX(t){return t.stopPropagation()}function UX(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function KX(t){const e=new Map;for(const s of t){const n=UX(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 Q3(t){const e=z.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=ie("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]=o):o=e[1];let l;e[2]!==s?(l=r.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:o,children:[l,n]}),e[4]=n,e[5]=o,e[6]=l,e[7]=a):a=e[7],a}const X3=V.lazy(()=>Sn(()=>import("./app-editor-FaPWiBOg.js"),__vite__mapDeps([150,1,2,17,49,50,51,16,3,18,4,5,6,7,8,9,10,11,12,13,14,15,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,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,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,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.AppEditor}))),HX=V.lazy(()=>Sn(()=>import("./post-editor-CRsA4SKG.js"),__vite__mapDeps([151,1,2,5,32,4,6,7,8,9,10,11,12,13,14,15,16,3,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,96,95,152,126,129,145,146,73,106,103,99,123,51,153,49,50,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,154,155,101,102,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,124,125,127,128,130,131,97,132,133,134,135,136,137,138,139,140,141,142,143,144,147,148])).then(t=>({default:t.PostEditor}))),WX=V.lazy(()=>Sn(()=>import("./record-editor-D99pxZjJ.js"),__vite__mapDeps([156,1,2,96,95,50,51,16,3,18,123,154,4,5,6,7,8,9,10,11,12,13,14,15,17,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,155,79,74,73,75,55,56,76,77,78,80,57,81,67,82,83,49,52,53,54,58,59,60,61,62,63,64,65,66,68,69,70,71,72,84,85,86,87,88,89,90,91,92,93,94,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.RecordEditor}))),qX=V.lazy(()=>Sn(()=>import("./category-editor--8nv-lbZ.js"),__vite__mapDeps([157,1,2,10,4,5,6,7,8,9,11,12,13,14,15,16,3,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,107,96,95,153,145,146,73,106,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,154,155,101,102,103,104,105,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,147,148])).then(t=>({default:t.CategoryEditor}))),GX=V.lazy(()=>Sn(()=>import("./bulk-category-panel-BT_WoOli.js"),__vite__mapDeps([158,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,95,50,51,79,74,73,75,55,56,76,77,78,80,57,81,67,82,83,49,52,53,54,58,59,60,61,62,63,64,65,66,68,69,70,71,72,84,85,86,87,88,89,90,91,92,93,94,96,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,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.BulkCategoryPanel}))),YX=V.lazy(()=>Sn(()=>import("./sections-editor-3J6fiIE3.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])).then(t=>({default:t.SectionsEditor}))),QX=V.lazy(()=>Sn(()=>import("./seo-editor-DlrMfO0C.js"),__vite__mapDeps([159,1,2,17,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,98,99,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,97,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.SeoEditor}))),XX=V.lazy(()=>Sn(()=>import("./variant-calendar-DW0WI87W.js"),__vite__mapDeps([160,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,3,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,95,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,96,99,161])).then(t=>({default:t.VariantCalendar}))),JX=V.lazy(()=>Sn(()=>import("./redirect-editor-BpmIW6_k.js"),__vite__mapDeps([162,1,2,129,16,96,95,50,51,3,18,155,7,79,74,73,47,21,75,55,56,76,77,78,80,57,81,67,82,83,49,4,5,6,8,9,10,11,12,13,14,15,17,19,20,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,48,52,53,54,58,59,60,61,62,63,64,65,66,68,69,70,71,72,84,85,86,87,88,89,90,91,92,93,94,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,130,131,97,132,133,134,135,136,99,137,138,139,140,141,142,143,144,145,146,147,148])).then(t=>({default:t.RedirectEditor})));function Z9(t){return t?t.kind==="page"?{collection:"pages",key:t.key,path:t.path}:{collection:"sections",key:t.key}:null}function ZX(t){return t?t.kind==="page"?`page:${t.key}:${t.path}`:`section:${t.key}`:null}function eJ(t){const e=z.c(15),{mode:s}=t,n=s===void 0?"content":s,i=vr(),{currentBranch:o}=Qs(),{org:l}=Me(),a=i?.entity?.id??null,c=jn(),d=Uo(),u=d.previewUrl,h=d.previewState;if(h.kind!=="iframe"){const x=`/${l.slug}/settings/connections`;let b;return e[0]!==d.start||e[1]!==h||e[2]!==x||e[3]!==c.lifecycle||e[4]!==c.phase?(b=r.jsx(lq,{state:h,claimPhase:c.phase,lifecycle:c.lifecycle,onStart:d.start,connectionsHref:x}),e[0]=d.start,e[1]=h,e[2]=x,e[3]=c.lifecycle,e[4]=c.phase,e[5]=b):b=e[5],b}if(!a||!o){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Dr,{title:"Waiting for sandbox context…"}),e[6]=x):x=e[6],x}const f=c.lifecycle.phase,m=f==="running",p=!m&&f!=="clone-failed"&&f!=="install-failed"&&f!=="start-failed"&&f!=="crashed";let g;return e[7]!==o||e[8]!==m||e[9]!==n||e[10]!==l.slug||e[11]!==u||e[12]!==p||e[13]!==a?(g=r.jsx(sJ,{orgSlug:l.slug,virtualMcpId:a,branch:o,previewUrl:u,mode:n,devServerReady:m,sandboxWarming:p}),e[7]=o,e[8]=m,e[9]=n,e[10]=l.slug,e[11]=u,e[12]=p,e[13]=a,e[14]=g):g=e[14],g}const J3=2e3,tJ=15;function Z3(t,e,s,n){return typeof e!="string"||s&&(W8(e,s,n)||t.state.dataUpdateCount>=tJ)?!1:J3}function sJ({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,mode:i,devServerReady:o,sandboxWarming:l}){const a=dp(),c={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n},d=qW(e),{data:u,isLoading:h}=T0(c,{fetchEnabled:o}),[f,m]=V.useState("pages"),[p,g]=V.useState(()=>i==="blocks"?Z9(a.state.target):null),[x,b]=V.useState(()=>i==="blocks"?a.state.editSeoPageKey:null),v=ZX(a.state.target),[y,_]=V.useState(v);if(i==="blocks"&&y!==v){_(v);const ce=Z9(a.state.target);g(ce),(ce?.collection==="pages"||ce?.collection==="sections")&&m(ce.collection)}const[L,w]=V.useState(a.state.editSeoPageKey);if(i==="blocks"&&L!==a.state.editSeoPageKey&&(w(a.state.editSeoPageKey),a.state.editSeoPageKey)){const ce=a.state.target;ce?.kind==="page"&&(m("pages"),g(Z9(ce)),b(ce.key))}const[S,k]=V.useState(""),[j,T]=V.useState(null),[N,C]=V.useState(null),[A,P]=V.useState("date-desc"),[R,E]=V.useState(()=>new Set),[M,I]=V.useState(null),$=()=>{E(new Set),I(null)},O=ce=>{g(ce),b(null),!(i!=="blocks"||!ce)&&(ce.collection==="pages"?a.selectTarget({kind:"page",key:ce.key,path:ce.path}):ce.collection==="sections"&&a.selectTarget({kind:"section",key:ce.key}))},[D,B]=V.useState(f);D!==f&&(B(f),k(""),T(null),C(null),P("date-desc"),E(new Set),I(null));const{data:F,isLoading:U,isFetching:H}=E0(c,{fetchEnabled:o,refetchInterval:ce=>{const Pe=ce.state.data;if(f==="apps"&&p&&p.collection==="apps"){const He=u?.[p.key];return Z3(ce,typeof He?.__resolveType=="string"?He.__resolveType:void 0,Pe)}if(f==="site"&&u){const He=Pe?Ih(u,Pe):null,Qe=u.site,Ne=He?.resolveType??(typeof Qe?.__resolveType=="string"?Qe.__resolveType:void 0);return Z3(ce,Ne,Pe,["seo"])}return!1}}),W=(ce,Pe)=>!W8(ce,F,Pe)&&(U||H),{catalog:q,isLoading:ee}=rq(F??void 0,u??void 0,{enabled:f==="apps"}),X=e9(c),Y=QW(c),G=$q({...c,packagePath:d}),J=Oq({...c,packagePath:d}),[oe,le]=V.useState(null),[Q,K]=V.useState(),[te,ne]=V.useState(null),[re,he]=V.useState(null),[pe,de]=V.useState(null),Z=!u||!F;if(h||U||Z&&l)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})});if(Z)return r.jsx(Dr,{title:"Could not load site data."});const fe=ym(u).sort((ce,Pe)=>ce.name.localeCompare(Pe.name)),ue=Rv(u).sort((ce,Pe)=>ce.from.localeCompare(Pe.from)),ye=_m(u,F),Le=f==="sections"?GA(F):[],Re=Ih(u,F),De=J8(u),Ue=up.some(ce=>De[ce].length>0),$e=rc(f)?De[f]:[],je=(Ue?Ic(u,"categories"):[]).map(({key:ce,payload:Pe})=>{const He=typeof Pe.slug=="string"?Pe.slug:"",Qe=typeof Pe.name=="string"?Pe.name:"";return{slug:He||ce,name:Qe||He||ce}}).filter(ce=>ce.slug).sort((ce,Pe)=>ce.name.localeCompare(Pe.name)),be=f==="posts"&&(R.size>0||M!==null),Ee=be?e7(u).filter(ce=>R.has(ce.key)):[],_e=g3(F,"loaders"),Ae=g3(F,"actions");if(!R0(u,F)&&!Ue&&_e===0&&Ae===0)return r.jsx(Dr,{icon:fn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Ce={pages:fe.length,sections:ye.length,apps:q.length,loaders:_e,actions:Ae,redirects:ue.length,posts:De.posts.length,authors:De.authors.length,categories:De.categories.length},xe=new Set(fe.map(ce=>$r(ce.path))),Se=new Set(fe.map(ce=>ce.name)),we=new Set(ye.map(ce=>ce.name)),ze=async ce=>{const Pe=u[ce.key];if(!Pe)return;const He=j8(u,ce.key),Qe=C8(u,ce.key,Math.max(0,He-1)),Ne=dH(Pe.sections,Qe);if(Ne)try{await X.mutateAsync({blockKey:ce.key,data:{...Pe,sections:Ne}}),me.success(`Variant added to "${ce.name}"`),g({collection:"pages",key:ce.key,path:ce.path})}catch(lt){me.error(lt instanceof Error?lt.message:"Could not add variant")}},Be=()=>{K(void 0),le({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},Xe=ce=>{K(void 0),le({mode:"duplicate",sourceKey:ce.key,initialName:y3(Se,ce.name),initialPath:aq(xe,ce.path)})},Ve=ce=>{K(void 0),le({mode:"rename",sourceKey:ce.key,initialName:ce.name,initialPath:ce.path})},ot=async ce=>{if(!oe)return;const{mode:Pe,sourceKey:He}=oe;try{if(Pe==="create"){let Qe;if(ce.templateKey){const lt=u[ce.templateKey];if(!lt)throw new Error("Selected template no longer exists.");Qe={...lt,name:ce.name,path:ce.path}}else Qe=uq(ce.name,ce.path);const Ne=fq(u,ce.name);await X.mutateAsync({blockKey:Ne,data:Qe}),me.success(`Created "${ce.name}"`),g({collection:"pages",key:Ne,path:ce.path})}else if(Pe==="duplicate"&&He){const Qe=u[He];if(!Qe)throw new Error("Source page not found");const{key:Ne,data:lt}=dq({source:Qe,pages:fe,newName:ce.name,newPath:ce.path});await X.mutateAsync({blockKey:Ne,data:lt}),me.success(`Duplicated as "${ce.name}"`),g({collection:"pages",key:Ne,path:ce.path})}else if(Pe==="rename"&&He){const Qe=u[He];if(!Qe)throw new Error("Page not found");const Ne={...Qe,name:ce.name,path:ce.path};await X.mutateAsync({blockKey:He,data:Ne}),me.success("Page updated"),p?.collection==="pages"&&p.key===He&&g({collection:"pages",key:He,path:ce.path})}le(null)}catch(Qe){K(Qe instanceof Error?Qe.message:"Save failed")}},gt=({path:ce})=>{if(!oe)return null;const Pe=$r(ce);return(oe.mode==="rename"?$r(oe.initialPath):null)!==Pe&&xe.has(Pe)?`A page with path "${ce}" already exists.`:null},ct=async(ce,Pe,He)=>{await X.mutateAsync({blockKey:Pe,data:{...He,name:Pe,__resolveType:ce}}),me.success(`Created section "${Pe}"`),g({collection:"sections",key:Pe})},dt=Q8((ce,Pe)=>X.mutate({blockKey:ce,data:Pe})),mt=async ce=>{const Pe=u[ce.key];if(!Pe){me.error("Section not found.");return}const He=cq(u,ce.key),Qe=y3(we,ce.name),Ne={...Pe,name:Qe};try{await X.mutateAsync({blockKey:He,data:Ne}),me.success(`Duplicated "${ce.name}"`),g({collection:"sections",key:He})}catch(lt){me.error(lt instanceof Error?lt.message:"Duplicate failed")}},ge=async ce=>{if(!te)return;const Pe=u[te];if(!Pe){me.error("Section not found.");return}try{await X.mutateAsync({blockKey:te,data:{...Pe,name:ce}}),me.success("Section renamed"),ne(null)}catch(He){me.error(He instanceof Error?He.message:"Rename failed")}},Ye=async()=>{const ce="/redirect-from",Pe=tP(u,ce),He=JA({from:ce,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await X.mutateAsync({blockKey:Pe,data:He}),me.success("Created redirect"),g({collection:"redirects",key:Pe})}catch(Qe){me.error(Qe instanceof Error?Qe.message:"Could not create redirect")}},tt=async ce=>{const Pe=w3(u,ce),He=Hd(Pe,ce,Vq(ce));try{await G.mutateAsync({blockKey:Pe,data:He}),me.success(`Created ${ic[ce]}`),g({collection:ce,key:Pe})}catch(Qe){me.error(Qe instanceof Error?Qe.message:"Could not create")}},ut=async ce=>{const Pe=u[ce.key];if(!Pe){me.error("Record not found.");return}const He=w3(u,ce.kind),Qe=ce.kind==="posts"?"title":"name",Ne={...structuredClone(uu(Pe,ce.kind)),[Qe]:`${ce.label} (copy)`};try{await G.mutateAsync({blockKey:He,data:Hd(He,ce.kind,Ne)}),me.success(`Duplicated "${ce.label}"`),g({collection:ce.kind,key:He})}catch(lt){me.error(lt instanceof Error?lt.message:"Duplicate failed")}},bt=ce=>{E(Pe=>{const He=new Set(Pe);return He.has(ce)?He.delete(ce):He.add(ce),He})},Vt=ce=>{m("posts"),B("posts"),g(null),b(null),k(""),T(null),C(null),P("date-desc"),E(new Set),I(ce||null)},St=async(ce,Pe)=>{const He=[...R];let Qe=0;for(const Ne of He){const lt=u[Ne],Bt=uu(lt,"posts"),Ns=ce==="add"?jq(Bt,Pe):Cq(Bt,Pe);Ns!==Bt&&(await G.mutateAsync({blockKey:Ne,data:Hd(Ne,"posts",L3(Ns))}),Qe+=1)}return Qe},Tt=async(ce,Pe)=>{const He=R.size;try{const Qe=await St(ce,Pe),Ne=ce==="add"?"Added to":"Moved",lt=He-Qe;me.success(`${Ne} ${Qe} ${Qe===1?"post":"posts"}`+(lt>0?` (${lt} already set)`:"")),$()}catch(Qe){me.error(Qe instanceof Error?Qe.message:"Bulk update failed")}},Kt=async()=>{if(re)try{if(re.kind==="blog-bulk"){for(const Qe of re.keys)await J.mutateAsync({blockKey:Qe});me.success(`Deleted ${re.count} ${re.count===1?"post":"posts"}`),p&&p.collection!=="available-section"&&re.keys.includes(p.key)&&g(null),$(),he(null);return}const{kind:ce,key:Pe,label:He}=re;if(ce==="blog"){if(re.blogKind==="categories"){const Qe=uu(u[Pe],"categories").slug,Ne=typeof Qe=="string"?Qe:"";if(Ne)for(const{key:lt,payload:Bt}of Ic(u,"posts")){const Ns=Nq(Bt,Ne);Ns!==Bt&&await G.mutateAsync({blockKey:lt,data:Hd(lt,"posts",L3(Ns))})}}await J.mutateAsync({blockKey:Pe})}else await Y.mutateAsync({blockKey:Pe});me.success(`Deleted "${He}"`),p&&p.collection!=="available-section"&&p.key===Pe&&g(null),he(null)}catch(ce){me.error(ce instanceof Error?ce.message:"Delete failed")}},es=Y.isPending||J.isPending||G.isPending,Mt=re?.kind==="blog"?ic[re.blogKind]:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"}`:re?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[i==="content"&&r.jsx(oq,{active:f,counts:Ce,showBlog:Ue,onSelect:ce=>{m(ce),g(null),b(null)}}),f!=="seo"&&f!=="site"&&f!=="calendar"&&f!=="loaders"&&f!=="actions"&&r.jsx(nJ,{blocksMode:i==="blocks",activeCollection:f,pages:fe,redirects:ue,sections:ye,availableSections:Le,appCatalog:q,appCatalogLoading:ee,blogEntries:$e,decofile:u,searchQuery:S,onSearchChange:k,postCategoryFilter:j,postAuthorFilter:N,postSort:A,onPostCategoryFilterChange:ce=>{T(ce),E(new Set)},onPostAuthorFilterChange:ce=>{C(ce),E(new Set)},onPostSortChange:P,selectedPostKeys:R,postBulkPanelOpen:be,onTogglePostSelect:bt,onSelectAllPosts:ce=>E(new Set(ce)),onClearPostSelection:()=>E(new Set),onExitPostSelection:$,onBulkDeletePosts:()=>he({kind:"blog-bulk",keys:[...R],count:R.size}),selection:p,onSelect:O,onCollectionSelect:ce=>{m(ce),g(null),b(null)},onCreate:()=>{f==="pages"?Be():f==="redirects"?Ye():rc(f)&&tt(f)},onDuplicatePage:Xe,onRenamePage:Ve,onAddPageVariant:ze,onDeletePage:ce=>he({kind:"page",key:ce.key,label:ce.name}),onEditPageSeo:ce=>{const Pe={collection:"pages",key:ce.key,path:ce.path};g(Pe),b(ce.key),i==="blocks"&&a.editSeo({kind:"page",key:ce.key,path:ce.path})},onViewPageJson:ce=>de(ce.key),onDuplicateSection:mt,onRenameSection:ce=>ne(ce.key),onDeleteSection:ce=>he({kind:"section",key:ce.key,label:ce.name}),onDeleteRedirect:ce=>he({kind:"redirect",key:ce.key,label:ce.from||ce.key}),onDuplicateBlog:ut,onDeleteBlog:ce=>he({kind:"blog",blogKind:ce.kind,key:ce.key,label:ce.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?r.jsx(vX,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:F,decofile:u,kind:f}):r.jsx(V.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(it,{size:20,className:"animate-spin text-muted-foreground"})}),children:f==="calendar"?r.jsx(XX,{decofile:u}):f==="site"?Re?r.jsx(X3,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:Re.key,block:u[Re.key],decofile:u,meta:F,title:"Site",excludeFields:["seo"],schemaPending:W(Re.resolveType,["seo"]),previewBaseUrl:n},`site:${Re.key}`):r.jsx(Dr,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="seo"?r.jsx(QX,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:F,target:{kind:"site"},previewBaseUrl:n}):f==="sections"?r.jsx(PX,{selection:p?.collection==="sections"||p?.collection==="available-section"?p:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:F,decofile:u,isCreating:X.isPending,onCreateAvailable:ct,onSaveReferencedBlock:dt}):be?r.jsx(GX,{posts:Ee,categories:je,initialSlug:M,isPending:G.isPending,onApply:(ce,Pe)=>{Tt(ce,Pe)},onClose:$},M??"selection"):p&&p.collection!=="available-section"?p.collection==="apps"?r.jsx(X3,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key],decofile:u,meta:F,previewBaseUrl:n,schemaPending:W(typeof u[p.key]?.__resolveType=="string"?String(u[p.key].__resolveType):void 0)},`app:${p.key}`):p.collection==="posts"?r.jsx(HX,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key],decofile:u,meta:F,previewBaseUrl:n},`post:${p.key}`):p.collection==="categories"?r.jsx(qX,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key],decofile:u,meta:F,onManagePosts:Vt,onOpenPost:ce=>{m("posts"),B("posts"),g({collection:"posts",key:ce}),b(null)},previewBaseUrl:n},`category:${p.key}`):p.collection==="authors"?r.jsx(WX,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:p.key,block:u[p.key]},`authors:${p.key}`):p.collection==="redirects"?r.jsx(JX,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:p.key,block:u[p.key]},`redirect:${p.key}`):r.jsx(YX,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:p.collection==="pages"?p.path:"/",activePageBlockKey:p.collection==="pages"?p.key:null,activeGlobalBlockKey:p.collection==="sections"?p.key:null,initialEditSeo:p.collection==="pages"&&x===p.key,onExitSeo:()=>{b(null),i==="blocks"&&a.consumeEditSeo()}},p.collection==="pages"?`page:${p.key}`:`section:${p.key}`):r.jsx(Dr,{title:`Select ${rc(f)?`a ${ic[f]}`:f==="pages"?"a page":f==="apps"?"an app":f==="redirects"?"a redirect":"a section"} to edit`,description:f==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),oe&&r.jsx(xq,{open:!!oe,mode:oe.mode,initialName:oe.initialName,initialPath:oe.initialPath,isPending:X.isPending,error:Q,templates:fe,validate:gt,onSubmit:ot,onOpenChange:ce=>{ce||(le(null),K(void 0))}}),te&&r.jsx(bq,{open:!!te,blockKey:te,initialName:ye.find(ce=>ce.key===te)?.name??te,isPending:X.isPending,onSubmit:ge,onOpenChange:ce=>{ce||ne(null)}}),pe&&r.jsx(Bq,{open:!!pe,onOpenChange:ce=>{ce||de(null)},pageKey:pe,decofile:u,onSave:ce=>X.mutateAsync({blockKey:pe,data:ce})}),r.jsx(vc,{open:!!re,onOpenChange:ce=>{!ce&&!es&&he(null)},children:r.jsxs(yc,{children:[r.jsxs(_c,{children:[r.jsx(Lc,{children:`Delete ${Mt}?`}),r.jsx(wc,{children:re?.kind==="section"?`"${re.label}" will be removed. Pages that still reference it will lose this section.`:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:re?`"${re.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(Sc,{children:[r.jsx(kc,{disabled:es,children:"Cancel"}),r.jsx(jc,{onClick:ce=>{ce.preventDefault(),Kt()},disabled:es,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:es?r.jsxs(r.Fragment,{children:[r.jsx(it,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function nJ(t){const e=z.c(88),{blocksMode:s,activeCollection:n,pages:i,redirects:o,sections:l,availableSections:a,appCatalog:c,appCatalogLoading:d,blogEntries:u,decofile:h,searchQuery:f,onSearchChange:m,postCategoryFilter:p,postAuthorFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostSortChange:y,selectedPostKeys:_,postBulkPanelOpen:L,onTogglePostSelect:w,onSelectAllPosts:S,onClearPostSelection:k,onExitPostSelection:j,onBulkDeletePosts:T,selection:N,onSelect:C,onCollectionSelect:A,onCreate:P,onDuplicatePage:R,onRenamePage:E,onAddPageVariant:M,onDeletePage:I,onEditPageSeo:$,onViewPageJson:O,onDuplicateSection:D,onRenameSection:B,onDeleteSection:F,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let q,ee,X,Y,G,J,oe,le;if(e[0]!==n||e[1]!==c||e[2]!==d||e[3]!==a||e[4]!==s||e[5]!==u||e[6]!==h||e[7]!==M||e[8]!==T||e[9]!==k||e[10]!==A||e[11]!==P||e[12]!==W||e[13]!==I||e[14]!==U||e[15]!==F||e[16]!==H||e[17]!==R||e[18]!==D||e[19]!==$||e[20]!==j||e[21]!==v||e[22]!==b||e[23]!==y||e[24]!==E||e[25]!==B||e[26]!==m||e[27]!==C||e[28]!==S||e[29]!==w||e[30]!==O||e[31]!==i||e[32]!==g||e[33]!==L||e[34]!==p||e[35]!==x||e[36]!==o||e[37]!==f||e[38]!==l||e[39]!==_||e[40]!==N){const ne=f.toLowerCase(),re=i.filter(ge=>!ne||ge.name.toLowerCase().includes(ne)||ge.path.toLowerCase().includes(ne)),he=o.filter(ge=>!ne||ge.from.toLowerCase().includes(ne)||ge.to.toLowerCase().includes(ne)),pe=l.filter(ge=>!ne||ge.name.toLowerCase().includes(ne)||ge.key.toLowerCase().includes(ne)||ge.resolveType.toLowerCase().includes(ne)),de=a.filter(ge=>!ne||ge.title.toLowerCase().includes(ne)||ge.resolveType.toLowerCase().includes(ne)||(ge.description?.toLowerCase().includes(ne)??!1)),Z=KX(pe),fe=c.filter(ge=>!ne||ge.title.toLowerCase().includes(ne)||ge.app.toLowerCase().includes(ne)||ge.vendor.toLowerCase().includes(ne)||ge.category.toLowerCase().includes(ne)),ue=u.filter(ge=>!ne||ge.label.toLowerCase().includes(ne)||ge.subtitle.toLowerCase().includes(ne)),ye=n==="posts",Le=lJ,Re=ye?e7(h):[],De=new Map,Ue=new Map;for(const ge of Re){for(const Ye of ge.categorySlugs)De.set(Ye,(De.get(Ye)??0)+1);for(const Ye of ge.authorEmails)Ue.set(Ye,(Ue.get(Ye)??0)+1)}const $e=(ye?Ic(h,"categories"):[]).map(ge=>{const{key:Ye,payload:tt}=ge,ut=Le(tt.slug)||Ye;return{slug:ut,name:Le(tt.name)||Le(tt.slug)||Ye,count:De.get(ut)??0}}).filter(oJ),je=(ye?Ic(h,"authors"):[]).map(ge=>{const{key:Ye,payload:tt}=ge,ut=Le(tt.email);return{email:ut,name:Le(tt.name)||Le(tt.email)||Ye,count:Ue.get(ut)??0}}).filter(rJ);let be;e[49]!==p?(be=ge=>!p||ge.categorySlugs.includes(p),e[49]=p,e[50]=be):be=e[50];let Ee;e[51]!==g?(Ee=ge=>!g||ge.authorEmails.includes(g),e[51]=g,e[52]=Ee):Ee=e[52];let _e;e[53]!==x?(_e=(ge,Ye)=>{if(x==="az")return ge.title.localeCompare(Ye.title);if(x==="za")return Ye.title.localeCompare(ge.title);const tt=ge.date.localeCompare(Ye.date);return x==="date-asc"?tt:-tt},e[53]=x,e[54]=_e):_e=e[54];const Ae=Re.filter(ge=>!ne||ge.title.toLowerCase().includes(ne)||ge.slug.toLowerCase().includes(ne)).filter(be).filter(Ee).sort(_e),Ce=_.size,xe=Ae.map(iJ),Se=xe.length>0&&xe.every(ge=>_.has(ge)),we=Ce>0||L,ze=()=>{Se?k():S(xe)},Be=`Search ${n}…`,Xe=rc(n)?`Create new ${ic[n]}`:n==="redirects"?"Create new redirect":"Create new page",Ve=n!=="apps"&&n!=="sections",ot=s?"w-[240px]":"w-[300px]";e[55]!==ot?(G=ie("shrink-0 border-r flex flex-col min-h-0",ot),e[55]=ot,e[56]=G):G=e[56],e[57]!==n||e[58]!==s||e[59]!==A?(J=s&&r.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[r.jsxs(ae,{variant:n==="pages"?"secondary":"ghost",size:"sm",className:"h-7 flex-1",onClick:()=>A("pages"),children:[r.jsx(or,{size:14}),"Pages"]}),r.jsxs(ae,{variant:n==="sections"?"secondary":"ghost",size:"sm",className:"h-7 flex-1",onClick:()=>A("sections"),children:[r.jsx(Vi,{size:14}),"Sections"]})]}),e[57]=n,e[58]=s,e[59]=A,e[60]=J):J=e[60];let gt;e[61]===Symbol.for("react.memo_cache_sentinel")?(gt=r.jsx(C0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[61]=gt):gt=e[61];let ct;e[62]!==m?(ct=ge=>m(ge.target.value),e[62]=m,e[63]=ct):ct=e[63];let dt;e[64]!==Be||e[65]!==f||e[66]!==ct?(dt=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[gt,r.jsx("input",{type:"text",value:f,onChange:ct,placeholder:Be,"aria-label":Be,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[64]=Be,e[65]=f,e[66]=ct,e[67]=dt):dt=e[67];let mt;e[68]!==Xe||e[69]!==P||e[70]!==Ve?(mt=Ve&&r.jsxs(Ge,{children:[r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",onClick:P,"aria-label":Xe,children:r.jsx(Nt,{size:14})})}),r.jsx(qe,{side:"bottom",children:Xe})]}),e[68]=Xe,e[69]=P,e[70]=Ve,e[71]=mt):mt=e[71],e[72]!==dt||e[73]!==mt?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[dt,mt]}),e[72]=dt,e[73]=mt,e[74]=oe):oe=e[74],le=ye&&(we?r.jsx(zX,{count:Ce,allSelected:Se,onToggleSelectAll:ze,onDelete:T,onExit:j}):r.jsx(DX,{categories:$e,authors:je,categoryFilter:p,authorFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onSortChange:y})),q=Yr,Y="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",ee="flex flex-col gap-1 p-1.5",X=n==="pages"?re.length===0?r.jsx(hl,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):re.map(ge=>{const Ye=N?.collection==="pages"&&N.key===ge.key,tt=j8(h,ge.key);return r.jsx(Yn,{icon:or,title:ge.name,subtitle:ge.path,active:Ye,variantCount:tt,onClick:()=>C({collection:"pages",key:ge.key,path:ge.path}),menu:r.jsx(wa,{onDuplicate:()=>R(ge),onRename:()=>E(ge),onAddVariant:()=>M(ge),onEditSeo:()=>$(ge),onViewJson:()=>O(ge),onDelete:()=>I(ge)})},ge.key)}):n==="sections"?pe.length===0&&de.length===0?r.jsx(hl,{hasItems:l.length>0||a.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):r.jsxs(r.Fragment,{children:[Z.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Q3,{icon:Vi,label:"Saved sections"}),Z.map(ge=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ge.label}),ge.sections.map(Ye=>{const tt=N?.collection==="sections"&&N.key===Ye.key;return r.jsx(Yn,{icon:Vi,accent:"global",title:Ye.name,subtitle:ge.label,active:tt,onClick:()=>C({collection:"sections",key:Ye.key}),menu:r.jsx(wa,{onDuplicate:()=>D(Ye),onRename:()=>B(Ye),onDelete:()=>F(Ye)})},Ye.key)})]},ge.label))]}),de.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Q3,{icon:or,label:"Available sections",className:ie(Z.length>0&&"mt-3")}),de.map(ge=>{const Ye=N?.collection==="available-section"&&N.resolveType===ge.resolveType,tt=ge.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(Yn,{icon:or,title:ge.title,subtitle:tt??ge.resolveType,active:Ye,onClick:()=>C({collection:"available-section",resolveType:ge.resolveType,title:ge.title})},ge.resolveType)})]})]}):n==="apps"?d?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(it,{size:18,className:"animate-spin text-muted-foreground"})}):fe.length===0?r.jsx(hl,{hasItems:c.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):fe.map(ge=>{const Ye=N?.collection==="apps"&&ge.blockKey!==null&&N.key===ge.blockKey;return r.jsx(Yn,{icon:F5,logoUrl:ge.logo,title:ge.title,subtitle:ge.category,active:Ye,trailing:ge.installed?r.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(!ge.installed||!ge.blockKey){me.message(`${ge.title} is not installed on this site.`);return}C({collection:"apps",key:ge.blockKey})}},ge.id)}):n==="redirects"?he.length===0?r.jsx(hl,{hasItems:o.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):he.map(ge=>r.jsx(Yn,{icon:v5,title:ge.from||"(no source)",subtitle:`→ ${ge.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===ge.key,trailing:r.jsx(vq,{type:ge.type}),onClick:()=>C({collection:"redirects",key:ge.key}),menu:r.jsx(wa,{onDelete:()=>U(ge)})},ge.key)):ye?Ae.length===0?r.jsx(hl,{hasItems:Re.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ae.map(ge=>{const Ye={key:ge.key,kind:"posts",label:ge.title,subtitle:ge.slug};return r.jsx(Yn,{icon:Ri,title:ge.title,subtitle:ge.slug||"no slug",invalid:ge.missing.length>0,invalidReason:`Missing: ${ge.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===ge.key,selectable:!0,selectionActive:we,selected:_.has(ge.key),onToggleSelect:()=>w(ge.key),onClick:()=>we?w(ge.key):C({collection:"posts",key:ge.key}),menu:r.jsx(wa,{onDuplicate:()=>H(Ye),onDelete:()=>W(Ye)})},ge.key)}):ue.length===0?r.jsx(hl,{hasItems:u.length>0,emptyLabel:`No ${n} yet.`,emptyHint:`Click "+" to create your first ${rc(n)?ic[n]:"item"}.`}):ue.map(ge=>{const Ye=N?.collection===ge.kind&&N.key===ge.key;return r.jsx(Yn,{icon:ge.kind==="posts"?Ri:ge.kind==="authors"?F1:_1,title:ge.label,subtitle:ge.subtitle,active:Ye,onClick:()=>C({collection:ge.kind,key:ge.key}),menu:r.jsx(wa,{onDuplicate:()=>H(ge),onDelete:()=>W(ge)})},ge.key)}),e[0]=n,e[1]=c,e[2]=d,e[3]=a,e[4]=s,e[5]=u,e[6]=h,e[7]=M,e[8]=T,e[9]=k,e[10]=A,e[11]=P,e[12]=W,e[13]=I,e[14]=U,e[15]=F,e[16]=H,e[17]=R,e[18]=D,e[19]=$,e[20]=j,e[21]=v,e[22]=b,e[23]=y,e[24]=E,e[25]=B,e[26]=m,e[27]=C,e[28]=S,e[29]=w,e[30]=O,e[31]=i,e[32]=g,e[33]=L,e[34]=p,e[35]=x,e[36]=o,e[37]=f,e[38]=l,e[39]=_,e[40]=N,e[41]=q,e[42]=ee,e[43]=X,e[44]=Y,e[45]=G,e[46]=J,e[47]=oe,e[48]=le}else q=e[41],ee=e[42],X=e[43],Y=e[44],G=e[45],J=e[46],oe=e[47],le=e[48];let Q;e[75]!==ee||e[76]!==X?(Q=r.jsx("div",{className:ee,children:X}),e[75]=ee,e[76]=X,e[77]=Q):Q=e[77];let K;e[78]!==q||e[79]!==Y||e[80]!==Q?(K=r.jsx(q,{className:Y,children:Q}),e[78]=q,e[79]=Y,e[80]=Q,e[81]=K):K=e[81];let te;return e[82]!==G||e[83]!==J||e[84]!==oe||e[85]!==le||e[86]!==K?(te=r.jsxs("div",{className:G,children:[J,oe,le,K]}),e[82]=G,e[83]=J,e[84]=oe,e[85]=le,e[86]=K,e[87]=te):te=e[87],te}function iJ(t){return t.key}function rJ(t){return t.email}function oJ(t){return t.slug}function lJ(t){return typeof t=="string"?t:""}function aJ(t){const e=z.c(13),{virtualMcpId:s}=t,n=se(),i=Hs(s),{activeTask:o}=Qs();if(!(Ln(i?.metadata)||Ln(o?.metadata))){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(fn,{size:24,className:"text-muted-foreground/60"}),e[0]=c):c=e[0];let d;e[1]!==n?(d=n("mainPanelTabs.contentTab.noContentToEdit"),e[1]=n,e[2]=d):d=e[2];let u;e[3]!==d?(u=r.jsx("div",{children:d}),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=n("mainPanelTabs.contentTab.connectGithubDescription"),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("div",{className:"text-xs text-muted-foreground/80",children:h}),e[7]=h,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[c,u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}let a;return e[12]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(eJ,{}),e[12]=a):a=e[12],a}const eh={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:Jr},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:cr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:r5}},cJ=["fast","smart","thinking"];function dJ(t){const e=z.c(19),{tier:s,onSelect:n}=t,i=se(),[o,l]=V.useState(!1),a=eh[s].icon;let c;e[0]!==a?(c=r.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=eh[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=r.jsx(fs,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{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=cJ.map(x=>{const b=eh[x],v=b.icon;return r.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[r.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm",children:i(b.labelKey)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&r.jsx(Ut,{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=r.jsx(ys,{align:"start",className:"p-1 w-64",children:r.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==o||e[16]!==f||e[17]!==p?(g=r.jsxs(_s,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function uJ(t){const e=z.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=se(),[a,c]=V.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=r.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]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?r.jsx(V.Suspense,{fallback:r.jsx(ae,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(hJ,{override:i,onOverrideChange:o})}):r.jsx(dJ,{tier:s,onSelect:n}),e[4]=o,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]!==o?(f=v=>{c(v),v||o(null)},e[11]=o,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=r.jsx(Mi,{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=r.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=r.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=r.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 hJ(t){const e=z.c(25),{override:s,onOverrideChange:n}=t,i=se(),o=y0(),l=o[0]?.id??null;let a;e[0]!==l||e[1]!==o||e[2]!==s?.credentialId?(a=o.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=o,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=V.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==o?(u=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=u):u=e[7];const h=u;let f;e[8]!==o||e[9]!==s?(f=s&&o.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]=o,e[9]=s,e[10]=f):f=e[10];const m=f;if(o.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=r.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}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 v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,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=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(ck,{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 B7=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:u1,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:kn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:Pi},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:Jn},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:x0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Di,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:w1},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:d1},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:h1},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Cc},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Di},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:qS}]},{key:"context",headingKey:"automations.automationConfig.context",icon:_u,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:_u},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Pl},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Pl}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Vi,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:N5},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Vi},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:$o}]}],fJ=B7.flatMap(t=>t.tools.map(e=>e.name));function mJ(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function pJ(t){const e=z.c(12),{agentId:s,value:n,onChange:i}=t,o=se();let l;e[0]!==o?(l=o("automations.automationConfig.toolsLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.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]!==o||e[7]!==n?(c=s?r.jsx(V.Suspense,{fallback:r.jsxs(ae,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(u1,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(gJ,{agentId:s,value:n,onChange:i})}):r.jsx("span",{className:"text-xs text-muted-foreground italic",children:o("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=o,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=r.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 ex(t){const e=z.c(17),{value:s,checked:n,onToggle:i,title:o,description:l,leading:a}=t;let c;e[0]!==n?(c=r.jsx(Gl,{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&&r.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==o?(u=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&r.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=r.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=r.jsxs(Jt,{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 tx(t){const e=z.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=se(),d=o===l;let u;e[0]!==i||e[1]!==s?(u=s?r.jsx(ai,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(GS,{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=r.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==l?(m=r.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",l]}),e[9]=o,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=y=>{y.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=r.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=r.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 v;return e[23]!==u||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function gJ(t){const e=z.c(83),{agentId:s,value:n,onChange:i}=t,o=se(),{org:l}=Me(),[a,c]=V.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=Pt(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=$1(h),p=Ii();let g,x,b,v,y,_,L,w,S,k,j,T,N;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const E=new Map(p.map(_J)),M=new Map;for(const de of f?.tools??[]){const Z=Ni(de._meta)??"__other__",fe=Fl(de.name,Z==="__other__"?void 0:Z),ue=de.title,ye=ue&&ue!==de.name?ue:mJ(fe);M.has(Z)||M.set(Z,{clientId:Z,conn:E.get(Z),tools:[]}),M.get(Z).tools.push({name:de.name,display:ye,description:de.description})}const I=[...M.values()].sort(yJ),$=(f?.tools??[]).map(vJ),O=[...fJ,...$],D=n===null?new Set(O):new Set(n),B=O.every(de=>D.has(de)),F=de=>i(O.every(Z=>de.has(Z))?null:[...de]),U=de=>{const Z=new Set(D);Z.has(de)?Z.delete(de):Z.add(de),F(Z)},H=(de,Z)=>{const fe=new Set(D);for(const ue of de)Z?fe.add(ue):fe.delete(ue);F(fe)};v=_s,N=a,y=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsx(u1,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let q;e[27]!==B||e[28]!==o?(q=o(B?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=B,e[28]=o,e[29]=q):q=e[29];const ee=!B&&r.jsxs(lj,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[D.size,"/",O.length]});let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx(fs,{size:14,className:"text-muted-foreground"}),e[30]=X):X=e[30],e[31]!==q||e[32]!==ee?(_=r.jsx(us,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,q,ee,X]})}),e[31]=q,e[32]=ee,e[33]=_):_=e[33],b=ys,j="p-0 w-80",T="start",x=pr;let Y;e[34]!==o?(Y=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=Y):Y=e[35],e[36]!==Y?(S=r.jsx(Wi,{placeholder:Y}),e[36]=Y,e[37]=S):S=e[37];const G=B?o("automations.automationConfig.allToolsEnabled",{count:O.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:D.size,total:O.length});let J;e[38]!==G?(J=r.jsx("span",{className:"text-xs text-muted-foreground",children:G}),e[38]=G,e[39]=J):J=e[39];let oe;e[40]!==i?(oe=()=>i(null),e[40]=i,e[41]=oe):oe=e[41];let le;e[42]!==o?(le=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=le):le=e[43];let Q;e[44]!==B||e[45]!==oe||e[46]!==le?(Q=r.jsx("button",{type:"button",onClick:oe,disabled:B,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:le}),e[44]=B,e[45]=oe,e[46]=le,e[47]=Q):Q=e[47];let K;e[48]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=K):K=e[48];let te;e[49]!==i?(te=()=>i([]),e[49]=i,e[50]=te):te=e[50];const ne=D.size===0;let re;e[51]!==o?(re=o("automations.automationConfig.clear"),e[51]=o,e[52]=re):re=e[52];let he;e[53]!==te||e[54]!==ne||e[55]!==re?(he=r.jsx("button",{type:"button",onClick:te,disabled:ne,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:re}),e[53]=te,e[54]=ne,e[55]=re,e[56]=he):he=e[56];let pe;e[57]!==Q||e[58]!==he?(pe=r.jsxs("div",{className:"flex items-center gap-2",children:[Q,K,he]}),e[57]=Q,e[58]=he,e[59]=pe):pe=e[59],e[60]!==J||e[61]!==pe?(k=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[J,pe]}),e[60]=J,e[61]=pe,e[62]=k):k=e[62],g=qi,L="max-h-80",w=m?r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("automations.automationConfig.loadingTools")}):r.jsxs(r.Fragment,{children:[r.jsx(si,{children:o("automations.automationConfig.noToolsFound")}),B7.map(de=>{const Z=de.tools.map(bJ),fe=Z.filter(ue=>D.has(ue)).length;return r.jsx(ks,{heading:r.jsx(tx,{label:o(de.headingKey),icon:de.icon,on:fe,total:Z.length,onToggle:()=>H(Z,fe!==Z.length)}),children:de.tools.map(ue=>r.jsx(ex,{value:`${o(ue.titleKey)} ${ue.name}`,checked:D.has(ue.name),onToggle:()=>U(ue.name),title:o(ue.titleKey),description:o(ue.descriptionKey),leading:r.jsx(ue.icon,{size:16,className:"text-muted-foreground"})},ue.name))},de.key)}),I.map(de=>{const Z=de.tools.map(xJ),fe=Z.filter(ue=>D.has(ue)).length;return r.jsx(ks,{heading:r.jsx(tx,{conn:de.conn,on:fe,total:Z.length,onToggle:()=>H(Z,fe!==Z.length)}),children:de.tools.map(ue=>r.jsx(ex,{value:`${ue.display} ${ue.name} ${de.conn?.title??""}`,checked:D.has(ue.name),onToggle:()=>U(ue.name),title:ue.display,description:ue.description},ue.name))},de.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=o,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=y,e[18]=_,e[19]=L,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=T,e[25]=N}else g=e[13],x=e[14],b=e[15],v=e[16],y=e[17],_=e[18],L=e[19],w=e[20],S=e[21],k=e[22],j=e[23],T=e[24],N=e[25];let C;e[63]!==g||e[64]!==L||e[65]!==w?(C=r.jsx(g,{className:L,children:w}),e[63]=g,e[64]=L,e[65]=w,e[66]=C):C=e[66];let A;e[67]!==x||e[68]!==C||e[69]!==S||e[70]!==k?(A=r.jsxs(x,{children:[S,k,C]}),e[67]=x,e[68]=C,e[69]=S,e[70]=k,e[71]=A):A=e[71];let P;e[72]!==b||e[73]!==A||e[74]!==j||e[75]!==T?(P=r.jsx(b,{className:j,align:T,children:A}),e[72]=b,e[73]=A,e[74]=j,e[75]=T,e[76]=P):P=e[76];let R;return e[77]!==v||e[78]!==y||e[79]!==_||e[80]!==P||e[81]!==N?(R=r.jsxs(v,{open:N,onOpenChange:y,children:[_,P]}),e[77]=v,e[78]=y,e[79]=_,e[80]=P,e[81]=N,e[82]=R):R=e[82],R}function xJ(t){return t.name}function bJ(t){return t.name}function vJ(t){return t.name}function yJ(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function _J(t){return[t.id,t]}function ac(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function LJ(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 o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const a=(o[2]??"0").padStart(2,"0"),c=(o[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 wJ(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 SJ(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 kJ(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const jJ=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function CJ({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=se(),{triggerAdd:a}=ed(),[c,d]=V.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}),me.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");me.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?o?.(p.webhook):me.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");me.error(g)}};return r.jsxs(qt,{open:u,onOpenChange:h,children:[r.jsx(Gt,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",children:[r.jsx(Nt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(Yt,{align:"end",className:"w-[200px]",children:[r.jsxs(Li,{children:[r.jsxs(wi,{className:"gap-2.5",children:[r.jsx(Ja,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(Si,{className:"w-[160px]",children:jJ.map(p=>r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(Ja,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[r.jsx(Ja,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[r.jsx($i,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(Ze,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(kn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function z7(t){const e=z.c(39),{open:s,onOpenChange:n,url:i,token:o,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=se(),[h,f]=V.useState(null),[m,p]=V.useState("curl"),[g,x]=V.useState("header"),b=V.useId();let v;e[0]!==u?(v=async(I,$)=>{try{await navigator.clipboard.writeText(I),f($),me.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{me.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const y=v;let _;e[2]!==g||e[3]!==o||e[4]!==i?(_=i&&o&&g==="url"?`${i.replace(/\/$/,"")}/${o}`:i??"",e[2]=g,e[3]=o,e[4]=i,e[5]=_):_=e[5];const L=_,w=i&&o?g==="header"?`curl -X POST "${L}" \\
|
|
533
533
|
-H "Authorization: Bearer ${o}" \\
|
|
534
534
|
-H "Content-Type: application/json" \\
|
|
535
535
|
-d '{"hello":"world"}'`:`curl -X POST "${L}" \\
|
|
@@ -718,7 +718,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
718
718
|
|
|
719
719
|
`);function MZ(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",IZ).replaceAll("{{title}}",DZ).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function $Z(t){const e=z.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=Oi(s),l=Oi(i??"");if(o.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(at,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(o.isError||!o.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.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]!==o.data?(c=MZ(o.data,a),e[2]=a,e[3]=o.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=r.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 Fa(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function OZ(t){const e=z.c(16),{family:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;let a;e[0]!==s?(a=r.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]!==o){let h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>{const m=o(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":f.name,title:p,value:jZ(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):r.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]=o,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.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=r.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 BZ(t){const e=z.c(9),{token:s,value:n}=t;if(s.kind==="space"){let o;return e[0]!==n?(o=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="radius"){let o;return e[2]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=o):o=e[3],o}if(s.kind==="shadow"){let o;return e[4]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=o):o=e[5],o}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const o=`min(${n}, 22px)`;let l;return e[6]!==o?(l=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:o},children:"Ag"}),e[6]=o,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Q7(t){const e=z.c(17),{token:s,value:n,editing:i,onEdit:o}=t;let l;e[0]!==s||e[1]!==n?(l=r.jsx(BZ,{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=r.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]!==o||e[10]!==s.name||e[11]!==n?(d=i?r.jsx(rt,{value:n,onChange:h=>o(s.name,h.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=o,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=r.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 Sa(t){const e=z.c(16),{label:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=r.jsx(Fa,{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]!==o){let h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>r.jsx(Q7,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.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=r.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 zZ({brandPath:t,onClose:e,variant:s}){const n=se(),{org:i}=Me(),o=a0(t),l=o.volume??"",a=o.dirPath,c=Xt(a),d=o.readOnly,u=Qt(),h=Ql(),f=Ab(l),{upload:m,remove:p}=Ec(l),g=V.useRef(null),x=Q1(l,a),b=x.data??[],v=ue=>b.some(ye=>ye.kind==="file"&&Xt(ye.path)===ue),y=v("tokens.css"),_=v("brand.md"),L=v("slides-theme.html"),w=TZ(b),S=h(l,`${a}/tokens.css`),k=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),T=Oi(S,{enabled:y}),N=Oi(k,{enabled:_}),[C,A]=V.useState(!1),[P,R]=V.useState({}),[E,M]=V.useState(null),[I,$]=V.useState(!1),[O,D]=V.useState(!1),[B,F]=V.useState("deck"),U=T.data?Y7(T.data):[],H=ue=>U.find(ye=>ye.name===ue)?.value,W=ue=>P[ue.name]??ue.value,q=NZ(U),ee=U.filter(ue=>ue.kind==="font"),X=U.filter(ue=>ue.kind==="type"),Y=U.filter(ue=>ue.kind==="space"),G=U.filter(ue=>ue.kind==="radius"),J=U.filter(ue=>ue.kind==="shadow"),oe=U.filter(ue=>ue.kind==="motion"),le=U.filter(ue=>ue.kind==="other"),Q=(ue,ye)=>R(Le=>({...Le,[ue]:ye})),K=L&&B==="deck",te=E??N.data??"",ne=Object.entries(P).filter(([ue,ye])=>H(ue)!==ye),re=E!==null&&E!==(N.data??""),he=ne.length>0||re;function pe(){R({}),M(null),A(!1)}async function de(){$(!0);try{if(ne.length>0){let ue=T.data??"";for(const[ye,Le]of ne)ue=VZ(ue,ye,Le);await f.mutateAsync({path:`${a}/tokens.css`,body:ue,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:Fe.fileText(S)})}re&&E!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:E,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:Fe.fileText(k)})),u.invalidateQueries({queryKey:Fe.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:Fe.orgFsRecent(i.id)}),R({}),M(null),A(!1),me.success(n("library.brandPreview.brandSaved"))}catch(ue){me.error(ue instanceof Error?ue.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function Z(ue){const ye=ue?.[0];if(!ye)return;const Re=`logo.${(ye.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([ye],Re,{type:ye.type})]}),w&&Xt(w)!==Re&&await p.mutateAsync(w),me.success(n("library.brandPreview.logoUpdated"))}catch(De){me.error(De instanceof Error?De.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const fe=!x.isPending&&!y&&!_&&!w;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(ku,{size:18})}),s==="dialog"?r.jsx(At,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?r.jsxs(r.Fragment,{children:[r.jsx(ae,{variant:"ghost",size:"sm",onClick:pe,disabled:I,children:n("library.brandPreview.cancel")}),r.jsx(ae,{size:"sm",disabled:!he||I,onClick:()=>{de()},children:n(I?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[r.jsx(QS,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(K4,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(hs,{size:16})})}):r.jsx(ae,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(hs,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(at,{className:"h-40 w-full rounded-xl"}),r.jsx(at,{className:"h-4 w-1/3"}),r.jsx(at,{className:"h-4 w-2/3"})]}):fe?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):r.jsxs(r.Fragment,{children:[(L||y)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(O?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>D(ue=>!ue),onKeyDown:ue=>{(ue.key==="Enter"||ue.key===" ")&&(ue.preventDefault(),D(ye=>!ye))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:ue=>ue.stopPropagation(),children:[L&&r.jsx("button",{type:"button",onClick:()=>{F("deck"),D(!1)},className:ie("rounded-md px-2.5 py-1",K?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{F("components"),D(!1)},className:ie("rounded-md px-2.5 py-1",K?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),O?r.jsx(fs,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(q5,{size:16,className:"shrink-0 text-muted-foreground"})]}),!O&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",K?"aspect-[16/9]":"h-96"),children:K?r.jsx($Z,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):r.jsx(RZ,{tokensUrl:S})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Fa,{children:n("library.brandPreview.logo")}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?r.jsx("img",{src:h(l,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(ku,{size:28,className:"text-muted-foreground/50"})}),C&&r.jsxs("div",{children:[r.jsxs(ae,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(Wn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:ue=>{Z(ue.target.files)}})]})]})]}),q.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Fa,{children:n("library.brandPreview.colors")}),q.map(ue=>r.jsx(OZ,{family:ue.family,tokens:ue.tokens,editing:C,valueOf:W,onEdit:Q},ue.family))]}),(ee.length>0||X.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Fa,{children:n("library.brandPreview.typography")}),ee.map(ue=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:ue.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?r.jsx(rt,{value:W(ue),onChange:ye=>Q(ue.name,ye.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(ue)},children:W(ue)})]},ue.name)),X.map(ue=>r.jsx(Q7,{token:ue,value:W(ue),editing:C,onEdit:Q},ue.name))]}),r.jsx(Sa,{label:n("library.brandPreview.spacing"),tokens:Y,editing:C,valueOf:W,onEdit:Q}),r.jsx(Sa,{label:n("library.brandPreview.radius"),tokens:G,editing:C,valueOf:W,onEdit:Q}),r.jsx(Sa,{label:n("library.brandPreview.shadows"),tokens:J,editing:C,valueOf:W,onEdit:Q}),r.jsx(Sa,{label:n("library.brandPreview.motion"),tokens:oe,editing:C,valueOf:W,onEdit:Q}),r.jsx(Sa,{label:n("library.brandPreview.tokens"),tokens:le,editing:C,valueOf:W,onEdit:Q}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Fa,{children:n("library.brandPreview.voiceGuidelines")}),C?r.jsx(Ur,{value:te,onChange:ue=>M(ue.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):N.isPending&&_?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(at,{className:"h-3 w-full"}),r.jsx(at,{className:"h-3 w-5/6"})]}):te.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Qr,{id:`brand-preview-${t}`,text:te})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function X7(t){const e=z.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 o;e[2]!==s||e[3]!==n?(o=r.jsx(jt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx(zZ,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(Ct,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function J7(t){const e=z.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,o=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]!==o?(a=r.jsx(jt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(G7,{previewPath:s,onClose:n,showSeeInLibrary:o,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsx(Ct,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function FZ(t){const e={};for(const s of t.split(`
|
|
720
720
|
`)){const n=s.match(/^([A-Za-z][\w-]*):\s*(.*)$/);n?.[1]&&n[2]!==void 0&&(e[n[1].toLowerCase()]=n[2].trim())}return e}function lx(t){for(const e of t.split(/\n\s*\n/)){const s=e.trim();if(!(!s||s.startsWith("#")))return s.replace(/\n/g," ")}return null}function Z7(t){const e=t.match(/^---\n([\s\S]*?)\n---\n?/);if(!e||e[1]===void 0)return{name:null,description:lx(t),body:t};const s=FZ(e[1]),n=t.slice(e[0].length);return{name:s.name||null,description:s.description||lx(n),body:n}}function UZ(t){const e=z.c(18),{skillPath:s,onClose:n,variant:i}=t,o=a0(s),{volume:l,dirPath:a}=o,c=Ql(),d=c(l??"",`${a}/SKILL.md`),u=Oi(d),h=Q1(l??"",a);let f;e[0]!==a?(f=Xt(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==u.data?(p=u.data?Z7(u.data):null,e[2]=u.data,e[3]=p):p=e[3];const g=p,x=HZ;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(R,E)=>x(R.path)?-1:x(E.path)?1:Xt(R.path).localeCompare(Xt(E.path)),e[4]=b):b=e[4];const v=(h.data??[]).filter(KZ).sort(b),[y,_]=V.useState(null),L=y===null?null:v.find(R=>R.path===y)??null,w=g?.name??m;let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx($i,{size:18})}),e[5]=S):S=e[5];let k;e[6]!==w||e[7]!==i?(k=i==="dialog"?r.jsx(At,{className:"flex-1 truncate text-base font-medium text-foreground",children:w}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:w}),e[6]=w,e[7]=i,e[8]=k):k=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(K4,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(hs,{size:16})})}):r.jsx(ae,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:n,children:r.jsx(hs,{size:16})}),e[9]=n,e[10]=i,e[11]=j):j=e[11];let T;e[12]!==k||e[13]!==j?(T=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[S,k,j]}),e[12]=k,e[13]=j,e[14]=T):T=e[14];let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=N):N=e[15];const C="relative flex min-w-0 flex-1 flex-col overflow-y-auto",A=L?r.jsx(jp,{file:{key:L.path,filename:Xt(L.path),size:L.size,downloadUrl:c(l??"",L.path)}}):u.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(at,{className:"h-4 w-1/3"}),r.jsx(at,{className:"h-3 w-full"}),r.jsx(at,{className:"h-3 w-5/6"}),r.jsx(at,{className:"h-3 w-2/3"})]}):u.isError||!g?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:g.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(Qr,{id:`skill-preview-${s}`,text:g.body})})]});let P;return e[16]!==A?(P=r.jsx("div",{className:C,children:A}),e[16]=A,e[17]=P):P=e[17],r.jsxs(r.Fragment,{children:[T,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[N,h.isPending?r.jsx(at,{className:"mx-2 h-4 w-24"}):v.map(R=>{const E=x(R.path)?L===null:y===R.path;return r.jsxs("button",{type:"button",onClick:()=>_(x(R.path)?null:R.path),className:ie("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",E?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(yn,{filename:Xt(R.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ie("truncate text-sm",E?"text-foreground":"text-muted-foreground"),children:Xt(R.path)})]},R.path)})]}),P]})]})}function KZ(t){return t.kind==="file"}function HZ(t){return Xt(t)==="SKILL.md"}function e_(t){const e=z.c(8),{skillPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==n||e[3]!==s?(o=r.jsx(jt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(UZ,{skillPath:s,onClose:n,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(Ct,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}const WZ={default:{backFrom:"#4D87DF",backTo:"#296FE8",frontFrom:"#72B6FA",frontTo:"#5BB1EF",stripe:"#84CDFB",glyph:"#014AC9"},system:{backFrom:"#8A94A6",backTo:"#6B7687",frontFrom:"#B6BEC9",frontTo:"#A3ADBA",stripe:"#D5DBE3",glyph:"#3D4757"}};function qZ(t){const e=z.c(46);let s,n,i,o;e[0]!==t?({glyph:s,readOnly:i,tone:o,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=o):(s=e[1],n=e[2],i=e[3],o=e[4]);const a=WZ[o===void 0?"default":o],c=V.useId(),d=`${c}-back`,u=`${c}-front`,h=`url(#${d})`;let f;e[5]!==h?(f=r.jsx("path",{d:"M2.53738 2.55C1.13602 2.55 0 3.68602 0 5.08738V11.535H31.931V7.65326C31.931 6.23616 30.7822 5.08738 29.3651 5.08738H14.7681L13.8775 5.02542C13.3886 4.99141 12.9197 4.81809 12.5261 4.52596L10.7726 3.22419C10.1828 2.78638 9.46784 2.55 8.73334 2.55H2.53738Z",fill:h}),e[5]=h,e[6]=f):f=e[6];const m=`url(#${u})`;let p;e[7]!==m?(p=r.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:m}),e[7]=m,e[8]=p):p=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),e[9]=g):g=e[9];let x,b;e[10]!==a.stripe?(x=r.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:a.stripe}),b=r.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:a.stripe}),e[10]=a.stripe,e[11]=x,e[12]=b):(x=e[11],b=e[12]);let v;e[13]!==s||e[14]!==a.glyph?(v=s&&r.jsx(s,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:a.glyph,opacity:.55}}),e[13]=s,e[14]=a.glyph,e[15]=v):v=e[15];let y;e[16]!==i?(y=i&&r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),r.jsx(Zc,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[16]=i,e[17]=y):y=e[17];let _;e[18]!==a.backFrom?(_=r.jsx("stop",{offset:"0.3",stopColor:a.backFrom}),e[18]=a.backFrom,e[19]=_):_=e[19];let L;e[20]!==a.backTo?(L=r.jsx("stop",{offset:"1",stopColor:a.backTo}),e[20]=a.backTo,e[21]=L):L=e[21];let w;e[22]!==d||e[23]!==_||e[24]!==L?(w=r.jsxs("linearGradient",{id:d,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[_,L]}),e[22]=d,e[23]=_,e[24]=L,e[25]=w):w=e[25];let S;e[26]!==a.frontFrom?(S=r.jsx("stop",{stopColor:a.frontFrom}),e[26]=a.frontFrom,e[27]=S):S=e[27];let k;e[28]!==a.frontTo?(k=r.jsx("stop",{offset:"1",stopColor:a.frontTo}),e[28]=a.frontTo,e[29]=k):k=e[29];let j;e[30]!==u||e[31]!==S||e[32]!==k?(j=r.jsxs("radialGradient",{id:u,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[S,k]}),e[30]=u,e[31]=S,e[32]=k,e[33]=j):j=e[33];let T;e[34]!==w||e[35]!==j?(T=r.jsxs("defs",{children:[w,j]}),e[34]=w,e[35]=j,e[36]=T):T=e[36];let N;return e[37]!==n||e[38]!==y||e[39]!==T||e[40]!==f||e[41]!==p||e[42]!==x||e[43]!==b||e[44]!==v?(N=r.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...n,children:[f,p,g,x,b,v,y,T]}),e[37]=n,e[38]=y,e[39]=T,e[40]=f,e[41]=p,e[42]=x,e[43]=b,e[44]=v,e[45]=N):N=e[45],N}const GZ=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),YZ=new Set(["csv","tsv"]),QZ=new Set(["mp4","webm","mov","m4v"]),XZ=new Set(["txt","md","markdown","json","log","yaml","yml","xml","html","htm"]),JZ=256*1024;function hd(t){const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const s=Date.now()-e.getTime(),n=Math.floor(s/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ZZ(t){return t.split(".").pop()?.toLowerCase()??""}async function eee(t,e){const s=await fetch(t,{credentials:"include",...e});if(!s.ok)throw new Error(`fetch failed: ${s.status}`);return s.text()}function t_(t){const e=z.c(6),{onShare:s,t:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(_5,{size:14}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("library.cards.share"),e[1]=n,e[2]=o):o=e[2];let l;return e[3]!==s||e[4]!==o?(l=r.jsxs(Ze,{onClick:s,children:[i,o]}),e[3]=s,e[4]=o,e[5]=l):l=e[5],l}function tee(t){const e=z.c(12),{state:s,t:n}=t;let i;e[0]!==s||e[1]!==n?(i=n(s==="password"?"library.cards.passwordProtected":s==="inherited"?"library.cards.sharedViaParent":"library.cards.publicBadge"),e[0]=s,e[1]=n,e[2]=i):i=e[2];const o=i,l=s==="password"?Xc:kn,a=s==="inherited"?"text-muted-foreground/60":"text-primary";let c;e[3]!==a?(c=ie(a),e[3]=a,e[4]=c):c=e[4];let d;e[5]!==l||e[6]!==o||e[7]!==c?(d=r.jsx(l,{size:12,className:c,"aria-label":o}),e[5]=l,e[6]=o,e[7]=c,e[8]=d):d=e[8];let u;return e[9]!==o||e[10]!==d?(u=r.jsx("span",{title:o,className:"mt-0.5 flex shrink-0 items-center",children:d}),e[9]=o,e[10]=d,e[11]=u):u=e[11],u}function s_(t){const e=z.c(26),{downloadUrl:s,filename:n,onShare:i,onDelete:o,t:l}=t;let a;e[0]!==n||e[1]!==l?(a=l("library.cards.actionsFor",{filename:n}),e[0]=n,e[1]=l,e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(k0,{size:14}),e[3]=c):c=e[3];let d;e[4]!==a?(d=r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:nee,"aria-label":a,children:c})}),e[4]=a,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==l?(u=i&&r.jsx(t_,{onShare:i,t:l}),e[6]=i,e[7]=l,e[8]=u):u=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(wo,{size:14}),e[9]=h):h=e[9];let f;e[10]!==l?(f=l("library.cards.download"),e[10]=l,e[11]=f):f=e[11];let m;e[12]!==s||e[13]!==n||e[14]!==f?(m=r.jsx(Ze,{asChild:!0,children:r.jsxs("a",{href:s,download:n,children:[h,f]})}),e[12]=s,e[13]=n,e[14]=f,e[15]=m):m=e[15];let p;e[16]!==o||e[17]!==l?(p=o&&r.jsxs(Ze,{variant:"destructive",onClick:o,children:[r.jsx(Ks,{size:14}),l("library.cards.delete")]}),e[16]=o,e[17]=l,e[18]=p):p=e[18];let g;e[19]!==u||e[20]!==m||e[21]!==p?(g=r.jsxs(Yt,{align:"end",onClick:see,children:[u,m,p]}),e[19]=u,e[20]=m,e[21]=p,e[22]=g):g=e[22];let x;return e[23]!==d||e[24]!==g?(x=r.jsxs(qt,{children:[d,g]}),e[23]=d,e[24]=g,e[25]=x):x=e[25],x}function see(t){return t.stopPropagation()}function nee(t){return t.stopPropagation()}function Cp(t){const e=z.c(22),{label:s,onBrowse:n,onShare:i,onDelete:o,t:l}=t;if(!n&&!i&&!o)return;let a;e[0]!==s||e[1]!==l?(a=l("library.cards.actionsFor",{label:s}),e[0]=s,e[1]=l,e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(k0,{size:14}),e[3]=c):c=e[3];let d;e[4]!==a?(d=r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:ree,"aria-label":a,children:c})}),e[4]=a,e[5]=d):d=e[5];let u;e[6]!==n||e[7]!==l?(u=n&&r.jsxs(Ze,{onClick:n,children:[r.jsx(Di,{size:14}),l("library.cards.browseFiles")]}),e[6]=n,e[7]=l,e[8]=u):u=e[8];let h;e[9]!==i||e[10]!==l?(h=i&&r.jsx(t_,{onShare:i,t:l}),e[9]=i,e[10]=l,e[11]=h):h=e[11];let f;e[12]!==o||e[13]!==l?(f=o&&r.jsxs(Ze,{variant:"destructive",onClick:o,children:[r.jsx(Ks,{size:14}),l("library.cards.delete")]}),e[12]=o,e[13]=l,e[14]=f):f=e[14];let m;e[15]!==u||e[16]!==h||e[17]!==f?(m=r.jsxs(Yt,{align:"end",onClick:iee,children:[u,h,f]}),e[15]=u,e[16]=h,e[17]=f,e[18]=m):m=e[18];let p;return e[19]!==d||e[20]!==m?(p=r.jsxs(qt,{children:[d,m]}),e[19]=d,e[20]=m,e[21]=p):p=e[21],p}function iee(t){return t.stopPropagation()}function ree(t){return t.stopPropagation()}function fd(t){const e=z.c(23),{onOpen:s,children:n,className:i,draggable:o,onDragStart:l,onContextMenu:a,onDragOver:c,onDrop:d,onDragLeave:u}=t,[h,f]=V.useState(!1);let m;e[0]!==s?(m=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),s())},e[0]=s,e[1]=m):m=e[1];let p;e[2]!==c||e[3]!==d?(p=_=>{c?.(_),d&&(_.preventDefault(),f(!0))},e[2]=c,e[3]=d,e[4]=p):p=e[4];let g;e[5]!==u?(g=_=>{u?.(_),f(!1)},e[5]=u,e[6]=g):g=e[6];let x;e[7]!==d?(x=_=>{d?.(_),f(!1)},e[7]=d,e[8]=x):x=e[8];const b=h&&d&&"border-primary bg-primary/5";let v;e[9]!==i||e[10]!==b?(v=ie("group/card flex cursor-pointer flex-col gap-3 rounded-2xl border border-border bg-background p-4 text-left transition-colors hover:border-border hover:bg-muted/40",b,i),e[9]=i,e[10]=b,e[11]=v):v=e[11];let y;return e[12]!==n||e[13]!==o||e[14]!==a||e[15]!==l||e[16]!==s||e[17]!==m||e[18]!==p||e[19]!==g||e[20]!==x||e[21]!==v?(y=r.jsx("div",{role:"button",tabIndex:0,draggable:o,onClick:s,onKeyDown:m,onDragStart:l,onContextMenu:a,onDragOver:p,onDragLeave:g,onDrop:x,className:v,children:n}),e[12]=n,e[13]=o,e[14]=a,e[15]=l,e[16]=s,e[17]=m,e[18]=p,e[19]=g,e[20]=x,e[21]=v,e[22]=y):y=e[22],y}function md(t){const e=z.c(20),{icon:s,name:n,meta:i,subtitle:o,publicState:l,actions:a,t:c}=t;let d;e[0]!==n?(d=r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",title:n,children:n}),e[0]=n,e[1]=d):d=e[1];let u;e[2]!==l||e[3]!==c?(u=l&&r.jsx(tee,{state:l,t:c}),e[2]=l,e[3]=c,e[4]=u):u=e[4];let h;e[5]!==i?(h=i&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:i}),e[5]=i,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==u||e[9]!==h?(f=r.jsxs("div",{className:"flex items-start gap-3",children:[d,u,h]}),e[7]=d,e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;e[11]!==o?(m=o&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",title:o,children:o}),e[11]=o,e[12]=m):m=e[12];let p;e[13]!==f||e[14]!==m?(p=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[f,m]}),e[13]=f,e[14]=m,e[15]=p):p=e[15];let g;return e[16]!==a||e[17]!==s||e[18]!==p?(g=r.jsxs("div",{className:"flex w-full items-center gap-2.5",children:[s,p,a]}),e[16]=a,e[17]=s,e[18]=p,e[19]=g):g=e[19],g}function a9(t){const e=z.c(24),{name:s,meta:n,subtitle:i,glyph:o,tone:l,readOnly:a,publicState:c,onOpen:d,onShare:u,onDelete:h,draggable:f,onDragStart:m,onContextMenu:p,onDrop:g}=t,x=se();let b;e[0]!==o||e[1]!==a||e[2]!==l?(b=r.jsx(qZ,{glyph:o,tone:l,readOnly:a,className:"size-8 shrink-0"}),e[0]=o,e[1]=a,e[2]=l,e[3]=b):b=e[3];let v;e[4]!==s||e[5]!==h||e[6]!==u||e[7]!==x?(v=r.jsx(Cp,{label:s,onShare:u,onDelete:h,t:x}),e[4]=s,e[5]=h,e[6]=u,e[7]=x,e[8]=v):v=e[8];let y;e[9]!==n||e[10]!==s||e[11]!==c||e[12]!==i||e[13]!==x||e[14]!==b||e[15]!==v?(y=r.jsx(md,{icon:b,name:s,meta:n,subtitle:i,publicState:c,actions:v,t:x}),e[9]=n,e[10]=s,e[11]=c,e[12]=i,e[13]=x,e[14]=b,e[15]=v,e[16]=y):y=e[16];let _;return e[17]!==f||e[18]!==p||e[19]!==m||e[20]!==g||e[21]!==d||e[22]!==y?(_=r.jsx(fd,{onOpen:d,draggable:f,onDragStart:m,onContextMenu:p,onDrop:g,children:y}),e[17]=f,e[18]=p,e[19]=m,e[20]=g,e[21]=d,e[22]=y,e[23]=_):_=e[23],_}function n_(t){const e=z.c(27),{filename:s,updatedAt:n,downloadUrl:i,subtitle:o,publicState:l,onOpen:a,onShare:c,onDelete:d,draggable:u,onDragStart:h,onContextMenu:f}=t,m=se();let p;e[0]!==s?(p=r.jsx(yn,{filename:s,className:"h-8 w-6.5 shrink-0"}),e[0]=s,e[1]=p):p=e[1];let g;e[2]!==n?(g=hd(n),e[2]=n,e[3]=g):g=e[3];let x;e[4]!==s||e[5]!==o?(x=o??U4(s),e[4]=s,e[5]=o,e[6]=x):x=e[6];let b;e[7]!==i||e[8]!==s||e[9]!==d||e[10]!==c||e[11]!==m?(b=r.jsx(s_,{downloadUrl:i,filename:s,onShare:c,onDelete:d,t:m}),e[7]=i,e[8]=s,e[9]=d,e[10]=c,e[11]=m,e[12]=b):b=e[12];let v;e[13]!==s||e[14]!==l||e[15]!==m||e[16]!==p||e[17]!==g||e[18]!==x||e[19]!==b?(v=r.jsx(md,{icon:p,name:s,meta:g,subtitle:x,publicState:l,actions:b,t:m}),e[13]=s,e[14]=l,e[15]=m,e[16]=p,e[17]=g,e[18]=x,e[19]=b,e[20]=v):v=e[20];let y;return e[21]!==u||e[22]!==f||e[23]!==h||e[24]!==a||e[25]!==v?(y=r.jsx(fd,{onOpen:a,draggable:u,onDragStart:h,onContextMenu:f,children:v}),e[21]=u,e[22]=f,e[23]=h,e[24]=a,e[25]=v,e[26]=y):y=e[26],y}function oee(t){const e=z.c(29),{dirName:s,updatedAt:n,skillMdUrl:i,publicState:o,onOpen:l,onBrowse:a,onShare:c,onDelete:d,draggable:u,onDragStart:h,onContextMenu:f}=t,m=se(),{data:p}=Oi(i);let g;e[0]!==p?(g=p?Z7(p):null,e[0]=p,e[1]=g):g=e[1];const x=g;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r.jsx($i,{size:16})}),e[2]=b):b=e[2];const v=x?.name??s;let y;e[3]!==n?(y=hd(n),e[3]=n,e[4]=y):y=e[4];let _;e[5]!==m?(_=m("library.cards.skill"),e[5]=m,e[6]=_):_=e[6];let L;e[7]!==s||e[8]!==a||e[9]!==d||e[10]!==c||e[11]!==m?(L=r.jsx(Cp,{label:s,onBrowse:a,onShare:c,onDelete:d,t:m}),e[7]=s,e[8]=a,e[9]=d,e[10]=c,e[11]=m,e[12]=L):L=e[12];let w;e[13]!==o||e[14]!==m||e[15]!==v||e[16]!==y||e[17]!==_||e[18]!==L?(w=r.jsx(md,{icon:b,name:v,meta:y,subtitle:_,publicState:o,actions:L,t:m}),e[13]=o,e[14]=m,e[15]=v,e[16]=y,e[17]=_,e[18]=L,e[19]=w):w=e[19];const S=x?.description??"";let k;e[20]!==S?(k=r.jsx("p",{className:"line-clamp-2 min-h-8 text-xs leading-4 text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;return e[22]!==u||e[23]!==f||e[24]!==h||e[25]!==l||e[26]!==w||e[27]!==k?(j=r.jsxs(fd,{onOpen:l,draggable:u,onDragStart:h,onContextMenu:f,children:[w,k]}),e[22]=u,e[23]=f,e[24]=h,e[25]=l,e[26]=w,e[27]=k,e[28]=j):j=e[28],j}function lee(t){const e=z.c(45),{dirName:s,updatedAt:n,tokensUrl:i,onOpen:o,onBrowse:l,onDelete:a,draggable:c,onDragStart:d,onContextMenu:u}=t,h=se(),{data:f}=Oi(i);let m,p,g,x,b,v,y,_;if(e[0]!==f||e[1]!==s||e[2]!==c||e[3]!==l||e[4]!==u||e[5]!==a||e[6]!==d||e[7]!==o||e[8]!==h||e[9]!==n){const S=f?Y7(f).filter(cee).slice(0,6):[];m=fd,x=o,b=c,v=d,y=u;let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r.jsx(ku,{size:16})}),e[18]=k):k=e[18];let j;e[19]!==n?(j=hd(n),e[19]=n,e[20]=j):j=e[20];let T;e[21]!==h?(T=h("library.cards.brand"),e[21]=h,e[22]=T):T=e[22];let N;e[23]!==s||e[24]!==l||e[25]!==a||e[26]!==h?(N=r.jsx(Cp,{label:s,onBrowse:l,onDelete:a,t:h}),e[23]=s,e[24]=l,e[25]=a,e[26]=h,e[27]=N):N=e[27],e[28]!==s||e[29]!==h||e[30]!==T||e[31]!==N||e[32]!==j?(_=r.jsx(md,{icon:k,name:s,meta:j,subtitle:T,actions:N,t:h}),e[28]=s,e[29]=h,e[30]=T,e[31]=N,e[32]=j,e[33]=_):_=e[33],p="flex min-h-5 items-center gap-1.5",g=S.map(aee),e[0]=f,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=a,e[6]=d,e[7]=o,e[8]=h,e[9]=n,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=y,e[17]=_}else m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],y=e[16],_=e[17];let L;e[34]!==p||e[35]!==g?(L=r.jsx("div",{className:p,children:g}),e[34]=p,e[35]=g,e[36]=L):L=e[36];let w;return e[37]!==m||e[38]!==x||e[39]!==b||e[40]!==v||e[41]!==y||e[42]!==_||e[43]!==L?(w=r.jsxs(m,{onOpen:x,draggable:b,onDragStart:v,onContextMenu:y,children:[_,L]}),e[37]=m,e[38]=x,e[39]=b,e[40]=v,e[41]=y,e[42]=_,e[43]=L,e[44]=w):w=e[44],w}function aee(t){return r.jsx("span",{className:"size-5 rounded-full border border-border/60",style:{backgroundColor:t.value},title:`${t.name}: ${t.value}`},t.name)}function cee(t){return t.isColor}function sh(t){const e=z.c(4),{children:s}=t,[n,i]=V.useState(!1);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>c=>{if(!c)return;const d=new IntersectionObserver(u=>{const[h]=u;h?.isIntersecting&&(i(!0),d.disconnect())},{rootMargin:"200px"});d.observe(c)},e[0]=o):o=e[0];const[l]=V.useState(o);if(n){let c;return e[1]!==s?(c=r.jsx(r.Fragment,{children:s}),e[1]=s,e[2]=c):c=e[2],c}let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{ref:l,className:"h-full w-full"}),e[3]=a):a=e[3],a}function dee(t){const e=z.c(4),{url:s}=t,{data:n}=Oi(s);if(!n)return null;let i;e[0]!==n?(i=n.slice(0,2e3),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==i?(o=r.jsx("pre",{className:"pointer-events-none h-full w-full overflow-hidden bg-background p-3 font-mono text-[9px] leading-[1.5] text-muted-foreground select-none",children:i}),e[2]=i,e[3]=o):o=e[3],o}function uee(t){const e=z.c(23),{url:s,ext:n}=t;let i;e[0]!==s?(i=Fe.csvThumb(s),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==s?(o=()=>eee(s,{headers:{Range:"bytes=0-8191"}}),e[2]=s,e[3]=o):o=e[3];let l;e[4]!==i||e[5]!==o?(l={queryKey:i,queryFn:o,staleTime:6e4,retry:!1},e[4]=i,e[5]=o,e[6]=l):l=e[6];const{data:a}=xt(l);if(!a)return null;const c=n==="tsv"?" ":",";let d,u,h,f;if(e[7]!==a||e[8]!==c){f=Symbol.for("react.early_return_sentinel");e:{let x;e[13]!==c?(x=v=>v.split(c).slice(0,6).map(mee),e[13]=c,e[14]=x):x=e[14];const b=a.split(`
|
|
721
|
-
`).filter(Boolean).slice(0,7).map(x);if(b.length===0){f=null;break e}h="pointer-events-none h-full w-full overflow-hidden bg-background p-2 select-none",u="w-full border-collapse",d=b.map(hee)}e[7]=a,e[8]=c,e[9]=d,e[10]=u,e[11]=h,e[12]=f}else d=e[9],u=e[10],h=e[11],f=e[12];if(f!==Symbol.for("react.early_return_sentinel"))return f;let m;e[15]!==d?(m=r.jsx("tbody",{children:d}),e[15]=d,e[16]=m):m=e[16];let p;e[17]!==u||e[18]!==m?(p=r.jsx("table",{className:u,children:m}),e[17]=u,e[18]=m,e[19]=p):p=e[19];let g;return e[20]!==h||e[21]!==p?(g=r.jsx("div",{className:h,children:p}),e[20]=h,e[21]=p,e[22]=g):g=e[22],g}function hee(t,e){return r.jsx("tr",{className:ie(e===0&&"bg-muted/50 font-medium"),children:t.map(fee)},e)}function fee(t,e){return r.jsx("td",{className:"max-w-[56px] overflow-hidden border border-border/30 px-1 py-px text-[7px] leading-[1.4] text-muted-foreground",style:{maxWidth:56},children:r.jsx("span",{className:"block truncate",children:t})},e)}function mee(t){return t.trim().replace(/^"|"$/g,"")}function pee(t){const e=z.c(14),{filename:s,size:n,downloadUrl:i}=t;let o;if(e[0]!==i||e[1]!==s||e[2]!==n){const l=ZZ(s);let a;if(GZ.has(l)){let c;e[4]!==i?(c=r.jsx("img",{src:i,alt:"",loading:"lazy",className:"h-full w-full object-cover"}),e[4]=i,e[5]=c):c=e[5],a=c}else if(QZ.has(l)){const c=`${i}#t=0.1`;let d;e[6]!==c?(d=r.jsx(sh,{children:r.jsx("video",{src:c,preload:"metadata",muted:!0,playsInline:!0,className:"pointer-events-none h-full w-full object-cover"})}),e[6]=c,e[7]=d):d=e[7],a=d}else if(l==="pdf"){let c;e[8]!==s?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx(yn,{filename:s,className:"h-14 w-11 opacity-60"})}),e[8]=s,e[9]=c):c=e[9],a=c}else if(YZ.has(l))a=r.jsx(sh,{children:r.jsx(uee,{url:i,ext:l})});else if(XZ.has(l)&&n<=JZ){let c;e[10]!==i?(c=r.jsx(sh,{children:r.jsx(dee,{url:i})}),e[10]=i,e[11]=c):c=e[11],a=c}else{let c;e[12]!==s?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx(yn,{filename:s,className:"h-14 w-11 opacity-60"})}),e[12]=s,e[13]=c):c=e[13],a=c}o=r.jsx("div",{className:"aspect-[400/265] w-full overflow-hidden rounded-lg border border-border/60 bg-muted/30",children:a}),e[0]=i,e[1]=s,e[2]=n,e[3]=o}else o=e[3];return o}function gee(t){const e=z.c(29),s=se(),n=t.onOpen;let i;e[0]!==t.filename?(i=r.jsx(yn,{filename:t.filename,className:"h-8 w-6.5 shrink-0"}),e[0]=t.filename,e[1]=i):i=e[1];const o=t.filename;let l;e[2]!==t.updatedAt?(l=hd(t.updatedAt),e[2]=t.updatedAt,e[3]=l):l=e[3];let a;e[4]!==t.filename||e[5]!==t.subtitle?(a=t.subtitle??U4(t.filename),e[4]=t.filename,e[5]=t.subtitle,e[6]=a):a=e[6];let c;e[7]!==t.downloadUrl||e[8]!==t.filename||e[9]!==t.onDelete||e[10]!==t.onShare||e[11]!==s?(c=r.jsx(s_,{downloadUrl:t.downloadUrl,filename:t.filename,onShare:t.onShare,onDelete:t.onDelete,t:s}),e[7]=t.downloadUrl,e[8]=t.filename,e[9]=t.onDelete,e[10]=t.onShare,e[11]=s,e[12]=c):c=e[12];let d;e[13]!==t.filename||e[14]!==t.publicState||e[15]!==s||e[16]!==i||e[17]!==l||e[18]!==a||e[19]!==c?(d=r.jsx(md,{icon:i,name:o,meta:l,subtitle:a,publicState:t.publicState,actions:c,t:s}),e[13]=t.filename,e[14]=t.publicState,e[15]=s,e[16]=i,e[17]=l,e[18]=a,e[19]=c,e[20]=d):d=e[20];let u;e[21]!==t.downloadUrl||e[22]!==t.filename||e[23]!==t.size?(u=r.jsx(pee,{filename:t.filename,size:t.size,downloadUrl:t.downloadUrl}),e[21]=t.downloadUrl,e[22]=t.filename,e[23]=t.size,e[24]=u):u=e[24];let h;return e[25]!==t.onOpen||e[26]!==d||e[27]!==u?(h=r.jsxs(fd,{onOpen:n,children:[d,u]}),e[25]=t.onOpen,e[26]=d,e[27]=u,e[28]=h):h=e[28],h}function Np(t){return`${window.location.origin}${t}`}function cc(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const xee=[fc,"uploads","outputs"],i_=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Wn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:cr}],hf=new Set([...i_.map(t=>t.volume),El("public")]),bee=6;function r_(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=A4(t),o=i?`public/${i}`:t==="home"?mc(s):t;return n?`${o}/${n}`:o}function Zd(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 Rr(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function rr(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"@container",children:r.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 c9(t){const e=z.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(rr,{children:Array.from({length:n*3},vee)}),e[0]=n,e[1]=i):i=e[1],i}function vee(t,e){return r.jsx(at,{className:"h-16 rounded-2xl"},e)}function Vp(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function yee(t){const e=z.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=se(),a=pV(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]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(u=r.jsx(a9,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:o}),e[6]=i,e[7]=o,e[8]=c,e[9]=d,e[10]=s,e[11]=u):u=e[11],u}function _ee(t){const e=z.c(9),{onOpenDir:s}=t,n=se(),o=Eb().data?.length??0;let l;e[0]!==s?(l=i_.map(d=>r.jsx(yee,{volume:d.volume,descriptionKey:d.descriptionKey,glyph:d.glyph,onOpen:()=>s(d.volume)},d.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o||e[4]!==n?(a=o>0&&r.jsx(a9,{name:El("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:$i,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=o,e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Lee(t){const e=z.c(19),{segments:s,onNavigate:n}=t,{org:i}=Me();let o;e[0]!==s?(o=s[0]===fc?s.slice(1):s,e[0]=s,e[1]=o):o=e[1];const l=o,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?r.jsx("span",{className:"truncate font-medium text-foreground",children:mc(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(fc),children:mc(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 r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(wn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:El(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:El(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=r.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 wee(t){const e=z.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=se(),{org:d}=Me(),u=Ql(),h=xV(s,n);let f;e[0]!==u||e[1]!==l?(f=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:Np(u(S.volume,S.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(c9,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=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=r.jsx(Vp,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=ie("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Rr,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]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let y;e[21]!==p||e[22]!==x?(y=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=y):y=e[23];let _;if(e[24]!==u||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==u||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(S=k=>{const j=A4(k.volume)!==null;return r.jsx(n_,{filename:Xt(k.path),updatedAt:k.updatedAt,downloadUrl:u(k.volume,k.path),subtitle:r_(k.volume,k.path,d.slug),publicState:cc(k),onOpen:()=>o(P4(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]=o,e[34]=d,e[35]=m,e[36]=S):S=e[36],_=g.map(S),e[24]=u,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=_}else _=e[30];let L;e[37]!==_?(L=r.jsx(rr,{children:_}),e[37]=_,e[38]=L):L=e[38];let w;return e[39]!==b||e[40]!==y||e[41]!==L?(w=r.jsxs("div",{className:b,children:[y,L]}),e[39]=b,e[40]=y,e[41]=L,e[42]=w):w=e[42],w}function See(t){const e=z.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=se(),{org:l}=Me(),a=Tb(),c=Ql();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:Np(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let y;e[5]!==v?(y=r.jsx(Rr,{children:v}),e[5]=v,e[6]=y):y=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(c9,{}),e[7]=_):_=e[7];let L;return e[8]!==y?(L=r.jsxs("div",{className:"flex flex-col gap-3",children:[y,_]}),e[8]=y,e[9]=L):L=e[9],L}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]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,bee);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let y;e[22]!==o?(y=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=y):y=e[23],e[24]!==y?(p=r.jsx(Rr,{children:y}),e[24]=y,e[25]=p):p=e[25],h=rr;let _;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(_=L=>r.jsx(gee,{filename:Xt(L.path),updatedAt:L.updatedAt,size:L.size,downloadUrl:c(L.volume,L.path),subtitle:r_(L.volume,L.path,l.slug),publicState:cc(L),onOpen:()=>s(P4(L.volume,L.path)),onShare:()=>u(L),onDelete:()=>i({volume:L.volume,path:L.path,kind:"file"})},`${L.volume}/${L.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=_):_=e[31],f=v.map(_)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=o,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=r.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=r.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function kee(t){const e=z.c(16),{onOpenDir:s}=t,n=se(),i=Eb();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(c9,{}),e[0]=d):d=e[0],d}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const l=o;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=r.jsx(Vp,{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=>r.jsx(a9,{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=r.jsx(rr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function jee(t){const e=z.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=se(),{org:m}=Me(),p=s.volume??"",g=Q1(p,s.dirPath),x=Ql();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&hf.has(C.toLowerCase())?`${mc(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let y;e[3]!==s.isHomeRoot||e[4]!==n?(y=s.isHomeRoot?r.jsx(_ee,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=y):y=e[5];const _=y;if(g.isPending){let C;e[6]!==_||e[7]!==f?(C=_&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.folders")}),r.jsx(rr,{children:_})]}),e[6]=_,e[7]=f,e[8]=C):C=e[8];let A;e[9]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(c9,{rows:2}),e[9]=A):A=e[9];let P;return e[10]!==C?(P=r.jsxs(r.Fragment,{children:[C,A]}),e[10]=C,e[11]=P):P=e[11],P}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let A;return e[15]!==C?(A=r.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=A):A=e[16],A}let L,w,S,k,j;if(e[17]!==v||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]!==o||e[29]!==a||e[30]!==_||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],A=C.filter(Tee),P=C.filter(Vee),R=C.filter(Nee),E=C.filter(Cee);if(C.length===0&&!s.isHomeRoot){let D;e[38]!==s.readOnly||e[39]!==f?(D=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=D):D=e[40];let B;e[41]!==D?(B=r.jsx(Vp,{children:D}),e[41]=D,e[42]=B):B=e[42],j=B;break e}let M;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(M=D=>s.readOnly?void 0:()=>c({volume:p,path:D.path,kind:D.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=M):M=e[46];const I=M;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=D=>s.readOnly?void 0:()=>a({volume:p,path:D.path,kind:D.kind,shareMode:D.shareMode??"private",effectivePublic:D.effectivePublic??!1,url:D.kind==="file"?Np(x(p,D.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const O=$;L=A.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.skills")}),r.jsx(rr,{children:A.map(D=>r.jsx(oee,{dirName:Xt(D.path),updatedAt:D.updatedAt,skillMdUrl:x(p,`${D.path}/SKILL.md`),publicState:cc(D),onOpen:()=>o(ll(s,D.path)),onBrowse:()=>n(ll(s,D.path)),onShare:O(D),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"dir",{onDragStart:d,onContextMenu:u})},D.path))})]}),w=P.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.brands")}),r.jsx(rr,{children:P.map(D=>r.jsx(lee,{dirName:Xt(D.path),updatedAt:D.updatedAt,tokensUrl:x(p,`${D.path}/tokens.css`),onOpen:()=>l(ll(s,D.path)),onBrowse:()=>n(ll(s,D.path)),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"dir",{onDragStart:d,onContextMenu:u})},D.path))})]}),S=(R.length>0||_)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.folders")}),r.jsxs(rr,{children:[_,R.map(D=>r.jsx(a9,{name:Xt(D.path),meta:hd(D.updatedAt),subtitle:v(Xt(D.path)),readOnly:s.readOnly,publicState:cc(D),onOpen:()=>n(ll(s,D.path)),onShare:O(D),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},D.path))]})]}),k=E.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.files")}),r.jsx(rr,{children:E.map(D=>r.jsx(n_,{filename:Xt(D.path),updatedAt:D.updatedAt,downloadUrl:x(p,D.path),publicState:cc(D),onOpen:()=>i(ll(s,D.path)),onShare:O(D),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"file",{onDragStart:d,onContextMenu:u})},D.path))})]})}e[17]=v,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]=o,e[29]=a,e[30]=_,e[31]=f,e[32]=p,e[33]=L,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else L=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let T;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(T=s.isHomeRoot&&r.jsx(See,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=T):T=e[56];let N;return e[57]!==L||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==T?(N=r.jsxs(r.Fragment,{children:[L,w,S,k,T]}),e[57]=L,e[58]=w,e[59]=S,e[60]=k,e[61]=T,e[62]=N):N=e[62],N}function Cee(t){return t.kind==="file"}function Nee(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Vee(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Tee(t){return t.kind==="dir"&&t.hasSkill}function Eee({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=se(),{org:i}=Me(),o=Qt(),l=It(),a=Xr(),c=qr({strict:!1}),d=c.path||fc,u=a0(d),h=(Z,fe)=>l({to:".",search:ue=>({...ue,[Z]:fe||void 0})}),f=Z=>h("path",Z),m=(Z,fe)=>l({to:".",search:ue=>({...ue,preview:void 0,skill:void 0,brand:void 0,[Z]:fe})}),p=t??(Z=>m("preview",Z)),g=e??(Z=>m("skill",Z)),x=s??(Z=>m("brand",Z)),[b,v]=V.useState(""),y=K5(b.trim(),300),_=!u.isHomeRoot&&u.volume!==null?{volume:u.volume,prefix:u.dirPath}:void 0,L=_?n("library.library.searchInPlaceholder",{folder:El(u.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),w=u.isHomeRoot?mc(i.slug):El(u.segments.at(-1)??""),[S,k]=V.useState(null),[j,T]=V.useState(null),[N,C]=V.useState(!1),[A,P]=V.useState(""),[R,E]=V.useState(!1),[M,I]=V.useState(null),[$,O]=V.useState(""),D=V.useRef(null),[B,F]=V.useState(!1),U=V.useRef(0),H=u.readOnly?null:u.volume,{upload:W,mkdir:q,move:ee}=Ec(H??fc),{remove:X}=Ec(S?.volume??"uploads");async function Y(Z){if(!(!H||!Z||Z.length===0))try{await W.mutateAsync({dir:u.dirPath,files:[...Z]}),me.success(Z.length===1?n("library.library.uploadedSingle",{filename:Z[0]?.name??""}):n("library.library.uploadedMultiple",{count:Z.length}))}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.uploadFailed"))}finally{D.current&&(D.current.value="")}}const G=H!==null;function J(Z){return Z.dataTransfer.types.includes("Files")}function oe(Z){!G||!J(Z)||(Z.preventDefault(),U.current+=1,F(!0))}function le(Z){!G||!J(Z)||Z.preventDefault()}function Q(){G&&(U.current=Math.max(0,U.current-1),U.current===0&&F(!1))}function K(Z){G&&(Z.preventDefault(),U.current=0,F(!1),Z.dataTransfer.files.length>0&&Y(Z.dataTransfer.files))}async function te(){const Z=A.trim();if(!(!H||!Z)){if(u.isHomeRoot&&hf.has(Z.toLowerCase())){me.error(n("library.library.folderNameReserved",{name:Z}));return}try{const fe=u.dirPath;await q.mutateAsync(fe?`${fe}/${Z}`:Z),me.success(n("library.library.folderCreated",{name:Z})),C(!1),P("")}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.folderCreateFailed"))}}}async function ne(){if(!S)return;const Z=S;try{await X.mutateAsync(Z.path),me.success(n("library.library.deleted",{name:Xt(Z.path)}))}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.deleteFailed"))}finally{k(null)}}async function re(){if(!M)return;const Z=$.trim();if(!Z||Z.includes("/")||Z.includes("..")||Z===Xt(M.path)){E(!1),I(null),O("");return}if(M.kind==="dir"&&u.isHomeRoot&&hf.has(Z.toLowerCase())){me.error(n("library.library.folderNameReserved",{name:Z}));return}try{const fe=M.path.includes("/")?M.path.slice(0,M.path.lastIndexOf("/")):"",ue=fe?`${fe}/${Z}`:Z;await ee.mutateAsync({from:M.path,to:ue});const ye=Z.replace(/[<>]/g,"");me.success(n("library.library.renamed",{name:ye}))}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.renameFailed"))}finally{E(!1),I(null),O("")}}async function he(Z,fe){try{const ue=Xt(Z),ye=fe?`${fe}/${ue}`:ue;await ee.mutateAsync({from:Z,to:ye}),me.success(n("library.library.moved",{name:ue,destination:fe||n("library.library.theLibrary")}))}catch(ue){me.error(ue instanceof Error?ue.message:n("library.library.moveFailed"))}}function pe(){for(const Z of xee)o.invalidateQueries({queryKey:Fe.orgFsVolume(i.id,Z)});u.volume&&o.invalidateQueries({queryKey:Fe.orgFsVolume(i.id,u.volume)}),o.invalidateQueries({queryKey:Fe.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:Fe.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:Fe.orgFsPublicSets(i.id)})}function de(Z){Z.defaultPrevented||!H||Z.target.closest("input, textarea, button, a, [role='button']")||(Z.preventDefault(),C(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:oe,onDragOver:le,onDragLeave:Q,onDrop:K,onContextMenu:de,children:[B&&r.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:r.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:[r.jsx(Wn,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:w})})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:r.jsx(Lee,{segments:u.segments,onNavigate:f})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(C0,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(rt,{value:b,onChange:Z=>v(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&v("")},placeholder:L,className:"h-9 rounded-xl pr-9 pl-9"}),b&&r.jsx(ae,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>v(""),"aria-label":n("library.library.clearSearch"),children:r.jsx(ti,{size:14})})]}),r.jsx(ae,{variant:"ghost",size:"icon",onClick:pe,"aria-label":n("library.library.refresh"),children:r.jsx(vn,{size:14})}),H&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>C(!0),children:[r.jsx(Nt,{size:14}),n("library.library.newFolder")]}),u.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Zc,{size:12}),n("library.library.readOnly")]}):r.jsxs(ae,{size:"sm",disabled:W.isPending,onClick:()=>D.current?.click(),children:[r.jsx(Wn,{size:14}),W.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:D,type:"file",multiple:!0,className:"hidden",onChange:Z=>{Y(Z.target.files)}})]}),y?r.jsx(wee,{query:y,scope:_,stale:b.trim()!==y,onOpenFile:p,onShare:T,onDelete:k}):u.volume===null?r.jsx(kee,{onOpenDir:f}):r.jsx(jee,{location:u,onOpenDir:f,onOpenFile:p,onOpenSkill:g,onOpenBrand:x,onShare:T,onDelete:k,onContextMenu:(Z,fe)=>{I({path:Z,kind:fe}),O(Xt(Z)),E(!0)},onMove:he},u.volume)]})}),a&&(c.preview?r.jsx(J7,{previewPath:c.preview,onClose:()=>h("preview",null)}):c.skill?r.jsx(e_,{skillPath:c.skill,onClose:()=>h("skill",null)},c.skill):c.brand?r.jsx(X7,{brandPath:c.brand,onClose:()=>h("brand",null)},c.brand):null),r.jsx(Ct,{open:N,onOpenChange:C,children:r.jsxs(jt,{children:[r.jsxs(os,{children:[r.jsx(At,{children:n("library.library.newFolderTitle")}),r.jsx(_n,{children:n("library.library.newFolderDescription",{path:w||n("library.library.theLibrary")})})]}),r.jsx(rt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:A,onChange:Z=>P(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&te()}}),r.jsxs(In,{children:[r.jsx(ae,{variant:"outline",onClick:()=>C(!1),children:n("library.library.cancel")}),r.jsx(ae,{disabled:!A.trim()||q.isPending,onClick:()=>{te()},children:n("library.library.create")})]})]})}),r.jsx(Ct,{open:R,onOpenChange:Z=>{E(Z),Z||(I(null),O(""))},children:r.jsxs(jt,{children:[r.jsxs(os,{children:[r.jsx(At,{children:M&&n("library.library.renameTitle",{name:Xt(M.path)})}),r.jsx(_n,{children:n("library.library.renameDescription")})]}),r.jsx(rt,{autoFocus:!0,value:$,onChange:Z=>O(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&re()}}),r.jsxs(In,{children:[r.jsx(ae,{variant:"outline",onClick:()=>E(!1),children:n("library.library.cancel")}),r.jsx(ae,{disabled:!$.trim()||ee.isPending,onClick:()=>{re()},children:n("library.library.rename")})]})]})}),r.jsx(uZ,{target:j,onOpenChange:Z=>{Z||T(null)}}),r.jsx(vc,{open:S!==null,onOpenChange:Z=>{Z||k(null)},children:r.jsxs(yc,{children:[r.jsxs(_c,{children:[r.jsx(Lc,{children:n("library.library.deleteTitle",{name:S?Xt(S.path):""})}),r.jsx(wc,{children:S?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(Sc,{children:[r.jsx(kc,{children:n("library.library.cancel")}),r.jsx(jc,{onClick:()=>{ne()},children:n("library.library.delete")})]})]})})]})}function Aee(){const t=z.c(12),e=It(),[s,n]=V.useState(null),[i,o]=V.useState(null);let l;t[0]!==e?(l=f=>e({to:".",search:m=>({...m,main:f}),replace:!0}),t[0]=e,t[1]=l):l=t[1];const a=l;let c;t[2]!==a?(c=r.jsx(Eee,{onOpenFile:f=>a(lS(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(e_,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let u;t[6]!==i?(u=i&&r.jsx(X7,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=u):u=t[7];let h;return t[8]!==c||t[9]!==d||t[10]!==u?(h=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,u]}),t[8]=c,t[9]=d,t[10]=u,t[11]=h):h=t[11],h}const ax=V.lazy(()=>Sn(()=>import("./project-app-view-CUPxbLM7.js"),__vite__mapDeps([163,1,2,49,50,51,16,3,18,4,5,6,7,8,9,10,11,12,13,14,15,17,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,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,114,142,115,116,117,111,112,113,101,102,103,104,105,106,107,108,109,110,118,119,120,121,122,123,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,143,144,145,146,147,148])).then(t=>({default:t.AppViewContent})));function Pee(t){const e=z.c(61),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let L;return e[0]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Qz,{}),e[0]=L):L=e[0],L}if(s==="board"){let L;return e[1]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(SF,{})}),e[1]=L):L=e[1],L}if(aS(s)){let L;return e[2]!==n?(L=r.jsx(rg,{virtualMcpId:n}),e[2]=n,e[3]=L):L=e[3],L}if(s==="git"){let L;return e[4]!==n?(L=r.jsx(nK,{virtualMcpId:n}),e[4]=n,e[5]=L):L=e[5],L}if(s==="automations"){let L;return e[6]!==n?(L=r.jsx(KJ,{virtualMcpId:n}),e[6]=n,e[7]=L):L=e[7],L}if(s==="preview"){let L;return e[8]!==n?(L=r.jsx(FW,{virtualMcpId:n}),e[8]=n,e[9]=L):L=e[9],L}let c;e[10]!==s?(c=cS(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let L;return e[12]!==d.path?(L=r.jsx(WW,{openPath:d.path}),e[12]=d.path,e[13]=L):L=e[13],L}if(s==="content"){let L;return e[14]!==n?(L=r.jsx(aJ,{virtualMcpId:n}),e[14]=n,e[15]=L):L=e[15],L}if(s==="files"){let L;return e[16]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Aee,{}),e[16]=L):L=e[16],L}if(s==="connect-sources"){let L;return e[17]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(ZJ,{}),e[17]=L):L=e[17],L}if(a){let L;return e[18]!==s?(L=r.jsx(OJ,{tabId:s}),e[18]=s,e[19]=L):L=e[19],L}let u;e[20]!==s?(u=t5(s),e[20]=s,e[21]=u):u=e[21];const h=u;if(h){let L;return e[22]!==h.path?(L=r.jsx(fZ,{path:h.path},h.path),e[22]=h.path,e[23]=L):L=e[23],L}let f;e[24]!==s?(f=e5(s),e[24]=s,e[25]=f):f=e[25];const m=f;if(m){let L;return e[26]!==m.key||e[27]!==i?(L=r.jsx(QJ,{fileKey:m.key,taskId:i}),e[26]=m.key,e[27]=i,e[28]=L):L=e[28],L}let p;e[29]!==s?(p=s5(s),e[29]=s,e[30]=p):p=e[30];const g=p;if(g){let L;return e[31]!==g.path?(L=r.jsx(xZ,{path:g.path},g.path),e[31]=g.path,e[32]=L):L=e[32],L}let x;e[33]!==s?(x=dS(s),e[33]=s,e[34]=x):x=e[34];const b=x;if(b){let L;if(e[35]!==l||e[36]!==b.connectionId||e[37]!==b.toolName){let T;e[39]!==b.connectionId||e[40]!==b.toolName?(T=N=>N.appId===b.connectionId&&N.toolName===b.toolName,e[39]=b.connectionId,e[40]=b.toolName,e[41]=T):T=e[41],L=l.find(T),e[35]=l,e[36]=b.connectionId,e[37]=b.toolName,e[38]=L}else L=e[38];const w=L;let S;e[42]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(To,{}),e[42]=S):S=e[42];const k=w?.args;let j;return e[43]!==s||e[44]!==b.connectionId||e[45]!==b.toolName||e[46]!==k?(j=r.jsx(V.Suspense,{fallback:S,children:r.jsx(ax,{connectionId:b.connectionId,toolName:b.toolName,args:k},s)}),e[43]=s,e[44]=b.connectionId,e[45]=b.toolName,e[46]=k,e[47]=j):j=e[47],j}let v;if(e[48]!==s||e[49]!==o){let L;e[51]!==s?(L=w=>w.id===s,e[51]=s,e[52]=L):L=e[52],v=o.find(L),e[48]=s,e[49]=o,e[50]=v}else v=e[50];const y=v;if(y){let L;e[53]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(To,{}),e[53]=L):L=e[53];let w;return e[54]!==s||e[55]!==y.id||e[56]!==y.view.appId||e[57]!==y.view.args?(w=r.jsx(V.Suspense,{fallback:L,children:r.jsx(ax,{connectionId:y.view.appId,toolName:y.id,args:y.view.args},s)}),e[54]=s,e[55]=y.id,e[56]=y.view.appId,e[57]=y.view.args,e[58]=w):w=e[58],w}let _;return e[59]!==n?(_=r.jsx(rg,{virtualMcpId:n}),e[59]=n,e[60]=_):_=e[60],_}function Ree(t){const e=z.c(14),{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:o,layoutTabs:l,expandedTools:a,automationTabParsed:c}=Lm(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(To,{}),e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(u=r.jsx(V.Suspense,{fallback:d,children:r.jsx(Pee,{activeTab:o,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=o,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=u):u=e[10];let h;return e[11]!==o||e[12]!==u?(h=r.jsx(Fs,{children:u},o),e[11]=o,e[12]=u,e[13]=h):h=e[13],h}const bo="setup";function Dee(t){const e=z.c(57),s=se();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let _;e[3]!==t.scriptTabs?(_=L=>!t.scriptTabs.includes(L),e[3]=t.scriptTabs,e[4]=_):_=e[4],n=t.scripts.filter(_),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let o;e[5]!==t?(o=()=>{t.active===bo?t.onToggle():t.onSelectTab(bo)},e[5]=t,e[6]=o):o=e[6];const l=o;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?r.jsx(fs,{className:"size-4"}):r.jsx(q5,{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=r.jsx(We,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=r.jsxs(Ge,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===bo;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(Iee,{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(_=>r.jsx($ee,{active:t.active===_,onClick:()=>{t.active===_?t.onToggle():t.onSelectTab(_)},onClose:()=>t.onCloseScript(_),t:s,children:_},_)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=r.jsx(Oee,{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=r.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 v;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?(v=t.showScriptControls?r.jsx(Bee,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(Mee,{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]=v):v=e[52];let y;return e[53]!==b||e[54]!==v||e[55]!==f?(y=r.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,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=y):y=e[56],y}function Iee(t){const e=z.c(11),{active:s,open:n,onClick:i,t:o}=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=ie("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=r.jsx(b5,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==o?(h=o("sandbox.toolbar.setupTab"),e[3]=o,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=r.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 Mee(t){const e=z.c(40),{status:s,onStart:n,onStop:i,onRestart:o,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(So,{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=r.jsxs(ae,{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=r.jsx(So,{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=r.jsxs(ae,{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=r.jsx(vn,{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=r.jsxs(ae,{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"&&!!o,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=ie(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=r.jsx(We,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(Ge,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==o||e[34]!==d||e[35]!==c?(b=d&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(fs,{className:"size-3"})})}),r.jsx(Yt,{align:"end",children:r.jsxs(Ze,{onClick:o,children:[r.jsx(vn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=o,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=r.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function $ee(t){const e=z.c(17),{active:s,onClick:n,onClose:i,children:o,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ie("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=ie("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==n||e[7]!==h?(f=r.jsx("button",{type:"button",onClick:n,className:h,children:o}),e[5]=o,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i||e[11]!==l?(m=i&&r.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(o)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:r.jsx(hs,{className:"size-3.5"})}),e[9]=o,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=r.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function Oee(t){const e=z.c(27),{scripts:s,onRun:n}=t,i=se(),[o,l]=V.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=r.jsx(Nt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(We,{asChild:!0,children:r.jsx(us,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=r.jsxs(Ge,{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=r.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?r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>r.jsxs("button",{type:"button",onClick:()=>{l(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=r.jsxs(ys,{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]!==o||e[24]!==x||e[25]!==f?(b=r.jsxs(_s,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function Bee(t){const e=z.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:o,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(it,{className:"size-3.5 animate-spin"}),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=r.jsxs(ae,{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=r.jsx(So,{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=r.jsx(We,{asChild:!0,children:r.jsxs(ae,{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=r.jsx(qe,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(Ge,{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]!==o||e[21]!==a?(c=r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"outline",size:"xs",onClick:o,children:a})}),e[20]=o,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=r.jsx(qe,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=r.jsxs(Ge,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var o_=Object.defineProperty,zee=Object.getOwnPropertyDescriptor,Fee=(t,e)=>{for(var s in e)o_(t,s,{get:e[s],enumerable:!0})},ms=(t,e,s,n)=>{for(var i=n>1?void 0:n?zee(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&o_(e,s,i),i},Ke=(t,e)=>(s,n)=>e(s,n,t),cx="Terminal input",ff={get:()=>cx,set:t=>cx=t},dx="Too much output to announce, navigate to rows manually to read",mf={get:()=>dx,set:t=>dx=t};function Uee(t){return t.replace(/\r?\n/g,"\r")}function Kee(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Hee(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function Wee(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");l_(i,e,s,n)}}function l_(t,e,s,n){t=Uee(t),t=Kee(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function a_(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,o=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function ux(t,e,s,n,i){a_(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ar(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 o=t[i];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var qee=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 o=t.charCodeAt(i++);56320<=o&&o<=57343?e[n++]=(this._interim-55296)*1024+o-56320+65536:(e[n++]=this._interim,e[n++]=o),this._interim=0}for(let o=i;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,n;let a=t.charCodeAt(o);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}},Gee=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,o,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)&&!((o=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=o,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(o=t[h++],(o&192)!==128){h--;continue}if(c=(i&31)<<6|o&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(o&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(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},c_="",Ir=" ",pd=class d_{constructor(){this.fg=0,this.bg=0,this.extended=new Zu}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 d_;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}},Zu=class u_{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 u_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hn=class h_ extends pd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Zu,this.combinedData=""}static fromCharData(e){let s=new h_;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?Ar(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()]}},hx="di$target",pf="di$dependencies",nh=new Map;function Yee(t){return t[pf]||[]}function Ws(t){if(nh.has(t))return nh.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");Qee(e,s,i)};return e._id=t,nh.set(t,e),e}function Qee(t,e,s){e[hx]===e?e[pf].push({id:t,index:s}):(e[pf]=[{id:t,index:s}],e[hx]=e)}var pn=Ws("BufferService"),f_=Ws("CoreMouseService"),Qo=Ws("CoreService"),Xee=Ws("CharsetService"),Tp=Ws("InstantiationService"),m_=Ws("LogService"),gn=Ws("OptionsService"),p_=Ws("OscLinkService"),Jee=Ws("UnicodeService"),gd=Ws("DecorationService"),gf=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,o=new Hn,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,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,a=o.extended.urlId;continue}else d=o.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):Zee(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};gf=ms([Ke(0,pn),Ke(1,gn),Ke(2,p_)],gf);function Zee(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
721
|
+
`).filter(Boolean).slice(0,7).map(x);if(b.length===0){f=null;break e}h="pointer-events-none h-full w-full overflow-hidden bg-background p-2 select-none",u="w-full border-collapse",d=b.map(hee)}e[7]=a,e[8]=c,e[9]=d,e[10]=u,e[11]=h,e[12]=f}else d=e[9],u=e[10],h=e[11],f=e[12];if(f!==Symbol.for("react.early_return_sentinel"))return f;let m;e[15]!==d?(m=r.jsx("tbody",{children:d}),e[15]=d,e[16]=m):m=e[16];let p;e[17]!==u||e[18]!==m?(p=r.jsx("table",{className:u,children:m}),e[17]=u,e[18]=m,e[19]=p):p=e[19];let g;return e[20]!==h||e[21]!==p?(g=r.jsx("div",{className:h,children:p}),e[20]=h,e[21]=p,e[22]=g):g=e[22],g}function hee(t,e){return r.jsx("tr",{className:ie(e===0&&"bg-muted/50 font-medium"),children:t.map(fee)},e)}function fee(t,e){return r.jsx("td",{className:"max-w-[56px] overflow-hidden border border-border/30 px-1 py-px text-[7px] leading-[1.4] text-muted-foreground",style:{maxWidth:56},children:r.jsx("span",{className:"block truncate",children:t})},e)}function mee(t){return t.trim().replace(/^"|"$/g,"")}function pee(t){const e=z.c(14),{filename:s,size:n,downloadUrl:i}=t;let o;if(e[0]!==i||e[1]!==s||e[2]!==n){const l=ZZ(s);let a;if(GZ.has(l)){let c;e[4]!==i?(c=r.jsx("img",{src:i,alt:"",loading:"lazy",className:"h-full w-full object-cover"}),e[4]=i,e[5]=c):c=e[5],a=c}else if(QZ.has(l)){const c=`${i}#t=0.1`;let d;e[6]!==c?(d=r.jsx(sh,{children:r.jsx("video",{src:c,preload:"metadata",muted:!0,playsInline:!0,className:"pointer-events-none h-full w-full object-cover"})}),e[6]=c,e[7]=d):d=e[7],a=d}else if(l==="pdf"){let c;e[8]!==s?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx(yn,{filename:s,className:"h-14 w-11 opacity-60"})}),e[8]=s,e[9]=c):c=e[9],a=c}else if(YZ.has(l))a=r.jsx(sh,{children:r.jsx(uee,{url:i,ext:l})});else if(XZ.has(l)&&n<=JZ){let c;e[10]!==i?(c=r.jsx(sh,{children:r.jsx(dee,{url:i})}),e[10]=i,e[11]=c):c=e[11],a=c}else{let c;e[12]!==s?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx(yn,{filename:s,className:"h-14 w-11 opacity-60"})}),e[12]=s,e[13]=c):c=e[13],a=c}o=r.jsx("div",{className:"aspect-[400/265] w-full overflow-hidden rounded-lg border border-border/60 bg-muted/30",children:a}),e[0]=i,e[1]=s,e[2]=n,e[3]=o}else o=e[3];return o}function gee(t){const e=z.c(29),s=se(),n=t.onOpen;let i;e[0]!==t.filename?(i=r.jsx(yn,{filename:t.filename,className:"h-8 w-6.5 shrink-0"}),e[0]=t.filename,e[1]=i):i=e[1];const o=t.filename;let l;e[2]!==t.updatedAt?(l=hd(t.updatedAt),e[2]=t.updatedAt,e[3]=l):l=e[3];let a;e[4]!==t.filename||e[5]!==t.subtitle?(a=t.subtitle??U4(t.filename),e[4]=t.filename,e[5]=t.subtitle,e[6]=a):a=e[6];let c;e[7]!==t.downloadUrl||e[8]!==t.filename||e[9]!==t.onDelete||e[10]!==t.onShare||e[11]!==s?(c=r.jsx(s_,{downloadUrl:t.downloadUrl,filename:t.filename,onShare:t.onShare,onDelete:t.onDelete,t:s}),e[7]=t.downloadUrl,e[8]=t.filename,e[9]=t.onDelete,e[10]=t.onShare,e[11]=s,e[12]=c):c=e[12];let d;e[13]!==t.filename||e[14]!==t.publicState||e[15]!==s||e[16]!==i||e[17]!==l||e[18]!==a||e[19]!==c?(d=r.jsx(md,{icon:i,name:o,meta:l,subtitle:a,publicState:t.publicState,actions:c,t:s}),e[13]=t.filename,e[14]=t.publicState,e[15]=s,e[16]=i,e[17]=l,e[18]=a,e[19]=c,e[20]=d):d=e[20];let u;e[21]!==t.downloadUrl||e[22]!==t.filename||e[23]!==t.size?(u=r.jsx(pee,{filename:t.filename,size:t.size,downloadUrl:t.downloadUrl}),e[21]=t.downloadUrl,e[22]=t.filename,e[23]=t.size,e[24]=u):u=e[24];let h;return e[25]!==t.onOpen||e[26]!==d||e[27]!==u?(h=r.jsxs(fd,{onOpen:n,children:[d,u]}),e[25]=t.onOpen,e[26]=d,e[27]=u,e[28]=h):h=e[28],h}function Np(t){return`${window.location.origin}${t}`}function cc(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const xee=[fc,"uploads","outputs"],i_=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Wn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:cr}],hf=new Set([...i_.map(t=>t.volume),El("public")]),bee=6;function r_(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=A4(t),o=i?`public/${i}`:t==="home"?mc(s):t;return n?`${o}/${n}`:o}function Zd(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 Rr(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function rr(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"@container",children:r.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 c9(t){const e=z.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(rr,{children:Array.from({length:n*3},vee)}),e[0]=n,e[1]=i):i=e[1],i}function vee(t,e){return r.jsx(at,{className:"h-16 rounded-2xl"},e)}function Vp(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function yee(t){const e=z.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=se(),a=pV(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]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(u=r.jsx(a9,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:o}),e[6]=i,e[7]=o,e[8]=c,e[9]=d,e[10]=s,e[11]=u):u=e[11],u}function _ee(t){const e=z.c(9),{onOpenDir:s}=t,n=se(),o=Eb().data?.length??0;let l;e[0]!==s?(l=i_.map(d=>r.jsx(yee,{volume:d.volume,descriptionKey:d.descriptionKey,glyph:d.glyph,onOpen:()=>s(d.volume)},d.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o||e[4]!==n?(a=o>0&&r.jsx(a9,{name:El("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:$i,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=o,e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Lee(t){const e=z.c(19),{segments:s,onNavigate:n}=t,{org:i}=Me();let o;e[0]!==s?(o=s[0]===fc?s.slice(1):s,e[0]=s,e[1]=o):o=e[1];const l=o,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?r.jsx("span",{className:"truncate font-medium text-foreground",children:mc(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(fc),children:mc(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 r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(wn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:El(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:El(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=r.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 wee(t){const e=z.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=se(),{org:d}=Me(),u=Ql(),h=xV(s,n);let f;e[0]!==u||e[1]!==l?(f=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:Np(u(S.volume,S.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(c9,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=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=r.jsx(Vp,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=ie("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Rr,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]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let y;e[21]!==p||e[22]!==x?(y=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=y):y=e[23];let _;if(e[24]!==u||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==u||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(S=k=>{const j=A4(k.volume)!==null;return r.jsx(n_,{filename:Xt(k.path),updatedAt:k.updatedAt,downloadUrl:u(k.volume,k.path),subtitle:r_(k.volume,k.path,d.slug),publicState:cc(k),onOpen:()=>o(P4(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]=o,e[34]=d,e[35]=m,e[36]=S):S=e[36],_=g.map(S),e[24]=u,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=_}else _=e[30];let L;e[37]!==_?(L=r.jsx(rr,{children:_}),e[37]=_,e[38]=L):L=e[38];let w;return e[39]!==b||e[40]!==y||e[41]!==L?(w=r.jsxs("div",{className:b,children:[y,L]}),e[39]=b,e[40]=y,e[41]=L,e[42]=w):w=e[42],w}function See(t){const e=z.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=se(),{org:l}=Me(),a=Tb(),c=Ql();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:Np(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let y;e[5]!==v?(y=r.jsx(Rr,{children:v}),e[5]=v,e[6]=y):y=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(c9,{}),e[7]=_):_=e[7];let L;return e[8]!==y?(L=r.jsxs("div",{className:"flex flex-col gap-3",children:[y,_]}),e[8]=y,e[9]=L):L=e[9],L}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]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,bee);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let y;e[22]!==o?(y=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=y):y=e[23],e[24]!==y?(p=r.jsx(Rr,{children:y}),e[24]=y,e[25]=p):p=e[25],h=rr;let _;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(_=L=>r.jsx(gee,{filename:Xt(L.path),updatedAt:L.updatedAt,size:L.size,downloadUrl:c(L.volume,L.path),subtitle:r_(L.volume,L.path,l.slug),publicState:cc(L),onOpen:()=>s(P4(L.volume,L.path)),onShare:()=>u(L),onDelete:()=>i({volume:L.volume,path:L.path,kind:"file"})},`${L.volume}/${L.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=_):_=e[31],f=v.map(_)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=o,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=r.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=r.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function kee(t){const e=z.c(16),{onOpenDir:s}=t,n=se(),i=Eb();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(c9,{}),e[0]=d):d=e[0],d}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const l=o;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=r.jsx(Vp,{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=>r.jsx(a9,{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=r.jsx(rr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function jee(t){const e=z.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=se(),{org:m}=Me(),p=s.volume??"",g=Q1(p,s.dirPath),x=Ql();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&hf.has(C.toLowerCase())?`${mc(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let y;e[3]!==s.isHomeRoot||e[4]!==n?(y=s.isHomeRoot?r.jsx(_ee,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=y):y=e[5];const _=y;if(g.isPending){let C;e[6]!==_||e[7]!==f?(C=_&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.folders")}),r.jsx(rr,{children:_})]}),e[6]=_,e[7]=f,e[8]=C):C=e[8];let A;e[9]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(c9,{rows:2}),e[9]=A):A=e[9];let P;return e[10]!==C?(P=r.jsxs(r.Fragment,{children:[C,A]}),e[10]=C,e[11]=P):P=e[11],P}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let A;return e[15]!==C?(A=r.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=A):A=e[16],A}let L,w,S,k,j;if(e[17]!==v||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]!==o||e[29]!==a||e[30]!==_||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],A=C.filter(Tee),P=C.filter(Vee),R=C.filter(Nee),E=C.filter(Cee);if(C.length===0&&!s.isHomeRoot){let D;e[38]!==s.readOnly||e[39]!==f?(D=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=D):D=e[40];let B;e[41]!==D?(B=r.jsx(Vp,{children:D}),e[41]=D,e[42]=B):B=e[42],j=B;break e}let M;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(M=D=>s.readOnly?void 0:()=>c({volume:p,path:D.path,kind:D.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=M):M=e[46];const I=M;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=D=>s.readOnly?void 0:()=>a({volume:p,path:D.path,kind:D.kind,shareMode:D.shareMode??"private",effectivePublic:D.effectivePublic??!1,url:D.kind==="file"?Np(x(p,D.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const O=$;L=A.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.skills")}),r.jsx(rr,{children:A.map(D=>r.jsx(oee,{dirName:Xt(D.path),updatedAt:D.updatedAt,skillMdUrl:x(p,`${D.path}/SKILL.md`),publicState:cc(D),onOpen:()=>o(ll(s,D.path)),onBrowse:()=>n(ll(s,D.path)),onShare:O(D),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"dir",{onDragStart:d,onContextMenu:u})},D.path))})]}),w=P.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.brands")}),r.jsx(rr,{children:P.map(D=>r.jsx(lee,{dirName:Xt(D.path),updatedAt:D.updatedAt,tokensUrl:x(p,`${D.path}/tokens.css`),onOpen:()=>l(ll(s,D.path)),onBrowse:()=>n(ll(s,D.path)),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"dir",{onDragStart:d,onContextMenu:u})},D.path))})]}),S=(R.length>0||_)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.folders")}),r.jsxs(rr,{children:[_,R.map(D=>r.jsx(a9,{name:Xt(D.path),meta:hd(D.updatedAt),subtitle:v(Xt(D.path)),readOnly:s.readOnly,publicState:cc(D),onOpen:()=>n(ll(s,D.path)),onShare:O(D),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},D.path))]})]}),k=E.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Rr,{children:f("library.libraryViews.files")}),r.jsx(rr,{children:E.map(D=>r.jsx(n_,{filename:Xt(D.path),updatedAt:D.updatedAt,downloadUrl:x(p,D.path),publicState:cc(D),onOpen:()=>i(ll(s,D.path)),onShare:O(D),onDelete:I(D),draggable:!s.readOnly,...Zd(D.path,"file",{onDragStart:d,onContextMenu:u})},D.path))})]})}e[17]=v,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]=o,e[29]=a,e[30]=_,e[31]=f,e[32]=p,e[33]=L,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else L=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let T;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(T=s.isHomeRoot&&r.jsx(See,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=T):T=e[56];let N;return e[57]!==L||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==T?(N=r.jsxs(r.Fragment,{children:[L,w,S,k,T]}),e[57]=L,e[58]=w,e[59]=S,e[60]=k,e[61]=T,e[62]=N):N=e[62],N}function Cee(t){return t.kind==="file"}function Nee(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Vee(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Tee(t){return t.kind==="dir"&&t.hasSkill}function Eee({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=se(),{org:i}=Me(),o=Qt(),l=It(),a=Xr(),c=qr({strict:!1}),d=c.path||fc,u=a0(d),h=(Z,fe)=>l({to:".",search:ue=>({...ue,[Z]:fe||void 0})}),f=Z=>h("path",Z),m=(Z,fe)=>l({to:".",search:ue=>({...ue,preview:void 0,skill:void 0,brand:void 0,[Z]:fe})}),p=t??(Z=>m("preview",Z)),g=e??(Z=>m("skill",Z)),x=s??(Z=>m("brand",Z)),[b,v]=V.useState(""),y=K5(b.trim(),300),_=!u.isHomeRoot&&u.volume!==null?{volume:u.volume,prefix:u.dirPath}:void 0,L=_?n("library.library.searchInPlaceholder",{folder:El(u.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),w=u.isHomeRoot?mc(i.slug):El(u.segments.at(-1)??""),[S,k]=V.useState(null),[j,T]=V.useState(null),[N,C]=V.useState(!1),[A,P]=V.useState(""),[R,E]=V.useState(!1),[M,I]=V.useState(null),[$,O]=V.useState(""),D=V.useRef(null),[B,F]=V.useState(!1),U=V.useRef(0),H=u.readOnly?null:u.volume,{upload:W,mkdir:q,move:ee}=Ec(H??fc),{remove:X}=Ec(S?.volume??"uploads");async function Y(Z){if(!(!H||!Z||Z.length===0))try{await W.mutateAsync({dir:u.dirPath,files:[...Z]}),me.success(Z.length===1?n("library.library.uploadedSingle",{filename:Z[0]?.name??""}):n("library.library.uploadedMultiple",{count:Z.length}))}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.uploadFailed"))}finally{D.current&&(D.current.value="")}}const G=H!==null;function J(Z){return Z.dataTransfer.types.includes("Files")}function oe(Z){!G||!J(Z)||(Z.preventDefault(),U.current+=1,F(!0))}function le(Z){!G||!J(Z)||Z.preventDefault()}function Q(){G&&(U.current=Math.max(0,U.current-1),U.current===0&&F(!1))}function K(Z){G&&(Z.preventDefault(),U.current=0,F(!1),Z.dataTransfer.files.length>0&&Y(Z.dataTransfer.files))}async function te(){const Z=A.trim();if(!(!H||!Z)){if(u.isHomeRoot&&hf.has(Z.toLowerCase())){me.error(n("library.library.folderNameReserved",{name:Z}));return}try{const fe=u.dirPath;await q.mutateAsync(fe?`${fe}/${Z}`:Z),me.success(n("library.library.folderCreated",{name:Z})),C(!1),P("")}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.folderCreateFailed"))}}}async function ne(){if(!S)return;const Z=S;try{await X.mutateAsync(Z.path),me.success(n("library.library.deleted",{name:Xt(Z.path)}))}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.deleteFailed"))}finally{k(null)}}async function re(){if(!M)return;const Z=$.trim();if(!Z||Z.includes("/")||Z.includes("..")||Z===Xt(M.path)){E(!1),I(null),O("");return}if(M.kind==="dir"&&u.isHomeRoot&&hf.has(Z.toLowerCase())){me.error(n("library.library.folderNameReserved",{name:Z}));return}try{const fe=M.path.includes("/")?M.path.slice(0,M.path.lastIndexOf("/")):"",ue=fe?`${fe}/${Z}`:Z;await ee.mutateAsync({from:M.path,to:ue});const ye=Z.replace(/[<>]/g,"");me.success(n("library.library.renamed",{name:ye}))}catch(fe){me.error(fe instanceof Error?fe.message:n("library.library.renameFailed"))}finally{E(!1),I(null),O("")}}async function he(Z,fe){try{const ue=Xt(Z),ye=fe?`${fe}/${ue}`:ue;await ee.mutateAsync({from:Z,to:ye}),me.success(n("library.library.moved",{name:ue,destination:fe||n("library.library.theLibrary")}))}catch(ue){me.error(ue instanceof Error?ue.message:n("library.library.moveFailed"))}}function pe(){for(const Z of xee)o.invalidateQueries({queryKey:Fe.orgFsVolume(i.id,Z)});u.volume&&o.invalidateQueries({queryKey:Fe.orgFsVolume(i.id,u.volume)}),o.invalidateQueries({queryKey:Fe.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:Fe.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:Fe.orgFsPublicSets(i.id)})}function de(Z){Z.defaultPrevented||!H||Z.target.closest("input, textarea, button, a, [role='button']")||(Z.preventDefault(),C(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:oe,onDragOver:le,onDragLeave:Q,onDrop:K,onContextMenu:de,children:[B&&r.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:r.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:[r.jsx(Wn,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:w})})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:r.jsx(Lee,{segments:u.segments,onNavigate:f})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(C0,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(rt,{value:b,onChange:Z=>v(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&v("")},placeholder:L,className:"h-9 rounded-xl pr-9 pl-9"}),b&&r.jsx(ae,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>v(""),"aria-label":n("library.library.clearSearch"),children:r.jsx(ti,{size:14})})]}),r.jsx(ae,{variant:"ghost",size:"icon",onClick:pe,"aria-label":n("library.library.refresh"),children:r.jsx(vn,{size:14})}),H&&r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>C(!0),children:[r.jsx(Nt,{size:14}),n("library.library.newFolder")]}),u.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Zc,{size:12}),n("library.library.readOnly")]}):r.jsxs(ae,{size:"sm",disabled:W.isPending,onClick:()=>D.current?.click(),children:[r.jsx(Wn,{size:14}),W.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:D,type:"file",multiple:!0,className:"hidden",onChange:Z=>{Y(Z.target.files)}})]}),y?r.jsx(wee,{query:y,scope:_,stale:b.trim()!==y,onOpenFile:p,onShare:T,onDelete:k}):u.volume===null?r.jsx(kee,{onOpenDir:f}):r.jsx(jee,{location:u,onOpenDir:f,onOpenFile:p,onOpenSkill:g,onOpenBrand:x,onShare:T,onDelete:k,onContextMenu:(Z,fe)=>{I({path:Z,kind:fe}),O(Xt(Z)),E(!0)},onMove:he},u.volume)]})}),a&&(c.preview?r.jsx(J7,{previewPath:c.preview,onClose:()=>h("preview",null)}):c.skill?r.jsx(e_,{skillPath:c.skill,onClose:()=>h("skill",null)},c.skill):c.brand?r.jsx(X7,{brandPath:c.brand,onClose:()=>h("brand",null)},c.brand):null),r.jsx(Ct,{open:N,onOpenChange:C,children:r.jsxs(jt,{children:[r.jsxs(os,{children:[r.jsx(At,{children:n("library.library.newFolderTitle")}),r.jsx(_n,{children:n("library.library.newFolderDescription",{path:w||n("library.library.theLibrary")})})]}),r.jsx(rt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:A,onChange:Z=>P(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&te()}}),r.jsxs(In,{children:[r.jsx(ae,{variant:"outline",onClick:()=>C(!1),children:n("library.library.cancel")}),r.jsx(ae,{disabled:!A.trim()||q.isPending,onClick:()=>{te()},children:n("library.library.create")})]})]})}),r.jsx(Ct,{open:R,onOpenChange:Z=>{E(Z),Z||(I(null),O(""))},children:r.jsxs(jt,{children:[r.jsxs(os,{children:[r.jsx(At,{children:M&&n("library.library.renameTitle",{name:Xt(M.path)})}),r.jsx(_n,{children:n("library.library.renameDescription")})]}),r.jsx(rt,{autoFocus:!0,value:$,onChange:Z=>O(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&re()}}),r.jsxs(In,{children:[r.jsx(ae,{variant:"outline",onClick:()=>E(!1),children:n("library.library.cancel")}),r.jsx(ae,{disabled:!$.trim()||ee.isPending,onClick:()=>{re()},children:n("library.library.rename")})]})]})}),r.jsx(uZ,{target:j,onOpenChange:Z=>{Z||T(null)}}),r.jsx(vc,{open:S!==null,onOpenChange:Z=>{Z||k(null)},children:r.jsxs(yc,{children:[r.jsxs(_c,{children:[r.jsx(Lc,{children:n("library.library.deleteTitle",{name:S?Xt(S.path):""})}),r.jsx(wc,{children:S?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(Sc,{children:[r.jsx(kc,{children:n("library.library.cancel")}),r.jsx(jc,{onClick:()=>{ne()},children:n("library.library.delete")})]})]})})]})}function Aee(){const t=z.c(12),e=It(),[s,n]=V.useState(null),[i,o]=V.useState(null);let l;t[0]!==e?(l=f=>e({to:".",search:m=>({...m,main:f}),replace:!0}),t[0]=e,t[1]=l):l=t[1];const a=l;let c;t[2]!==a?(c=r.jsx(Eee,{onOpenFile:f=>a(lS(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(e_,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let u;t[6]!==i?(u=i&&r.jsx(X7,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=u):u=t[7];let h;return t[8]!==c||t[9]!==d||t[10]!==u?(h=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,u]}),t[8]=c,t[9]=d,t[10]=u,t[11]=h):h=t[11],h}const ax=V.lazy(()=>Sn(()=>import("./project-app-view-Bupj8bfK.js"),__vite__mapDeps([163,1,2,49,50,51,16,3,18,4,5,6,7,8,9,10,11,12,13,14,15,17,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,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,114,142,115,116,117,111,112,113,101,102,103,104,105,106,107,108,109,110,118,119,120,121,122,123,124,125,126,127,128,129,130,131,97,132,133,134,135,136,99,137,138,139,140,141,143,144,145,146,147,148])).then(t=>({default:t.AppViewContent})));function Pee(t){const e=z.c(61),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let L;return e[0]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Qz,{}),e[0]=L):L=e[0],L}if(s==="board"){let L;return e[1]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(SF,{})}),e[1]=L):L=e[1],L}if(aS(s)){let L;return e[2]!==n?(L=r.jsx(rg,{virtualMcpId:n}),e[2]=n,e[3]=L):L=e[3],L}if(s==="git"){let L;return e[4]!==n?(L=r.jsx(nK,{virtualMcpId:n}),e[4]=n,e[5]=L):L=e[5],L}if(s==="automations"){let L;return e[6]!==n?(L=r.jsx(KJ,{virtualMcpId:n}),e[6]=n,e[7]=L):L=e[7],L}if(s==="preview"){let L;return e[8]!==n?(L=r.jsx(FW,{virtualMcpId:n}),e[8]=n,e[9]=L):L=e[9],L}let c;e[10]!==s?(c=cS(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let L;return e[12]!==d.path?(L=r.jsx(WW,{openPath:d.path}),e[12]=d.path,e[13]=L):L=e[13],L}if(s==="content"){let L;return e[14]!==n?(L=r.jsx(aJ,{virtualMcpId:n}),e[14]=n,e[15]=L):L=e[15],L}if(s==="files"){let L;return e[16]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Aee,{}),e[16]=L):L=e[16],L}if(s==="connect-sources"){let L;return e[17]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(ZJ,{}),e[17]=L):L=e[17],L}if(a){let L;return e[18]!==s?(L=r.jsx(OJ,{tabId:s}),e[18]=s,e[19]=L):L=e[19],L}let u;e[20]!==s?(u=t5(s),e[20]=s,e[21]=u):u=e[21];const h=u;if(h){let L;return e[22]!==h.path?(L=r.jsx(fZ,{path:h.path},h.path),e[22]=h.path,e[23]=L):L=e[23],L}let f;e[24]!==s?(f=e5(s),e[24]=s,e[25]=f):f=e[25];const m=f;if(m){let L;return e[26]!==m.key||e[27]!==i?(L=r.jsx(QJ,{fileKey:m.key,taskId:i}),e[26]=m.key,e[27]=i,e[28]=L):L=e[28],L}let p;e[29]!==s?(p=s5(s),e[29]=s,e[30]=p):p=e[30];const g=p;if(g){let L;return e[31]!==g.path?(L=r.jsx(xZ,{path:g.path},g.path),e[31]=g.path,e[32]=L):L=e[32],L}let x;e[33]!==s?(x=dS(s),e[33]=s,e[34]=x):x=e[34];const b=x;if(b){let L;if(e[35]!==l||e[36]!==b.connectionId||e[37]!==b.toolName){let T;e[39]!==b.connectionId||e[40]!==b.toolName?(T=N=>N.appId===b.connectionId&&N.toolName===b.toolName,e[39]=b.connectionId,e[40]=b.toolName,e[41]=T):T=e[41],L=l.find(T),e[35]=l,e[36]=b.connectionId,e[37]=b.toolName,e[38]=L}else L=e[38];const w=L;let S;e[42]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(To,{}),e[42]=S):S=e[42];const k=w?.args;let j;return e[43]!==s||e[44]!==b.connectionId||e[45]!==b.toolName||e[46]!==k?(j=r.jsx(V.Suspense,{fallback:S,children:r.jsx(ax,{connectionId:b.connectionId,toolName:b.toolName,args:k},s)}),e[43]=s,e[44]=b.connectionId,e[45]=b.toolName,e[46]=k,e[47]=j):j=e[47],j}let v;if(e[48]!==s||e[49]!==o){let L;e[51]!==s?(L=w=>w.id===s,e[51]=s,e[52]=L):L=e[52],v=o.find(L),e[48]=s,e[49]=o,e[50]=v}else v=e[50];const y=v;if(y){let L;e[53]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(To,{}),e[53]=L):L=e[53];let w;return e[54]!==s||e[55]!==y.id||e[56]!==y.view.appId||e[57]!==y.view.args?(w=r.jsx(V.Suspense,{fallback:L,children:r.jsx(ax,{connectionId:y.view.appId,toolName:y.id,args:y.view.args},s)}),e[54]=s,e[55]=y.id,e[56]=y.view.appId,e[57]=y.view.args,e[58]=w):w=e[58],w}let _;return e[59]!==n?(_=r.jsx(rg,{virtualMcpId:n}),e[59]=n,e[60]=_):_=e[60],_}function Ree(t){const e=z.c(14),{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:o,layoutTabs:l,expandedTools:a,automationTabParsed:c}=Lm(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(To,{}),e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(u=r.jsx(V.Suspense,{fallback:d,children:r.jsx(Pee,{activeTab:o,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=o,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=u):u=e[10];let h;return e[11]!==o||e[12]!==u?(h=r.jsx(Fs,{children:u},o),e[11]=o,e[12]=u,e[13]=h):h=e[13],h}const bo="setup";function Dee(t){const e=z.c(57),s=se();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let _;e[3]!==t.scriptTabs?(_=L=>!t.scriptTabs.includes(L),e[3]=t.scriptTabs,e[4]=_):_=e[4],n=t.scripts.filter(_),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let o;e[5]!==t?(o=()=>{t.active===bo?t.onToggle():t.onSelectTab(bo)},e[5]=t,e[6]=o):o=e[6];const l=o;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?r.jsx(fs,{className:"size-4"}):r.jsx(q5,{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=r.jsx(We,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=r.jsxs(Ge,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===bo;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(Iee,{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(_=>r.jsx($ee,{active:t.active===_,onClick:()=>{t.active===_?t.onToggle():t.onSelectTab(_)},onClose:()=>t.onCloseScript(_),t:s,children:_},_)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=r.jsx(Oee,{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=r.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 v;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?(v=t.showScriptControls?r.jsx(Bee,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(Mee,{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]=v):v=e[52];let y;return e[53]!==b||e[54]!==v||e[55]!==f?(y=r.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,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=y):y=e[56],y}function Iee(t){const e=z.c(11),{active:s,open:n,onClick:i,t:o}=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=ie("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=r.jsx(b5,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==o?(h=o("sandbox.toolbar.setupTab"),e[3]=o,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=r.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 Mee(t){const e=z.c(40),{status:s,onStart:n,onStop:i,onRestart:o,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(So,{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=r.jsxs(ae,{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=r.jsx(So,{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=r.jsxs(ae,{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=r.jsx(vn,{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=r.jsxs(ae,{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"&&!!o,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=ie(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=r.jsx(We,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(Ge,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==o||e[34]!==d||e[35]!==c?(b=d&&r.jsxs(qt,{children:[r.jsx(Gt,{asChild:!0,children:r.jsx(ae,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(fs,{className:"size-3"})})}),r.jsx(Yt,{align:"end",children:r.jsxs(Ze,{onClick:o,children:[r.jsx(vn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=o,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=r.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function $ee(t){const e=z.c(17),{active:s,onClick:n,onClose:i,children:o,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ie("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=ie("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==n||e[7]!==h?(f=r.jsx("button",{type:"button",onClick:n,className:h,children:o}),e[5]=o,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i||e[11]!==l?(m=i&&r.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(o)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:r.jsx(hs,{className:"size-3.5"})}),e[9]=o,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=r.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function Oee(t){const e=z.c(27),{scripts:s,onRun:n}=t,i=se(),[o,l]=V.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=r.jsx(Nt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(We,{asChild:!0,children:r.jsx(us,{asChild:!0,children:r.jsx(ae,{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=r.jsx(qe,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=r.jsxs(Ge,{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=r.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?r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>r.jsxs("button",{type:"button",onClick:()=>{l(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=r.jsxs(ys,{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]!==o||e[24]!==x||e[25]!==f?(b=r.jsxs(_s,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function Bee(t){const e=z.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:o,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(it,{className:"size-3.5 animate-spin"}),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=r.jsxs(ae,{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=r.jsx(So,{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=r.jsx(We,{asChild:!0,children:r.jsxs(ae,{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=r.jsx(qe,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(Ge,{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]!==o||e[21]!==a?(c=r.jsx(We,{asChild:!0,children:r.jsx(ae,{variant:"outline",size:"xs",onClick:o,children:a})}),e[20]=o,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=r.jsx(qe,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=r.jsxs(Ge,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var o_=Object.defineProperty,zee=Object.getOwnPropertyDescriptor,Fee=(t,e)=>{for(var s in e)o_(t,s,{get:e[s],enumerable:!0})},ms=(t,e,s,n)=>{for(var i=n>1?void 0:n?zee(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&o_(e,s,i),i},Ke=(t,e)=>(s,n)=>e(s,n,t),cx="Terminal input",ff={get:()=>cx,set:t=>cx=t},dx="Too much output to announce, navigate to rows manually to read",mf={get:()=>dx,set:t=>dx=t};function Uee(t){return t.replace(/\r?\n/g,"\r")}function Kee(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Hee(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function Wee(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");l_(i,e,s,n)}}function l_(t,e,s,n){t=Uee(t),t=Kee(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function a_(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,o=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function ux(t,e,s,n,i){a_(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ar(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 o=t[i];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var qee=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 o=t.charCodeAt(i++);56320<=o&&o<=57343?e[n++]=(this._interim-55296)*1024+o-56320+65536:(e[n++]=this._interim,e[n++]=o),this._interim=0}for(let o=i;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,n;let a=t.charCodeAt(o);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}},Gee=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,o,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)&&!((o=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=o,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(o=t[h++],(o&192)!==128){h--;continue}if(c=(i&31)<<6|o&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(o&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(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},c_="",Ir=" ",pd=class d_{constructor(){this.fg=0,this.bg=0,this.extended=new Zu}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 d_;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}},Zu=class u_{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 u_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hn=class h_ extends pd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Zu,this.combinedData=""}static fromCharData(e){let s=new h_;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?Ar(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()]}},hx="di$target",pf="di$dependencies",nh=new Map;function Yee(t){return t[pf]||[]}function Ws(t){if(nh.has(t))return nh.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");Qee(e,s,i)};return e._id=t,nh.set(t,e),e}function Qee(t,e,s){e[hx]===e?e[pf].push({id:t,index:s}):(e[pf]=[{id:t,index:s}],e[hx]=e)}var pn=Ws("BufferService"),f_=Ws("CoreMouseService"),Qo=Ws("CoreService"),Xee=Ws("CharsetService"),Tp=Ws("InstantiationService"),m_=Ws("LogService"),gn=Ws("OptionsService"),p_=Ws("OscLinkService"),Jee=Ws("UnicodeService"),gd=Ws("DecorationService"),gf=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,o=new Hn,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,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,a=o.extended.urlId;continue}else d=o.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):Zee(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};gf=ms([Ke(0,pn),Ke(1,gn),Ke(2,p_)],gf);function Zee(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
722
722
|
|
|
723
723
|
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 u9=Ws("CharSizeService"),xr=Ws("CoreBrowserService"),Ep=Ws("MouseService"),br=Ws("RenderService"),ete=Ws("SelectionService"),g_=Ws("CharacterJoinerService"),la=Ws("ThemeService"),x_=Ws("LinkProviderService"),tte=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?fx.isErrorNoTelemetry(t)?new fx(t.message+`
|
|
724
724
|
|